1 2011-07-12 Ian Lance Taylor <iant@google.com>
4 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
5 GLOB_DAT relocation rather than a RELATIVE relocation for a
6 protected symbol when creating a shared library.
7 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
8 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
9 * testsuite/protected_main_1.cc (main): Test that protected
10 function has same address.
12 2011-07-11 Ian Lance Taylor <iant@google.com>
15 * options.h (class General_options): Add -Bgroup.
16 * options.cc (General_options::finalize): If -Bgroup is set,
17 default to --unresolved-symbols=report-all.
18 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
19 * target-reloc.h (issue_undefined_symbol_error): Handle
20 --unresolved-symbols=report-all.
22 2011-07-08 Ian Lance Taylor <iant@google.com>
25 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
26 if linker script discards key sections.
27 (Layout::create_dynamic_symtab): Likewise.
28 (Layout::assign_local_dynsym_offsets): Likewise.
29 (Layout::sized_create_version_sections): Likewise.
30 (Layout::create_interp): Likewise.
31 (Layout::finish_dynamic_section): Likewise.
32 (Layout::set_dynamic_symbol_size): Likewise.
34 2011-07-08 Ian Lance Taylor <iant@google.com>
37 * options.h (class General_options): Add --unresolved-symbols.
38 * target-reloc.h (issue_undefined_symbol_error): Check
39 --unresolved-symbols. Add comments.
41 2011-07-08 Ian Lance Taylor <iant@google.com>
43 * testsuite/odr_violation2.cc (Ordering::operator()): Make
44 expression more complex.
46 2011-07-08 Ian Lance Taylor <iant@google.com>
49 * target-reloc.h (issue_undefined_symbol_error): New inline
50 function, broken out of relocate_section.
51 (relocate_section): Call issue_undefined_symbol_error.
52 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
53 there is no TLS segment if we are about to issue an undefined
55 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
57 2011-07-08 Ian Lance Taylor <iant@google.com>
60 * resolve.cc (Symbol_table::should_override): Add fromtype
61 parameter. Change all callers. Give error when linking together
62 TLS and non-TLS symbol.
63 (Symbol_table::should_override_with_special): Add fromtype
64 parameter. Change all callers.
65 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
66 there is no TLS segment if we have reported some errors.
67 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
69 2011-07-08 Ian Lance Taylor <iant@google.com>
72 * target.h (Target::plt_address_for_global): New function.
73 (Target::plt_address_for_local): New function.
74 (Target::plt_section_for_global): Remove.
75 (Target::plt_section_for_local): Remove.
76 (Target::do_plt_address_for_global): New virtual function.
77 (Target::do_plt_address_for_local): New virtual function.
78 (Target::do_plt_section_for_global): Remove.
79 (Target::do_plt_section_for_local): Remove.
80 (Target::register_global_plt_entry): Add Symbol_table and Layout
82 * output.cc (Output_data_got::Got_entry::write): Use
83 plt_address_for_global and plt_address_for_local.
84 * layout.cc (Layout::add_target_dynamic_tags): Use size and
85 address of output section.
86 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
87 got_irelative_, and irelative_count_ fields. Update
89 (Output_data_plt_i386::has_irelative_section): New function.
90 (Output_data_plt_i386::entry_count): Add irelative_count_.
91 (Output_data_plt_i386::set_final_data_size): Likewise.
92 (class Target_i386): Add got_irelative_ and rel_irelative_
93 fields. Update declarations.
94 (Target_i386::Target_i386): Initialize new fields.
95 (Target_i386::do_plt_address_for_global): New function replacing
96 do_plt_section_for_global.
97 (Target_i386::do_plt_address_for_local): New function replacing
98 do_plt_section_for_local.
99 (Target_i386::got_section): Create got_irelative_.
100 (Target_i386::rel_irelative_section): New function.
101 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
102 fields. Don't define __rel_iplt_{start,end}.
103 (Output_data_plt_i386::add_entry): Add symtab and layout
104 parameters. Change all callers. Use different PLT and GOT for
106 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
107 layout parameters. Change all callers. Use different PLT and
109 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
110 (Output_data_plt_i386::rel_irelative): New function.
111 (Output_data_plt_i386::address_for_global): New function.
112 (Output_data_plt_i386::address_for_local): New function.
113 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
114 IRELATIVE GOT when changing IFUNC GOT entries.
115 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
117 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
118 if we didn't create an IRELATIVE GOT.
119 (Target_i386::Relocate::relocate): Use plt_address_for_global and
120 plt_address_for_local.
121 (Target_i386::do_dynsym_value): Use plt_address_for_global.
122 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
123 got_irelative_, and irelative_count_ fields. Update
125 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
126 Initialize new fields. Remove symtab parameter. Change all
128 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
130 (Output_data_plt_x86_64::has_irelative_section): New function.
131 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
132 (class Target_x86_64): Add got_irelative_ and rel_irelative_
133 fields. Update declarations.
134 (Target_x86_64::Target_x86_64): Initialize new fields.
135 (Target_x86_64::do_plt_address_for_global): New function replacing
136 do_plt_section_for_global.
137 (Target_x86_64::do_plt_address_for_local): New function replacing
138 do_plt_section_for_local.
139 (Target_x86_64::got_section): Create got_irelative_.
140 (Target_x86_64::rela_irelative_section): New function.
141 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
142 all callers. Don't create __rel_iplt_{start,end}.
143 (Output_data_plt_x86_64::add_entry): Add symtab and layout
144 parameters. Change all callers. Use different PLT and GOT for
146 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
147 layout parameters. Change all callers. Use different PLT and
149 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
150 parameters. Change all callers. Use different PLT and GOT for
152 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
153 (Output_data_plt_x86_64::rela_irelative): New function.
154 (Output_data_plt_x86_64::address_for_global): New function.
155 (Output_data_plt_x86_64::address_for_local): New function.
156 (Output_data_plt_x86_64::set_final_data_size): Likewise.
157 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
158 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
159 (Target_x86_64::register_global_plt_entry): Add symtab and layout
161 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
163 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
164 symbols if we didn't create an IRELATIVE GOT.
165 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
166 plt_address_for_local.
167 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
168 * testsuite/ifuncvar1.c: New test file.
169 * testsuite/ifuncvar2.c: New test file.
170 * testsuite/ifuncvar3.c: New test file.
171 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
172 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
173 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
174 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
175 * testsuite/Makefile.in: Rebuild.
177 2011-07-07 Cary Coutant <ccoutant@google.com>
179 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
180 (two_file_test_1_ndebug.o): Likewise.
181 (two_file_test_1b_ndebug.o): Likewise.
182 (two_file_test_2_ndebug.o): Likewise.
183 (two_file_test_main_ndebug.o): Likewise.
184 (incremental_test_2): Link with no-debug versions.
186 2011-07-06 Cary Coutant <ccoutant@google.com>
188 * gold/incremental.cc
189 (Output_section_incremental_inputs::write_info_blocks): Check for
190 hidden and internal symbols.
192 2011-07-06 Cary Coutant <ccoutant@google.com>
194 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
195 Check disposition for startup file.
196 (Incremental_inputs::report_command_line): Ignore
197 --incremental-startup-unchanged option.
198 * options.cc (General_options::parse_incremental_startup_unchanged):
200 (General_options::General_options): Initialize new data member.
201 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
202 (General_options): Add --incremental-startup-unchanged option.
203 (General_options::incremental_startup_disposition): New function.
204 (General_options::incremental_startup_disposition_): New data member.
206 2011-07-06 Cary Coutant <ccoutant@google.com>
208 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
209 input file index to Script_info ctor.
210 (Sized_incremental_binary::do_file_has_changed): Find the
211 command-line argument for files named in scripts.
212 * incremental.h (Script_info::Script_info): New ctor
213 with input file index.
214 (Script_info::input_file_index): New function.
215 (Script_info::input_file_index_): New data member.
216 (Incremental_binary::get_library): Add const.
217 (Incremental_binary::get_script_info): Add const.
218 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
219 * testsuite/Makefile.am (incremental_test_5): New test case.
220 (incremental_test_6): New test case.
221 * testsuite/Makefile.in: Regenerate.
223 2011-07-06 Cary Coutant <ccoutant@google.com>
225 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
226 debug output when command lines differ.
228 2011-07-06 Cary Coutant <ccoutant@google.com>
230 * incremental.cc (Incremental_inputs::report_command_line): Ignore
231 --incremental-patch option.
232 * layout.cc (Free_list::allocate): Extend allocation beyond original
234 (Layout::make_output_section): Mark sections that should get
236 * options.cc (parse_percent): New function.
237 * options.h (parse_percent): New function.
238 (DEFINE_percent): New macro.
239 (General_options): Add --incremental-patch option.
240 * output.cc (Output_section::Output_section): Initialize new data
242 (Output_section::add_input_section): Print section name when out
244 (Output_section::add_output_section_data): Likewise.
245 (Output_section::set_final_data_size): Add patch space when
246 doing --incremental-full.
247 (Output_section::do_reset_address_and_file_offset): Remove patch
249 (Output_segment::set_section_list_addresses): Print debug output
250 only if --incremental-update.
251 * output.h (Output_section::set_is_patch_space_allowed): New function.
252 (Output_section::is_patch_space_allowed_): New data member.
253 (Output_section::patch_space_): New data member.
254 * parameters.cc (Parameters::incremental_full): New function.
255 * parameters.h (Parameters::incremental_full): New function
256 * testsuite/Makefile.am (incremental_test_2): Add test for
257 --incremental-patch option.
258 * testsuite/Makefile.in: Regenerate.
259 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
260 (t18): Remove function body.
262 2011-07-05 Doug Kwan <dougkwan@google.com>
265 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
266 Arm_Address type for relocation result.
267 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
269 (Arm_relocate_functions::abs32): Use unaligned access.
270 (Arm_relocate_functions::rel32): Ditto.
271 (Arm_relocate_functions::prel31): Ditto.
272 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
273 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
274 static data relocations.
275 * testsuite/Makefile.in: Regnerate.
276 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
278 2011-07-05 Ian Lance Taylor <iant@google.com>
281 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
282 symbols if necessary.
283 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
285 2011-07-05 Ian Lance Taylor <iant@google.com>
288 * resolve.cc (Symbol::override_base_with_special): Simply override
289 version with special symbol version, ignoring previous version.
291 2011-07-05 Ian Lance Taylor <iant@google.com>
293 * object.cc (Sized_relobj_file::include_section_group): Add
294 information to comment about signature location.
296 2011-07-02 Ian Lance Taylor <iant@google.com>
299 * options.h (class General_options): Add -f and -F.
300 * options.cc (General_options::finalize): Fatal error if -f/-F
301 are used without -shared.
302 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
304 2011-07-02 Ian Lance Taylor <iant@google.com>
306 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
308 2011-07-01 Ian Lance Taylor <iant@google.com>
312 * resolve.cc (Symbol::override_base_with_special): Don't override
313 the version if the overriding symbol has a different name.
314 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
315 all callers. If we give an error about an undefined version,
316 define the base version if necessary.
317 * dynobj.h (class Versions): Update declaration.
318 * testsuite/weak_alias_test_5.cc: New file.
319 * testsuite/weak_alias_test.script: New file.
320 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
321 and versioned_alias have the right value, and call t2.
322 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
323 weak_alias_test_5.so.
324 (weak_alias_test_LDADD): Likewise.
325 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
326 * testsuite/Makefile.in: Rebuild.
328 2011-07-01 Ian Lance Taylor <iant@google.com>
331 * options.h (class General_options): Support -z notext.
332 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
334 (two_file_shared_nonpic.so): Likewise.
335 (two_file_shared_mixed.so): Likewise.
336 (two_file_shared_mixed_1.so): Likewise.
337 (weak_undef_lib_nonpic.so): Likewise.
338 (alt/weak_undef_lib_nonpic.so): Likewise.
339 (tls_test_shared_nonpic.so): Likewise.
340 * testsuite/Makefile.in: Rebuild.
342 2011-07-01 Ian Lance Taylor <iant@google.com>
345 * configure.ac: Test whether static linking works, setting
346 the automake conditional HAVE_STATIC.
347 * testsuite/Makefile.am: Disable tests using -static if
348 HAVE_STATIC is not true.
349 * configure, testsuite/Makefile.in: Rebuild.
351 2011-07-01 Ian Lance Taylor <iant@google.com>
354 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
355 Assert if we see DW_EH_PE_indirect.
356 * target.h (Target::ehframe_datarel_base): New function.
357 (Target::do_ehframe_datarel_base): New target function.
358 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
359 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
362 2011-07-01 Ian Lance Taylor <iant@google.com>
365 * options.h (class General_options): Add
366 --ld-generated-unwind-info.
367 * ehframe.cc (Fde::write): Add address parameter. Change all
368 callers. If associated with PLT, fill in address and size.
369 (Cie::set_output_offset): Only add merge mapping if there is an
371 (Cie::write): Add address parameter. Change all callers.
372 (Eh_frame::add_ehframe_for_plt): New function.
373 * ehframe.h (class Fde): Update declarations. Move shndx_ and
374 input_offset_ fields into union u_, with new plt field.
375 (Fde::Fde): Adjust for new union field.
376 (Fde::Fde) [Output_data version]: New constructor.
377 (Fde::add_mapping): Only add merge mapping if there is an object.
378 (class Cie): Update declarations.
379 (class Eh_frame): Declare add_ehframe_for_plt.
380 * layout.cc (Layout::layout_eh_frame): Break out code into
381 make_eh_frame_section, and call it.
382 (Layout::make_eh_frame_section): New function.
383 (Layout::add_eh_frame_for_plt): New function.
384 * layout.h (class Layout): Update declarations.
385 * merge.cc (Merge_map::add_mapping): Add assertion.
386 * i386.cc: Include "dwarf.h".
387 (class Output_data_plt_i386): Make first_plt_entry,
388 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
389 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
390 and plt_eh_frame_fde.
391 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
392 boundary. Call add_eh_frame_for_plt if appropriate.
393 * x86_64.cc: Include "dwarf.h".
394 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
395 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
396 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
397 and plt_eh_frame_fde.
398 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
401 2011-06-29 Ian Lance Taylor <iant@google.com>
404 * object.cc (Sized_relobj_file::layout_section): Change shdr
405 parameter to be const.
406 (Sized_relobj_file::layout_eh_frame_section): New function, broken
408 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
409 appropriate. Call layout_eh_frame_section.
410 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
412 * object.h (class Sized_relobj_file): Update declarations.
414 2011-06-29 Ian Lance Taylor <iant@google.com>
417 * script.cc (Token::integer_value): Accept trailing M/m/K/k
419 (Lex::gather_token): Accept trailing M/m/K/k for integers.
421 2011-06-29 Ian Lance Taylor <iant@google.com>
424 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
426 * layout.cc (Layout::layout_eh_frame): Likewise.
428 2011-06-29 Ian Lance Taylor <iant@google.com>
431 * layout.cc (Layout::symtab_section_shndx): New function.
432 * layout.h (class Layout): Declare symtab_section_shndx.
433 * output.cc (Output_section::write_header): Call it.
435 2011-06-29 Ian Lance Taylor <iant@google.com>
438 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
439 symbols which are not used in a relocation.
441 2011-06-28 Ian Lance Taylor <iant@google.com>
444 * layout.cc (Layout::segment_precedes): Don't crash if a linker
445 script create indistinguishable segments.
446 (Layout::set_segment_offsets): Use stable_sort when sorting
447 segments. Pass this to Compare_segments constructor.
448 * layout.h (class Layout): Make segment_precedes non-static.
449 (class Compare_segments): Change from struct to class. Add
450 layout_ field. Add constructor.
452 (Script_sections::attach_sections_using_phdrs_clause): Rename
453 local orphan to is_orphan. Don't report failure to put empty
454 section in segment. On attachment failure, report name of
455 section, and attach to first PT_LOAD segment.
457 2011-06-28 Ian Lance Taylor <iant@google.com>
460 * target-select.cc (Target_selector::Target_selector): Add
461 emulation parameter. Change all callers.
462 (select_target_by_bfd_name): Rename from select_target_by_name.
464 (select_target_by_emulation): New function.
465 (supported_emulation_names): New function.
466 * target-select.h (class Target_selector): Add emulation_ field.
468 (Target_selector::recognize_by_bfd_name): Rename from
469 recognize_by_name. Change all callers.
470 (Target_selector::supported_bfd_names): Rename from
471 supported_names. Change all callers.
472 (Target_selector::recognize_by_emulation): New function.
473 (Target_selector::supported_emulations): New function.
474 (Target_selector::emulation): New function.
475 (Target_selector::do_recognize_by_bfd_name): Rename from
476 do_recognize_by_name. Change all callers.
477 (Target_selector::do_supported_bfd_names): Rename from
478 do_supported_names. Change all callers.
479 (Target_selector::do_recognize_by_emulation): New function.
480 (Target_selector::do_supported_emulations): New function.
481 (select_target_by_bfd_name): Change name in declaration.
482 (select_target_by_emulation): Declare.
483 (supported_emulation_names): Declare.
484 * parameters.cc (parameters_force_valid_target): Try to find
485 target based on emulation from -m option.
486 * options.h (class General_options): Change doc string for -m.
487 * options.cc (help): Print emulations.
488 (General_options::parse_V): Likewise.
489 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
490 Add emulation parameter. Change all callers.
492 2011-06-28 Ian Lance Taylor <iant@google.com>
494 * target.h (class Target): Add osabi_ field.
495 (Target::osabi): New function.
496 (Target::set_osabi): New function.
497 (Target::Target): Initialize osabi_.
498 (Target::do_adjust_elf_header): Make pure virtual.
499 (Sized_target::do_adjust_elf_header): Declare.
500 * target.cc (Sized_target::do_adjust_elf_header): New function.
501 (class Sized_target): Instantiate all versions.
502 * freebsd.h (class Target_freebsd): Remove.
503 (Target_selector_freebsd::do_recognize): Call set_osabi on
505 (Target_selector_freebsd::do_recognize_by_name): Likewise.
506 (Target_selector_freebsd::set_osabi): Remove.
507 * i386.cc (class Target_i386): Inherit from Sized_target rather
509 * x86_64.cc (class Target_x86_64): Likewise.
511 2011-06-28 Ian Lance Taylor <iant@google.com>
513 * target.h (Target::can_check_for_function_pointers): Rewrite.
515 (Target::can_icf_inline_merge_sections): Likewise.
516 (Target::section_may_have_icf_unsafe_poineters): Likewise.
517 (Target::Target_info): Add can_icf_inline_merge_sections field.
518 (Target::do_can_check_for_function_pointers): New virtual
520 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
521 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
522 from can_check_for_function_pointers, move in file.
523 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
524 section_may_have_icf_unsafe_poineters, move in file.
525 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
526 * i386.cc (Target_i386::do_can_check_for_function_pointers):
527 Rename from can_check_for_function_pointers, move in file.
528 (Target_i386::can_icf_inline_merge_sections): Remove.
529 (Target_i386::i386_info): Initialize
530 can_icf_inline_merge_sections.
531 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
532 Initialize can_icf_inline_merge_sections.
533 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
534 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
535 Rename from can_check_for_function_pointers, move in file.
536 (Target_x86_64::can_icf_inline_merge_sections): Remove.
537 (Target_x86_64::x86_64_info): Initialize
538 can_icf_inline_merge_sections.
539 * testsuite/testfile.cc (Target_test::test_target_info):
541 * icf.cc (get_section_contents): Correct formatting.
543 2011-06-27 Ian Lance Taylor <iant@google.com>
545 * symtab.cc (Symbol::versioned_name): New function.
546 (Symbol_table::add_to_final_symtab): Use versioned_name when
548 (Symbol_table::sized_write_symbol): Likewise.
549 * symtab.h (class Symbol): Declare versioned_name.
550 * stringpool.h (class Stringpool_template): Add variant of add
551 which takes a std::basic_string.
552 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
553 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
554 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
555 (ver_test_12.o): New target.
556 * testsuite/Makefile.in: Rebuild.
558 2011-06-27 Doug Kwan <dougkwan@google.com>
560 * arm.cc (Arm_relocate_functions::thm_jump8,
561 Arm_relocate_functions::thm_jump11): Use a wider signed
562 type to compute offset.
563 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
565 * testsuite/Makefile.in: Regenerate.
566 * testsuite/arm_branch_in_range.sh: Check test results of
567 arm_thm_jump11 and arm_thm_jump8.
568 * testsuite/arm_thm_jump11.s: New test source file.
569 * testsuite/arm_thm_jump11.t: New linker script.
570 * testsuite/arm_thm_jump8.s: New test source file.
571 * testsuite/arm_thm_jump8.t: New linker script.
573 2011-06-24 Ian Lance Taylor <iant@google.com>
575 * layout.cc: Include "object.h".
576 (ctors_sections_in_init_array): New static variable.
577 (Layout::is_ctors_in_init_array): New function.
578 (Layout::layout): Add entry to ctors_sections_in_init_array if
580 * layout.h (class Layout): Declare is_ctors_in_init_array.
581 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
582 is_ctors_reverse_view is set.
583 (Sized_relobj_file::write_sections): Add layout parameter. Change
584 all callers. Set is_ctors_reverse_view field of View_size.
585 (Sized_relobj_file::reverse_words): New function.
586 * object.h (Sized_relobj_file::View_size): Add
587 is_ctors_reverse_view field.
588 (class Sized_relobj_file): Update declarations.
589 * testsuite/initpri3.c: New test.
590 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
592 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
593 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
594 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
595 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
596 * testsuite/Makefile.in: Rebuild.
598 2011-06-24 Cary Coutant <ccoutant@google.com>
600 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
601 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
602 (debug_msg_cdebug.err): New targets.
603 * testsuite/Makefile.in: Regenerate.
604 * testsuite/debug_msg.sh: Check output of link with compressed debug.
605 Fix checks for link with shared library.
607 2011-06-24 Doug Kwan <dougkwan@google.com>
609 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
610 skip empty text sections.
611 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
613 2011-06-22 Ian Lance Taylor <iant@google.com>
616 * options.h (class General_options): Add --ctors-in-init-array.
617 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
618 friends as SHT_PROGBITS for merging sections.
619 (Layout::layout): Remove special handling of .init_array and
620 friends. Don't sort if doing relocatable link. Sort for .ctors
621 and .dtors if ctors_in_init_array.
622 (Layout::make_output_section): Force correct section types for
623 .init_array and friends. Don't sort if doing relocatable link,
624 Don't sort .ctors and .dtors if ctors_in_init_array.
625 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
626 (Layout::output_section_name): Add relobj parameter. Change all
627 callers. Handle .ctors. and .dtors. in code rather than table.
628 Handle .ctors and .dtors if ctors_in_init_array.
629 (Layout::match_file_name): New function, moved from output.cc.
630 * layout.h (class Layout): Update declarations.
631 * output.cc: Include "layout.h".
632 (Input_section_sort_entry::get_priority): New function.
633 (Input_section_sort_entry::match_file_name): Just call
634 Layout::match_file_name.
635 (Output_section::Input_section_sort_init_fini_compare::operator()):
636 Handle .ctors and .dtors. Sort by explicit priority rather than
638 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
639 * testsuite/initpri2.c: New test.
640 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
641 (check_PROGRAMS): Add initpri2.
642 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
643 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
644 * configure, testsuite/Makefile.in: Rebuild.
646 2011-06-19 Ian Lance Taylor <iant@google.com>
649 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
650 .interp section to a PT_INTERP segment even if we have seen a
651 --dynamic-linker option. Don't do it if we have seen a PHDRS
652 clause in a linker script.
653 (Layout::finalize): Don't create a .interp section if we've
654 already create a PT_INTERP segment.
655 (Layout::create_interp): Always call choose_output_section (revert
656 patch of 2011-06-17). Don't create PT_INTERP segment.
658 (Script_sections::create_note_and_tls_segments): Add a .interp
659 section to a PT_INTERP segment even if we have seen a
660 --dynamic-linker option.
662 2011-06-18 Ian Lance Taylor <iant@google.com>
664 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
665 merely because a non-PT_LOAD segment has a dynamic reloc.
667 2011-06-18 Ian Lance Taylor <iant@google.com>
669 * layout.cc (Layout::finish_dynamic_section): Don't create
670 DT_FLAGS entry if not needed.
672 2011-06-18 Ian Lance Taylor <iant@google.com>
675 * layout.cc (Layout::layout_eh_frame): Correct handling of
676 writable .eh_frame section.
678 2011-06-17 Ian Lance Taylor <iant@google.com>
681 * resolve.cc (Symbol_table::resolve): Don't give an error if a
682 symbol is redefined with the exact same object and value.
684 2011-06-17 Ian Lance Taylor <iant@google.com>
687 * layout.h (class Layout): Add interp_segment_ field.
688 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
689 (Layout::attach_allocated_section_to_segment): If making shared
690 library, put .interp section in PT_INTERP segment.
691 (Layout::finalize): Also call create_interp if -dynamic-linker
693 (Layout::create_interp): Assert that there is no PT_INTERP
694 segment. If not using a SECTIONS clause, use make_output_section.
695 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
697 (Script_sections::create_note_and_tls_segments): If making shared
698 library, put .interp section in PT_INTERP segment.
700 2011-06-17 Ian Lance Taylor <iant@google.com>
702 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
703 when making a shared library.
705 2011-06-17 Ian Lance Taylor <iant@google.com>
707 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
708 parameter. Change all callers. Don't issue warning about PC32
709 against locally defined symbol.
711 2011-06-16 Ian Lance Taylor <iant@google.com>
713 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
714 occurs in same object.
716 2011-06-14 Alan Modra <amodra@gmail.com>
718 * po/POTFILES.in: Regenerate.
720 2011-06-09 Ian Lance Taylor <iant@google.com>
723 (Orphan_output_section::set_section_addresses): For a relocatable
724 link set address to 0.
726 2011-06-09 Cary Coutant <ccoutant@google.com>
729 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
730 used with --compress-debug-sections.
731 * gold/object.cc (Sized_relobj_file::do_layout): Report
732 uncompressed size of compressed input sections.
734 2011-06-08 Cary Coutant <ccoutant@google.com>
737 * testsuite/two_file_test_2_v1.cc: Change initialization of
738 v2 to keep it in .data.
740 2011-06-07 Cary Coutant <ccoutant@google.com>
742 * common.cc (Symbol_table::do_allocate_commons_list): Call
744 * errors.cc (Errors::fatal): Adjust call to gold_exit.
745 (Errors::fallback): New function.
746 (gold_fallback): New function.
747 * errors.h (Errors::fallback): New function.
748 * gold.cc (gold_exit): Change status parameter to enum; adjust
750 (queue_initial_tasks): Call gold_fallback.
751 * gold.h: Include cstdlib.
752 (Exit_status): New enum type.
753 (gold_exit): Change status parameter to enum.
754 (gold_fallback): New function.
755 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
756 (Layout::create_symtab_sections): Likewise.
757 (Layout::create_shdrs): Likewise.
758 * main.cc (main): Adjust call to gold_exit.
759 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
760 (Output_data_got::add_got_entry_pair): Likewise.
761 (Output_section::add_input_section): Likewise.
762 (Output_section::add_output_section_data): Likewise.
763 (Output_segment::set_section_list_addresses): Likewise.
764 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
766 2011-06-07 Cary Coutant <ccoutant@google.com>
768 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
769 for incremental links.
770 * output.cc (Output_segment::set_section_list_addresses): Remove
771 FIXME and test for TLS or BSS.
773 2011-06-07 Cary Coutant <ccoutant@google.com>
775 * testsuite/Makefile.am: Add incremental_copy_test,
776 incremental_common_test_1.
777 * testsuite/Makefile.in: Regenerate.
778 * testsuite/common_test_1_v1.c: New source file.
779 * testsuite/common_test_1_v2.c: New source file.
780 * testsuite/copy_test_v1.cc: New source file.
782 2011-06-07 Cary Coutant <ccoutant@google.com>
784 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
785 update, allocate common from bss section's free list.
786 * incremental-dump.cc (dump_incremental_inputs): Print flag for
787 linker-defined symbols.
788 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
789 Skip GOT and PLT entries that are no longer referenced.
790 (Output_section_incremental_inputs::write_info_blocks): Mark
791 linker-defined symbols.
792 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
793 * output.cc (Output_section::allocate): New function.
794 * output.h (Output_section::allocate): New function.
795 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
796 linker-defined symbols.
797 (Symbol::override_base_with_special): Copy is_predefined_ flag.
798 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
799 (Symbol::init_base_output_data): Likewise.
800 (Symbol::init_base_output_segment): Likewise.
801 (Symbol::init_base_constant): Likewise.
802 (Sized_symbol::init_output_data): Likewise.
803 (Sized_symbol::init_output_segment): Likewise.
804 (Sized_symbol::init_constant): Likewise.
805 (Symbol_table::do_define_in_output_data): Likewise.
806 (Symbol_table::do_define_in_output_segment): Likewise.
807 (Symbol_table::do_define_as_constant): Likewise.
808 * symtab.h (Symbol::is_predefined): New function.
809 (Symbol::init_base_output_data): Add is_predefined parameter.
810 (Symbol::init_base_output_segment): Likewise.
811 (Symbol::init_base_constant): Likewise.
812 (Symbol::is_predefined_): New data member.
813 (Sized_symbol::init_output_data): Add is_predefined parameter.
814 (Sized_symbol::init_output_segment): Likewise.
815 (Sized_symbol::init_constant): Likewise.
816 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
818 2011-06-07 Cary Coutant <ccoutant@google.com>
820 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
821 instead of emit_copy_reloc.
822 (Copy_relocs::emit_copy_reloc): Refactor.
823 (Copy_relocs::make_copy_reloc): New function.
824 (Copy_relocs::add_copy_reloc): Remove.
825 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
827 (Copy_relocs::make_copy_reloc): New function.
828 (Copy_relocs::add_copy_reloc): Remove.
829 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
830 unchanged input files.
831 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
832 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
833 Reserve BSS space for COPY relocations.
834 (Sized_incremental_binary::do_emit_copy_relocs): New function.
835 (Output_section_incremental_inputs::write_info_blocks): Record
836 whether a symbol is copied from a shared object.
837 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
838 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
839 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
840 (Incremental_input_entry_reader::get_output_symbol_index): Add
842 (Incremental_binary::emit_copy_relocs): New function.
843 (Incremental_binary::do_emit_copy_relocs): New function.
844 (Sized_incremental_binary::Sized_incremental_binary): Initialize
846 (Sized_incremental_binary::add_copy_reloc): New function.
847 (Sized_incremental_binary::do_emit_copy_relocs): New function.
848 (Sized_incremental_binary::Copy_reloc): New struct.
849 (Sized_incremental_binary::Copy_relocs): New typedef.
850 (Sized_incremental_binary::copy_relocs_): New data member.
851 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
852 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
853 * target.h (Sized_target::emit_copy_reloc): New function.
854 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
856 2011-06-02 Cary Coutant <ccoutant@google.com>
859 * gold/archive.cc (Archive::Archive): Initialize new data member.
860 (Archive::include_all_members): Return if archive has already been
862 * gold/archive.h (Archive::include_all_members_): New data member.
864 2011-06-02 Nick Clifton <nickc@redhat.com>
866 * dynobj.h: Fix spelling mistake in comment.
867 * output.cc: Likewise.
869 2011-05-31 Doug Kwan <dougkwan@google.com>
873 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
874 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
875 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
876 redundant arm_exidx_test.so.
877 * testsuite/Makefile.in: Regenerate.
878 (check_SCRIPTS): Add pr12826.sh
879 (check_DATA): Add pr12826.stdout
880 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
881 * testsuite/pr12826.sh: New file.
882 * testsuite/pr12826_1.s: Ditto.
883 * testsuite/pr12826_1.s: Ditto.
885 2011-05-30 Ian Lance Taylor <iant@google.com>
887 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
890 2011-05-29 Ian Lance Taylor <iant@google.com>
893 * testsuite/Makefile.am: Use different file name for two_file_test
894 temporary file for each incremental test.
895 * testsuite/Makefile.in: Rebuild.
897 2011-05-29 Ian Lance Taylor <iant@google.com>
899 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
900 binary input file is empty.
902 2011-05-27 Ian Lance Taylor <iant@google.com>
904 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
905 (ver_test_9.so): Likewise.
906 * testsuite/Makefile.in: Rebuild.
908 2011-05-26 Cary Coutant <ccoutant@google.com>
910 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
911 * incremental.cc (Incremental_inputs::report_input_section): Fix
912 comment, indentation.
913 (Incremental_inputs::report_comdat_group): New function.
914 (Output_section_incremental_inputs::set_final_data_size): Adjust size
915 of data for incremental input file entry.
916 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
917 group count, COMDAT group signatures.
918 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
919 an unchanged input file.
920 * incremental.h (Incremental_object_entry::Incremental_object_entry):
921 Initialize new data member.
922 (Incremental_object_entry::add_comdat_group): New function.
923 (Incremental_object_entry::get_comdat_group_count): New function.
924 (Incremental_object_entry::get_comdat_signature_key): New function.
925 (Incremental_object_entry::groups_): New data member.
926 (Incremental_inputs::report_comdat_group): New function.
927 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
928 data for incremental input file entry.
929 (Incremental_input_entry_reader::get_comdat_group_count): New function.
930 (Incremental_input_entry_reader::get_input_section): Adjust size of
931 data for incremental input file entry.
932 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
933 (Incremental_input_entry_reader::get_comdat_group_signature): New
935 * object.cc (Sized_relobj::include_section_group): Report kept
936 COMDAT groups for incremental links.
938 2011-05-24 David Meyer <pdox@google.com>
940 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
941 with name parameter. Add found_name parameter.
942 * fileread.cc (Input_file::find_file): Adjust code accordingly.
943 * dirsearch.h (class Dirsearch): Update declaration.
945 2011-05-24 Ian Lance Taylor <iant@google.com>
947 * archive.cc (Library_base::should_include_member): Pull in object
948 from archive if it defines the entry symbol.
949 * parameters.cc (Parameters::entry): New function.
950 * parameters.h (class Parameters): Declare entry.
951 * output.h (class Output_file_header): Remove entry_ field.
952 * output.cc (Output_file_header::Output_file_header): Remove entry
953 parameter. Change all callers.
954 (Output_file_header::entry): Use parameters->entry.
955 * gold.cc (queue_middle_tasks): Likewise.
956 * plugin.cc (Plugin_hook::run): Likewise.
958 2011-05-24 Cary Coutant <ccoutant@google.com>
960 * gold.cc (queue_initial_tasks): Pass incremental base filename
961 to Output_file::open_base_file; don't print error message.
962 * incremental-dump.cc (main): Adjust call to
963 Output_file::open_for_modification.
964 * incremental-dump.cc (main): Likewise.
965 * incremental.cc (Incremental_inputs::report_command_line):
966 Ignore --incremental-base option when comparing command lines.
967 Ignore parameter when given as separate argument.
968 * options.h (class General_options): Add --incremental-base.
969 * output.cc (Output_file::Output_file):
970 (Output_file::open_base_file): Add base_name and writable parameters;
971 read base file into new file; print error message here.
972 (Output_file::map_no_anonymous): Add writable parameter; adjust all
974 * output.h (Output_file::open_for_modification): Rename to...
975 (Output_file::open_base_file): ...this; add base_name and
976 writable parameters; adjust all callers.
977 (Output_file::map_no_anonymous): Add writable parameter; adjust all
979 * testsuite/Makefile.am (incremental_test_4): Test
981 * testsuite/Makefile.in: Regenerate.
983 2011-05-24 Cary Coutant <ccoutant@google.com>
985 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
987 * testsuite/Makefile.in: Regenerate.
988 * testsuite/two_file_test_1_v1.cc: New test source file.
989 * testsuite/two_file_test_1b_v1.cc: New test source file.
990 * testsuite/two_file_test_2_v1.cc: New test source file.
992 2011-05-24 Cary Coutant <ccoutant@google.com>
994 * dynobj.h (Dynobj::do_dynobj): New function.
995 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
996 flag and soname for shared objects.
997 * incremental.cc (Incremental_inputs::report_object): Make
998 either Incremental_object_entry or Incremental_dynobj_entry; add
999 soname to string table.
1000 (Incremental_inputs::report_input_section): Add assertion.
1001 (Output_section_incremental_inputs::set_final_data_size): Adjust
1002 type of input file entry for shared libraries; adjust size of
1003 shared library info entry.
1004 (Output_section_incremental_inputs::write_input_files): Write
1005 as_needed flag for shared libraries.
1006 (Output_section_incremental_inputs::write_info_blocks): Adjust type
1007 of input file entry for shared libraries; write soname.
1008 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
1009 soname from incremental info.
1010 * incremental.h (enum Incremental_input_flags): Add
1011 INCREMENTAL_INPUT_AS_NEEDED.
1012 (Incremental_input_entry::Incremental_input_entry): Initialize new
1014 (Incremental_input_entry::set_as_needed): New function.
1015 (Incremental_input_entry::as_needed): New function.
1016 (Incremental_input_entry::do_dynobj_entry): New function.
1017 (Incremental_input_entry::as_needed_): New data member.
1018 (Incremental_object_entry::Incremental_object_entry): Don't check
1020 (Incremental_object_entry::do_type): Likewise.
1021 (class Incremental_dynobj_entry): New class.
1022 (Incremental_input_entry_reader::as_needed): New function.
1023 (Incremental_input_entry_reader::get_soname): New function.
1024 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
1025 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
1026 size of shared library info entry.
1027 * layout.cc (Layout::finish_dynamic_section): Don't test for
1028 incremental link when adding DT_NEEDED entries.
1029 * object.h (Object::Object): Initialize new data member.
1030 (Object::dynobj): New function.
1031 (Object::set_as_needed): New function.
1032 (Object::as_needed): New function.
1033 (Object::do_dynobj): New function.
1034 (Object::as_needed_): New data member.
1036 2011-05-24 Cary Coutant <ccoutant@google.com>
1038 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
1039 info; adjust display of GOT entries.
1040 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1041 vector of input objects; remove file_status_.
1042 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
1043 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
1044 got_plt reader; call target hooks to reserve GOT entries.
1045 (Output_section_incremental_inputs::set_final_data_size): Adjust size
1046 of input file info header and GOT info entry.
1047 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
1049 (Got_plt_view_info::got_descriptor): Remove.
1050 (Got_plt_view_info::sym_index): New data member.
1051 (Got_plt_view_info::input_index): New data member.
1052 (Local_got_offset_visitor::visit): Write input file index.
1053 (Global_got_offset_visitor::visit): Write 0 for input file index.
1054 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
1055 with sym_index and input_index.
1056 (Output_section_incremental_inputs::write_got_plt): Adjust size of
1057 incremental info GOT entry; replace got_descriptor with input_index.
1058 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
1059 map from input file index to object.
1060 (Sized_relobj_incr::do_layout): Replace direct data member reference
1061 with accessor function.
1062 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
1063 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
1064 Adjust size of input file info header.
1065 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
1066 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
1067 (Incremental_input_entry_reader::get_input_section): Adjust size of
1068 input file info header.
1069 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
1070 of incremental info GOT entry.
1071 (Incremental_got_plt_reader::get_got_desc): Remove.
1072 (Incremental_got_plt_reader::get_got_symndx): New function.
1073 (Incremental_got_plt_reader::get_got_input_index): New function.
1074 (Sized_incremental_binary::Sized_incremental_binary): Remove
1075 file_status_; add input_objects_.
1076 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
1077 (Sized_incremental_binary::set_file_is_unchanged): Remove.
1078 (Sized_incremental_binary::file_is_unchanged): Remove.
1079 (Sized_incremental_binary::set_input_object): New function.
1080 (Sized_incremental_binary::input_object): New function.
1081 (Sized_incremental_binary::file_status_): Remove.
1082 (Sized_incremental_binary::input_objects_): New data member.
1083 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
1085 (Sized_relobj_incr::invalid_address): Move to base class.
1086 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
1088 (Sized_relobj_incr::do_output_section_offset): Likewise.
1089 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
1090 (Sized_relobj_incr::section_offsets_): Likewise.
1091 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
1093 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
1094 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
1095 with accessor function.
1096 (Sized_relobj_file::do_layout): Likewise.
1097 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
1098 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
1099 (Sized_relobj_file::compute_final_local_value): Replace refs to
1100 section_offsets_ with accessor function.
1101 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
1102 * object.h (Relobj::Relobj): Initialize new data members.
1103 (Relobj::add_dyn_reloc): New function.
1104 (Relobj::first_dyn_reloc): New function.
1105 (Relobj::dyn_reloc_count): New function.
1106 (Relobj::first_dyn_reloc_): New data member.
1107 (Relobj::dyn_reloc_count_): New data member.
1108 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
1110 (Sized_relobj::Address): New typedef.
1111 (Sized_relobj::invalid_address): Move here from child class.
1112 (Sized_relobj::Sized_relobj): Initialize new data members.
1113 (Sized_relobj::sized_relobj): New function.
1114 (Sized_relobj::is_output_section_offset_invalid): Move here from
1116 (Sized_relobj::get_output_section_offset): Likewise.
1117 (Sized_relobj::local_has_got_offset): Likewise.
1118 (Sized_relobj::local_got_offset): Likewise.
1119 (Sized_relobj::set_local_got_offset): Likewise.
1120 (Sized_relobj::do_for_all_local_got_entries): Likewise.
1121 (Sized_relobj::clear_got_offsets): New function.
1122 (Sized_relobj::section_offsets): Move here from child class.
1123 (Sized_relobj::do_output_section_offset): Likewise.
1124 (Sized_relobj::do_set_section_offset): Likewise.
1125 (Sized_relobj::Local_got_offsets): Likewise.
1126 (Sized_relobj::local_got_offsets_): Likewise.
1127 (Sized_relobj::section_offsets_): Likewise.
1128 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
1130 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
1132 (Sized_relobj_file::sized_relobj): New function
1133 (Sized_relobj_file::local_has_got_offset): Move to base class.
1134 (Sized_relobj_file::local_got_offset): Likewise.
1135 (Sized_relobj_file::set_local_got_offset): Likewise.
1136 (Sized_relobj_file::get_output_section_offset): Likewise.
1137 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
1138 (Sized_relobj_file::do_output_section_offset): Likewise.
1139 (Sized_relobj_file::do_set_section_offset): Likewise.
1140 (Sized_relobj_file::Local_got_offsets): Likewise.
1141 (Sized_relobj_file::local_got_offsets_): Likewise.
1142 (Sized_relobj_file::section_offsets_): Likewise.
1143 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
1145 (set_needs_dynsym_index): Convert relobj to derived class pointer.
1146 (Output_reloc::get_symbol_index): Likewise.
1147 (Output_reloc::local_section_offset): Likewise.
1148 (Output_reloc::get_address): Likewise.
1149 (Output_reloc::symbol_value): Likewise.
1150 (Output_data_got::reserve_slot): Move to class definition.
1151 (Output_data_got::reserve_local): New function.
1152 (Output_data_got::reserve_slot_for_global): Remove.
1153 (Output_data_got::reserve_global): New function.
1154 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
1155 (all constructors, two instantiations).
1156 (Output_reloc::get_relobj): New function (two instantiations).
1157 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
1158 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
1159 (Output_data_reloc::add_global): Adjust type of relobj.
1160 (Output_data_reloc::add_global_relative): Likewise.
1161 (Output_data_reloc::add_symbolless_global_addend): Likewise.
1162 (Output_data_reloc::add_local): Likewise.
1163 (Output_data_reloc::add_local_relative): Likewise.
1164 (Output_data_reloc::add_symbolless_local_addend): Likewise.
1165 (Output_data_reloc::add_local_section): Likewise.
1166 (Output_data_reloc::add_output_section): Likewise.
1167 (Output_data_reloc::add_absolute): Likewise.
1168 (Output_data_reloc::add_target_specific): Likewise.
1169 (Output_data_got::reserve_slot): Move definition here.
1170 (Output_data_got::reserve_local): New function.
1171 (Output_data_got::reserve_global): New function.
1172 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
1173 section_offsets_ with accessor function.
1174 (Sized_relobj_file::write_sections): Likewise.
1175 (Sized_relobj_file::do_relocate_sections): Likewise.
1176 * target.h (Sized_target::reserve_local_got_entry): New function.
1177 (Sized_target::reserve_global_got_entry): New function.
1178 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
1179 (Target_x86_64::reserve_global_got_entry): New function.
1180 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
1182 2011-05-23 Cary Coutant <ccoutant@google.com>
1184 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
1185 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
1186 bit when checking got_type.
1187 * incremental.cc (Sized_incremental_binary::setup_readers):
1188 Store symbol table and string table locations; initialize bit vector
1189 of file status flags.
1190 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
1192 (Sized_incremental_binary::do_process_got_plt): New function.
1193 (Sized_incremental_binary::get_symtab_view): Use stored locations.
1194 (Output_section_incremental_inputs::set_final_data_size): Record
1195 file index for each input file.
1196 (Output_section_incremental_inputs::write_got_plt): Store file index
1197 instead of input entry offset for each GOT entry.
1199 (Incremental_input_entry::Incremental_input_entry): Initialize new
1201 (Incremental_input_entry::set_offset): Store file index.
1202 (Incremental_input_entry::get_file_index): New function.
1203 (Incremental_input_entry::file_index_): New data member.
1204 (Incremental_binary::process_got_plt): New function.
1205 (Incremental_binary::do_process_got_plt): New function.
1206 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
1208 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
1209 (Sized_incremental_binary::set_file_is_unchanged): New function.
1210 (Sized_incremental_binary::file_is_unchanged): New function.
1211 (Sized_incremental_binary::do_process_got_plt): New function.
1212 (Sized_incremental_binary::file_status_): New data member.
1213 (Sized_incremental_binary::main_symtab_loc_): New data member.
1214 (Sized_incremental_binary::main_strtab_loc_): New data member.
1215 * output.cc (Output_data_got::Got_entry::write): Add case
1217 (Output_data_got::add_global): Call add_got_entry.
1218 (Output_data_got::add_global_plt): Likewise.
1219 (Output_data_got::add_global_with_rel): Likewise.
1220 (Output_data_got::add_global_with_rela): Likewise.
1221 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
1222 (Output_data_got::add_global_pair_with_rela): Likewise.
1223 (Output_data_got::add_local): Call add_got_entry.
1224 (Output_data_got::add_local_plt): Likewise.
1225 (Output_data_got::add_local_with_rel): Likewise.
1226 (Output_data_got::add_local_with_rela): Likewise.
1227 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
1228 (Output_data_got::add_local_pair_with_rela): Likewise.
1229 (Output_data_got::reserve_slot): New function.
1230 (Output_data_got::reserve_slot_for_global): New function.
1231 (Output_data_got::add_got_entry): New function.
1232 (Output_data_got::add_got_entry_pair): New function.
1233 (Output_section::add_output_section_data): Edit FIXME.
1235 (Output_section_data_build::Output_section_data_build): New
1236 constructor with size parameter.
1237 (Output_data_space::Output_data_space): Likewise.
1238 (Output_data_got::Output_data_got): Initialize new data member; new
1239 constructor with size parameter.
1240 (Output_data_got::add_constant): Call add_got_entry.
1241 (Output_data_got::reserve_slot): New function.
1242 (Output_data_got::reserve_slot_for_global): New function.
1243 (class Output_data_got::Got_entry): Add RESERVED_CODE.
1244 (Output_data_got::add_got_entry): New function.
1245 (Output_data_got::add_got_entry_pair): New function.
1246 (Output_data_got::free_list_): New data member.
1247 * target.h (Sized_target::init_got_plt_for_update): New function.
1248 (Sized_target::register_global_plt_entry): New function.
1249 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1250 Initialize new data member; call init; add constructor with PLT count.
1251 (Output_data_plt_x86_64::init): New function.
1252 (Output_data_plt_x86_64::add_relocation): New function.
1253 (Output_data_plt_x86_64::reserve_slot): New function.
1254 (Output_data_plt_x86_64::free_list_): New data member.
1255 (Target_x86_64::init_got_plt_for_update): New function.
1256 (Target_x86_64::register_global_plt_entry): New function.
1257 (Output_data_plt_x86_64::add_entry): Allocate from free list for
1258 incremental updates.
1259 (Output_data_plt_x86_64::add_relocation): New function.
1260 * testsuite/object_unittest.cc (Object_test): Set default options.
1262 2011-05-16 Ian Lance Taylor <iant@google.com>
1264 * options.h (class General_options): Make -i a synonym for -r.
1266 2011-05-16 Ian Lance Taylor <iant@google.com>
1268 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
1270 2011-05-10 Cary Coutant <ccoutant@google.com>
1272 * object.cc (Sized_relobj::do_count_local_symbols): Check for
1275 2011-05-06 Ian Lance Taylor <iant@google.com>
1277 * layout.cc (Layout::layout): If the output section flags change,
1278 update the ordering.
1280 2011-04-25 Cary Coutant <ccoutant@google.com>
1282 * incremental-dump.cc (dump_incremental_inputs): Print local
1283 symbol info for each input file.
1285 (Output_section_incremental_inputs::set_final_data_size): Add local
1286 symbol info to input file entries in incremental info.
1287 (Output_section_incremental_inputs::write_info_blocks): Likewise.
1288 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
1289 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
1290 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
1292 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
1293 (Sized_incr_relobj::do_relocate): Write the local symbols.
1294 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
1295 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
1296 Adjust size of input file header.
1297 (Incremental_inputs_reader::get_local_symbol_offset): New function.
1298 (Incremental_inputs_reader::get_local_symbol_count): New function.
1299 (Incremental_inputs_reader::get_input_section): Adjust size of input
1301 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
1302 (Sized_incr_relobj::This): New typedef.
1303 (Sized_incr_relobj::sym_size): New const data member.
1304 (Sized_incr_relobj::Local_symbol): New struct.
1305 (Sized_incr_relobj::do_output_local_symbol_count): New function.
1306 (Sized_incr_relobj::do_local_symbol_offset): New function.
1307 (Sized_incr_relobj::local_symbol_count_): New data member.
1308 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
1309 (Sized_incr_relobj::local_symbol_index_): New data member.
1310 (Sized_incr_relobj::local_symbol_offset_): New data member.
1311 (Sized_incr_relobj::local_dynsym_offset_): New data member.
1312 (Sized_incr_relobj::local_symbols_): New data member.
1313 * object.h (Relobj::output_local_symbol_count): New function.
1314 (Relobj::local_symbol_offset): New function.
1315 (Relobj::do_output_local_symbol_count): New function.
1316 (Relobj::do_local_symbol_offset): New function.
1317 (Sized_relobj::do_output_local_symbol_count): New function.
1318 (Sized_relobj::do_local_symbol_offset): New function.
1320 2011-04-22 Vladimir Simonov <sv@sw.ru>
1322 * descriptors.cc (set_close_on_exec): New function.
1323 (Descriptors::open): Use set_close_on_exec.
1324 * output.cc (S_ISLNK): Define if not defined.
1326 2011-04-22 Cary Coutant <ccoutant@google.com>
1328 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1330 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
1331 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
1332 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
1334 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
1335 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
1336 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
1338 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
1340 (Incremental_binary::apply_incremental_relocs): New function.
1341 (Incremental_binary::do_apply_incremental_relocs): New function.
1342 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
1344 (Sized_incremental_binary::add_global_symbol): New function.
1345 (Sized_incremental_binary::global_symbol): New function.
1346 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
1347 (Sized_incremental_binary::symbol_map_): New data member.
1348 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
1349 * target.h (Sized_target::apply_relocation): New function.
1350 * target-reloc.h (apply_relocation): New function.
1351 * x86_64.cc (Target_x86_64::apply_relocation): New function.
1353 2011-04-22 Doug Kwan <dougkwan@google.com>
1355 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
1356 flag of a SHT_ARM_EXIDX section.
1357 * testsuite/Makefile.am (arm_exidx_test): New test rules.
1358 * testsuite/Makefile.in: Regenerate.
1359 * testsuite/arm_exidx_test.s: New file.
1360 * testsuite/arm_exidx_test.sh: Same.
1362 2011-04-20 Cary Coutant <ccoutant@google.com>
1365 * archive.h (Incremental_archive_entry::Archive_member):
1366 Initialize arg_serial_ (second constructor).
1368 2011-04-17 Ian Lance Taylor <iant@google.com>
1370 * object.cc (Relocate_info::location): Simplify location string.
1371 * errors.cc (Errors::error_at_location): Don't print program
1373 (Errors::warning_at_location): Likewise.
1374 (Errors::undefined_symbol): Likewise.
1375 * testsuite/debug_msg.sh: Update accordingly.
1377 2011-04-14 Cary Coutant <ccoutant@google.com>
1379 * gold/layout.cc (Layout::symtab_section_offset): New function.
1380 * gold/layout.h (Layout::symtab_section_offset): New function.
1381 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
1383 2011-04-12 Ian Lance Taylor <iant@google.com>
1385 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
1386 with MREMAP_MAYMOVE.
1387 * output.h (class Output_file): Add map_is_allocated_ field.
1388 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
1389 not available, provide stubs. If mremap is not available, #define
1391 (MREMAP_MAYMOVE): Define if not defined.
1392 (Output_file::Output_file): Initialize map_is_allocated_.
1393 (Output_file::resize): Check map_is_allocated_.
1394 (Output_file::map_anonymous): If mmap fails, use malloc.
1395 (Output_file::unmap): Don't do anything for an anonymous map.
1396 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
1397 is not available, provide stubs.
1398 (File_read::View::~View): Use free rather than delete[].
1399 (File_read::make_view): Use malloc rather than new[]. If mmap
1401 (File_read::find_or_make_view): Use malloc rather than new[].
1402 * gold.h: Remove HAVE_REMAP code.
1403 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
1404 exists. Rename mremap to gold_mremap. If mmap is not available
1406 * configure, config.in: Rebuild.
1408 2011-04-11 Ian Lance Taylor <iant@google.com>
1410 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
1411 initialize local variable v.
1413 2011-04-11 Cary Coutant <ccoutant@google.com>
1415 * archive.cc (Archive::include_member): Adjust call to
1417 (Add_archive_symbols::run): Track argument serial numbers.
1418 (Lib_group::include_member): Likewise.
1419 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
1420 * archive.h (Incremental_archive_entry::Archive_member):
1421 Initialize arg_serial_.
1422 (Archive_member::arg_serial_): New data member.
1423 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
1424 (Sized_dynobj::do_add_symbols): Track symbols when doing an
1426 (Sized_dynobj::do_for_all_local_got_entries): New function.
1427 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
1429 * fileread.cc (get_mtime): New function.
1430 * fileread.h (get_mtime): New function.
1431 * gold.cc (queue_initial_tasks): Check for incremental update.
1432 (process_incremental_input): New function.
1433 (queue_middle_tasks): Don't force valid target for incremental
1435 * incremental-dump.cc (find_input_containing_global): Adjust
1436 size of symbol info entry.
1437 (dump_incremental_inputs): Dump argument serial number and
1438 in_system_directory flag; bias shndx by 1; print symbol names
1439 when dumping per-file symbol lists; use new symbol info readers.
1441 (Output_section_incremental_inputs:update_data_size): New function.
1442 (Sized_incremental_binary::setup_readers): Setup input readers
1443 for each input file; build maps for files added from libraries
1445 (Sized_incremental_binary::check_input_args): New function.
1446 (Sized_incremental_binary::do_check_inputs): Build map of argument
1447 serial numbers to input arguments.
1448 (Sized_incremental_binary::do_file_has_changed): Rename
1449 do_file_is_unchanged to this; compare file modification times.
1450 (Sized_incremental_binary::do_init_layout): New function.
1451 (Sized_incremental_binary::do_reserve_layout): New function.
1452 (Sized_incremental_binary::do_get_input_reader): Remove.
1453 (Sized_incremental_binary::get_symtab_view): New function.
1454 (Incremental_checker::can_incrementally_link_output_file): Remove.
1455 (Incremental_inputs::report_command_line): Exclude --debug options.
1456 (Incremental_inputs::report_archive_begin): Add parameter; track
1457 argument serial numbers; don't put input file entry for archive
1458 before archive members.
1459 (Incremental_inputs::report_archive_end): Put input file entry
1460 for archive after archive members.
1461 (Incremental_inputs::report_object): Add parameter; track argument
1462 serial numbers and in_system_directory flag.
1463 (Incremental_inputs::report_script): Add parameter; track argument
1465 (Output_section_incremental_inputs::set_final_data_size): Adjust
1466 size of symbol info entry; check for forwarding symbols.
1467 (Output_section_incremental_inputs::write_input_files): Write
1468 in_system_directory flag and argument serial number.
1469 (Output_section_incremental_inputs::write_info_blocks): Map section
1470 indices between incremental info and original input file; store
1471 input section index for each symbol.
1472 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
1473 change operator() to visit().
1474 (class Global_got_offset_visitor): Likewise.
1475 (class Global_symbol_visitor_got_plt):
1476 (Output_section_incremental_inputs::write_got_plt): Use new visitor
1478 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
1479 (Sized_incr_relobj::do_read_symbols): New function.
1480 (Sized_incr_relobj::do_layout): New function.
1481 (Sized_incr_relobj::do_layout_deferred_sections): New function.
1482 (Sized_incr_relobj::do_add_symbols): New function.
1483 (Sized_incr_relobj::do_should_include_member): New function.
1484 (Sized_incr_relobj::do_for_all_global_symbols): New function.
1485 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
1486 (Sized_incr_relobj::do_section_size): New function.
1487 (Sized_incr_relobj::do_section_name): New function.
1488 (Sized_incr_relobj::do_section_contents): New function.
1489 (Sized_incr_relobj::do_section_flags): New function.
1490 (Sized_incr_relobj::do_section_entsize): New function.
1491 (Sized_incr_relobj::do_section_address): New function.
1492 (Sized_incr_relobj::do_section_type): New function.
1493 (Sized_incr_relobj::do_section_link): New function.
1494 (Sized_incr_relobj::do_section_info): New function.
1495 (Sized_incr_relobj::do_section_addralign): New function.
1496 (Sized_incr_relobj::do_initialize_xindex): New function.
1497 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
1498 (Sized_incr_relobj::do_read_relocs): New function.
1499 (Sized_incr_relobj::do_gc_process_relocs): New function.
1500 (Sized_incr_relobj::do_scan_relocs): New function.
1501 (Sized_incr_relobj::do_count_local_symbols): New function.
1502 (Sized_incr_relobj::do_finalize_local_symbols): New function.
1503 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
1504 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
1505 (Sized_incr_relobj::do_relocate): New function.
1506 (Sized_incr_relobj::do_set_section_offset): New function.
1507 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
1508 (Sized_incr_dynobj::do_read_symbols): New function.
1509 (Sized_incr_dynobj::do_layout): New function.
1510 (Sized_incr_dynobj::do_add_symbols): New function.
1511 (Sized_incr_dynobj::do_should_include_member): New function.
1512 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
1513 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
1514 (Sized_incr_dynobj::do_section_size): New function.
1515 (Sized_incr_dynobj::do_section_name): New function.
1516 (Sized_incr_dynobj::do_section_contents): New function.
1517 (Sized_incr_dynobj::do_section_flags): New function.
1518 (Sized_incr_dynobj::do_section_entsize): New function.
1519 (Sized_incr_dynobj::do_section_address): New function.
1520 (Sized_incr_dynobj::do_section_type): New function.
1521 (Sized_incr_dynobj::do_section_link): New function.
1522 (Sized_incr_dynobj::do_section_info): New function.
1523 (Sized_incr_dynobj::do_section_addralign): New function.
1524 (Sized_incr_dynobj::do_initialize_xindex): New function.
1525 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
1526 (make_sized_incremental_object): New function.
1527 (Incremental_library::copy_unused_symbols): New function.
1528 (Incremental_library::do_for_all_unused_symbols): New function.
1529 * incremental.h (enum Incremental_input_flags): New type.
1530 (class Incremental_checker): Remove.
1531 (Incremental_input_entry::Incremental_input_entry): Add argument
1533 (Incremental_input_entry::arg_serial): New function.
1534 (Incremental_input_entry::set_is_in_system_directory): New function.
1535 (Incremental_input_entry::is_in_system_directory): New function.
1536 (Incremental_input_entry::arg_serial_): New data member.
1537 (Incremental_input_entry::is_in_system_directory_): New data member.
1538 (class Script_info): Move here from script.h.
1539 (Script_info::Script_info): Add filename parameter.
1540 (Script_info::filename): New function.
1541 (Script_info::filename_): New data member.
1542 (Incremental_script_entry::Incremental_script_entry): Add argument
1544 (Incremental_object_entry::Incremental_object_entry): Likewise.
1545 (Incremental_object_entry::add_input_section): Build list of input
1546 sections with map to original shndx.
1547 (Incremental_object_entry::get_input_section_index): New function.
1548 (Incremental_object_entry::shndx_): New data member.
1549 (Incremental_object_entry::name_key_): Rename; adjust all refs.
1550 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
1551 (Incremental_archive_entry::Incremental_archive_entry): Add argument
1553 (Incremental_inputs::report_archive_begin): Likewise.
1554 (Incremental_inputs::report_object): Likewise.
1555 (Incremental_inputs::report_script): Likewise.
1556 (class Incremental_global_symbol_reader): New class.
1557 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
1558 and store flags and input file type.
1559 (Incremental_input_entry_reader::arg_serial): New function.
1560 (Incremental_input_entry_reader::type): Extract type from flags.
1561 (Incremental_input_entry_reader::is_in_system_directory): New function.
1562 (Incremental_input_entry_reader::get_input_section_count): Call
1563 accessor function for type.
1564 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
1565 function for type; adjust size of global symbol entry.
1566 (Incremental_input_entry_reader::get_global_symbol_count): Call
1567 accessor function for type.
1568 (Incremental_input_entry_reader::get_object_count): Likewise.
1569 (Incremental_input_entry_reader::get_object_offset): Likewise.
1570 (Incremental_input_entry_reader::get_member_count): Likewise.
1571 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
1572 (Incremental_input_entry_reader::get_member_offset): Likewise.
1573 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
1574 (Incremental_input_entry_reader::Global_symbol_info): Remove.
1575 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
1576 (Incremental_input_entry_reader::get_global_symbol_reader): New
1578 (Incremental_input_entry_reader::get_output_symbol_index): New
1580 (Incremental_input_entry_reader::type_): Remove.
1581 (Incremental_input_entry_reader::flags_): New data member.
1582 (Incremental_inputs_reader::input_file_offset): New function.
1583 (Incremental_inputs_reader::input_file_index): New function.
1584 (Incremental_inputs_reader::input_file): Call input_file_offset.
1585 (Incremental_inputs_reader::input_file_at_offset): New function.
1586 (Incremental_relocs_reader::get_r_type): Reformat.
1587 (Incremental_relocs_reader::get_r_shndx): Reformat.
1588 (Incremental_relocs_reader::get_r_offset): Reformat.
1589 (Incremental_relocs_reader::data): New function.
1590 (Incremental_binary::Incremental_binary): Initialize new data members.
1591 (Incremental_binary::check_inputs): Add cmdline parameter.
1592 (Incremental_binary::file_is_unchanged): Remove.
1593 (Input_reader::arg_serial): New function.
1594 (Input_reader::get_unused_symbol_count): New function.
1595 (Input_reader::get_unused_symbol): New function.
1596 (Input_reader::do_arg_serial): New function.
1597 (Input_reader::do_get_unused_symbol_count): New function.
1598 (Input_reader::do_get_unused_symbol): New function.
1599 (Incremental_binary::input_file_count): New function.
1600 (Incremental_binary::get_input_reader): Change signature to use
1601 index instead of filename.
1602 (Incremental_binary::file_has_changed): New function.
1603 (Incremental_binary::get_input_argument): New function.
1604 (Incremental_binary::get_library): New function.
1605 (Incremental_binary::get_script_info): New function.
1606 (Incremental_binary::init_layout): New function.
1607 (Incremental_binary::reserve_layout): New function.
1608 (Incremental_binary::output_file): New function.
1609 (Incremental_binary::do_check_inputs): New function.
1610 (Incremental_binary::do_file_is_unchanged): Remove.
1611 (Incremental_binary::do_file_has_changed): New function.
1612 (Incremental_binary::do_init_layout): New function.
1613 (Incremental_binary::do_reserve_layout): New function.
1614 (Incremental_binary::do_input_file_count): New function.
1615 (Incremental_binary::do_get_input_reader): Change signature.
1616 (Incremental_binary::input_args_map_): New data member.
1617 (Incremental_binary::library_map_): New data member.
1618 (Incremental_binary::script_map_): New data member.
1619 (Sized_incremental_binary::Sized_incremental_binary): Initialize
1621 (Sized_incremental_binary::output_section): New function.
1622 (Sized_incremental_binary::inputs_reader): Add const.
1623 (Sized_incremental_binary::symtab_reader): Add const.
1624 (Sized_incremental_binary::relocs_reader): Add const.
1625 (Sized_incremental_binary::got_plt_reader): Add const.
1626 (Sized_incremental_binary::get_symtab_view): New function.
1627 (Sized_incremental_binary::Inputs_reader): New typedef.
1628 (Sized_incremental_binary::Input_entry_reader): New typedef.
1629 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
1630 (Sized_incremental_binary::do_file_is_unchanged): Remove.
1631 (Sized_incremental_binary::do_file_has_changed): New function.
1632 (Sized_incremental_binary::do_init_layout): New function.
1633 (Sized_incremental_binary::do_reserve_layout): New function.
1634 (Sized_input_reader::Inputs_reader): Remove.
1635 (Sized_input_reader::Input_entry_reader): Remove.
1636 (Sized_input_reader::do_arg_serial): New function.
1637 (Sized_input_reader::do_get_unused_symbol_count): New function.
1638 (Sized_input_reader::do_get_unused_symbol): New function.
1639 (Sized_incremental_binary::do_input_file_count): New function.
1640 (Sized_incremental_binary::do_get_input_reader): Change signature;
1641 use index instead of filename.
1642 (Sized_incremental_binary::section_map_): New data member.
1643 (Sized_incremental_binary::input_entry_readers_): New data member.
1644 (class Sized_incr_relobj): New class.
1645 (class Sized_incr_dynobj): New class.
1646 (make_sized_incremental_object): New function.
1647 (class Incremental_library): New class.
1648 * layout.cc (Free_list::num_lists): New static data member.
1649 (Free_list::num_nodes): New static data member.
1650 (Free_list::num_removes): New static data member.
1651 (Free_list::num_remove_visits): New static data member.
1652 (Free_list::num_allocates): New static data member.
1653 (Free_list::num_allocate_visits): New static data member.
1654 (Free_list::init): New function.
1655 (Free_list::remove): New function.
1656 (Free_list::allocate): New function.
1657 (Free_list::dump): New function.
1658 (Free_list::print_stats): New function.
1659 (Layout_task_runner::run): Resize output file for incremental updates.
1660 (Layout::Layout): Initialize new data members.
1661 (Layout::set_incremental_base): New function.
1662 (Layout::init_fixed_output_section): New function.
1663 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
1664 incremental updates.
1665 (Layout::create_gold_note): Do not create gold note section for
1666 incremental updates.
1667 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
1668 for incremental updates.
1669 (Layout::set_section_offsets): For incremental updates, allocate space
1671 (Layout::create_symtab_sections): Layout with offsets relative to
1672 start of section; for incremental updates, allocate space from free
1674 (Layout::create_shdrs): For incremental updates, allocate space from
1676 (Layout::finish_dynamic_section): For incremental updates, do not
1677 check --as-needed (fixed in subsequent patch).
1678 * layout.h (class Free_list): New class.
1679 (Layout::set_incremental_base): New function.
1680 (Layout::incremental_base): New function.
1681 (Layout::init_fixed_output_section): New function.
1682 (Layout::allocate): New function.
1683 (Layout::incremental_base_): New data member.
1684 (Layout::free_list_): New data member.
1685 * main.cc (main): Print Free_list statistics.
1686 * object.cc (Relobj::finalize_incremental_relocs): Add
1687 clear_counts parameter; clear counts only when clear_counts is set.
1688 (Sized_relobj::Sized_relobj): Initialize new base class.
1689 (Sized_relobj::do_layout): Don't report special sections.
1690 (Sized_relobj::do_for_all_local_got_entries): New function.
1691 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
1692 symtab_off to all symbol table offsets.
1693 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
1694 * object.h (class Got_offset_list): Move to top of file.
1695 (Object::Object): Allow case where input_file == NULL.
1696 (Object::~Object): Likewise.
1697 (Object::input_file): Assert that input_file != NULL.
1698 (Object::lock): Allow case where input_file == NULL.
1699 (Object::unlock): Likewise.
1700 (Object::is_locked): Likewise.
1701 (Object::token): Likewise.
1702 (Object::release): Likewise.
1703 (Object::is_incremental): New function.
1704 (Object::get_mtime): New function.
1705 (Object::for_all_local_got_entries): New function.
1706 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
1707 (Object::set_is_in_system_directory): New function.
1708 (Object::is_in_system_directory): New function.
1709 (Object::do_is_incremental): New function.
1710 (Object::do_get_mtime): New function.
1711 (Object::do_for_all_local_got_entries): New function.
1712 (Object::is_in_system_directory_): New data member.
1713 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
1714 (class Sized_relobj_base): New class.
1715 (class Sized_relobj): Derive from Sized_relobj_base.
1716 (class Sized_relobj::Symbols): Redeclare from base class.
1717 (class Sized_relobj::local_got_offset_list): Remove.
1718 (class Sized_relobj::Output_sections): Redeclare from base class.
1719 (class Sized_relobj::do_for_all_local_got_entries): New function.
1720 (class Sized_relobj::write_local_symbols): Add offset parameter.
1721 (class Sized_relobj::local_symbol_offset_): Update comment.
1722 (class Sized_relobj::local_dynsym_offset_): Update comment.
1723 * options.cc (Input_arguments::add_file): Remove const.
1724 * options.h (Input_file_argument::Input_file_argument):
1725 Initialize arg_serial_ (all constructors).
1726 (Input_file_argument::set_arg_serial): New function.
1727 (Input_file_argument::arg_serial): New function.
1728 (Input_file_argument::arg_serial_): New data member.
1729 (Input_arguments::Input_arguments): Initialize file_count_.
1730 (Input_arguments::add_file): Remove const.
1731 (Input_arguments::number_of_input_files): New function.
1732 (Input_arguments::file_count_): New data member.
1733 (Command_line::number_of_input_files): Call
1734 Input_arguments::number_of_input_files.
1735 * output.cc (Output_segment_headers::Output_segment_headers):
1737 (Output_section::Input_section::current_data_size): New function.
1738 (Output_section::Output_section): Initialize new data members.
1739 (Output_section::add_input_section): Don't do merge sections for
1740 an incremental link; allocate space from free list for an
1742 (Output_section::add_output_section_data): Allocate space from
1743 free list for an incremental update.
1744 (Output_section::update_data_size): New function.
1745 (Output_section::set_fixed_layout): New function.
1746 (Output_section::reserve): New function.
1747 (Output_segment::set_section_addresses): Remove const.
1748 (Output_segment::set_section_list_addresses): Remove const; allocate
1749 space from free list for an incremental update.
1750 (Output_segment::set_offset): Adjust size of RELRO segment for an
1752 * output.h (Output_data::current_data_size): Move here from
1754 (Output_data::pre_finalize_data_size): New function.
1755 (Output_data::update_data_size): New function.
1756 (Output_section_headers::update_data_size): new function.
1757 (Output_section_data_build::current_data_size): Move to Output_data.
1758 (Output_data_strtab::update_data_size): New function.
1759 (Output_section::current_data_size): Move to Output_data.
1760 (Output_section::set_fixed_layout): New function.
1761 (Output_section::has_fixed_layout): New function.
1762 (Output_section::reserve): New function.
1763 (Output_section::update_data_size): New function.
1764 (Output_section::has_fixed_layout_): New data member.
1765 (Output_section::free_list_): New data member.
1766 (Output_segment::set_section_addresses): Remove const.
1767 (Output_segment::set_section_list_addresses): Remove const.
1768 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
1770 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
1772 * readsyms.cc (Read_symbols::do_read_symbols): Add library
1773 parameter when calling Add_symbols constructor; store argument
1774 serial number for members of a lib group.
1775 (Add_symbols::locks): Allow case where token == NULL.
1776 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
1777 (Read_member::~Read_member): New function.
1778 (Read_member::is_runnable): New function.
1779 (Read_member::locks): New function.
1780 (Read_member::run): New function.
1781 (Check_script::~Check_script): New function.
1782 (Check_script::is_runnable): New function.
1783 (Check_script::locks): New function.
1784 (Check_script::run): New function.
1785 (Check_library::~Check_library): New function.
1786 (Check_library::is_runnable): New function.
1787 (Check_library::locks): New function.
1788 (Check_library::run): New function.
1789 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
1790 (Add_symbols::library_): New data member.
1791 (class Read_member): New class.
1792 (class Check_script): New class.
1793 (class Check_library): New class.
1794 * reloc.cc (Read_relocs::is_runnable): Allow case where
1796 (Read_relocs::locks): Likewise.
1797 (Scan_relocs::locks): Likewise.
1798 (Relocate_task::locks): Likewise.
1799 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
1801 (Sized_relobj::incremental_relocs_scan): Fix comment.
1802 (Sized_relobj::do_relocate): Pass output file offset to
1803 write_local_symbols.
1804 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
1805 from class declaration.
1806 * script.cc (read_input_script): Allocate Script_info; pass
1807 argument serial number to report_script.
1808 * script.h (class Script_info): Move to incremental.h.
1809 * symtab.cc (Symbol_table::add_from_incrobj): New function.
1810 * symtab.h (Symbol_table::add_from_incrobj): New function.
1811 (Symbol_table::set_file_offset): New function.
1813 2011-04-05 Cary Coutant <ccoutant@google.com>
1815 * incremental-dump.cc (dump_incremental_inputs): Change signature
1816 to take a Sized_incremental_binary; change caller. Use readers
1817 in Sized_incremental_binary.
1819 (Sized_incremental_binary::find_incremental_inputs_sections):
1820 Rename do_find_incremental_inputs_sections to this.
1821 (Sized_incremental_binary::setup_readers): New function.
1822 (Sized_incremental_binary::do_check_inputs): Check
1823 has_incremental_info_ flag; move setup code to setup_readers;
1825 (Sized_incremental_binary::do_file_is_unchanged): New function.
1826 (Sized_incremental_binary::do_get_input_reader): New function.
1827 * incremental.h (class Incremental_binary): Move to end of file.
1828 (Incremental_binary::file_is_unchanged): New function.
1829 (Incremental_binary::do_file_is_unchanged): New function.
1830 (Incremental_binary::Input_reader): New class.
1831 (Incremental_binary::get_input_reader): New function.
1832 (class Sized_incremental_binary): Move to end of file.
1833 (Sized_incremental_binary::Sized_incremental_binary): Setup the
1834 input section reader classes.
1835 (Sized_incremental_binary::has_incremental_info): New function.
1836 (Sized_incremental_binary::inputs_reader): New function.
1837 (Sized_incremental_binary::symtab_reader): New function.
1838 (Sized_incremental_binary::relocs_reader): New function.
1839 (Sized_incremental_binary::got_plt_reader): New function.
1840 (Sized_incremental_binary::do_file_is_unchanged): New function.
1841 (Sized_incremental_binary::Sized_input_reader): New class.
1842 (Sized_incremental_binary::get_input_reader): New function.
1843 (Sized_incremental_binary::find_incremental_inputs_sections):
1844 Rename do_find_incremental_inputs_sections to this.
1845 (Sized_incremental_binary::setup_readers): New function.
1846 (Sized_incremental_binary::has_incremental_info_): New data member.
1847 (Sized_incremental_binary::inputs_reader_): New data member.
1848 (Sized_incremental_binary::symtab_reader_): New data member.
1849 (Sized_incremental_binary::relocs_reader_): New data member.
1850 (Sized_incremental_binary::got_plt_reader_): New data member.
1851 (Sized_incremental_binary::current_input_file_): New data member.
1853 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
1856 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
1859 2011-03-30 Cary Coutant <ccoutant@google.com>
1861 * archive.cc (Archive::include_member): Adjust call to report_object.
1862 (Add_archive_symbols::run): Add script_info to call to
1863 report_archive_begin.
1864 (Lib_group::include_member): Adjust call to report_object.
1865 (Add_lib_group_symbols::run): Adjust call to report_object.
1866 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
1867 blocks. Add object count for script input files.
1868 * incremental.cc (Incremental_inputs::report_archive_begin): Add
1869 script_info parameter; change all callers.
1870 (Incremental_inputs::report_object): Add script_info parameter;
1872 (Incremental_inputs::report_script): Store backpointer to
1873 incremental info entry.
1874 (Output_section_incremental_inputs::set_final_data_size): Record
1875 additional information for scripts.
1876 (Output_section_incremental_inputs::write_info_blocks): Likewise.
1877 * incremental.h (Incremental_script_entry::add_object): New function.
1878 (Incremental_script_entry::get_object_count): New function.
1879 (Incremental_script_entry::get_object): New function.
1880 (Incremental_script_entry::objects_): New data member; adjust
1882 (Incremental_inputs::report_archive_begin): Add script_info parameter.
1883 (Incremental_inputs::report_object): Add script_info parameter.
1884 (Incremental_inputs_reader::get_object_count): New function.
1885 (Incremental_inputs_reader::get_object_offset): New function.
1886 * options.cc (Input_arguments::add_file): Return reference to
1888 * options.h (Input_argument::set_script_info): New function.
1889 (Input_argument::script_info): New function.
1890 (Input_argument::script_info_): New data member; adjust all
1892 (Input_file_group::add_file): Return reference to new input argument.
1893 (Input_file_lib::add_file): Likewise.
1894 (Input_arguments::add_file): Likewise.
1895 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
1896 * script.cc (Parser_closure::Parser_closure): Add script_info
1897 parameter; adjust all callers.
1898 (Parser_closure::script_info): New function.
1899 (Parser_closure::script_info_): New data member.
1900 (read_input_script): Report scripts earlier to incremental info.
1901 (script_add_file): Set script_info in Input_argument.
1902 (script_add_library): Likewise.
1903 * script.h (Script_options::Script_info): Rewrite class.
1905 2011-03-29 Cary Coutant <ccoutant@google.com>
1907 * archive.cc (Library_base::should_include_member): Move
1908 method here from class Archive.
1909 (Archive::Archive): Initialize base class.
1910 (Archive::should_include_member): Move to base class.
1911 (Archive::do_for_all_unused_symbols): New function.
1912 (Add_archive_symbols::run): Remove redundant access to
1914 (Lib_group::Lib_group): Initialize base class.
1915 (Lib_group::do_filename): New function.
1916 (Lib_group::include_member): Pass pointer to Lib_group to
1918 (Lib_group::do_for_all_unused_symbols): New function.
1919 (Add_lib_group_symbols::run): Report archive information for
1921 * archive.h (class Library_base): New base class.
1922 (class Archive): Derive from Library_base.
1923 (Archive::filename): Move to base class.
1924 (Archive::set_incremental_info): Likewise.
1925 (Archive::incremental_info): Likewise.
1926 (Archive::Should_include): Likewise.
1927 (Archive::should_include_member): Likewise.
1928 (Archive::Armap_entry): Remove.
1929 (Archive::Unused_symbol_iterator): Remove.
1930 (Archive::unused_symbols_begin): Remove.
1931 (Archive::unused_symbols_end): Remove.
1932 (Archive::do_filename): New function.
1933 (Archive::do_get_mtime): New function.
1934 (Archive::do_for_all_unused_symbols): New function.
1935 (Archive::task_): Move to base class.
1936 (Archive::incremental_info_): Likewise.
1937 (class Lib_group): Derive from Library_base.
1938 (Lib_group::do_filename): New function.
1939 (Lib_group::do_get_mtime): New function.
1940 (Lib_group::do_for_all_unused_symbols): New function.
1941 (Lib_group::task_): Move to base class.
1942 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
1944 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
1946 * incremental.cc (Incremental_inputs::report_archive_begin):
1947 Use Library_base; call library's get_mtime; add incremental inputs
1948 entry before members.
1949 (class Unused_symbol_visitor): New class.
1950 (Incremental_inputs::report_archive_end): Use Library_base; use
1951 visitor class to record unused symbols; don't add incremental inputs
1952 entry after members.
1953 (Incremental_inputs::report_object): Use Library_base.
1955 (Incremental_archive_entry::Incremental_archive_entry): Remove
1956 unused Archive parameter.
1957 (Incremental_inputs::report_archive_begin): Use Library_base.
1958 (Incremental_inputs::report_archive_end): Likewise.
1959 (Incremental_inputs::report_object): Likewise.
1960 * object.cc (Sized_relobj::do_for_all_global_symbols): New
1962 * object.h (Object::for_all_global_symbols): New function.
1963 (Object::do_for_all_global_symbols): New function.
1964 (Sized_relobj::do_for_all_global_symbols): New function.
1965 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
1967 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
1970 2011-03-27 Ian Lance Taylor <iant@google.com>
1972 * archive.cc (Archive::interpret_header): Return -1 if something
1973 goes wrong. Change callers accordingly.
1975 2011-03-25 Cary Coutant <ccoutant@google.com>
1977 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
1978 * testsuite/Makefile.in: Regenerate.
1980 2010-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
1982 * plugin.cc (get_view): New.
1983 (Plugin::load): Pass get_view to the plugin.
1984 (Plugin_manager::get_view): New.
1986 2011-03-21 Ian Lance Taylor <iant@google.com>
1988 * testsuite/final_layout.sh: Rewrite to not use dc.
1989 * testsuite/relro_test.sh: Fail if dc is not present.
1991 2011-03-21 Sriraman Tallam <tmsriram@google.com>
1993 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
1995 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
1996 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
1998 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
1999 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
2001 2011-03-14 Ian Lance Taylor <iant@google.com>
2003 * script-sections.cc (Sort_output_sections::script_compare):
2004 Rename from is_before, change return type.
2005 (Sort_output_sections::operator()): Adjust accordingly.
2007 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
2010 * testsuite/odr_violation2.cc: Add comment to make all error line
2011 numbers double digits.
2012 * testsuite/debug_msg.sh: Adjust expected errors.
2014 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
2016 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
2017 but mark earlier ones as non-canonical
2018 (offset_to_iterator): Update search target and example
2019 (do_addr2line): Return extra lines in a vector*
2020 (format_file_lineno): Extract from do_addr2line
2021 (one_addr2line): Add vector* out-param
2022 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
2023 when a lineno entry appeared last for its instruction
2024 (Dwarf_line_info): Add vector* out-param
2025 * object.cc (Relocate_info): Pass NULL for the vector* out-param
2026 * symtab.cc (Odr_violation_compare): Include the lineno in the
2028 (linenos_from_loc): New. Combine the canonical line for an
2029 address with its other lines.
2030 (True_if_intersect): New. Helper functor to make
2031 std::set_intersection a query.
2032 (detect_odr_violations): Compare sets of lines instead of just
2033 one line for each function. This became less deterministic, but
2034 has fewer false positives.
2035 * symtab.h: Declarations.
2036 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
2037 mix an optimized and non-optimized object in the same binary
2038 (odr_violation2.so): Same.
2039 * testsuite/Makefile.in: Regenerate from Makefile.am.
2040 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
2041 * testsuite/debug_msg.sh: Update line numbers and add
2043 * testsuite/odr_violation1.cc: Use OdrDerived, in a
2044 non-optimized context.
2045 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
2046 isn't inlined, and use OdrDerived in an optimized context.
2047 * testsuite/odr_header1.h: Defines OdrDerived, where
2048 optimization will change the
2049 first-instruction-in-the-destructor's file and line number.
2050 * testsuite/odr_header2.h: Defines OdrBase.
2052 2011-03-09 Ian Lance Taylor <iant@google.com>
2054 * fileread.cc (File_read::clear_views): Don't delete the whole
2057 2011-03-08 Ian Lance Taylor <iant@google.com>
2060 * fileread.cc: #include <climits>.
2061 (GOLD_IOV_MAX): Define.
2062 (File_read::read_multiple): Limit number of entries by iov_max.
2063 * fileread.h (class File_read): Always set max_readv_entries to
2066 2011-03-07 Ian Lance Taylor <iant@google.com>
2069 * options.h (class General_options): Add -dy and -dn.
2071 2011-03-02 Cary Coutant <ccoutant@google.com>
2073 * testsuite/script_test_9.t: Add TLS segment.
2075 2011-03-02 Simon Baldwin <simonb@google.com>
2077 * configure.ac: Add check for gnu_indirect_function support in
2078 the toolchain building binutils.
2079 * configure: Rebuild.
2081 2010-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
2083 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
2084 plugin only symbols.
2085 (Symbol_table::sized_finalize_symbol) Mark symbol only present
2086 in plugin files as not needed in the symbol table.
2088 2011-02-11 Sriraman Tallam <tmsriram@google.com>
2090 * output.cc (Output_section::add_input_section): Delay fill
2091 generation for section ordering.
2093 2011-02-09 Ian Lance Taylor <iant@google.com>
2096 * object.h (class Sized_relobj): Remove clear_local_symbols.
2097 * reloc.cc (Sized_relobj::do_relocate): Don't call
2098 clear_local_symbols.
2100 2010-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
2102 * plugin.cc (is_visible_from_outside): Return true for symbols
2105 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
2107 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
2110 2011-02-02 Sriraman Tallam <tmsriram@google.com>
2112 * icf.h (is_section_foldable_candidate): Change type of parameter
2114 * icf.cc (Icf::find_identical_sections): Change type of local variable
2115 section_name to be std::string.
2116 (is_function_ctor_or_dtor): Change type of parameter to std::string.
2118 2011-01-25 Ian Lance Taylor <iant@google.com>
2120 * script.cc (script_add_extern): Rewrite to use
2121 add_symbol_reference.
2123 2011-01-25 Doug Kwan <dougkwan@google.com>
2125 * icf.cc (get_section_contents): Always lock section's object.
2127 2011-01-24 Ian Lance Taylor <iant@google.com>
2129 * options.h (class General_options): Accept
2130 --no-detect-odr-violations.
2132 2011-01-24 Ian Lance Taylor <iant@google.com>
2134 * version.cc (version_string): Bump to 1.11.
2136 2011-01-24 Ian Lance Taylor <iant@google.com>
2138 * plugin.cc (class Plugin_rescan): Define new class.
2139 (Plugin_manager::claim_file): Set any_claimed_.
2140 (Plugin_manager::save_archive): New function.
2141 (Plugin_manager::save_input_group): New function.
2142 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
2144 (Plugin_manager::new_undefined_symbol): New function.
2145 (Plugin_manager::rescan): New function.
2146 (Plugin_manager::rescannable_defines): New function.
2147 (Plugin_manager::add_input_file): Set any_added_.
2148 * plugin.h (class Plugin_manager): define new fields rescannable_,
2149 undefined_symbols_, any_claimed_, and any_added_. Declare
2150 Plugin_rescan as friend. Declare new functions.
2151 (Plugin_manager::Rescannable): Define type.
2152 (Plugin_manager::Rescannable_list): Define type.
2153 (Plugin_manager::Undefined_symbol_list): Define type.
2154 (Plugin_manager::Plugin_manager): Initialize new fields.
2155 * archive.cc (Archive::defines_symbol): New function.
2156 (Add_archive_symbols::run): Pass archive to plugins if any.
2157 * archive.h (class Archive): Declare defines_symbol.
2158 * readsyms.cc (Input_group::~Input_group): New function.
2159 (Finish_group::run): Pass input_group to plugins if any.
2160 * readsyms.h (class Input_group): Declare destructor.
2161 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
2164 2011-01-10 Ian Lance Taylor <iant@google.com>
2166 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
2168 (Layout::set_segment_offsets): Reset increase_relro before calling
2169 set_section_addresses a second time.
2171 2011-01-04 Cary Coutant <ccoutant@google.com>
2173 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
2174 sections before NOBITS sections.
2176 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
2178 * version.cc (print_version): Update copyright to 2011.
2180 2010-12-23 Cary Coutant <ccoutant@google.com>
2182 * output.h (Output_data_reloc::add_output_section): Pass OD instead
2183 of OS to this->add. Add OD parameter to second form of the function.
2185 2010-12-20 Ian Lance Taylor <iant@google.com>
2187 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
2188 second of two consecutive entries with same offset.
2190 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2192 * testsuite/Makefile.am (ifuncmain2static_LDADD)
2193 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
2194 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
2195 to avoid unneeded links against $(LDADD).
2196 * testsuite/Makefile.in: Regenerate.
2198 2010-12-15 Ian Lance Taylor <iant@google.com>
2201 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
2202 for R_X86_64_32 and R_X86_64_PC32.
2203 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
2204 ver_matching_def_pic.o.
2205 (ver_matching_def_pic.o): New target.
2207 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2209 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
2210 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
2211 Move definition before File_read::View member definitions.
2212 (File_read::View::~View): Initialize and hold lock before
2213 updating current_mapped_bytes.
2215 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2217 * dwarf_reader.cc: Remove outdated comment.
2218 * gold-threads.cc: Fix typo in error message.
2219 * archive.cc: Fix typos in comments.
2220 * archive.h: Likewise.
2221 * arm-reloc-property.cc: Likewise.
2222 * arm-reloc-property.h: Likewise.
2223 * arm-reloc.def: Likewise.
2225 * attributes.h: Likewise.
2226 * cref.cc: Likewise.
2227 * ehframe.cc: Likewise.
2228 * fileread.h: Likewise.
2230 * i386.cc: Likewise.
2232 * incremental.h: Likewise.
2233 * int_encoding.cc: Likewise.
2234 * layout.h: Likewise.
2235 * main.cc: Likewise.
2236 * merge.h: Likewise.
2237 * object.cc: Likewise.
2238 * object.h: Likewise.
2239 * options.cc: Likewise.
2240 * readsyms.cc: Likewise.
2241 * reduced_debug_output.cc: Likewise.
2242 * reloc.cc: Likewise.
2243 * script-sections.cc: Likewise.
2244 * sparc.cc: Likewise.
2245 * symtab.h: Likewise.
2246 * target-reloc.h: Likewise.
2247 * target.cc: Likewise.
2248 * target.h: Likewise.
2249 * timer.cc: Likewise.
2250 * timer.h: Likewise.
2251 * x86_64.cc: Likewise.
2253 2010-12-09 Cary Coutant <ccoutant@google.com>
2255 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
2257 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
2258 parameter; change all callers.
2259 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
2260 * options.h (warn_execstack): New option.
2262 2010-12-07 Doug Kwan <dougkwan@google.com>
2264 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
2265 like function call relocations.
2267 2010-12-07 Ian Lance Taylor <iant@google.com>
2269 * archive.cc (Archive::get_elf_object_for_member): Permit
2270 punconfigured to be NULL.
2271 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
2272 (Archive::include_member): Pass NULL to get_elf_object_for_member
2273 if we searched for the archive and this is the first included
2276 2010-12-01 Ian Lance Taylor <iant@google.com>
2278 * dwarf_reader.h (class Sized_dwarf_line_info): Add
2279 track_relocs_type_ field.
2280 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2281 Set track_relocs_type_.
2282 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
2283 contents when using RELA relocs.
2284 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
2286 * reloc.cc (Track_relocs::next_addend): New function.
2287 * reloc.h (class Track_relocs): Declare next_addend.
2289 2010-12-01 Ian Lance Taylor <iant@google.com>
2291 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
2294 2010-12-01 Ian Lance Taylor <iant@google.com>
2296 * README: Update compilers known to work and fail.
2298 2010-11-23 Matthias Klose <doko@ubuntu.com>
2300 * configure.in: For --enable-gold, handle value `default' instead of
2301 `both*'. Always install ld as ld.bfd, install as ld if gold is
2303 * configure: Regenerate.
2305 2010-11-18 Doug Kwan <dougkwan@google.com>
2307 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
2308 and right_alignment to be zero. Store result alignment only if it is
2309 greater than existing alignment.
2311 2010-11-16 Cary Coutant <ccoutant@google.com>
2314 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2315 Check for ".zdebug_line".
2317 2010-11-16 Doug Kwan <dougkwan@google.com>
2318 Cary Coutant <ccoutant@google.com>
2320 * output.h (Output_segment::set_section_addresses): Pass increase_relro
2321 by reference; adjust all callers.
2322 * output.cc (Output_segment::set_section_addresses): Adjust references
2323 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
2325 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
2326 end at page boundary.
2328 2010-11-16 Cary Coutant <ccoutant@google.com>
2331 * layout.cc (Layout::choose_output_section): Transform names of
2332 compressed sections even when using a script with a SECTIONS clause.
2333 (Layout::output_section_name): Remove code to transform
2334 compressed debug section names.
2335 * output.cc (Output_section::add_input_section): Use uncompressed
2336 section size when tracking input sections.
2338 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
2340 * symtab.h (Symbol::NON_PIC_REF): Remove.
2341 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
2342 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
2343 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
2344 (Symbol::use_plt_offset): Take a flags argument and pass it
2345 directly to needs_dynamic_reloc. Restrict check for undefined
2346 weak symbols to function calls.
2347 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
2348 (Target_arm::Scan::global): Use it.
2349 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
2350 (Target_arm::Relocate::relocate): Likewise.
2351 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
2352 parameter with an r_type parameter. Use get_reference_flags
2354 (Target_arm::Relocate::relocate): Update accordingly.
2355 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
2356 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
2357 (Target_i386::Scan::global): Likewise.
2358 (Target_i386::Relocate::relocate): Likewise.
2359 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
2360 parameter with an r_type parameter. Use get_reference_flags
2362 (Target_i386::Relocate::relocate): Update accordingly.
2363 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
2364 (Target_powerpc::Scan::global): Use it.
2365 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
2366 (Target_powerpc::Relocate::relocate): Likewise.
2367 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
2368 (Target_sparc::Scan::global): Use it.
2369 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
2370 (Target_sparc::Relocate::relocate): Likewise.
2371 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
2372 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
2373 (Target_x86_64::Scan::global): Likewise.
2374 (Target_x86_64::Relocate::relocate): Likewise.
2376 2010-11-08 Doug Kwan <dougkwan@google.com>
2377 Cary Coutant <ccoutant@google.com>
2379 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
2380 (Arm_exidx_merge_section::section_contents_): New data member.
2381 (Arm_input_section::Arm_input_section): Initialize original_contents_.
2382 (Arm_input_section::~Arm_input_section): De-allocate memory.
2383 (Arm_input_section::original_contents_): New data member.
2384 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
2385 in parameters instead of calling Object::section_contents without
2387 (Arm_output_section::group_section): New parameter TASK. Pass it
2388 to callees that need locking objects.
2389 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
2390 to lock EXIDX input sections. Fix a formatting issue. Call
2391 Arm_exidx_merged_section::build_contents to create merged section
2393 (Arm_output_section::create_stub_group): New parameter TASK. Use it
2394 to lock object of stub table owner.
2395 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
2396 TEXT_SIZE to initialize data member TEXT_SIZE_.
2397 (Arm_exidx_input_section::addralign): Fix typo in comment.
2398 (Arm_exidx_input_section::text_size): New method.
2399 (Target_arm::do_relax): New parameter TASK. Pass it to callees
2400 that require locking objects. Lock objects before scanning for stubs
2401 and updating local symbols.
2402 (Arm_input_section<big_endian>::init): Copy contents of original
2404 (Arm_input_section<big_endian>::do_write): Use saved contents of
2405 original input section instead of calling Object::section_contents
2407 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
2408 size without calling Object::section_size().
2409 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
2410 for size. Allocate a buffer for merged EXIDX entries.
2411 (Arm_exidx_merged_section::build_contents): New method.
2412 (Arm_exidx_merged_section::do_write): Move merge section contents
2413 building code to Arm_exidx_merged_section::build_contetns. Write
2414 out contetns in buffer instead of building it on the fly.
2415 (Arm_relobj::make_exidx_input_section): Also pass text section size
2416 to Arm_exidx_input_section constructor.
2417 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
2418 (Arm_dynobj::do_read_symbols): Fix memory leak.
2419 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
2420 * target.h: (class Task): Add forward declaration.
2421 (Target::relax): Add new parameter TASK and pass it to
2423 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
2425 2010-11-05 Cary Coutant <ccoutant@google.com>
2428 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
2429 object when reading from the file.
2430 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
2432 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
2433 when reading section contents.
2434 (get_section_contents): Likewise.
2435 (icf::find_identical_sections): Likewise.
2436 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
2437 object when reading from the file.
2438 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
2439 the object when doing deferred section layout.
2441 2010-11-03 Nick Clifton <nickc@redhat.com>
2444 * script.h (class Symbol_assignment: name): New member. Returns
2445 the name of the symbol.
2446 * scrfipt.cc (Script_options::is_pending_assignment): New member.
2447 Returns true if the given symbol name is on the list of
2448 assignments wating to be processed.
2449 * archive.cc (should_incldue_member): If the symbol is undefined,
2450 check to see if it is on the list of symbols pending assignment.
2452 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
2454 * script-sections.cc (Script_sections::find_memory_region): Check
2455 for a NULL output section pointer.
2457 2010-10-29 Doug Kwan <dougkwan@google.com>
2459 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
2460 Output_section::add_relaxed_input_section.
2461 * output.cc (Output_section::add_relaxed_input_section): Add new
2462 arguments LAYOUT and NAME. Set section order index.
2463 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
2464 Copy section order index.
2465 * output.h (Output_section::add_relaxed_input_section): Add new
2466 arguments LAYOUT and NAME.
2468 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2470 * testsuite/Makefile.am: Move gcctestdir/ld rule to
2471 NATIVE_OR_CROSS_LINKER.
2472 * testsuite/Makefile.in: Regenerate.
2474 2010-10-20 Doug Kwan <dougkwan@google.com>
2476 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
2477 without SHF_LINK_ORDER flags.
2478 * layout.cc (Layout::choose_output_section): Do not filter
2479 SHF_LINK_ORDER flag in a relocatable link.
2481 2010-10-17 Cary Coutant <ccoutant@google.com>
2483 * output.h (Output_segment::set_section_addresses): Change function
2484 signature. Update all callers.
2485 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
2487 (Output_segment::set_section_addresses): Align after last TLS
2488 section. Add padding before last relro section instead of after.
2490 2010-10-17 Doug Kwan <dougkwan@google.com>
2492 * gold/arm.cc (Target_arm::got_section): Use correct order and set
2493 GOT output section to be writable.
2495 2010-10-14 Cary Coutant <ccoutant@google.com>
2497 * debug.h (DEBUG_INCREMENTAL): New flag.
2498 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
2499 * gold.cc (queue_initial_tasks): Check parameters for incremental link
2501 * incremental.cc (report_command_line): Ignore all forms of
2503 * layout.cc (Layout::Layout): Check parameters for incremental link
2505 * options.cc (General_options::parse_incremental): New function.
2506 (General_options::parse_no_incremental): New function.
2507 (General_options::parse_incremental_full): New function.
2508 (General_options::parse_incremental_update): New function.
2509 (General_options::incremental_mode_): New data member.
2510 (General_options::finalize): Check incremental_mode_.
2511 * options.h (General_options): Update help text for --incremental.
2512 Add --no-incremental, --incremental-full, --incremental-update.
2513 (General_options::Incremental_mode): New enum type.
2514 (General_options::incremental_mode): New function.
2515 (General_options::incremental_mode_): New data member.
2516 * parameters.cc (Parameters::incremental_mode_): New data member.
2517 (Parameters::set_options): Set incremental_mode_.
2518 (Parameters::set_incremental_full): New function.
2519 (Parameters::incremental): New function.
2520 (Parameters::incremental_update): New function.
2521 (set_parameters_incremental_full): New function.
2522 * parameters.h (Parameters::set_incremental_full): New function.
2523 (Parameters::incremental): New function.
2524 (Parameters::incremental_update): New function.
2525 (Parameters::incremental_mode_): New data member.
2526 (set_parameters_incremental_full): New function.
2527 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
2528 incremental link mode.
2529 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
2530 (Sized_relobj::do_relocate_sections): Likewise.
2531 * testsuite/Makefile.am (incremental_test): Use --incremental-full
2533 * testsuite/Makefile.in: Regenerate.
2534 * testsuite/incremental_test.sh: Filter all forms of --incremental.
2536 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2538 * script-sections.h (class Script_sections): Make
2539 Sections_elements typedef public.
2540 * script-sections.cc (class Sort_output_sections): Add elements_
2541 field. Add constructor which sets it; change all callers.
2542 (Sort_output_sections::is_before): New function.
2543 (Sort_output_sections::operator()): Call is_before.
2544 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
2546 * testsuite/script_test_10.sh: New test. Test script section
2548 * testsuite/script_test_10.t: Likewise.
2549 * testsuite/script_test_10.s: Likewise.
2550 * testsuite/Makefile.am: Wrap the cross linker tests and the
2551 common tests into NATIVE_OR_CROSS_LINKER.
2552 (check_SCRIPTS): Add script_test_10.sh.
2553 (check_DATA): Add script_test_10.stdout.
2554 (script_test_10.o, script_test_10): New targets.
2555 (script_test_10.stdout): New target.
2556 * configure, testsuite/Makefile.in: Regenerate.
2558 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2560 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
2561 error for the deprecated relocations.
2562 (Target_arm::Scan::global): Likewise.
2563 (Target_arm::Relocate::relocate): Likewise.
2565 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
2567 * fileread.cc (Input_file::find_file): Initialize *found_name
2568 and *namep when using the fallback search for case 4.
2570 2010-10-11 Cary Coutant <ccoutant@google.com>
2572 * options.h (class General_options): Redefine -z lazy as an alias for
2573 the negation of -z now.
2575 2010-10-11 Ian Lance Taylor <iant@google.com>
2577 * resolve.cc (symbol_to_bits): Report the value of the unsupported
2580 2010-10-06 Nick Clifton <nickc@redhat.com>
2582 * script-sections.cc(class Memory_region): Remove
2583 current_lma_offset_ field. Rename current_vma_offset_ to
2584 current_offset_. Add last_section_ field.
2585 (Memory_region::get_current_vma_address): Rename to
2586 get_current_address.
2587 (Memory_region::get_current_lma_address): Delete.
2588 (Memory_region::increment_vma_offset): Rename to
2590 (Memory_region::increment_lma_offset): Delete.
2591 (Memory_region::attributes_compatible): New method. Returns
2592 true if the provided section is compatible with the region.
2593 (Memory_region::get_last_section): New method. Returns the last
2594 section to use the region.
2595 (Memory_region::set_last_section): New method. Stores the last
2596 section to use the region.
2597 (Script_sections::block_in_region): New method. Returns true if
2598 a block of memory is contained within a region.
2599 (Script_sections::find_memory_region): New method. Locates a
2600 memory region to be used to set a VMA or LMA address.
2601 (Output_section_definition::set_section_addresses): Add code to
2602 check for addresses set by memory regions.
2603 (Output_segment::set_section_addresses): Remove memory region
2605 (Script_sections::create_segment): Add a warning if a header
2606 segment is created outside of any region.
2607 * script-sections.h (class Script_sections): Add prototypes for
2608 find_memory_region and block_in_region methods.
2609 * testsuite/memory_test.s: Use .long instead of .word.
2610 * testsuite/memory_test.t: Add some more output sections.
2611 * testsuite/memory_test.sh: Update expected output.
2613 2010-10-02 Doug Kwan <dougkwan@google.com>
2615 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
2616 defintion to symtab.h
2617 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
2618 declaration to defintion.
2620 2010-10-01 Nick Clifton <nickc@redhat.com>
2622 * expression.cc (eval): Replace dummy argument with NULL.
2623 (eval_maybe_dot): Check for a NULL result section pointer.
2624 (Symbol_expression::value): Likewise.
2625 (Dot_expression::value): Likewise.
2626 (BINARY_EXPRESSION): Likewise.
2627 (Max_expression::value): Likewise.
2628 (Min_expression::value): Likewise.
2629 (Absolute_expression::value): Likewise.
2630 (Addr_expression::value_from_output_section): Likewise.
2631 (Loaddddr_expression::value_from_output_section): Likewise.
2632 (Segment_start_expression::value): Likewise.
2633 * script-sections.cc
2634 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
2636 (Sections_elememt_dot_assignment::set_section_addresses):
2638 (Output_data_expression::do_write_to_buffer): Likewise.
2639 (Output_section_definition::finalize_symbols): Likewise.
2640 (Output_section_definition::set_section_addresses): Likewise.
2642 2010-09-30 Doug Kwan <dougkwan@google.com>
2644 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
2646 2010-09-28 Sriraman Tallam <tmsriram@google.com>
2648 * target.h (Target::can_icf_inline_merge_sections): New virtual
2650 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
2652 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
2654 * icf.cc (get_section_contents): Inline merge sections only when
2657 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2659 * configure: Regenerate.
2661 2010-09-17 Ian Lance Taylor <iant@google.com>
2663 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
2664 * testsuite/Makefile.am (memory_test.o): New target.
2665 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
2667 * testsuite/Makefile.in: Rebuild.
2669 2010-09-17 Doug Kwan <dougkwan@google.com>
2671 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
2672 defintion if relocation uses GOT entries of the symbol.
2673 * testsuite/icf_safe_test.sh: Fix test.
2674 * testsuite/icf_safe_so_test.sh: Fix test.
2676 2010-09-16 Cary Coutant <ccoutant@google.com>
2678 * script_sections.cc (class Memory_region): Remove "NULL" from
2679 vector initializations.
2681 2010-09-15 Cary Coutant <ccoutant@google.com>
2683 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
2684 Resolve forwarding symbols.
2686 2010-09-15 Doug Kwan <dougkwan@google.com>
2688 * gold/testsuite/script_test_3.t: Add ARM special sections.
2689 * gold/testsuite/script_test_4.t: Same.
2690 * gold/testsuite/script_test_5.t: Same.
2691 * gold/testsuite/script_test_6.t: Same.
2692 * gold/testsuite/script_test_7.t: Same.
2693 * gold/testsuite/script_test_7.t: Same.
2694 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
2696 2010-09-14 Cary Coutant <ccoutant@google.com>
2698 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
2699 (Target_x86_64::Relocate::relocate_tls): Replace check for
2700 saw_tls_block_reloc_ with test for executable section.
2702 2010-09-12 Cary Coutant <ccoutant@google.com>
2704 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
2705 position-independent executables to shared libraries need dynamic
2707 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
2708 position-independent executables.
2709 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
2710 * testsuite/Makefile.in: Regenerate.
2712 2010-09-10 Nick Clifton <nickc@redhat.com>
2715 * testsuite/memory_test.t: Discard any sections that are not
2718 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
2721 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
2722 "This::" to work around a bug in gcc 4.2.
2724 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
2726 2010-09-09 Rafael Espindola <espindola@google.com>
2728 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
2729 sections with different PF_X flags in the same segment.
2730 (Layout::find_first_load_seg): Search all segments to find the first
2732 * options.h (rosegment): New.
2734 2010-09-08 Rafael Espindola <espindola@google.com>
2736 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
2738 2010-09-08 Doug Kwan <dougkwan@google.com>
2740 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
2741 (Arm_relobj::do_relocate_sections): Add new parameter for output
2742 file to match the parent.
2743 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
2744 of local symbols instead of input values. Update code to track
2745 changes in gold::relocate_section.
2746 * object.cc (Sized_relobj::compute_final_local_value): New methods.
2747 (Sized_relobj::compute_final_local_value_internal): New methods.
2748 (Sized_relobj::do_finalize_local_symbols): Move code from loop
2749 body into private version of Sized_relobj::compute_final_local_value.
2750 Call the inline method.
2751 * object.h (Symbol_value::Symbol_value): Define destructor. Free
2752 merged symbol value if there is one.
2753 (Symbol_value::has_output_value): New method defintiion.
2754 (Sized_relobj::Compute_final_local_value_status): New enum type.
2755 (Sized_relobj::compute_final_local_value): New methods.
2756 (Sized_relobj::compute_final_local_value_internal): New methods.
2757 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
2758 and arm_cortex_a8.sh.
2759 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
2760 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
2762 * Makefile.in: Regenerate.
2763 * testsuite/arm_bl_out_of_range.s: Update test.
2764 * testsuite/thumb_bl_out_of_range.s: Ditto.
2765 * testsuite/thumb_blx_out_of_range.s: Ditto.
2766 * testsuite/arm_branch_out_of_range.sh: New file.
2767 * testsuite/arm_cortex_a8.sh: Ditto.
2768 * testsuite/arm_cortex_a8_b.s: Ditto.
2769 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
2770 * testsuite/arm_cortex_a8_b_local.s: Ditto.
2771 * testsuite/arm_cortex_a8_bl.s: Ditto.
2772 * testsuite/arm_cortex_a8_blx.s: Ditto.
2773 * testsuite/arm_cortex_a8_local.s: Ditto.
2774 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
2775 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
2777 2010-09-08 Rafael Espindola <espindola@google.com>
2779 * Makefile.am (memory_test.stdout): Run readelf with -W.
2780 * Makefile.in: Regenerate.
2781 * testsuite/memory_test.sh: Make the regexps accept both 32 and
2784 2010-09-08 Rafael Espindola <espindola@google.com>
2786 * script-sections.cc (Script_sections::add_memory_region): Convert
2787 field precision to int.
2788 * script.cc (script_set_section_region, script_set_section_region):
2789 Convert field precision to int.
2791 2010-09-08 Rafael Espindola <espindola@google.com>
2793 * arm.cc (do_finalize_sections): Create the __exidx_start and
2794 __exdix_end symbols even when the section is missing.
2796 2010-09-08 Nick Clifton <nickc@redhat.com>
2798 * README: Remove claim that MEMORY is not supported.
2799 * expression.cc (script_exp_function_origin)
2800 (script_exp_function_length): Move from here to ...
2801 * script.cc: ... here.
2802 (script_set_section_region, script_add_memory)
2803 (script_parse_memory_attr, script_include_directive): New
2805 * script-sections.cc
2806 (class Memory_region): New class.
2807 (class Output_section_definition): Add set_memory_region,
2808 set_section_vma, set_section_lma and get_section_name methods.
2809 (class Script_Sections): Add add_memory_region,
2810 find_memory_region, find_memory_region_origin,
2811 find_memory_region_length and set_memory_region methods.
2812 Have set_section_addresses method walk the list of set memory
2814 Extend the print methos to display memory regions.
2815 * script-sections.h: Add prototypes for new methods.
2816 Add enum for MEMORY region attributes.
2817 * yyscript.y: Add support for parsing MEMORY regions.
2818 * script-c.h: Add prototypes for new functions.
2819 * testsuite/Makefile.am: Add test of MEMORY region functionality.
2820 * testsuite/Makefile.in: Regenerate.
2821 * testsuite/memory_test.sh: New script.
2822 * testsuite/memory_test.s: New assembler source file.
2823 * testsuite/memory_test.t: New linker script.
2825 2010-08-27 Doug Kwan <dougkwan@google.com>
2827 * gold/resolve.cc (Symbol_table::should_override): Let a weak
2828 reference override an existing dynamic weak reference.
2829 * testsuite/Makefile.am: Add new test dyn_weak_ref.
2830 * testsuite/Makefile.in: Regenerate.
2831 * testsuite/dyn_weak_ref.sh: New file.
2832 * testsuite/dyn_weak_ref_1.c: Ditto.
2833 * testsuite/dyn_weak_ref_2.c: Ditto.
2835 2010-08-27 Ian Lance Taylor <iant@google.com>
2837 * incremental.h (class Incremental_input_entry): Add virtual
2840 2010-08-27 Ian Lance Taylor <iant@google.com>
2842 * testsuite/start_lib_test_3.c: Mark t3 as used.
2844 2010-08-27 Nick Clifton <nickc@redhat.com>
2846 * options.cc (version_script): Fix small typo in previous
2849 2010-08-25 Nick Clifton <nickc@redhat.com>
2851 * archive.cc: Formatting fixes: Remove whitespace between
2852 typename and following asterisk. Remove whitespace between
2853 function name and opening parenthesis.
2854 * archive.h: Likewise.
2856 * attributes.cc: Likewise.
2857 * attributes.h: Likewise.
2858 * common.cc: Likewise.
2859 * copy-relocs.cc: Likewise.
2860 * dirsearch.h: Likewise.
2861 * dynobj.cc: Likewise.
2862 * ehframe.cc: Likewise.
2863 * ehframe.h: Likewise.
2864 * expression.cc: Likewise.
2865 * fileread.cc: Likewise.
2866 * fileread.h: Likewise.
2868 * gold-threads.cc: Likewise.
2869 * gold.cc: Likewise.
2870 * i386.cc: Likewise.
2872 * incremental-dump.cc: Likewise.
2873 * incremental.cc: Likewise.
2874 * layout.cc: Likewise.
2875 * layout.h: Likewise.
2876 * main.cc: Likewise.
2877 * merge.cc: Likewise.
2878 * merge.h: Likewise.
2879 * object.cc: Likewise.
2880 * object.h: Likewise.
2881 * options.cc: Likewise.
2882 * options.h: Likewise.
2883 * output.cc: Likewise.
2884 * output.h: Likewise.
2885 * plugin.cc: Likewise.
2886 * plugin.h: Likewise.
2887 * powerpc.cc: Likewise.
2888 * reloc.cc: Likewise.
2889 * script-c.h: Likewise.
2890 * script-sections.cc: Likewise.
2891 * script.cc: Likewise.
2892 * stringpool.cc: Likewise.
2893 * symtab.cc: Likewise.
2894 * symtab.h: Likewise.
2895 * target.cc: Likewise.
2896 * timer.cc: Likewise.
2897 * timer.h: Likewise.
2898 * version.cc: Likewise.
2899 * x86_64.cc: Likewise.
2901 2010-08-24 Nick Clifton <nickc@redhat.com>
2904 * layout.cc (segment_precedes): Sort segments by their physical
2905 addresses, if they have been set.
2907 2010-08-23 Cary Coutant <ccoutant@google.com>
2909 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
2911 (Lib_group::include_member): Unlock object after deleting its
2913 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
2916 2010-08-19 Neil Vachharajani <nvachhar@google.com>
2917 Cary Coutant <ccoutant@google.com>
2919 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
2920 constructor, and set_blocker.
2921 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
2923 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
2924 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
2925 * testsuite/Makefile.am (start_lib_test): New test case.
2926 * testsuite/Makefile.in: Regenerate.
2927 * testsuite/start_lib_test_main.c: New file.
2928 * testsuite/start_lib_test_1.c: New file.
2929 * testsuite/start_lib_test_2.c: New file.
2930 * testsuite/start_lib_test_3.c: New file.
2932 2010-08-19 Ian Lance Taylor <iant@google.com>
2934 * Makefile.in: Rebuild with automake 1.11.1.
2935 * aclocal.m4: Likewise.
2936 * testsuite/Makefile.in: Likewise.
2938 2010-08-19 Ian Lance Taylor <iant@google.com>
2941 * i386.cc (class Output_data_plt_i386): Update declarations.
2942 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
2943 local_ifuncs_ fields.
2944 (Target_i386::do_plt_section_for_global): New function.
2945 (Target_i386::do_plt_section_for_local): New function.
2946 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
2947 parameter; change all callers. Initialize global_ifuncs_ and
2948 local_ifuncs_. If doing a static link define __rel_iplt_start and
2950 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
2951 (Output_data_plt_i386::add_local_ifunc_entry): New function.
2952 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
2954 (Target_i386::make_plt_section): New function, broken out of
2955 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
2956 (Target_i386::make_plt_entry): Call make_plt_section.
2957 (Target_i386::make_local_ifunc_plt_entry): New function.
2958 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
2959 (Target_i386::Scan::local): Handle IFUNC symbols. Add
2960 R_386_IRELATIVE to switch.
2961 (Target_i386::Scan::global): Likewise.
2962 (Target_i386::Relocate::relocate): Likewise.
2963 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
2965 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
2966 (Target_x86_64::do_plt_section_for_global): New function.
2967 (Target_x86_64::do_plt_section_for_local): New function.
2968 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
2969 parameter; change all callers. If doing a static link define
2970 __rela_iplt_start and __rela_iplt_end.
2971 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
2972 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
2973 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
2975 (Target_x86_64::make_local_ifunc_plt_entry): New function.
2976 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
2978 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
2979 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
2980 R_X86_64_IRELATIVE to switch.
2981 (Target_x86_64::Scan::global): Likewise.
2982 (Target_x86_64::Relocate::relocate): Likewise.
2983 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
2985 * target.h (class Target): Add plt_section_for_global and
2986 plt_section_for_local functions. Add do_plt_section_for_global
2987 and do_plt_section_for_local virtual functions.
2988 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
2989 clarifying comments.
2990 (Symbol::use_plt_offset): Handle IFUNC symbol.
2991 * object.cc (Sized_relobj::Sized_relobj): Initialize
2993 (Sized_relobj::local_has_plt_offset): New function.
2994 (Sized_relobj::local_plt_offset): New function.
2995 (Sized_relobj::set_local_plt_offset): New function.
2996 (Sized_relobj::do_count): Handle IFUNC symbol.
2997 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
2998 a bit away from input_shndx_ field. Add set_is_func_symbol and
2999 is_ifunc_symbol functions.
3000 (class Sized_relobj): Update declarations. Remove Tls_got_entry
3001 and Local_tls_got_offsets. Define Local_plt_offsets. Add
3002 local_plt_offsets_ field.
3003 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
3004 * output.h (class Output_section_data): Add non-const
3005 output_section function.
3006 (class Output_data_got): Update declarations.
3007 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
3008 Add use_plt_offset parameter to global and local constructors.
3009 Change all callers. Change local_sym_index_ field to 31 bits.
3010 Change GSYM_CODE and CONSTANT_CODE accordingly.
3011 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
3012 doing a static link don't set sh_link field.
3013 (Output_data_got::Got_entry::write): Use PLT offset if
3015 (Output_data_got::add_global_plt): New function.
3016 (Output_data_got::add_local_plt): New function.
3017 * target-reloc.h (relocate_section): Handle IFUNC symbol.
3018 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
3019 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
3020 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
3021 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
3023 * testsuite/ifunc-sel.h: New file.
3024 * testsuite/ifuncmain1.c: New file.
3025 * testsuite/ifuncmain1vis.c: New file.
3026 * testsuite/ifuncmod1.c: New file.
3027 * testsuite/ifuncdep2.c: New file.
3028 * testsuite/ifuncmain2.c: New file.
3029 * testsuite/ifuncmain3.c: New file.
3030 * testsuite/ifuncmod3.c: New file.
3031 * testsuite/ifuncmain4.c: New file.
3032 * testsuite/ifuncmain5.c: New file.
3033 * testsuite/ifuncmod5.c: New file.
3034 * testsuite/ifuncmain6pie.c: New file.
3035 * testsuite/ifuncmod6.c: New file.
3036 * testsuite/ifuncmain7.c: New file.
3037 * configure, testsuite/Makefile.in: Rebuild.
3039 2010-08-18 Ian Lance Taylor <iant@google.com>
3042 (Output_section_incremental_inputs::write_input_files): Add cast
3043 to avoid signed/unsigned comparison warning.
3044 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3046 2010-08-12 Cary Coutant <ccoutant@google.com>
3048 * common.cc (Sort_commons::operator()): Remove unnecessary code.
3050 2010-08-13 Ian Lance Taylor <iant@google.com>
3052 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
3054 2010-08-12 Cary Coutant <ccoutant@google.com>
3055 Doug Kwan <dougkwan@google.com>
3057 * resolve.cc (Symbol_table::should_override): When a weak dynamic
3058 defintion overrides non-weak undef, remember that the original undef
3060 * symtab.cc (Symbol_table::sized_write_global): For undef without
3061 an original weak binding, set binding to global in output.
3062 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
3063 * testsuite/Makefile.in: Regenerate.
3064 * testsuite/strong_ref_weak_def.sh: New file.
3065 * testsuite/strong_ref_weak_def_1.c: Ditto.
3066 * testsuite/strong_ref_weak_def_2.c: Ditto.
3068 2010-08-12 Cary Coutant <ccoutant@google.com>
3070 * testsuite/incremental_test.sh: Rewrite.
3071 * testsuite/incremental_test_1.c: Rewrite.
3072 * testsuite/incremental_test_2.c: Rewrite.
3074 2010-08-12 Cary Coutant <ccoutant@google.com>
3076 * arm.cc (Target_arm::got_size): Add const.
3077 (Target_arm::got_entry_count): New function.
3078 (Target_arm::plt_entry_count): New function.
3079 (Target_arm::first_plt_entry_offset): New function.
3080 (Target_arm::plt_entry_size): New function.
3081 (Output_data_plt_arm::entry_count): New function.
3082 (Output_data_plt_arm::first_plt_entry_offset): New function.
3083 (Output_data_plt_arm::get_plt_entry_size): New function.
3084 * i386.cc (Target_i386::got_size): Add const.
3085 (Target_i386::got_entry_count): New function.
3086 (Target_i386::plt_entry_count): New function.
3087 (Target_i386::first_plt_entry_offset): New function.
3088 (Target_i386::plt_entry_size): New function.
3089 (Output_data_plt_i386::entry_count): New function.
3090 (Output_data_plt_i386::first_plt_entry_offset): New function.
3091 (Output_data_plt_i386::get_plt_entry_size): New function.
3092 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
3093 find_incremental_inputs_sections. Dump incremental_got_plt section.
3094 * incremental.cc: Include target.h.
3095 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
3096 parameter. Adjust all callers. Find incremental_got_plt section.
3097 (Incremental_inputs::create_data_sections): Create incremental_got_plt
3099 (Output_section_incremental_inputs::set_final_data_size): Calculate
3100 size of incremental_got_plt section.
3101 (Output_section_incremental_inputs::do_write): Write the
3102 incremental_got_plt section.
3103 (Got_plt_view_info): New struct.
3104 (Local_got_offset_visitor): New class.
3105 (Global_got_offset_visitor): New class.
3106 (Global_symbol_visitor_got_plt): New class.
3107 (Output_section_incremental_inputs::write_got_plt): New function.
3108 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
3109 Add parameter. Adjust all callers.
3110 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3111 (Incremental_inputs::got_plt_section): New function.
3112 (Incremental_inputs::got_plt_section_): New data member.
3113 (Incremental_got_plt_reader): New class.
3114 * layout.cc (Layout::create_incremental_info_sections): Add the
3115 incremental_got_plt section.
3116 * object.h (Got_offset_list::get_list): New function.
3117 (Got offset_list::for_all_got_offsets): New function.
3118 (Sized_relobj::local_got_offset_list): New function.
3119 * powerpc.cc (Target_powerpc::got_size): Add const.
3120 (Target_powerpc::got_entry_count): New function.
3121 (Target_powerpc::plt_entry_count): New function.
3122 (Target_powerpc::first_plt_entry_offset): New function.
3123 (Target_powerpc::plt_entry_size): New function.
3124 (Output_data_plt_powerpc::entry_count): New function.
3125 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
3126 (Output_data_plt_powerpc::get_plt_entry_size): New function.
3127 * sparc.cc (Target_sparc::got_size): Add const.
3128 (Target_sparc::got_entry_count): New function.
3129 (Target_sparc::plt_entry_count): New function.
3130 (Target_sparc::first_plt_entry_offset): New function.
3131 (Target_sparc::plt_entry_size): New function.
3132 (Output_data_plt_sparc::entry_count): New function.
3133 (Output_data_plt_sparc::first_plt_entry_offset): New function.
3134 (Output_data_plt_sparc::get_plt_entry_size): New function.
3135 * symtab.h (Symbol::got_offset_list): New function.
3136 (Symbol_table::for_all_symbols): New function.
3137 * target.h (Sized_target::got_entry_count): New function.
3138 (Sized_target::plt_entry_count): New function.
3139 (Sized_target::plt_entry_size): New function.
3140 * x86_64.cc (Target_x86_64::got_size): Add const.
3141 (Target_x86_64::got_entry_count): New function.
3142 (Target_x86_64::plt_entry_count): New function.
3143 (Target_x86_64::first_plt_entry_offset): New function.
3144 (Target_x86_64::plt_entry_size): New function.
3145 (Output_data_plt_x86_64::entry_count): New function.
3146 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
3147 (Output_data_plt_x86_64::get_plt_entry_size): New function.
3149 2010-08-12 Cary Coutant <ccoutant@google.com>
3151 * archive.cc: Include incremental.h.
3152 (Archive::Archive): Initialize incremental_info_.
3153 (Archive::include_member): Record archive members in incremental info.
3154 (Add_archive_symbols::run): Record begin and end of an archive in
3156 (Lib_group::include_member): Record objects in incremental info.
3157 * archive.h (Incremental_archive_entry): Forward declaration.
3158 (Archive::set_incremental_info): New member function.
3159 (Archive::incremental_info): New member function.
3160 (Archive::Unused_symbol_iterator): New class.
3161 (Archive::unused_symbols_begin): New member function.
3162 (Archive::unused_symbols_end): New member function.
3163 (Archive::incremental_info_): New data member.
3164 * incremental-dump.cc (find_input_containing_global): New function.
3165 (dump_incremental_inputs): Dump new incremental info sections.
3166 * incremental.cc: Include symtab.h.
3167 (Output_section_incremental_inputs): New class.
3168 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
3169 new incremental info sections.
3170 (Sized_incremental_binary::do_check_inputs): Likewise.
3171 (Incremental_inputs::report_archive): Remove.
3172 (Incremental_inputs::report_archive_begin): New function.
3173 (Incremental_inputs::report_archive_end): New function.
3174 (Incremental_inputs::report_object): New function.
3175 (Incremental_inputs::finalize_inputs): Remove.
3176 (Incremental_inputs::report_input_section): New function.
3177 (Incremental_inputs::report_script): Rewrite.
3178 (Incremental_inputs::finalize): Do nothing but finalize string table.
3179 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3180 (Incremental_inputs::sized_create_inputs_section_data): Remove.
3181 (Incremental_inputs::create_data_sections): New function.
3182 (Incremental_inputs::relocs_entsize): New function.
3183 (Output_section_incremental_inputs::set_final_data_size): New function.
3184 (Output_section_incremental_inputs::do_write): New function.
3185 (Output_section_incremental_inputs::write_header): New function.
3186 (Output_section_incremental_inputs::write_input_files): New function.
3187 (Output_section_incremental_inputs::write_info_blocks): New function.
3188 (Output_section_incremental_inputs::write_symtab): New function.
3189 * incremental.h (Incremental_script_entry): Forward declaration.
3190 (Incremental_object_entry): Forward declaration.
3191 (Incremental_archive_entry): Forward declaration.
3192 (Incremental_inputs): Forward declaration.
3193 (Incremental_inputs_header_data): Remove.
3194 (Incremental_inputs_header): Remove.
3195 (Incremental_inputs_header_write): Remove.
3196 (Incremental_inputs_entry_data): Remove.
3197 (Incremental_inputs_entry): Remove.
3198 (Incremental_inputs_entry_write): Remove.
3199 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
3200 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
3201 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3202 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
3204 (Incremental_input_entry): New class.
3205 (Incremental_script_entry): New class.
3206 (Incremental_object_entry): New class.
3207 (Incremental_archive_entry): New class.
3208 (Incremental_inputs::Incremental_inputs): Initialize new data members.
3209 (Incremental_inputs::report_inputs): Remove.
3210 (Incremental_inputs::report_archive): Remove.
3211 (Incremental_inputs::report_archive_begin): New function.
3212 (Incremental_inputs::report_archive_end): New function.
3213 (Incremental_inputs::report_object): Change prototype.
3214 (Incremental_inputs::report_input_section): New function.
3215 (Incremental_inputs::report_script): Change prototype.
3216 (Incremental_inputs::get_reloc_count): New function.
3217 (Incremental_inputs::set_reloc_count): New function.
3218 (Incremental_inputs::create_data_sections): New function.
3219 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3220 (Incremental_inputs::inputs_section): New function.
3221 (Incremental_inputs::symtab_section): New function.
3222 (Incremental_inputs::relocs_section): New function.
3223 (Incremental_inputs::get_stringpool): Add const.
3224 (Incremental_inputs::command_line): Add const.
3225 (Incremental_inputs::inputs): Remove.
3226 (Incremental_inputs::command_line_key): New function.
3227 (Incremental_inputs::input_file_count): New function.
3228 (Incremental_inputs::input_files): New function.
3229 (Incremental_inputs::relocs_entsize): New function.
3230 (Incremental_inputs::sized_create_inputs_section_data): Remove.
3231 (Incremental_inputs::finalize_inputs): Remove.
3232 (Incremental_inputs::Input_info): Remove.
3233 (Incremental_inputs::lock_): Remove.
3234 (Incremental_inputs::inputs_): Change type.
3235 (Incremental_inputs::inputs_map_): Remove.
3236 (Incremental_inputs::current_object_entry_): New data member.
3237 (Incremental_inputs::inputs_section_): New data member.
3238 (Incremental_inputs::symtab_section_): New data member.
3239 (Incremental_inputs::relocs_section_): New data member.
3240 (Incremental_inputs::reloc_count_): New data member.
3241 (Incremental_inputs_reader): New class.
3242 (Incremental_symtab_reader): New class.
3243 (Incremental_relocs_reader): New class.
3244 * layout.cc (Layout::finalize): Move finalization of incremental info
3245 and creation of incremental info sections to follow finalization of
3246 symbol table. Set offsets for postprocessing sections.
3247 (Layout::create_incremental_info_sections): Call
3248 Incremental_inputs::create_data_sections. Add incremental symtab
3249 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
3250 sections to layout after input sections.
3251 * layout.h (struct Timespec): Forward declaration.
3252 (Layout::incremental_inputs): Add const.
3253 (Layout::create_incremental_info_sections): Add parameter.
3254 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
3255 * object.cc: Include incremental.h.
3256 (Relobj::finalize_incremental_relocs): New function.
3257 (Sized_relobj::do_layout): Record input sections in incremental info.
3258 * object.h (Object::output_section): New function.
3259 (Object::output_section_offset): Moved from Relobj.
3260 (Object::get_incremental_reloc_base): New function.
3261 (Object::get_incremental_reloc_count): New function.
3262 (Object::do_output_section): New function.
3263 (Object::do_output_section_offset): Moved from Relobj.
3264 (Object::do_get_incremental_reloc_base): New function.
3265 (Object::do_get_incremental_reloc_count): New function.
3266 (Object::Object): Initialize new data members.
3267 (Relobj::output_section): Renamed do_output_section and moved to
3269 (Relobj::output_section_offset): Moved to Object.
3270 (Relobj::do_get_incremental_reloc_base): New function.
3271 (Relobj::do_get_incremental_reloc_count): New function.
3272 (Relobj::allocate_incremental_reloc_counts): New function.
3273 (Relobj::count_incremental_reloc): New function.
3274 (Relobj::finalize_incremental_relocs): New function.
3275 (Relobj::next_incremental_reloc_index): New function.
3276 (Relobj::reloc_counts_): New data member.
3277 (Relobj::reloc_bases_): New data member.
3278 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
3279 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
3280 (Sized_relobj::incremental_relocs_scan): New function.
3281 (Sized_relobj::incremental_relocs_scan_reltype): New function.
3282 (Sized_relobj::incremental_relocs_write): New function.
3283 (Sized_relobj::incremental_relocs_write_reltype): New function.
3284 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
3286 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
3287 archives and object files elsewhere.
3288 (Add_symbols::run): Report object files here.
3289 (Finish_group::run): Report end of archive at end of group.
3290 * reloc.cc: Include layout.h, incremental.h.
3291 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
3292 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
3293 (Sized_relobj::incremental_relocs_scan): New function.
3294 (Sized_relobj::incremental_relocs_scan_reltype): New function.
3295 (Sized_relobj::do_relocate_sections): Write incremental relocations.
3296 (Sized_relobj::incremental_relocs_write): New function.
3297 (Sized_relobj::incremental_relocs_write_reltype): New function.
3298 * script.cc (read_input_script): Rewrite test for incremental link.
3299 Change call to Incremental_inputs::report_script.
3300 * symtab.h (Symbol_table::first_global_index): New function.
3301 (Symbol_table::output_count): New function.
3303 2010-08-12 Doug Kwan <dougkwan@google.com>
3305 * arm.cc (Target_arm::merge_object_attributes): Check command line
3306 options --no-wchar-size-warning and --no-enum-size-warning.
3307 * options.h (General_options): Add ld-compatible options
3308 --no-enum-size-warning and --no-wchar-size-warning.
3310 2010-08-04 Ian Lance Taylor <iant@google.com>
3312 * x86_64.cc (Target_x86_64::Scan::local): Use
3313 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
3314 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
3315 (Target_x86_64::Scan::global): Likewise.
3316 (Target_x86_64::Relocate::relocate): Likewise.
3317 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
3320 2010-08-03 Cary Coutant <ccoutant@google.com>
3322 * merge.cc (Output_merge_string::do_add_input_section): Count strings
3323 to reserve space in merged_strings vector. Keep total input size
3325 (Output_merge_string::do_print_merge_stats): Print total input size.
3326 * merge.h (Output_merge_string): Add input_size_ field.
3327 * stringpool.cc (Stringpool_template::string_length): Move
3328 implementations out of Stringpool_template class and place in
3330 * stringpool.h (string_length): Move out of Stringpool_template.
3332 2010-08-03 Ian Lance Taylor <iant@google.com>
3335 * layout.cc (relaxation_loop_body): If address of load segment is
3336 set, adjust address to include headers if possible.
3338 2010-08-03 Ian Lance Taylor <iant@google.com>
3340 * version.cc (version_string): Bump to 1.10.
3342 2010-08-03 Ian Lance Taylor <iant@google.com>
3345 * layout.h (enum Output_section_order): Define.
3346 (class Layout): Update declarations.
3347 * layout.cc (Layout::get_output_section): Add order parameter.
3348 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
3349 is_first_non_relro parameters. Change all callers.
3350 (Layout::choose_output_section): Likewise.
3351 (Layout::add_output_section_data): Likewise.
3352 (Layout::make_output_section): Likewise. Set order.
3353 (Layout::default_section_order): New function.
3354 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
3355 * output.cc (Output_section::Output_section): Initialize order_.
3356 Don't initialize deleted fields.
3357 (Output_segment::Output_segment): Don't initialize deleted
3359 (Output_segment::add_output_section_to_load): New function
3360 replacing add_output_section. Change all callers to call this or
3361 add_output_section_to_nonload.
3362 (Output_segment::add_output_section_to_nonload): New function.
3363 (Output_segment::remove_output_section): Rewrite.
3364 (Output_segment::add_initial_output_data): Likewise.
3365 (Output_segment::has_any_data_sections): Likewise.
3366 (Output_segment::is_first_section_relro): Likewise.
3367 (Output_segment::maximum_alignment): Likewise.
3368 (Output_segment::has_dynamic_reloc): New function replacing
3369 dynamic_reloc_count. Change all callers.
3370 (Output_segment::has_dynamic_reloc_list): New function replacing
3371 dynamic_reloc_count_list. Change all callers.
3372 (Output_segment::set_section_addresses): Rewrite.
3373 (Output_segment::set_offset): Rewrite.
3374 (Output_segment::find_first_and_last_list): Remove.
3375 (Output_segment::set_tls_offsets): Rewrite.
3376 (Output_segment::first_section_load_address): Likewise.
3377 (Output_segment::output_section_count): Likewise.
3378 (Output_segment::section_with_lowest_load_address): Likewise.
3379 (Output_segment::write_section_headers): Likewise.
3380 (Output_segment::print_sections_to_map): Likewise.
3381 * output.h (class Output_data): Remove dynamic_reloc_count_
3382 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
3383 (Output_data::add_dynamic_reloc): Rewrite.
3384 (Output_data::has_dynamic_reloc): New function.
3385 (Output_data::dynamic_reloc_count): Remove.
3386 (class Output_section): Add order_ field. Remvoe is_relro_local_,
3387 is_last_relro_, is_first_non_relro_, is_interp_,
3388 is_dynamic_linker_section_ fields. Add order and set_order
3389 functions. Remove is_relro_local, set_is_relro_local,
3390 is_last_relro, set_is_last_relro, is_first_non_relro,
3391 set_is_first_non_relro functions, is_interp, set_is_interp,
3392 is_dynamic_linker_section, and set_is_dynamic_linker_section
3394 (class Output_segment): Change Output_data_list from std::list to
3395 std:;vector. Add output_lists_ field. Remove output_data_ and
3396 output_bss_ fields. Update declarations.
3398 2010-08-02 Ian Lance Taylor <iant@google.com>
3400 * arm.cc (Target_arm::gc_process_relocs): Use typename.
3401 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
3402 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
3404 2010-08-02 Ian Lance Taylor <iant@google.com>
3407 * script.cc (Script_options::Script_options): Initialize
3408 symbol_definitions_ and symbol_references_.
3409 (Script_options::add_symbol_assignment): Update
3410 symbol_definitions_ and symbol_references_.
3411 (Script_options::add_symbol_reference): New function.
3412 (script_symbol): New function.
3413 * script.h (class Script_options): Add symbol_definitions_ and
3414 symbol_references_ fields.
3415 (Script_options::referenced_const_iterator): New type.
3416 (Script_options::referenced_begin): New function.
3417 (Script_options::referenced_end): New function.
3418 (Script_options::is_referenced): New function.
3419 (Script_options::any_unreferenced): New function.
3420 * script-c.h (script_symbol): Declare.
3421 * yyscript.y (exp): Call script_symbol.
3422 * symtab.cc: Include "script.h".
3423 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
3424 Change all callers. Check symbols referenced by scripts.
3425 (Symbol_table::add_undefined_symbols_from_command_line): Add
3426 layout parameter. Change all callers.
3427 (Symbol_table::do_add_undefined_symbols_from_command_line):
3428 Likewise. Break out loop body. Check symbols referenced by
3430 (Symbol_table::add_undefined_symbol_from_command_line): New
3431 function broken out of
3432 do_add_undefined_symbols_from_command_line.
3433 * symtab.h (class Symbol_table): Update declarations.
3434 * archive.cc: Include "layout.h".
3435 (Archive::should_include_member): Add layout parameter. Change
3436 all callers. Check for symbol mentioned in expression.
3437 * archive.h (class Archive): Update declaration.
3438 * object.cc (Sized_relobj::do_should_include_member): Add layout
3440 * object.h (Object::should_include_member): Add layout parameter.
3442 (Object::do_should_include_member): Add layout parameter.
3443 (class Sized_relobj): Update declaration.
3444 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
3446 * dynobj.h (class Sized_dynobj): Update declaration.
3447 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
3449 * plugin.h (class Sized_pluginobj): Update declaration.
3451 2010-08-02 Ian Lance Taylor <iant@google.com>
3454 * output.cc (Output_segment::set_offset): Search for the first and
3455 last sections rather than assuming that the list is in order.
3456 (Output_segment::find_first_and_last_list): New function.
3457 * output.h (class Output_segment): Update declarations.
3458 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
3459 (relro_strip_test_SOURCES): New variable.
3460 (relro_strip_test_DEPENDENCIES): New variable.
3461 (relro_strip_test_LDFLAGS): New variable.
3462 (relro_strip_test_LDADD): New variable.
3463 (relro_strip_test.so): New target.
3465 2010-08-02 Ian Lance Taylor <iant@google.com>
3467 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
3468 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
3469 (Target_i386::got_tlsdesc_section): New function.
3470 (Target_i386::got_section): Create space for GOT entries for
3471 TLSDESC relocations.
3472 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
3474 (Target_i386::Scan::global): Likewise.
3475 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
3477 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
3478 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
3479 (Target_x86_64::got_tlsdesc_section): New function.
3480 (Target_x86_64::got_section): Create space for GOT entries for
3481 TLSDESC relocations.
3482 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
3484 (Target_x86_64::Scan::global): Likewise.
3485 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
3488 2010-08-02 Ian Lance Taylor <iant@google.com>
3490 * testsuite/final_layout.sh: Use dc to convert from hex to
3493 2010-07-29 Sriraman Tallam <tmsriram@google.com>
3495 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
3496 paramter to the call to gold::gc_process_relocs.
3497 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
3498 paramter to the call to gold::gc_process_relocs.
3499 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
3500 parameter to the call to gold::gc_process_relocs.
3501 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
3502 template parameter to the call to gold::gc_process_relocs.
3503 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
3504 paramter to the call to gold::gc_process_relocs.
3505 * gc.h (get_embedded_addend_size): New function.
3506 (gc_process_relocs): Save the size of the reloc for use by ICF.
3507 * icf.cc (get_section_contents): Get the addend from the text section
3508 for SHT_REL relocation sections.
3509 * icf.h (Icf::Reloc_addend_size_info): New typedef.
3510 (Icf::Reloc_info): Add new member reloc_addend_size_info.
3511 * int_encoding.h (read_from_pointer): New overloaded function.
3512 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
3513 * testsuite/icf_sht_rel_addend_test.sh: New file.
3514 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
3515 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
3517 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3519 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
3520 * Makefile.in: Regenerate.
3521 * testsuite/Makefile.in: Regenerate.
3523 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
3525 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
3526 * gold/testsuite/debug_msg.cc: Likewise.
3527 * gold/testsuite/odr_violation1.cc
3528 * gold/testsuite/odr_violation2.cc
3530 2010-07-21 Cary Coutant <ccoutant@google.com>
3532 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
3533 string, and length fields.
3534 (Output_merge_string::Merged_strings_list): New type.
3535 (Output_merge_string::Merged_strings_lists): New typedef.
3536 (Output_merge_string): Replace merged_strings_ with
3537 merged_strings_lists_.
3538 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
3539 Merged_strings_list per input object and section. Don't store pointer
3540 to the string. Don't store length with each merged string entry.
3541 (Output_merge_string::finalize_merged_data): Loop over list of merged
3542 strings lists. Recompute length of each merged string.
3544 2010-07-15 Cary Coutant <ccoutant@google.com>
3546 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
3549 2010-07-14 Ian Lance Taylor <iant@google.com>
3551 * descriptors.cc (Descriptors::open): Report correct name in error
3554 2010-07-13 Doug Kwan <dougkwan@google.com>
3556 * arm.cc (Arm_input_section::Arm_input_section): For a
3557 SHT_ARM_EXIDX section, always keeps the input sections.
3558 (Arm_input_section::set_exidx_section_link): New method.
3559 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
3560 has_errors_ to false.
3561 (Arm_exidx_input_section::has_errors,
3562 Arm_exidx_input_section::set_has_errors): New methods.
3563 (Arm_exidx_input_section::has_errors_): New data member.
3564 (Arm_relobj::get_exidx_shndx_list): New method.
3565 (Arm_output_section::append_text_sections_to_list): Do not skip
3566 section without SHF_EXECINSTR.
3567 (Arm_output_section::fix_exidx_coverage): Skip input sections with
3569 (Arm_relobj::make_exidx_input_section): Add new parameter for text
3570 section header. Make error messages more verbose. Check for
3571 a non-executable section linked to an EXIDX section.
3572 (Arm_relobj::do_read_symbols): Remove error checking, which has been
3573 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
3574 check that there is no deferred EXIDX section if we exit early.
3575 Instead of not making an EXIDX section in case of an error, make one
3576 and set the has_errors flag of it.
3577 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
3578 in a relocatable link.
3579 (Target_arm::do_relax): Look for the EXIDX output section instead of
3580 assuming that it is called .ARM.exidx.
3581 (Target_arm::fix_exidx_coverage): Add a new parameter for input
3582 section list. Do not check for SHF_EXECINSTR section flags but
3583 skip any input section with errors.
3584 * output.cc (Output_section::Output_section): Initialize
3585 always_keeps_input_sections_ to false.
3586 (Output_section::add_input_section): Check for
3587 always_keeps_input_sections_.
3588 * output.h (Output_section::always_keeps_input_sections,
3589 Output_section::set_always_keeps_input_sections): New methods.
3590 (Output_section::always_keeps_input_sections): New data member.
3592 2010-07-13 Rafael Espindola <espindola@google.com>
3594 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
3595 * fileread.h (Input_file): Add try_extra_search_path and find_file.
3597 2010-07-13 Philip Herron <herron.philip@googlemail.com>
3598 Ian Lance Taylor <iant@google.com>
3600 * output.h (Output_section_lookup_maps::add_merge_section):
3601 Correct check of whether value was inserted.
3602 (Output_section_lookup_maps::add_merge_input_section): Likewise.
3603 (Output_section_lookup_maps::add_relaxed_input_section):
3605 * arm.cc (Target_arm::got_section): Remove used local os.
3606 * i386.cc (Target_i386::got_section): Likewise.
3607 * x86_64.cc (Target_x86_64::got_section): Likewise.
3608 * sparc.cc (Target_sparc::got_section): Likewise.
3609 (Target_sparc::relocate): Remove unused local have_got_offset.
3610 * powerpc.cc (Target_powerpc::relocate): Likewise.
3612 2010-07-13 Ian Lance Taylor <iant@google.com>
3614 * compressed_output.cc (zlib_decompress): Fix signature in
3617 * archive.cc (Archive::include_member): Unlock an external member
3618 of a thin archive. Don't bother to delete an object we know is
3621 2010-07-12 Cary Coutant <ccoutant@google.com>
3623 * compressed_output.cc (zlib_decompress): New function.
3624 (get_uncompressed_size): New function.
3625 (decompress_input_section): New function.
3626 * compressed_output.h (get_uncompressed_size): New function.
3627 (decompress_input_section): New function.
3628 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
3629 Handle compressed debug sections.
3630 * layout.cc (is_compressed_debug_section): New function.
3631 (Layout::output_section_name): Map compressed section names to
3633 * layout.h (is_compressed_debug_section): New function.
3634 (is_debug_info_section): Recognize compressed debug sections.
3635 * merge.cc: Include compressed_output.h.
3636 (Output_merge_data::do_add_input_section): Handle compressed
3638 (Output_merge_string::do_add_input_section): Handle compressed
3640 * object.cc: Include compressed_output.h.
3641 (Sized_relobj::Sized_relobj): Initialize new data members.
3642 (build_compressed_section_map): New function.
3643 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
3644 * object.h (Object::section_is_compressed): New method.
3645 (Object::do_section_is_compressed): New method.
3646 (Sized_relobj::Compressed_section_map): New type.
3647 (Sized_relobj::do_section_is_compressed): New method.
3648 (Sized_relobj::compressed_sections_): New data member.
3649 * output.cc (Output_section::add_input_section): Handle compressed
3651 * reloc.cc: Include compressed_output.h.
3652 (Sized_relobj::write_sections): Handle compressed debug sections.
3654 2010-07-08 Cary Coutant <ccoutant@google.com>
3656 * resolve.cc (Symbol_table::resolve): Remember whether undef was
3657 weak when resolving to a dynamic def.
3658 (Symbol_table::should_override): Add adjust_dyndef flag; set it
3659 for weak undef/dynamic def cases. Adjust callers.
3660 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
3661 undef_binding_weak_.
3662 (Symbol_table::sized_write_globals): Adjust symbol binding.
3663 (Symbol_table::sized_write_symbol): Add binding parameter.
3664 * symtab.h (Symbol::set_undef_binding): New method.
3665 (Symbol::is_undef_binding_weak): New method.
3666 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
3667 (Symbol_table::should_override): Add new parameter.
3668 (Symbol_table::sized_write_symbol): Add new parameter.
3670 * testsuite/weak_undef_file1.cc: Add new test case.
3671 * testsuite/weak_undef_file2.cc: Fix header comment.
3672 * testsuite/weak_undef_test.cc: Add new test case.
3674 2010-06-29 Doug Kwan <dougkwan@google.com>
3676 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
3677 Initialize USE_SYMBOL_.
3678 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
3680 (Arm_reloc_property::uses_symbol_): New data member declaration.
3681 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
3682 uses symbol value and symbol is undefined but not weakly undefined.
3684 2010-06-28 Rafael Espindola <espindola@google.com>
3686 * plugin.cc (Plugin::load): Use dlerror.
3688 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
3690 * symtab.cc (detect_odr_violations): When reporting an ODR
3691 violation, report an object where the symbol is defined.
3693 2010-06-25 Doug Kwan <dougkwan@google.com>
3695 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
3696 (Target_arm::section_may_have_icf_unsafe_pointers): New method
3698 (Target_arm::Scan::local_reloc_may_be_function_pointer,
3699 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
3700 target hook to detect function points.
3701 (Target_arm::Scan::possible_function_pointer_reloc): New method.
3702 * icf.h (Icf::check_section_for_function_pointers): Change type of
3703 parameter SECTION_NAME to const reference to std::string. Use
3704 target hook to determine if section may have unsafe pointers.
3705 * target.h (Target::section_may_have_icf_unsafe_pointers): New
3708 2010-06-21 Rafael Espindola <espindola@google.com>
3710 * fileread.cc (Input_file::find_fie): New
3711 (Input_file::open): Use Input_file::find_fie.
3712 * fileread.h (Input_file::find_fie): New
3713 * plugin.cc (set_extra_library_path): New.
3714 (Plugin::load): Add set_extra_library_path to the transfer vector.
3715 (Plugin_manager::set_extra_library_path): New.
3716 (Plugin_manager::add_input_file): Use the extra search path if set.
3717 (set_extra_library_path(): New.
3718 * plugin.h (Plugin_manager): Add set_extra_library_path and
3721 2010-06-19 Cary Coutant <ccoutant@google.com>
3723 * layout.cc (gdb_sections): Add .debug_types.
3724 (lines_only_debug_sections): Likewise.
3726 2010-06-18 Rafael Espindola <espindola@google.com>
3728 * plugin.cc (add_input_file,add_input_library)
3729 (Plugin_manager::add_input_file): Make filename arguments const.
3730 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
3733 2010-06-16 Doug Kwan <dougkwan@google.com>
3735 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
3736 .ARM.attributes section if we have not merged any input
3737 attributes sections.
3739 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3741 * arm.cc: Allow combining objects with no EABI version
3744 2010-06-15 Rafael Espindola <espindola@google.com>
3746 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
3748 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3750 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
3751 (struct iovec): Correct !HAVE_READV definition.
3753 2010-06-10 Cary Coutant <ccoutant@google.com>
3755 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
3756 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
3758 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
3761 * symtab.h (Symbol::is_placeholder): New member function.
3762 * target-reloc.h (relocate_section): Check for placeholder symbols.
3764 * testsuite/Makefile.am (plugin_test_8): New test.
3765 (plugin_test_9): New test.
3766 * testsuite/Makefile.in: Regenerate.
3768 2010-06-09 Nick Clifton <nickc@redhat.com>
3770 * yyscript.y (input_list_element): Allow strings prefixed with
3771 the '-' character. Treat these as libraries.
3772 * script.cc (script_add_library): New function. Adds a library
3773 specified by "-l<name>" found in an input script.
3774 * script-c.h: Add prototype for script_add_library.
3776 2010-06-07 Doug Kwan <dougkwan@google.com>
3778 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
3779 Restrict stub-group size to be within long conditional branch
3780 range when working around cortex-A8 erratum.
3782 2010-06-07 Damien Diederen <dd@crosstwine.com>
3784 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
3787 2010-06-03 Sriraman Tallam <tmsriram@google.com>
3791 (Output_section::Input_section_sort_entry::compare_section_ordering):
3792 Change to return non-zero correctly.
3793 (Output_section::Input_section_sort_section_order_index_compare
3794 ::operator()): Change to fix ambiguity in comparisons.
3796 2010-06-01 Sriraman Tallam <tmsriram@google.com>
3798 * gold.h (is_wildcard_string): New function.
3799 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
3800 (Layout::layout_eh_frame): Ditto.
3801 (Layout::find_section_order_index): New method.
3802 (Layout::read_layout_from_file): New method.
3803 * layout.h (Layout::find_section_order_index): New method.
3804 (Layout::read_layout_from_file): New method.
3805 (Layout::input_section_position_): New private member.
3806 (Layout::input_section_glob_): New private member.
3807 * main.cc (main): Call read_layout_from_file here.
3808 * options.h (--section-ordering-file): New option.
3809 * output.cc (Output_section::input_section_order_specified_): New
3811 (Output_section::Output_section): Initialize new member.
3812 (Output_section::add_input_section): Add new parameter.
3813 Keep input sections when --section-ordering-file is used.
3814 (Output_section::set_final_data_size): Sort input sections when
3815 section ordering file is specified.
3816 (Output_section::Input_section_sort_entry): Add new parameter.
3818 (Output_section::Input_section_sort_entry::compare_section_ordering):
3820 (Output_section::Input_section_sort_compare::operator()): Change to
3821 consider section_order_index.
3822 (Output_section::Input_section_sort_init_fini_compare::operator()):
3823 Change to consider section_order_index.
3824 (Output_section::Input_section_sort_section_order_index_compare
3825 ::operator()): New method.
3826 (Output_section::sort_attached_input_sections): Change to sort
3827 according to section order when specified.
3828 (Output_section::add_input_section<32, true>): Add new parameter.
3829 (Output_section::add_input_section<64, true>): Add new parameter.
3830 (Output_section::add_input_section<32, false>): Add new parameter.
3831 (Output_section::add_input_section<64, false>): Add new parameter.
3832 * output.h (Output_section::add_input_section): Add new parameter.
3833 (Output_section::input_section_order_specified): New
3835 (Output_section::set_input_section_order_specified): New method.
3836 (Input_section::Input_section): Initialize section_order_index_.
3837 (Input_section::section_order_index): New method.
3838 (Input_section::set_section_order_index): New method.
3839 (Input_section::section_order_index_): New member.
3840 (Input_section::Input_section_sort_section_order_index_compare): New
3842 (Output_section::input_section_order_specified_): New member.
3843 * script-sections.cc (is_wildcard_string): Delete and move modified
3845 (Output_section_element_input::Output_section_element_input): Modify
3846 call to is_wildcard_string.
3847 (Output_section_element_input::Input_section_pattern
3848 ::Input_section_pattern): Ditto.
3849 (Output_section_element_input::Output_section_element_input): Ditto.
3850 * testsuite/Makefile.am (final_layout): New test case.
3851 * testsuite/Makefile.in: Regenerate.
3852 * testsuite/final_layout.cc: New file.
3853 * testsuite/final_layout.sh: New file.
3855 2010-06-01 Rafael Espindola <espindola@google.com>
3857 * plugin.cc (Plugin::load): Pass the output name to the plugin.
3859 2010-06-01 Rafael Espindola <espindola@google.com>
3861 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
3862 visibility of symbols.
3864 2010-05-27 Doug Kwan <dougkwan@google.com>
3866 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
3867 from start of output section instead of address for a local symbol
3868 in a merged or relaxed section when doing a relocatable link.
3870 2010-05-26 Rafael Espindola <espindola@google.com>
3873 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
3874 adding sections the garbage collector removed.
3875 * gold/testsuite/Makefile.am: Add test.
3876 * gold/testsuite/Makefile.in: Regenerate.
3877 * gold/testsuite/plugin_test_7.sh: New.
3878 * gold/testsuite/plugin_test_7_1.c: New.
3879 * gold/testsuite/plugin_test_7_2.c: New.
3881 2010-05-26 Rafael Espindola <espindola@google.com>
3883 * script-sections.cc (Output_section_definition::set_section_addresses):
3884 Check for --section-start.
3886 2010-05-26 Doug Kwan <dougkwan@google.com>
3888 * arm.cc (Arm_scan_relocatable_relocs): New class.
3889 (Target_arm::relocate_special_relocatable): New method.
3890 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
3891 (Arm_relocate_functions::thumb_branch_common): Same.
3892 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
3893 instead of Default_scan_relocatable_relocs.
3894 * target-reloc.h (relocate_for_relocatable): Let target handle
3895 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
3896 * target.h (Sized_target::relocate_special_relocatable): New method.
3898 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3900 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
3902 2010-05-23 Doug Kwan <dougkwan@google.com>
3904 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
3906 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
3907 with a direct branch, not a conditional branch, to a stub.
3908 * merge.cc (Output_merge_base::record_input_section): New method
3910 (Output_merge_data::do_add_input_section): Record input section if
3911 keeps-input-sections flag is set.
3912 (Output_merge_string::do_add_input_section): Ditto.
3913 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
3914 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
3916 (Output_merge_base::keeps_input_sections,
3917 Output_merge_base::set_keeps_input_sections,
3918 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
3920 (Output_merge_base::Input_sections): New type declaration.
3921 (Output_merge_base::input_sections_begin,
3922 Output_merge_base::input_sections_end,
3923 Output_merge_base::do_set_keeps_input_sections): New method definitions.
3924 (Output_merge_base::bool keeps_input_sections_,
3925 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
3926 Output_merge_base::input_sections_): New data members.
3927 (Output_merge_data::do_set_keeps_input_sections): New method
3929 (Output_merge_string::do_set_keeps_input_sections): Ditto.
3930 * output.cc (Output_section::Input_section::relobj): Move method
3931 defintion from class declaration to here and handle merge sections.
3932 (Output_section::Input_section::shndx): Ditto.
3933 (Output_section::Output_section): Remove initializations of removed
3934 data members and initialize new data member LOOKUP_MAPS_.
3935 (Output_section::add_input_section): Set keeps-input-sections flag
3936 for a newly created merge output section as appropriate. Adjust code
3937 to use Output_section_lookup_maps class.
3938 (Output_section::add_relaxed_input_section): Adjst code for lookup
3939 maps code refactoring.
3940 (Output_section::add_merge_input_section): Add a new parameter
3941 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
3942 class. If adding input section to a newly created merge output
3943 section fails, remove the new merge section.
3944 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
3945 Adjust code for use of the Output_section_lookup_maps class.
3946 (Output_section::find_merge_section): Ditto.
3947 (Output_section::build_lookup_maps): New method defintion.
3948 (Output_section::find_relaxed_input_section): Adjust code to use
3949 Output_section_lookup_maps class.
3950 (Output_section::get_input_sections): Export merge sections. Adjust
3951 code to use Output_section_lookup_maps class.
3952 (Output_section:::add_script_input_section): Adjust code to use
3953 Output_section_lookup_maps class. Update lookup maps for merge
3955 (Output_section::discard_states): Use Output_section_lookup_maps.
3956 (Output_section::restore_states): Same.
3957 * output.h (Merge_section_properties): Move class defintion out of
3959 (Output_section_lookup_maps): New class.
3960 (Output_section::Input_section::is_merge_section): New method
3962 (Output_section::Input_section::relobj): Move defintion out of class
3963 defintion. Declare method only.
3964 (Output_section::Input_section::shndx): Ditto.
3965 (Output_section::Input_section::output_merge_base): New method defintion.
3966 (Output_section::Input_section::u2_.pomb): New union field.
3967 (Output_section::Merge_section_by_properties_map,
3968 Output_section::Output_section_data_by_input_section_map,
3969 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
3971 (Output_section::add_merge_input_section): Add new parameter
3972 KEEPS_INPUT_SECTIONS.
3973 (Output_section::build_lookup_maps): New method declaration.
3974 (Output_section::merge_section_map_,
3975 Output_section::merge_section_by_properties_map_,
3976 Output_section::relaxed_input_section_map_,
3977 Output_section::is_relaxed_input_section_map_valid_): Remove data
3979 (Output_section::lookup_maps_): New data member.
3981 2010-05-21 Doug Kwan <dougkwan@google.com>
3984 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
3985 avoid a compilation error.
3987 2010-05-19 Rafael Espindola <espindola@google.com>
3989 * script-sections.cc (Output_section_definition::allocate_to_segment):
3990 Update the phdrs_list even when the output section is NULL.
3991 * testsuite/Makefile.am: Add test.
3992 * testsuite/Makefile.in: Regenerate.
3993 * testsuite/script_test_9.cc: New.
3994 * testsuite/script_test_9.sh: New.
3995 * testsuite/script_test_9.t: New.
3997 2010-05-19 Doug Kwan <dougkwan@google.com>
3999 * arm.cc (Arm_input_section::original_size): New method.
4000 (Arm_input_section::do_addralign): Add a cast.
4001 (Arm_input_section::do_output_offset): Remove static cast.
4002 (Arm_input_section::original_addralign,
4003 Arm_input_section::original_size_): Change type to uint32_t.
4004 (Arm_input_section::init): Add safe casts for section alignment
4006 (Arm_input_section::set_final_data_size): Do not set address and
4007 offset of stub table.
4008 (Arm_output_section::fix_exidx_coverage): Change use of of
4009 Output_section::Simple_input_section to that of
4010 Output_section::Input_section.
4011 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
4012 except for the first pass.
4013 * output.cc (Output_section::get_input_sections): Change type of
4014 input_sections to std::list<Input_section>.
4015 (Output_section::add_script_input_section): Rename from
4016 Output_section::add_simple_input_section. Change type of SIS
4017 parameter from Simple_input_section to Input_section.
4018 * output.h (Output_section::Simple_input_section): Remove class.
4019 (Output_section::Input_section): Change class visibility to public.
4020 (Output_section::Input_section::addralign): Use stored alignments
4021 for special input sections if set.
4022 (Output_section::Input_section::set_addralign): New method.
4023 (Output_section::get_input_sections): Change parameter type from
4024 list of Simple_input_section to list of Input_section.
4025 (Output_section::add_script_input_section): Rename from
4026 Output_section::add_simple_input_section. Change first parameter's
4027 type from Simple_input_section to Input_section and remove the
4028 second and third parameters.
4029 * script-sections.cc (Input_section::Input_section_list): Change
4030 type to list of Output_section::Input_section/
4031 (Input_section_info::Input_section_info): Change parameter type of
4032 INPUT_SECTION to Output_section::Input_section.
4033 (Input_section_info::input_section): Change return type.
4034 (Input_section_info::input_section_): Change type to
4035 Output_section::Input_section.
4036 (Output_section_element_input::set_section_addresses): Adjust code
4037 to use Output_section::Input_section instead of
4038 Output_section::Simple_input_section. Adjust code for renaming
4039 of Output_section::add_simple_input_section.
4040 (Orphan_output_section::set_section_addresses): Ditto.
4042 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4044 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
4045 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
4047 2010-05-18 Rafael Espindola <espindola@google.com>
4049 * options.cc (General_options::finalize): Handle -nostdlib.
4050 * options.h (nostdlib): New option.
4051 * script.cc (script_add_search_dir): Handle -nostdlib.
4053 2010-05-12 Doug Kwan <dougkwan@google.com>
4055 * arm.cc (Target_arm::do_finalize_sections): Create an empty
4056 attributes section only if there no attributes section after merging.
4057 (Target_arm::merge_object_attributes): Move value of
4058 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
4059 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
4060 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
4061 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
4062 and arm_attr_merge_7.stdout.
4063 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
4064 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
4065 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
4066 arm_attr_merge_7b.o): New rules.
4067 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
4069 * testsuite/Makefile.in: Regenerate.
4070 * testsuite/arm_attr_merge.sh: New file.
4071 * testsuite/arm_attr_merge_[67][ab].s: Same.
4073 2010-05-05 Nick Clifton <nickc@redhat.com>
4075 * po/es.po: Updated Spanish translation.
4077 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
4079 * Makefile.am (install-exec-local): Properly install gold as
4080 default cross linker.
4081 * Makefile.in: Regenerated.
4083 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
4084 Nick Clifton <nickc@redhat.com>
4086 * configure.ac (install_as_default): Define and set to false
4087 unless --enable-gold or --enable-gold=both/gold has been
4089 * configure: Regenerate.
4091 * Makefile.am (install-exec-local): Install the executable as
4092 'ld.gold'. If install_as_default is true then also install it as
4094 * Makefile.in: Regenerated.
4096 2010-04-24 Ian Lance Taylor <iant@google.com>
4098 * layout.cc (Layout::layout_reloc): In relocatable link don't
4099 combine reloc sections for grouped sections.
4101 2010-04-23 Sriraman Tallam <tmsriram@google.com>
4103 * gc.h (gc_process_relocs): Pass information on relocs pointing to
4104 sections that are not ordinary to icf.
4105 * icf.cc (get_section_contents): Handle relocation pointing to section
4106 with no object or shndx information.
4107 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
4108 * testsuite/Makefile.in: Regenerate.
4109 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
4110 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
4112 2010-04-22 Ian Lance Taylor <iant@google.com>
4114 * expression.cc (Expression::Expression_eval_info): Add
4115 result_alignment_pointer field.
4116 (Expression::eval_with_dot): Add result_alignment_pointer
4117 parameter. Change all callers.
4118 (Expression::eval_maybe_dot): Likewise.
4119 (class Binary_expression): Add alignment_pointer parameter to
4120 left_value and right_value. Change all callers.
4121 (BINARY_EXPRESSION): Set result alignment.
4122 (class Trinary_expression): Add alignment_pointer parameter to
4123 arg2_value and arg3_value. Change all callers.
4124 (Trinary_cond::value): Set result alignment.
4125 (Max_expression::value, Min_expression::value): Likewise.
4126 (Align_expression::value): Likewise.
4127 * script-sections.cc (class Sections_element): Add dot_alignment
4128 parameter to set_section_addresses virtual function. Update
4130 (class Output_section_element): Likewise.
4131 (Script_sections::create_segments): Add dot_alignment parameter.
4133 (Script_sections::create_segments_from_phdrs_clause): Likewise.
4134 (Script_sections::set_phdrs_clause_addresses): Likewise.
4135 * script-sections.h: Update declarations.
4136 * script.h: Update declarations.
4137 * output.h (Output_segment::set_minimum_p_align): Don't decrease
4139 * testsuite/script_test_3.t: Set large alignment.
4140 * testsuite/script_test_3.sh: Make sure that at least one LOAD
4141 segment has expected alignment.
4143 2010-04-22 Nick Clifton <nickc@redhat.com>
4145 * po/gold.pot: Updated by the Translation project.
4146 * po/vi.po: Updated Vietnamese translation.
4148 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
4150 * testsuite/Makefile.am (check_PROGRAMS): Add
4151 icf_virtual_function_folding_test.
4152 * testsuite/Makefile.in: Regenerated.
4154 2010-04-15 Andrew Haley <aph@redhat.com>
4156 * options.h (merge_exidx_entries): New option.
4157 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
4158 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
4159 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
4160 (Target_arm::merge_exidx_entries): New function.
4161 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
4162 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
4163 to Arm_exidx_fixup constructor.
4164 Add new arg, merge_exidx_entries.
4165 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
4166 Arm_output_section::fix_exidx_coverage.
4168 2010-04-18 Sriraman Tallam <tmsriram@google.com>
4170 * icf.cc (get_section_contents): Check for preemptible functions.
4171 Ignore addend when appropriate.
4172 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
4174 (add_from_relobj): Check for section folded.
4175 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
4176 * symtab.h (should_add_dynsym_entry): Add new parameter.
4177 * target-reloc.h (scan_relocs): Check for section folded.
4178 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
4179 Check reloc types for function pointers in shared objects.
4180 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
4182 (icf_preemptible_functions_test): New test case.
4183 (icf_string_merge_test): New test case.
4184 * testsuite.Makefile.in: Regenerate.
4185 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
4186 bar_glob. Refactor code.
4187 * testsuite/icf_preemptible_functions_test.cc: New file.
4188 * testsuite/icf_preemptible_functions_test.sh: New file.
4189 * testsuite/icf_string_merge_test.cc: New file.
4190 * testsuite/icf_string_merge_test.sh: New file.
4191 * testsuite/icf_virtual_function_folding_test.cc: New file.
4192 * testsuite/icf_virtual_function_folding_test.sh: New file.
4194 2010-04-14 Doug Kwan <dougkwan@google.com>
4196 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
4197 for local symbol recounting if we remove a section due to ICF.
4198 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
4199 there are no regular objects in input.
4201 2010-04-13 Doug Kwan <dougkwan@google.com>
4203 * arm.cc (Arm_input_section::set_final_data_size): Compute
4204 accurate final data size instead of using current data size.
4206 2010-04-09 Doug Kwan <dougkwan@google.com>
4208 * layout.cc (Layout::choose_output_section): Handle script section
4210 (Layout::make_output_section_for_script): Add section type parameter.
4211 Handle script section types.
4212 * layout.h (Layout::make_output_section_for_script): Add section
4214 * output.cc (Output_section::Output_section): Initialize data member
4216 (Output_section::do_reset_address_and_file_offset): Do not set address
4217 to 0 if section is a NOLOAD section.
4218 * output.h (Output_section::is_noload): New method.
4219 (Output_section::set_is_noload): Ditto.
4220 (Output_section::is_noload_): New data member.
4221 * script-c.h (Script_section_type): New enum type.
4222 (struct Parser_output_section_header): Add new file section_type.
4223 * script-sections.cc (Sections_element::output_section_name): Add
4224 parameter for returning script section type.
4225 (Output_section_definition::output_section_name): Ditto.
4226 (Output_section_definition::section_type)P; New method.
4227 (Output_section_definiton::script_section_type_name): Ditto.
4228 (Output_section_definition::script_section_type_): New data member.
4229 (Output_section_definition::Output_section_definition): Initialize
4230 data member Output_section_definition::script_section_type_.
4231 (Output_section_definition::create_sections): Pass script section type
4232 to Layout::make_output_section_for_script.
4233 (Output_section_definition::output_section_name): Return script
4234 section type to caller.
4235 (Output_section_definition::set_section_address): Do not advance
4236 dot value and load address if section type is NOLOAD. Set address
4237 of NOLOAD sections regardless of section flags.
4238 (Output_section_definition::print): Print section type if it is
4239 not SCRIPT_SECTION_TYPE_NONE.
4240 (Output_section_definition::section_type): New method.
4241 (Output_section_definition::script_section_type_name): Ditto.
4242 (Script_sections::output_section_name): Add new parameter
4243 PSECTION_TYPE for returning script section type. Pass it to
4244 section elements. Handle discard sections.
4245 (Sort_output_sections::operator()): Handle NOLOAD sections.
4246 * script-sections.h (Script_sections::Section_type): New enum type.
4247 (Script_sections::output_section_name): Add a new parameter for
4248 returning script section type.
4249 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
4251 * yyscript.y (union): Add new field SECTION_TYPE.
4252 (COPY, DSECT, INFO, NOLOAD): New tokens.
4253 (opt_address_and_section_type): Change type to output_section_header.
4254 (section_type): New non-terminal
4255 (section_header): Handle section type.
4256 (opt_address_and_section_type): Return section type value.
4258 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
4260 * testsuite/plugin_common_test_1.c (foo): Add prototype.
4261 * testsuite/plugin_common_test_2.c (foo): Likewise.
4263 2010-04-08 Doug Kwan <dougkwan@google.com>
4265 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
4267 * output.cc (Output_section::add_merge_input_section): Simplify
4268 code and return status of Output_merge_base::add_input_section.
4269 Update merge section map only if Output_merge_base::add_input_section
4272 2010-04-07 Doug Kwan <dougkwan@google.com>
4274 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
4275 if section is marked as containing instructions but has no mapping
4277 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
4278 correct section index.
4279 (Arm_relobj::find_linked_text_section): Ditto.
4281 2010-04-07 Cary Coutant <ccoutant@google.com>
4283 * archive.cc (include_member): Destroy Read_symbols_data object before
4285 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
4286 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
4287 (Read_symbols_data::~Read_symbols_data) New destructor.
4288 (Section_relocs::Section_relocs) New constructor.
4289 (Section_relocs::~Section_relocs) New destructor.
4290 (Read_relocs_data::Read_relocs_data) New constructor.
4291 (Read_relocs_data::~Read_relocs_data) New destructor.
4292 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
4293 pointers to NULL after deleting.
4295 2010-04-07 Doug Kwan <dougkwan@google.com>
4297 * arm.cc: Replace "endianity" with "endianness" in comments.
4298 (Arm_exidx_cantunwind): Ditto.
4299 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
4300 (Arm_relobj::merge_flags_and_attributes): New method.
4301 (Arm_relobj::merge_flags_and_attributes_): New data member.
4302 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
4303 (Arm_relobj::scan_sections_for_stubs): Ditto.
4304 (Arm_relobj::do_read_symbols): Check to see if we really want to
4305 merge processor-specific flags and attributes. Exit early if
4306 an object is empty except for section names and the undefined symbol.
4307 (Target_arm::do_finalize_sections): Move check for ELF format to
4308 Arm_relobj::do_read_symbols. Merge processor specific flags and
4309 attributes from a regular object only when we have determined that
4310 it is aapropriate. Do not create an .ARM.attributes section in
4311 output if there is no regular input object.
4312 (Target_arm::merge_processor_specific_flags): Check
4313 --warn-mismatch before printing any error.
4314 (Target_arm::merge_object_attributes): Ditto.
4315 * gold.cc (queue_middle_tasks): Handle the case in which there is
4316 no regular object in input.
4317 * options.cc (General_options::parse_EB): New method.
4318 (General_options::parse_EL): Same.
4319 (General_options::General_options): Initialize endianness_.
4320 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
4322 (General_options::Endianness): New enum.
4323 (General_options::endianness): New method.
4324 (General_options::endianness_): New data member.
4325 * parameters.cc (Parameters::set_options): Check target endianness.
4326 (Parameters::set_target_once): Ditto.
4327 (Parameters::check_target_endianness): New method.
4328 (parameters_force_valid_target): If either -EL or -EB is specified,
4329 use it to define endianness of default target.
4330 * parameters.h (Parameters::check_target_endianness): New method
4332 * target.h (class Target): Change "endianity" to "endianness"
4335 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4337 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
4338 * configure: Regenerate.
4339 * Makefile.in: Regenerate.
4340 * testsuite/Makefile.in: Regenerate.
4342 2010-04-06 Cary Coutant <ccoutant@google.com>
4345 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
4346 prevailing definitions of common symbols.
4347 * testsuite/plugin_test_6.sh: New test case.
4348 * testsuite/plugin_common_test_1.c: New test case.
4349 * testsuite/plugin_common_test_2.c: New test case.
4350 * testsuite/Makefile.am (plugin_test_6): New test case.
4351 * testsuite/Makefile.in: Regenerate.
4353 2010-04-06 Nick Clifton <nickc@redhat.com>
4355 * po/vi.po: New Vietnamese translation.
4357 2010-03-30 Doug Kwan <dougkwan@google.com>
4359 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
4361 2010-03-25 Doug Kwan <dougkwan@google.com>
4363 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
4364 to avoid a conversion warning on a 32-bit host.
4366 2010-03-24 Ian Lance Taylor <iant@google.com>
4368 * testsuite/script_test_3.t: Add a TLS segment.
4369 * testsuite/Makefile.am (check_PROGRAMS): Add
4370 tls_phdrs_script_test.
4371 (tls_phdrs_script_test_SOURCES): Define.
4372 (tls_phdrs_script_test_DEPENDENCIES): Define.
4373 (tls_phdrs_script_test_LDFLAGS): Define.
4374 (tls_phdrs_script_test_LDADD): Define.
4375 * testsuite/Makefile.in: Rebuild.
4377 2010-03-23 Cary Coutant <ccoutant@google.com>
4379 * fileread.cc (find_or_make_view): Fix comment.
4381 2010-03-23 Ian Lance Taylor <iant@google.com>
4383 * script-sections.cc (class Orphan_section_placement): Define
4384 PLACE_TLS and PLACE_TLS_BSS.
4385 (Orphan_section_placement::Orphan_section_placement): Initialize
4387 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
4388 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
4389 (tls_script_test_SOURCES): Define.
4390 (tls_script_test_DEPENDENCIES): Define.
4391 (tls_script_test_LDFLAGS): Define.
4392 (tls_script_test_LDADD): Define.
4393 * testsuite/Makefile.in: Rebuild.
4395 2010-03-22 Doug Kwan <dougkwan@google.com>
4397 * arm.cc (Arm_relocate_functions::abs8,
4398 Arm_relocate_functions::abs16): Use correct check for overflow
4399 specified in the ARM ELF specs.
4400 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
4401 target of a BLX instruction specially.
4402 (Reloc_stub::stub_type_for_reloc): Ditto.
4403 (Relocate::relocate): Use symbolic names instead of numeric relocation
4404 codes to report error.
4405 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
4407 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
4408 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
4409 thumb2_blx_out_of_range.stdout
4410 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
4411 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
4412 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
4413 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
4414 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
4415 thumb2_blx_in_range, thumb2_blx_in_range.o,
4416 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
4417 thumb2_blx_out_of_range.o): New rules.
4418 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
4419 thumb2_blx_in_range and thumb2_blx_out_of_range.
4420 * testsuite/Makefile.in: Regenerate.
4421 * arm_branch_in_range.sh: Add tests for THUMB BLX.
4422 * testsuite/thumb_blx_in_range.s: New file.
4423 * testsuite/thumb_blx_out_of_range.s: New file.
4425 2010-03-22 Rafael Espindola <espindola@google.com>
4427 * archive.cc (Should_include): Move to archive.h.
4428 (should_include_member): Make it a member of Archive.
4430 (Add_lib_group_symbols): New.
4431 * archive.h: Include options.h.
4432 (Archive_member): Moved from Archive.
4433 (Should_include): Moved from archive.cc.
4435 (Add_lib_group_symbols): New.
4436 * dynobj.cc (do_should_include_member): New.
4437 * dynobj.h (do_should_include_member): New.
4438 * gold.cc (queue_initial_tasks): Update call to queue.
4439 * main.cc (main): Print lib group stats.
4440 * object.cc (do_should_include_member): New.
4441 * object.h: Include archive.h.
4442 (Object::should_include_member): New.
4443 (Object::do_should_include_member): New.
4444 (Sized_relobj::do_should_include_member): New.
4445 * options.cc (General_options::parse_start_lib): New.
4446 (General_options::parse_end_lib): New.
4447 (Input_arguments::add_file): Handle lib groups.
4448 (Input_arguments::start_group): Check we are not in a lib.
4449 (Input_arguments::start_lib): New.
4450 (Input_arguments::end_lib): New.
4451 * options.h (General_options): Add start_lib and end_lib.
4452 (Input_argument::lib_): New.
4453 (Input_argument::lib): New.
4454 (Input_argument::is_lib): New.
4455 (Input_file_lib): New.
4456 (Input_arguments::in_lib_): New.
4457 (Input_arguments::in_lib): New.
4458 (Input_arguments::start_lib): New.
4459 (Input_arguments::end_lib_): New.
4460 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
4461 in unused members as preempted.
4462 (Sized_pluginobj::do_should_include_member): New.
4463 * plugin.h (Sized_pluginobj::do_should_include_member): New.
4464 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
4466 (Read_symbols::do_whole_lib_group): New.
4467 (Read_symbols::do_lib_group): New.
4468 (Read_symbols::do_read_symbols): Handle lib groups.
4469 (Read_symbols::get_name): Handle lib groups.
4470 * readsyms.h (Read_symbols): Add an archive member pointer.
4471 (Read_symbols::do_whole_lib_group): New.
4472 (Read_symbols::do_lib_group): New.
4473 (Read_symbols::member_): New.
4474 * script.cc (read_input_script): Update call to queue_soon.
4476 2010-03-19 Doug Kwan <dougkwan@google.com>
4478 * arm.cc (Stub_table::Stub_table): Initialize new data members
4479 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
4480 (Stub_table::add_reloc_stub): Assign stub offset and update
4481 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
4482 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
4484 (Stub_table::update_data_size_and_addralign): Use
4485 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
4486 instead of going over all reloc stubs.
4487 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
4488 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
4489 Stringpool_template::offset_ to size of Stringpool_char.
4490 (Stringpool_template::new_key_offset): Remove code to initialize
4491 Stringpool_template::offset_.
4492 * stringpool.h (Stringpool_template::set_no_zero_null): Set
4493 Stringpool_template::offset_ to zero.
4495 2010-03-15 Doug Kwan <dougkwan@google.com>
4497 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
4499 (Stringpool_template::new_key_offset): New method.
4500 (Stringpool_template::add_string): Assign offsets when adding new
4502 (Stringpool_template::set_string_offsets): Do not set string offsets
4503 when not optimizing.
4504 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
4506 (Chunked_vector::clear): Clear size_.
4507 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
4508 (Chunked_vector::size): Return size_.
4509 (Chunked_vector::push_back): Use size_ to find insert position.
4510 (Chunked_vector::size_): New data member.
4511 (Stringpool_template::set_no_zero_null): Assert string set is empty.
4512 (Stringpool_template::new_key_offset): New method declaration.
4513 (Stringpool_template::offset_): New data member.
4515 2010-03-15 Rafael Espindola <espindola@google.com>
4517 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
4518 Add_symbols' constructor.
4519 * readsyms.h (Add_symbols): Remove the input_group member.
4521 2010-03-10 Ian Lance Taylor <iant@google.com>
4523 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
4524 target to ask whether a reference to a symbol requires a stack
4526 * target.h (Target::is_call_to_non_split): New function.
4527 (Target::do_is_call_to_non_split): Declare virtual function.
4528 * target.cc: Include "symtab.h".
4529 (Target::do_is_call_to_non_split): New function.
4530 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
4532 2010-03-10 Cary Coutant <ccoutant@google.com>
4534 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
4535 (File_read::open[1]): Remove initial mapping of whole_file_view_.
4536 (File_read::open[2]): Add whole_file_view_ to list of views.
4537 (File_read::make_view): Remove test of whole_file_view_.
4538 (File_read::find_or_make_view): Create whole_file_view_ if
4540 (File_read::clear_views): Replace bool parameter with enum;
4541 adjust all callers. Don't delete views with permanent data;
4542 do delete cached views and views from archives if
4543 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
4544 if clearing the corresponding view.
4545 * fileread.h (File_read::Clear_views_mode): New enum.
4546 (File_read::View::is_permanent_view): New method.
4547 (File_read::clear_views): Replace bool parameter
4548 with enum; adjust all callers.
4549 * options.h (General_options): Change keep_files_mapped option;
4550 add map_whole_files.
4551 * readsyms.cc (Add_symbols::run): Delete sd_ object before
4553 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
4556 2010-03-10 David S. Miller <davem@davemloft.net>
4558 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
4560 2010-03-09 Sriraman Tallam <tmsriram@google.com>
4562 * icf.cc (get_section_contents): Add '@' marker after processing the
4565 2010-03-08 Doug Kwan <dougkwan@google.com>
4567 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
4568 due to a conversion warning.
4569 (Arm_relobj::update_output_local_symbol_count): Check for local
4570 symbol with unset output index.
4572 2010-03-05 Ian Lance Taylor <iant@google.com>
4574 * options.h (class General_options): Add --spare-dynamic-tags.
4575 * output.cc (Output_data_dynamic::set_final_data_size): Implement
4576 --spare-dynamic-tags.
4578 2010-03-05 Ian Lance Taylor <iant@google.com>
4580 * incremental.cc: Include "libiberty.h".
4582 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
4584 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
4585 function, is_info_ member.
4586 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
4587 (Versions::Versions): Update caller.
4588 (Versions::define_base_version): Likewise.
4589 (Versions::add_def): Likewise.
4591 2010-03-03 Sriraman Tallam <tmsriram@google.com>
4593 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
4594 (Scan::possible_function_pointer_reloc): New function.
4595 (Scan::local_reloc_may_be_function_pointer): Change to call
4596 possible_function_pointer_reloc.
4597 (Scan::global_reloc_may_be_function_pointer): Ditto.
4598 * icf.h (Icf::check_section_for_function_pointers): Change to reject
4599 relocations in ".data.rel.ro._ZTV" section.
4600 * testsuite/icf_safe_so_test.sh: Change to pass i386.
4601 * testsuite/icf_safe_so_test.cc: Ditto.
4602 * testsuite/icf_safe_test.cc: Ditto.
4603 * testsuite/icf_safe_test.sh: Ditto.
4605 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4606 Ian Lance Taylor <iant@google.com>
4608 * target-reloc.h (relocate_section): Check the symbol table index
4609 for -1U before setting the local symbol index.
4610 (scan_relocatable_relocs): If copying the relocation, record that
4611 the local symbol is required.
4612 * object.h (Symbol_value::is_output_symtab_index_set): New
4614 (Symbol_value::may_be_discarded_from_output_symtab): New
4616 (Symbol_value::has_output_symtab_entry): New function.
4617 (Symbol_value::needs_output_symtab_entry): Remove.
4618 (Symbol_value::output_symtab_index): Make sure the symbol index is
4620 (Symbol_value::set_output_symtab_index): Make sure the symbol
4621 index is not set. Make sure the new index is valid.
4622 (Symbol_value::set_must_have_output_symtab_entry): New function.
4623 (Symbol_value::has_output_dynsym_entry): New function.
4624 (Symbol_value::set_output_dynsym_index): Make sure the new index
4626 (Sized_relobj::set_must_have_output_symtab_entry): New function.
4627 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
4628 local symbol if permitted.
4629 (Sized_relobj::do_finalize_local_symbols): Call
4630 is_output_symtab_index_set rather than needs_output_symtab_entry.
4631 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
4632 rather than needs_output_symtab_entry. Call
4633 has_output_dynsym_entry rather than needs_output_dynsym_entry.
4634 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
4635 is_output_symtab_index_set rather than needs_output_symtab_entry.
4636 * testsuite/discard_locals_relocatable_test.c: New file.
4637 * testsuite/discard_locals_test.sh: Test -r.
4638 * testsuite/Makefile.am (check_DATA): Add
4639 discard_locals_relocatable_test1.syms,
4640 discard_local_relocatable_test2.syms.
4641 (MOSTLYCLEANFILES): Likewise. Also add
4642 discard_locals_relocatable_test1.lout and
4643 discard_locals_relocatable_test2.out.
4644 (discard_locals_relocatable_test1.syms): New target.
4645 (discard_locals_relocatable_test.o): New target.
4646 (discard_locals_relocatable_test1.out): New target.
4647 (discard_locals_relocatable_test2.syms): New target.
4648 (discard_locals_relocatable_test2.out): New target.
4649 (various): Add missing ../ld-new dependencies.
4650 * testsuite/Makefile.in: Rebuild.
4652 2010-03-03 Nick Clifton <nickc@redhat.com>
4654 * po/fi.po: New Finnish translation.
4656 2010-03-01 Doug Kwan <dougkwan@google.com>
4658 * layout.cc (Layout::Layout): Force section types of .init_array*,
4659 .preinit_array* and .fini_array* sections.
4660 * output.cc (Output_section::Input_section_sort_entry::has_priority):
4661 Fix check of return value of std::string::find.().
4662 (Output_section::Input_section_sort_compare::operator()): Remove
4663 comment about .init_array.
4664 (Output_section::Input_section_sort_init_fini_compare::operator()):
4666 (Output_section::sort_attached_input_sections): Handle .init_array
4667 and .fini_array specially.
4668 * output.h (Output_section::Inut_section_sort_compare): Update
4670 (Output_section::Input_section_sort_init_fini_compare): New struct.
4672 2010-02-26 Doug Kwan <dougkwan@google.com>
4674 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
4675 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
4676 * testsuite/debug_msg.sh: Avoid matching source line number for
4677 use of global variable undef_int.
4679 2010-02-26 Doug Kwan <dougkwan@google.com>
4681 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
4682 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
4683 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
4684 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
4685 * options.cc (General_options::General_options): Initialize member
4687 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
4688 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
4689 and rm_no_fix_v4bx.stdout
4690 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
4691 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
4692 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
4693 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
4694 and arm_no_fix_v4bx.
4695 * Makefile.in: Regenerate.
4696 * testsuite/arm_fix_v4bx.s: New file.
4697 * testsuite/arm_fix_v4bx.sh: Ditto.
4699 2010-02-24 Doug Kwan <dougkwan@google.com>
4701 * arm.cc (Target_arm::got_section): Make the .got section the first
4702 non RELRO section in the data segment.
4703 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
4704 suffixes of section names.
4706 2010-02-24 Doug Kwan <dougkwan@google.com>
4708 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
4709 flags and attributes merging if an input file is a binary file.
4710 * fileread.cc (Input_file::open): Record format of original file.
4711 * fileread.h (Input_file::Format): New enum type.
4712 (Input_file::Input_file): Initialize data member format_.
4713 (Input_file::format): New method definition.
4714 (Input_file::format_):: New data member.
4716 2010-02-24 Doug Kwan <dougkwan@google.com>
4718 * arm.cc (Arm_output_data_got): New class.
4719 (ARM_TCB_SIZE): New constant
4720 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
4721 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
4722 If user uses a script with a SECTIONS clause, issue only a warning
4723 for a misplaced EXIDX input section. Otherwise, issue an error.
4724 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
4726 (Target_arm::got_mode_index_entry): Handle static linking.
4727 (Target_arm::Scan::local): Ditto.
4728 (Target_arm::Scan::global): Ditto.
4729 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
4730 all incorrectly implemented relocations.
4731 (Target_arm::fix_exidx_coverage): Pass layout to
4732 Arm_output_section::fix_exidx_coverage.
4733 * layout.cc (Layout::section_name_mapping): Remove trailing dots
4734 from ".ARM.exidx." and ".ARM.extab.".
4736 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4738 * arm.cc (Target_arm::do_finalize_sections): Create attribute
4739 section if it does not already exist.
4740 * attributes.cc (Attributes_section_data::Attributes_section_data):
4741 Don't crash if size is zero.
4743 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4744 Ian Lance Taylor <iant@google.com>
4746 * gold.cc (queue_middle_tasks): If no input files were opened,
4748 * workqueue.h (Task_function::Task_function): Assert that there is
4751 2010-02-22 Doug Kwan <dougkwan@google.com>
4753 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
4754 * icf.cc (get_section_contents): Cast snprintf arguments to long long
4755 types to avoid warnings due to different uint64_t implementations
4758 2010-02-21 Doug Kwan <dougkwan@google.com>
4760 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
4761 handling of the maximum backward branch offset.
4762 (Arm_relocate_functions::thumb_branch_common): Ditto.
4763 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
4764 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
4765 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
4766 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
4767 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
4768 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
4769 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
4770 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
4771 thumb_bl_out_of_range thumb_bl_out_of_range.o,
4772 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
4773 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
4774 thumb2_bl_out_of_range.o): New rules.
4775 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
4776 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
4777 thumb2_bl_out_of_range
4778 * testsuite/Makefile.in: Regenerate.
4779 * testsuite/arm_bl_in_range.s: New file.
4780 * testsuite/arm_bl_out_of_range.s: Ditto.
4781 * testsuite/arm_branch_in_range.sh: Ditto.
4782 * testsuite/arm_branch_range.t: Ditto.
4783 * testsuite/thumb2_branch_range.t: Ditto.
4784 * testsuite/thumb_bl_in_range.s: Ditto.
4785 * testsuite/thumb_bl_out_of_range.s: Ditto.
4786 * testsuite/thumb_branch_range.t: Ditto.
4788 2010-02-20 Sriraman Tallam <tmsriram@google.com>
4790 * gc.h (gc_process_relocs): Change vectors to point to the new list.
4791 Add reloc offset information.
4792 * icf.cc (get_section_contents): Change iterators to point to the new
4793 vectors. Add reloc offset information to the contents.
4794 * icf.h (Icf::Sections_reachable_info): New typedef.
4795 (Icf::Sections_reachable_list): New typedef.
4796 (Icf::Offset_info): New typedef.
4797 (Icf::Reloc_info): New struct typedef.
4798 (Icf::Reloc_info_list): New typedef.
4799 (Icf::symbol_reloc_list): Delete method.
4800 (Icf::addend_reloc_list): Delete method.
4801 (Icf::section_reloc_list): Delete method.
4802 (Icf::reloc_info_list): New method.
4803 (Icf::reloc_info_list_): New member.
4805 2010-02-19 Doug Kwan <dougkwan@google.com>
4807 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
4808 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
4809 * arm.cc (Arm_relocation_functions): New forward declaration.
4810 (Target_arm::Target_arm): Initialize new data members
4811 got_mod_index_offset_ and tls_base_symbol_defined_.
4812 (Target_arm::Relocate::relocate_tls): New method.
4813 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
4814 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
4816 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
4817 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
4818 (Target_arm::got_mod_index_offset_,
4819 Target_arm::tls_base_symbol_defined_): New data members.
4820 (Target_arm::Scan::local, Target::Scan::global,
4821 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
4824 2010-02-18 Doug Kwan <dougkwan@google.com>
4826 * arm.cc (Arm_relobj::find_linked_text_section): New method.
4827 (Arm_relobj::make_exidx_input_section): Pass section index of linked
4828 text section as a parameter becuase some broken tools may not set
4829 the link in section header.
4830 (Target_arm::has_got_section): New method.
4831 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
4832 without any mapping symbol as data only. Remove warning.
4833 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
4834 link in its section header, try to discover the link by inspecting the
4835 REL31 relocation at the beginning of the section.
4836 (Target_arm::Scan::check_non_pic): Report name of offending relocation
4838 (Target_arm::Scan::global): Treat any reference to the symbol
4839 _GLOBAL_OFFSET_TABLE_ as a GOT access.
4841 2010-02-12 Sriraman Tallam <tmsriram@google.com>
4843 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
4844 (Scan::global_reloc_may_be_function_pointer): New function.
4845 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
4846 (Scan::global_reloc_may_be_function_pointer): New function.
4847 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
4848 (Scan::global_reloc_may_be_function_pointer): New function.
4849 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
4850 (Scan::global_reloc_may_be_function_pointer): New function.
4851 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
4852 (Scan::global_reloc_may_be_function_pointer): New function.
4853 (Scan::possible_function_pointer_reloc): New function.
4854 (Target_x86_64::can_check_for_function_pointers): New function.
4855 * gc.h (gc_process_relocs): Scan relocation types to determine if
4856 function pointers were taken for targets that support it.
4857 * icf.cc (Icf::find_identical_sections): Include functions for
4858 folding in safe ICF whose pointer is not taken.
4859 * icf.h (Secn_fptr_taken_set): New typedef.
4860 (fptr_section_id_): New member.
4861 (section_has_function_pointers): New function.
4862 (set_section_has_function_pointers): New function.
4863 (check_section_for_function_pointers): New function.
4864 * options.h: Fix comment for safe ICF option.
4865 * target.h (can_check_for_function_pointers): New function.
4866 * testsuite/Makefile.am: Add icf_safe_so_test test case.
4867 Modify icf_safe_test for X86-64.
4868 * testsuite/Makefile.in: Regenerate.
4869 * testsuite/icf_safe_so_test.cc: New file.
4870 * testsuite/icf_safe_so_test.sh: New file.
4871 * testsuite/icf_safe_test.cc (kept_func_3): New function.
4872 (main): Change to take pointer to function kept_func_3.
4873 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
4874 folding is done correctly for X86-64.
4876 2010-02-12 David S. Miller <davem@davemloft.net>
4878 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
4879 is_symbolless parameter.
4880 (Output_reloc<SHT_REL>::is_symbolless): New.
4881 (Output_reloc<SHT_REL>::is_symbolless_): New.
4882 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
4883 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
4884 (Output_reloc<SHT_RELA>::is_symbolless): New.
4885 (Output_data_reloc::add_global): Handle is_symbolless.
4886 (Output_data_reloc::add_global_relative): Likewise.
4887 (Output_data_reloc::add_local): Likewise.
4888 (Output_data_reloc::add_local_relative): Likewise.
4889 (Output_data_reloc::add_symbolless_global_addend): New.
4890 (Output_data_reloc::add_symbolless_local_addend): New.
4891 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
4893 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
4894 instead of ->is_relative_
4895 (Output_reloc::write): Likewise.
4896 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
4897 (Output_reloc::write_rel): Simplify.
4899 * sparc.cc (Target_sparc::Scan::local): Use
4900 ->add_symbolless_local_addend as needed.
4901 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
4902 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
4903 based upon relocation offset.
4905 2010-02-11 Doug Kwan <dougkwan@google.com>
4907 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
4908 (Target_arm::Scan::global): Ditto. Also remove a comment before the
4909 beginning of function.
4910 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
4911 and MOVT_ABS relocations. Those are non issued in scanning. Fix
4912 parameter is_32bit in calls to should_apply_static_reloc.
4913 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
4914 (check_DATA): Add arm_abs_global.stdout.
4915 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
4916 arm_abs_global.stdout): New rules.
4917 (MOSTLLYCLEANFILES): Add arm_abs_global
4918 * Makefile.in: Regenerate.
4919 * testsuite/arm_abs_global.s: New file.
4920 * testsuite/arm_abs_global.sh: Ditto.
4921 * testsuite/arm_abs_lib.s: Ditto.
4923 2010-02-11 Ian Lance Taylor <iant@google.com>
4925 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
4927 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
4928 Allocate_commons_task first.
4929 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
4930 task, rather than symtab_lock_.
4931 (Gc_process_relocs::~Gc_process_relocs): New function.
4932 (Gc_process_relocs::is_runnable): Check this_blocker_.
4933 (Gc_process_relocs::locks): Use next_blocker_ rather than
4935 (Scan_relocs::~Scan_relocs): New function.
4936 (Scan_relocs::is_runnable): Check this_blocker_ rather than
4938 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
4940 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
4941 fields. Add this_blocker_ and next_blocker_ fields. Adjust
4942 constructor accordingly.
4943 (class Gc_process_relocs): Likewise.
4944 (class Scan_relocs): Likewise.
4945 * common.h (class Allocate_commons_task): Remove symtab_lock_
4946 field, and corresponding constructor parameter.
4947 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
4949 (Allocate_commons_task::locks): Likewise.
4951 2010-02-11 Ian Lance Taylor <iant@google.com>
4953 * gold-threads.h (class Once): Define.
4954 (class Initialize_lock): Rewrite as child of Once.
4955 * gold-threads.cc (class Once_initialize): Define.
4956 (once_pointer_control): New static variable.
4957 (once_pointer, once_arg): New static variables.
4958 (c_run_once): New static function.
4959 (Once::Once, Once::run_once, Once::internal_run): New functions.
4960 (class Initialize_lock_once): Remove.
4961 (initialize_lock_control): Remove.
4962 (initialize_lock_pointer): Remove.
4963 (initialize_lock_once): Remove.
4964 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
4965 (Initialize_lock::initialize): Rewrite.
4966 (Initialize_lock::do_run_once): New function.
4967 * archive.cc (Archive::interpret_header): Only clear name if it is
4969 * fileread.cc: Include "gold-threads.h"
4970 (file_counts_lock): New static variable.
4971 (file_counts_initialize_lock): Likewise.
4972 (File_read::release): Only increment counts when using --stats.
4973 Use a lock around the increment.
4974 * parameters.cc (class Set_parameters_target_once): Define.
4975 (set_parameters_target_once): New static variable.
4976 (Parameters::Parameters): Move here from parameters.h.
4977 (Parameters::set_target): Rewrite.
4978 (Parameters::set_target_once): New function.
4979 (Parameters::clear_target): Move here and rewrite.
4980 * parameters.h (class Parameters): Update declarations. Add
4981 set_parameters_target_once_ field.
4982 (Parameters::Parameters): Move to parameters.cc.
4983 (Parameters::clear_target): Likewise.
4984 * readsyms.cc (Read_symbols::do_group): Create a Start_group
4986 (Start_group::~Start_group): New function.
4987 (Start_group::is_runnable): New function.
4988 (Start_group::locks, Start_group::run): New functions.
4989 (Finish_group::run): Change saw_undefined to size_t.
4990 * readsyms.h (class Start_group): Define.
4991 (class Finish_group): Change saw_undefined_ field to size_t.
4992 (Finish_group::Finish_group): Remove saw_undefined and
4993 this_blocker parameters. Change all callers.
4994 (Finish_group::set_saw_undefined): New function.
4995 (Finish_group::set_blocker): New function.
4996 * symtab.h (class Symbol_table): Change saw_undefined to return
4997 size_t. Change saw_undefined_ field to size_t.
4998 * target-select.cc (Set_target_once::do_run_once): New function.
4999 (Target_selector::Target_selector): Initialize set_target_once_
5000 field. Don't initialize lock_ and initialize_lock_ fields.
5001 (Target_selector::instantiate_target): Rewrite.
5002 (Target_selector::set_target): New function.
5003 * target-select.h (class Set_target_once): Define.
5004 (class Target_selector): Update declarations. Make
5005 Set_target_once a friend. Remove lock_ and initialize_lock_
5006 fields. Add set_target_once_ field.
5008 2010-02-10 Ian Lance Taylor <iant@google.com>
5010 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
5012 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
5013 (queue_middle_tasks): Add all blockers before queueing any tasks.
5014 (queue_final_tasks): Likewise.
5015 * token.h (Task_token::add_blockers): New function.
5016 * object.h (Input_objects::number_of_relobjs): New function.
5018 2010-02-10 Ian Lance Taylor <iant@google.com>
5020 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
5021 shared, not if not position independent.
5022 * x86_64.cc (Relocate::relocate_tls): Likewise.
5023 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
5024 (tls_pie_pic_test): New target.
5025 * testsuite/Makefile.in: Rebuild.
5027 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
5028 (tls_test_main_pie.o, tls_test_pie.o): New targets.
5029 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
5030 * testsuite/Makefile.in: Rebuild.
5032 2010-02-09 David S. Miller <davem@davemloft.net>
5034 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
5035 R_SPARC_RELATIVE using ->add_local_relative().
5036 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
5038 * output.h (Output_data_dynamic::add_section_size): New method
5039 that takes two Output_data objects.
5040 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
5041 entry param. Handle it in initializers.
5042 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
5043 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
5044 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
5046 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
5047 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
5048 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
5049 for dynrel_includes_plt.
5050 * i386.cc (Target_i386::do_finalize_sections): Likewise.
5051 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5052 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
5054 (Target_sparc::do_finalize_sections): Update to pass true for
5055 dynrel_includes_plt.
5056 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
5057 output before .rela.plt
5058 (Target_powerpc::do_finalize_sections): Update to pass true for
5059 dynrel_includes_plt when 32-bit.
5061 2010-02-08 Doug Kwan <dougkwan@google.com>
5063 * arm.cc (Arm_relobj::simple_input_section_output_address): New
5065 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
5066 Arm_relobj::scan_section_for_cortex_a8_stubs,
5067 Arm_relobj::do_relocation_section): Instead of calling
5068 Output_section::output_address, use faster
5069 Arm_relobj::simple_input_section_output_address.
5071 2010-02-08 David S. Miller <davem@davemloft.net>
5073 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
5074 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
5075 relocation helper function.
5077 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
5078 just like R_SPARC_GOT{10,13,22}.
5079 (Target_sparc::Scan::local): Likewise.
5080 (Target_sparc::Relocate:relocate): Likewise.
5082 2010-02-06 Ian Lance Taylor <iant@google.com>
5084 * configure.ac: Rewrite targetobjs duplicate removal code to use
5085 only shell constructs.
5086 * configure: Rebuild.
5088 2010-02-05 Doug Kwan <dougkwan@google.com>
5091 * arm.cc (Arm_relobj::section_is_scannable): New method.
5092 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
5093 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
5095 2010-02-04 Doug Kwan <dougkwan@google.com>
5098 * arm-reloc-property.cc (cstdio): Include.
5099 * configure.ac (targetobjs): Remove duplicates.
5100 * configure: Regenerate.
5101 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
5102 big and little endian version for a given address size.
5104 2010-02-03 Doug Kwan <dougkwan@google.com>
5106 * arm-reloc-property.cc
5107 (Arm_reloc_property_table::reloc_name_in_error_message): New method
5109 * arm-reloc-property.h
5110 (Arm_reloc_property_table::get_implemented_static_reloc_property):
5111 New method definition.
5112 (Arm_reloc_property_table::reloc_name_in_error_message): New method
5114 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
5116 (GOT_PREL): Change implemented to Y.
5117 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
5118 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
5119 (Arm_relocate_functions::movw_abs_nc): Remove method.
5120 (Arm_relocate_functions::movt_abs): Ditto.
5121 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
5122 (Arm_relocate_functions::thm_movt_abs): Ditto.
5123 (Arm_relocate_functions::movw_rel_nc): Ditto.
5124 (Arm_relocate_functions::movw_rel): Ditto.
5125 (Arm_relocate_functions::movt_rel): Ditto.
5126 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
5127 (Arm_relocate_functions:thm_movw_rel): Ditto.
5128 (Arm_relocate_functions:thm_movt_rel): Ditto.
5129 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
5130 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
5131 New method definitions.
5132 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
5133 (Arm_relocation_functions::arm_grp_ldr): Ditto.
5134 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
5135 (Arm_relocation_functions::arm_grp_ldc): Ditto.
5136 (Target_arm::Relocate::relocate): Check for non-static or
5137 unimplemented relocation code and exit early. Change calls to
5138 Target_arm::reloc_uses_thumb_bit and
5139 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
5140 instead. Refactor code to handle similar relocations to increase
5141 code sharing. Remove check for unsupported relocation code in switch
5143 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
5144 relocation property table to find out size. Change error message to
5145 print out the name of a relocation code instead of the numeric value.
5146 (Target_arm::scan_reloc_for_stub): Use relocation property table
5147 instead of calling Target_arm::reloc_uses_thumb_bit().
5149 2010-02-02 Doug Kwan <dougkwan@google.com>
5151 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
5152 types of relaxed input section.
5154 2010-02-02 Doug Kwan <dougkwan@google.com>
5156 * Makefile.am (HFILES): Add arm-reloc-property.h.
5158 (TARGETSOURCES): Add arm-reloc-property.cc
5159 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
5160 (libgold_a_SOURCES): $(DEFFILES)
5161 * Makefile.in: Regenerate.
5162 * arm-reloc-property.cc: New file.
5163 * arm-reloc-property.h: New file.
5164 * arm-reloc.def: New file.
5165 * arm.cc: Update comments.
5166 (arm-reloc-property.h): New included header.
5167 (arm_reloc_property_table): New global variable.
5168 (Target_arm::do_select_as_default_target): New method definition.
5169 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
5170 arm-reloc-property to targ_extra_obj.
5171 * parameters.cc (set_parameters_target): Call
5172 Target::select_as_default_target().
5173 * target.h (Target::select_as_default_target): New method definition.
5174 (Target::do_select_as_default_target): Same.
5176 2010-02-01 Doug Kwan <dougkwan@google.com>
5178 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
5179 first_output_text_section_.
5180 (Arm_exidx_fixup::first_output_text_section): New method definition.
5181 (Arm_exidx_fixup::first_output_text_section_): New data member.
5182 (Arm_exidx_fixup::process_exidx_section): Record the first text
5183 output section seen.
5184 (Arm_output_section::fix_exidx_coverage): Set correct linked section
5185 and entsize in output section header.
5187 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5189 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
5190 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
5191 (Arm_relocate_functions::thm_alu11): New Method.
5192 (Arm_relocate_functions::thm_pc8): New Method.
5193 (Arm_relocate_functions::thm_pc12): New Method.
5194 (Target_arm::Scan::local): Handle the relocations.
5195 (Target_arm::Scan::global): Likewise.
5196 (Target_arm::Relocate::relocate): Likewise.
5197 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
5199 2010-01-29 Doug Kwan <dougkwan@google.com>
5201 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
5202 of relocation types as ld.
5204 2010-01-29 Doug Kwan <dougkwan@google.com>
5206 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
5208 (Arm_relocate_functions::thumb_branch_common): Ditto.
5209 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
5210 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
5211 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
5212 Arm_relocate_functions::jump24): Remove.
5213 (Target_arm::Relocate::relocate): Adjust code to call
5214 Arm_relocation_functions::arm_branch_common and
5215 Arm_relocation_functions::thumb_branch_common instead of their removed
5216 wrappers. Merge switch-cases together to reduce source code size.
5218 2010-01-29 Doug Kwan <dougkwan@google.com>
5220 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
5221 output_local_symbol_count_needs_update_.
5222 (Arm_relobj::output_local_symbol_count_needs_update,
5223 Arm_relobj::set_output_local_symbol_count_needs_update,
5224 Arm_relobj::update_output_local_symbol_count): New methods.
5225 (Arm_relobj::output_local_symbol_count_needs_update_): New data
5227 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
5228 of pointed function as in a R_ARM_PREL31 relocation.
5229 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
5230 for output local symbol count updating.
5231 (Target_arm::do_relax): Update output local symbol counts in objects
5233 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
5235 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5237 * arm.cc: Added support for the ARM relocations:
5238 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
5239 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
5240 (Arm_relocate_functions::movw_rel_nc): Renamed (was
5242 (Arm_relocate_functions::movw_rel): New method.
5243 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
5244 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
5246 (Arm_relocate_functions::thm_movw_rel): New method.
5247 (Arm_relocate_functions::thm_movt_rel): Renamed (was
5249 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
5251 (Target_arm::Scan::global): Likewise.
5252 (Target_arm::Relocate::relocate): Likewise.
5253 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5256 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5258 * arm.cc: Added support for ARM group relocations.
5259 (Target_arm::reloc_needs_sym_origin): New method.
5260 (Arm_relocate_functions::calc_grp_kn): New method.
5261 (Arm_relocate_functions::calc_grp_residual): New method.
5262 (Arm_relocate_functions::calc_grp_gn): New method.
5263 (Arm_relocate_functions::arm_grp_alu): New Method.
5264 (Arm_relocate_functions::arm_grp_ldr): New Method.
5265 (Arm_relocate_functions::arm_grp_ldrs): New Method.
5266 (Arm_relocate_functions::arm_grp_ldc): New Method.
5267 (Target_arm::Scan::local): Handle the ARM group relocations.
5268 (Target_arm::Scan::global): Likewise.
5269 (Target_arm::Relocate::relocate): Likewise.
5270 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5273 2010-01-26 Doug Kwan <dougkwan@google.com>
5275 * arm.cc (set): Include.
5276 (class Arm_exidx_fixup): Change type of last_input_section_ to const
5278 (Arm_output_section::Text_section_list): New type.
5279 (Arm_output_section::append_text_sections_to_list): New method.
5280 (Arm_output_section::fix_exidx_coverage): Ditto.
5281 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
5282 (Arm_relobj::convert_input_section_to_relaxed_section): Use
5283 Relobj::set_section_offset() instead of
5284 Sized_relobj::invalidate_section_offset().
5285 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
5286 parameter for section headers. Ignore relocation sections for
5287 unallocated sections and EXIDX sections.
5288 (Target_arm::fix_exidx_coverage): New method.
5289 (Target_arm::output_section_address_less_than): New type.
5290 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
5291 linked text section instead of the EXIDX section.
5292 (Arm_output_section::create_stub_group): Add an assertion to check
5293 that this is not an EXIDX output section.
5294 (Arm_output_section::append_text_sections_to_list): New method.
5295 (Arm_output_section::fix_exidx_coverage): Ditto.
5296 (Arm_relobj::scan_sections_for_stubs): Adjust call to
5297 Arm_relobj::section_needs_reloc_stub_scanning.
5298 (Target_arm::do_relax): Fix EXIDX output section coverage in the
5300 (Target_arm::fix_exidx_coverage): New method.
5301 * object.h (Relobj::set_output_section): New method.
5302 (Sized_relobj::invalidate_section_offset): Remove method.
5303 (Sized_relobj::do_invalidate_section_offset): Remove method.
5304 (Sized_relobj::do_set_section_offset): Handle offset value -1.
5306 2010-01-25 Doug Kwan <dougkwan@google.com>
5308 * arm.cc (Arm_exidx_merged_section::do_output_offset):
5309 Fix warning due to signed and unsigned comparison on a 32-bit host.
5311 2010-01-22 Doug Kwan <dougkwan@google.com>
5313 * arm.cc (Target_arm::do_relax): Record an output section for section
5314 offset adjustment it contains any stub table that has changed.
5315 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
5316 offsets in an output section if necessary.
5317 * output.cc (Output_section::Output_section): Initialize
5318 section_offsets_need_adjustments_.
5319 (Output_section::add_input_section_for_script): Renamed to
5320 Output_section::add_simple_input_section.
5321 (Output_section::save_states): Add a comment.
5322 (Output_section::discard_states): New method defintion.
5323 (Output_section::adjust_section_offsets): Same.
5324 * output.h (Output_section::add_input_section_for_script): Renamed to
5325 Output_section::add_simple_input_section.
5326 (Output_section::discard_states): New method declaration.
5327 (Output_section::adjust_section_offsets): Same.
5328 (Output_section::section_offsets_need_adjustment,
5329 Output_section::set_section_offsets_need_adjustment): New method
5331 (Output_section::section_offsets_need_adjustment_): New data member.
5332 * script-sections.cc
5333 (Output_section_element_input::set_section_address): Adjust code for
5334 renaming of Output_section::add_input_section_for_script.
5335 (Orphan_output_section::set_section_address): Same.
5337 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5339 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
5340 Fix_v4bx enum values .
5341 * gold/options.h (General_options): New option definitions.
5342 (General_options::fix_v4bx): New method.
5343 (General_options::Fix_v4bx): New enum.
5344 * gold/options.cc (General_options::parse_fix_v4bx): New method.
5345 (General_options::parse_fix_v4bx_interworking): New method.
5347 2010-01-22 Doug Kwan <dougkwan@google.com>
5349 * arm.cc (Arm_exidx_fixup): New class.
5351 2010-01-21 Doug Kwan <dougkwan@google.com>
5353 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
5355 (Arm_exidx_section_offset_map): New type.
5357 2010-01-21 Doug Kwan <dougkwan@google.com>
5359 * arm.cc (Arm_exidx_input_section): New class.
5360 (Arm_relobj::exidx_input_section_by_link,
5361 Arm_relobj::exidx_input_section_by_shndx,
5362 Arm_relobj::make_exidx_input_section): New methods.
5363 (read_arm_attributes_section): Remove.
5364 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
5365 information about them.
5366 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
5369 2010-01-20 Doug Kwan <dougkwan@google.com>
5371 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
5372 Input_section_specifier to Section_id.
5373 (Target_arm::new_arm_input_section: Adjust code for change of key
5375 (Target_arm::find_arm_input_section): Ditto.
5376 * gc.h (object.h): Include for Section_id nand Section_id_hash.
5377 (Section_id): Remove.
5378 (Garbage_collection::Section_id_hash): Remove.
5379 * icf.h (object.h): Include for Section_id nand Section_id_hash.
5380 (Section_id): Remove.
5381 (Icf::Section_id_hash): Remove.
5382 * object.h (Section_id, Const_section_id, Section_id_hash,
5383 Const_section_id_hash): New type definitions.
5384 * output.cc (Output_section::add_relaxed_input_section): Change to
5385 use Const_section_id instead of Input_section_specifier as key type.
5386 (Output_section::add_merge_input_section): Ditto.
5387 (Output_section::build_relaxation_map): Change to use Section_id
5388 instead of Input_section_specifier as key type.
5389 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5391 (Output_section::convert_input_sections_to_relaxed_sections): Change
5392 to use Const_section_id instead of Input_section_specifier as key type.
5393 (Output_section::find_merge_section): Ditto.
5394 (Output_section::find_relaxed_input_section): Ditto.
5395 * output.h (Input_section_specifier): Remove class.
5396 (Output_section::Output_section_data_by_input_section_map): Change
5397 key type to Const_section_id.
5398 (Output_section::Output_relaxed_input_section_by_input_section_map):
5400 (Output_section::Relaxation_map): Change key type to Section_id.
5402 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5404 * gold/arm.cc: Added support for R_ARM_V4BX relocation
5405 (class Arm_v4bx_stub): New class.
5406 (DEF_STUBS): Updated definition to support v4_veneer_bx.
5407 (Stub_factory::make_arm_v4bx_stub): New method.
5408 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
5409 (Stub_table::empty): Handle v4bx stubs.
5410 (Stub_table::add_arm_v4bx_stub): New method.
5411 (Stub_table::find_arm_v4bx_stub): New method.
5412 (Arm_relocate_functions::v4bx): New method.
5413 (Target_arm::fix_v4bx): New method.
5414 (Target_arm::Target_arm): Handle R_ARM_V4BX.
5415 (Stub_table::relocate_stubs): Likewise.
5416 (Stub_table::do_write): Likewise.
5417 (Stub_table::update_data_size_and_addralign): Likewise.
5418 (Stub_table::finalize_stubs): Likewise.
5419 (Target_arm::Scan::local): Likewise.
5420 (Target_arm::Scan::global): Likewise.
5421 (Target_arm::do_finalize_sections): Likewise.
5422 (Target_arm::Relocate::relocate): Likewise.
5423 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5425 (Target_arm::scan_reloc_for_stub): Likewise.
5426 (Target_arm::scan_reloc_section_for_stubs): Likewise.
5428 2010-01-19 Ian Lance Taylor <iant@google.com>
5430 * output.cc (Output_section_headers::do_sized_write): Write large
5431 segment count to sh_info field.
5432 (Output_file_header::do_sized_write): For large segment count,
5433 write PN_XNUM to e_phnum field.
5435 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5437 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
5438 (Arm_relocate_functions::thm_jump8): New function.
5439 (Arm_relocate_functions::thm_jump11): New function.
5440 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
5442 (Target_arm::Scan::global): Likewise.
5443 (Target_arm::Relocate::relocate): Likewise.
5444 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5447 2010-01-14 Doug Kwan <dougkwan@google.com>
5449 * arm.cc (map, utility): Include headers.
5450 (Target_arm::apply_cortex_a8_workaround): New method.
5451 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
5452 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
5453 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
5454 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
5455 the --[no-]fix-cortex-a8 command line options.
5456 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
5457 (Target_arm::relocate_stub): Use addend in instruction template.
5458 * options.h (DEFINE_bool): Set the user-set flag.
5459 (General_options): Add --[no-]-fix-cortex options.
5460 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
5461 : Update fast look-up map after conversion.
5463 2010-01-14 Sriraman Tallam <tmsriram@google.com>
5465 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
5466 in the first pass of do_layout.
5468 2010-01-13 Doug Kwan <dougkwan@google.com>
5470 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
5471 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
5472 apparent compiler problem of not folding static constant integral
5473 data members of elfcpp::Elf_sizes<32>.
5475 2010-01-13 Doug Kwan <dougkwan@google.com>
5477 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
5478 Arm_relobj::section_needs_cortex_a8_stub_scanning,
5479 Arm_relobj::scan_section_for_cortex_a8_erratum,
5480 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
5481 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
5482 sections to scan for relocation stubs into a new method
5483 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
5484 relocation and Cortex-A8 stub scanning.
5485 (Target_arm::do_relax): Force stubs to be after stubbed sections
5486 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
5487 the beginning of a new relaxation pass. Update a comment.
5488 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
5490 2010-01-12 Ian Lance Taylor <iant@google.com>
5492 * target-reloc.h (visibility_error): New inline function.
5493 (relocate_section): Call visibility_error.
5494 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
5495 (MOSTLYCLEANFILES): Likewise.
5496 (protected_4_pic.o, protected_3.err): New targets.
5497 * testsuite/protected_4.cc: New file.
5499 2010-01-12 Doug Kwan <dougkwan@google.com>
5501 * arm.cc (Cortex_a8_reloc): New class.
5502 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
5503 and cortex_a8_relocs_info_.
5504 (Target_arm::fix_cortex_a8): New method definition.
5505 (Target_arm::Cortex_a8_relocs_info): New type.
5506 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
5507 New data member declarations.
5508 (Target_arm::scan_reloc_for_stub): Record information about
5509 relocations for THUMB branches that might be exempted from the
5510 Cortex-A8 workaround.
5511 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
5512 at the beginning of a relaxation pass.
5514 2010-01-12 Doug Kwan <dougkwan@google.com>
5516 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
5517 (Arm_relobj::Mapping_symbol_position,
5518 Arm_reloj::Mapping_symbol_position_less,
5519 Arm_relobj::Mapping_symbols_info): New types.
5520 (Target_arm::is_mapping_symbol_name): New method definition.
5521 (Arm_relobj::do_count_local_symbols): Save information about mapping
5524 2010-01-11 Doug Kwan <dougkwan@google.com>
5526 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
5527 Arm_relocate_functions::thumb32_branch_upper,
5528 Arm_relocate_functions::thumb32_branch_lower,
5529 Arm_relocate_functions::thumb32_cond_branch_offset,
5530 Arm_relocate_functions::thumb32_cond_branch_upper,
5531 Arm_relocate_functions::thumb32_cond_branch_lower,
5532 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
5533 branch offset encoding.
5534 (Arm_relocate_functions::thumb_branch_common): Use new branch
5535 offset encoding methods to avoid code duplication.
5536 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
5537 (Stub_addend_reader::operator()): Use new branch encoding method
5538 to avoid code duplication.
5540 2010-01-11 Doug Kwan <dougkwan@google.com>
5542 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
5543 (Target_arm::do_finalize_sections): Define special EXIDX section
5544 symbols only if referenced.
5545 * gc.h (Garbage_collection::add_reference): New method.
5546 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
5549 2010-01-11 Ian Lance Taylor <iant@google.com>
5551 * script.cc (Version_script_info::build_expression_list_lookup):
5552 Change complaing about duplicate wildcard match from error to
5555 * script.cc (class Lazy_demangler): Recreate--revert part of patch
5557 (Version_script_info::Version_script_info): Initialize globs_,
5558 default_version_, default_is_global_, and exact_. Don't
5559 initialize globals_ or locals_.
5560 (Version_script_info::build_lookup_tables): Build local symbols
5562 (Version_script_info::unquote): New function.
5563 (Version_script_info::add_exact_match): New function.
5564 (Version_script_info::build_expression_list_lookup): Remove lookup
5565 parameter. Add is_global parameter. Change all callers. Handle
5566 wildcard pattern specially. Unquote pattern. Call
5568 (Version_script_info::get_name_to_match): New function.
5569 (Version_script_info::get_symbol_version): New function.
5570 (Version_script_info::get_symbol_version_helper): Remove.
5571 (Version_script_info::check_unmatched_names): Call unquote.
5572 * script.h (class Version_script_info): Change get_symbol_version
5573 to be non-inline and add is_global parameter; change all callers.
5574 Rewrite symbol_is_local. Update declarations. Define struct
5575 Version_tree_match, Exact, Globs. Don't define struct Lookup.
5576 Remove globals_ and locals_ members. Add exact_, globs_,
5577 default_version_, is_global_.
5578 (Version_script_info::Glob): Remove pattern, add expression and
5579 is_global. Update constructor. Change all callers.
5580 * dynobj.cc (Versions::finalize): Mark the version symbol as the
5582 (Versions::symbol_section_contents): If a symbol is undefined, or
5583 defined in a dynamic object, set the version index to
5585 * symtab.cc (Symbol_table::add_from_relobj): Don't call
5587 (Symbol_table::add_from_pluginobj): Likewise.
5588 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
5590 2010-01-11 Doug Kwan <dougkwan@google.com>
5592 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
5593 (incremental_dump_LDADD): Add linking option for libintl.
5594 * Makefile.in: Regenerate.
5596 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
5599 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
5601 * testsuite/Makefile.in: Regenerated.
5603 2010-01-10 Doug Kwan <dougkwan@google.com>
5605 * options.h (DEFINE_var): Use parentheses around argument varname__
5606 in macro body to avoid any unintended subsequent substitutions.
5608 2010-01-10 Ian Lance Taylor <iant@google.com>
5610 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
5611 candidates before doing symbol resolution.
5613 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
5614 ODR candidates if only one is weak.
5616 2010-01-08 Ian Lance Taylor <iant@google.com>
5618 * script.cc (Version_script_info::build_expression_list_lookup):
5619 Don't warn about ambiguous version, just record the ambiguity.
5620 (Version_script_info::get_symbol_version_helper): Give error if
5621 version is ambiguous.
5623 2010-01-08 Doug Kwan <dougkwan@google.com>
5625 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
5626 prev_data_size_ and prev_addralign_. Remove initializer for
5627 deleted data member has_been_changed_.
5628 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
5629 to determine if the table is empty.
5630 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
5632 (Stub_table::add_reloc_stub): Define method in class definition
5633 instead of just declaring it there.
5634 (Stub_table::add_cortex_a8_stub): New method definition.
5635 (Stub_table::update_data_size_and_addralign): Ditto.
5636 (Stub_table::finalize_stubs): Ditto.
5637 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
5638 (Stub_table::do_addralign_): Return address alignment in the
5639 (Stub_table::do_reset_address_and_file_offset): Define method in
5640 class definition instead of declaring it there. Set current data
5641 size to be the data size of the previous pass.
5642 (Stub_table::set_final_data_size): Use current data size as the
5644 (Stub_table::relocate_stub): Change parameter type of stub from
5645 Reloc_stub pointer to Stub pointer.
5646 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
5647 (Stub_table::Cortex_a8_stub_list): New typedef.
5648 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
5649 Stub_table::prev_addralign_): New data member.
5650 (Arm_relobj::Arm_relobj): Initialize data member
5651 section_has_cortex_a8_workaround_.
5652 (Arm_relobj::section_has_cortex_a8_workaround,
5653 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
5655 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
5657 (Target_arm::relocate_stub): Change parameter type of stub from
5658 Reloc_stub pointer to Stub pointer.
5659 (Insn_template::size, Insn_template::alignment): Handle
5660 THUMB16_SPECIAL_TYPE.
5661 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
5662 Stub_table::update_data_size_and_addralign,
5663 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
5665 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
5666 (Stub_table::do_write): Ditto.
5667 (Target_arm::do_relax): Adjust code for changes in Stub_table.
5669 2010-01-08 Ian Lance Taylor <iant@google.com>
5672 * symtab.h (class Symbol): Remove fields is_target_special_ and
5673 has_plt_offset_. Add field is_defined_in_discarded_section_.
5674 (Symbol::is_defined_in_discarded_section): New function.
5675 (Symbol::set_is_defined_in_discarded_section): New function.
5676 (Symbol::has_plt_offset): Rewrite.
5677 (Symbol::set_plt_offset): Verify that new offset is not -1U.
5678 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
5679 Don't initialize is_target_special_ or has_plt_offset_.
5680 Initialize is_defined_in_discarded_section_.
5681 (Symbol_table::add_from_relobj): If appropriate, set
5682 is_defined_in_discarded_section.
5683 * resolve.cc (Symbol::override_base_with_special): Don't test
5684 is_target_special_. Change has_plt_offset_ to has_plt_offset().
5685 * target-reloc.h (relocate_section): Do special handling for
5686 symbols defined in discarded sections for global symbols as well
5689 2010-01-08 Ian Lance Taylor <iant@google.com>
5691 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
5692 the SHT_SYMTAB case.
5694 2010-01-08 Ian Lance Taylor <iant@google.com>
5696 * object.cc (Sized_relobj::do_layout): Don't get confused if
5697 layout_eh_frame returns NULL.
5699 2010-01-08 Ian Lance Taylor <iant@google.com>
5702 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
5703 dynamic symbol table, use the normal symbol table.
5704 (Sized_dynobj::do_read_symbols): Remove assertion about type of
5707 2010-01-08 Ian Lance Taylor <iant@google.com>
5710 * layout.cc (Layout::include_section): Remove .gnu_debuglink
5713 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
5715 * version.cc (print_version): Change to "Copyright 2010".
5717 2010-01-08 Ian Lance Taylor <iant@google.com>
5721 * i386.cc (class Target_i386): Change return type of plt_section
5723 (class Output_data_plt_i386): Add tls_desc_rel_ field.
5724 (Output_data_plt_i386::Output_data_plt_i386): Initialize
5725 tls_desc_rel_ field.
5726 (Output_data_plt_i386::rel_tls_desc): New function.
5727 (Target_i386::rel_tls_desc_section): New function.
5728 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
5729 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
5730 R_386_TLS_DESC reloc in rel_tls_desc_section.
5731 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
5732 Define struct Tlsdesc_info.
5733 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
5734 (Target_x86_64::do_reloc_symbol_index): New function.
5735 (Target_x86_64::add_tlsdesc_info): New function.
5736 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
5737 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
5739 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
5741 (Output_data_plt_x86_64::rela_tlsdesc): New function.
5742 (Target_x86_64::rela_tlsdesc_section): New function.
5743 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
5745 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
5746 (Target_x86_64::do_reloc_addend): New function.
5747 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
5748 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
5749 declarations. Define TARGET_CODE. Add arg field to u1_ union.
5750 (Output_reloc::type): New function.
5751 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
5752 (Output_reloc::is_target_specific): New function.
5753 (Output_reloc::target_arg): New function.
5754 (class Output_reloc) [SHT_RELA]: Add four new constructors for
5755 absolute relocs and target specific relocs.
5756 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
5757 add_target_specific.
5758 (class Output_data_reloc) [SHT_RELA]: Likewise.
5759 * output.cc (Output_reloc::Output_reloc): Add four new versions
5760 for absolute relocs and target specific relocs.
5761 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
5762 (Output_reloc::get_symbol_index): Likewise.
5763 (Output_reloc::local_section_offset): Check that local_sym_index_
5764 is not TARGET_CODE or 0.
5765 (Output_reloc::symbol_value): Likewise.
5766 (Output_reloc::write) [SHT_RELA]: Call target for target specific
5768 * target.h (class Target): Add reloc_symbol_index and reloc_addend
5769 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
5771 * layout.cc (add_target_dynamic_tags): Use output section for
5772 DT_PLTRELSZ and DT_JMPREL.
5774 2010-01-07 Ian Lance Taylor <iant@google.com>
5777 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
5779 (class Output_data_reloc_generic): Define.
5780 (class Output_data_reloc_base): Change base class to
5781 Output_data_reloc_generic. Change add() method to call
5782 bump_relative_reloc_count for a relative reloc. Remove
5784 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
5786 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
5787 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
5789 * layout.h (class Layout): Update declaration.
5791 2010-01-07 Ian Lance Taylor <iant@google.com>
5793 * output.h (class Output_data): Add const version of
5794 output_section and do_output_section.
5795 (class Output_section_data): Add const version of
5797 (class Output_section): Likewise.
5798 * layout.cc (Layout::add_target_dynamic_tags): New function.
5799 * layout.h (class Layout): Update declarations.
5800 * arm.cc (Target_arm::do_finalize_sections): Use
5801 add_target_dynamic_tags.
5802 * i386.cc (Target_i386::do_finalize_sections): Likewise.
5803 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
5804 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
5805 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5807 2010-01-07 Ian Lance Taylor <iant@google.com>
5810 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
5813 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
5814 Ian Lance Taylor <iant@google.com>
5817 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
5818 Xindex::read_symtab_xindex.
5820 2010-01-07 Doug Kwan <dougkwan@google.com>
5822 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
5823 (Insn_template::thumb16_bcond_insn): New method declaration.
5824 (Insn_template): Fix spelling.
5825 (Stub::thumb16_special): New method declaration.
5826 (Stub::do_write): Define virtual method which was previously pure
5828 (Stub::do_thumb16_special): New method declaration.
5829 (Stub::do_fixed_endian_write): New template member.
5830 (Reloc_stub::do_write): Remove.
5831 (Reloc_stub::do_fixed_endian_write): Remove.
5832 (Cortex_a8_stub): New class definition.
5833 (Stub_factory::make_cortex_a8_stub): New method definition.
5834 (Stub_factory::Stub_factory): Add missing static storage class
5835 qualifier for elf32_arm_stub_a8_veneer_blx.
5837 2010-01-07 Ian Lance Taylor <iant@google.com>
5840 * options.h (class General_options): Add --warn-unresolved-symbols
5841 and --error-unresolved-symbols.
5842 * errors.cc (Errors::undefined_symbol): Implement
5843 --warn-unresolved-symbols.
5845 * options.h (class General_options): Add -z text and -z textoff.
5846 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
5848 2010-01-06 Sriraman Tallam <tmsriram@google.com>
5850 * gc.h (Garbage_collection::Cident_section_map): New typedef.
5851 (Garbage_collection::cident_sections): New function.
5852 (Garbage_collection::add_cident_section): New function.
5853 (Garbage_collection::cident_sections_): New member.
5854 (gc_process_relocs): Add references to sections whose names are C
5856 * gold.h (cident_section_start_prefix): New constant.
5857 (cident_section_stop_prefix): New constant.
5858 (is_cident): New function.
5859 * layout.cc (Layout::define_section_symbols): Replace string constants
5860 with the newly defined constants.
5861 * object.cc (Sized_relobj::do_layout): Track sections whose names are
5863 * testsuite/Makefile.am: Add gc_orphan_section_test.
5864 * testsuite/Makefile.in: Regenerate.
5865 * testsuite/gc_orphan_section_test.cc: New file.
5866 * testsuite/gc_orphan_section_test.sh: New file.
5868 2010-01-06 Ian Lance Taylor <iant@google.com>
5871 * options.h (class General_options): Add --warn-shared-textrel.
5872 * layout.cc (Layout::finish_dynamic_section): Implement
5873 --warn-shared-textrel.
5876 * options.h (class General_options): Add --warn-multiple-gp.
5878 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5880 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
5881 $(THREADSLIB) and $(LIBDL).
5882 * Makefile.in: Rebuild.
5884 2010-01-06 Ian Lance Taylor <iant@google.com>
5887 * options.cc (General_options::parse_section_start): New function.
5888 (General_options::section_start): New function.
5889 (General_options::General_options): Initialize all members.
5890 * options.h: Include <map>
5891 (class General_options): Add --section-start. Add section_starts_
5893 * layout.cc (Layout::attach_allocated_section_to_segment): If
5894 --section-start was used, set the address of the segment. Remove
5895 local sort_sections.
5896 (Layout::relaxation_loop_body): If the address of the load segment
5897 has been set by --section-start, don't use it.
5898 * output.h (Output_segment::update_flags_for_output_section): New
5900 * output.cc (Output_segment::add_output_section): Call
5901 update_flags_for_output_section.
5903 2010-01-05 Ian Lance Taylor <iant@google.com>
5906 * options.h (class General_options): Add --undefined-version.
5907 * script.cc (struct Version_expression): Add was_matched_by_symbol
5909 (Version_script_info::matched_symbol): New function.
5910 (Version_script_info::get_symbol_version_helper): Call
5912 (Version_script_info::check_unmatched_names): New function.
5913 * script.h (class Version_script_info): Update declarations.
5914 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
5916 * options.h (class General_options): Use DEFINE_bool_alias for
5917 allow_multiple_definition.
5918 * resolve.cc (Symbol_table::should_override): Don't test
5919 allow_multiple_definition.
5922 * options.h (class General_options): Add --cref.
5923 * main.cc (main): Print cref table if --cref. Don't close mapfile
5924 until after printing cref table.
5925 * cref.cc: Include "symtab.h".
5926 (class Cref_inputs): Define Cref_table_compare and Cref_table.
5927 (Cref_table_compare::operator()): New function.
5928 (Cref_inputs::gather_cref): New function.
5929 (filecol): New static const.
5930 (Cref_inputs::print_cref): New function.
5931 (Cref::print_cref): New function.
5932 * cref.h: Include <cstdio>.
5933 (class Cref): Update declarations.
5934 * mapfile.h (Mapfile::file): New function.
5935 * object.h (class Object): Define Symbols. Declare virtual
5936 do_get_global_symbols.
5937 (Object::get_global_symbols): New function.
5938 * object.cc (Input_objects::add_object): Pass object to cref_ if
5940 (Input_objects::archive_start): Likewise.
5941 (Input_objects::archive_stop): Likewise.
5942 (Input_objects::print_cref): New function.
5943 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
5944 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
5946 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
5948 * plugin.h (class Sized_pluginobj): Update declarations.
5950 2010-01-05 Ian Lance Taylor <iant@google.com>
5952 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
5953 to is_default_version. Rename insdef to insdefault.
5954 (Symbol_table::add_from_relobj): Rename def to is_default_version
5955 and local to is_forced_local.
5956 (Symbol_table::add_from_pluginobj): Likewise.
5957 (Symbol_table::add_from_dynobj): Likewise.
5958 (Symbol_table::define_special_symbol): Rename insdef to
5961 2010-01-04 Ian Lance Taylor <iant@google.com>
5964 * options.h (class General_options): Add
5965 --allow-multiple-definition and -z muldefs.
5966 * resolve.cc (Symbol_table::should_override): Don't warn about a
5967 multiple symbol definition if --allow-multiple-definition or -z
5971 * options.h (class General_options): Add --add-needed and
5972 --copy-dt-needed-entries. Tweak --as-needed help entry.
5973 * object.cc (Input_objects::check_dynamic_dependencies): Give an
5974 error if --copy-dt-needed-entries aka --add-needed is used and
5975 would cause a change in behaviour.
5978 * options.h (class General_options): Add -G as a short version of
5979 --shared. Add no-op options -assert, -g, and -i.
5981 2010-01-04 Sriraman Tallam <tmsriram@google.com>
5983 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
5984 check for .text or .gnu.linkonce.t sections.
5985 * icf.cc (Icf::find_identical_sections): Ditto.
5986 Change the detection for mangled function name within the section
5988 * icf.h (is_section_foldable_candidate): New function.
5990 2009-12-30 Ian Lance Taylor <iant@google.com>
5993 * options.h (class General_options): Permit two dashes with
5994 --retain-symbols-file.
5996 2009-12-30 Ian Lance Taylor <iant@google.com>
5999 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
6000 don't put the file header and segment headers in the text
6004 * common.cc (Sort_commons::operator()): Stabilize sort when both
6006 (Symbol_table::do_allocate_commons_list): When allocating common
6007 symbols, skip a symbol which is no longer common.
6008 * symtab.h (Symbol::is_common): Test whether the symbol comes from
6009 an object before checking its type.
6010 * testsuite/common_test_2.c: New file.
6011 * testsuite/common_test_3.c: New file.
6012 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
6013 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
6014 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
6015 (common_test_2_pic.o, common_test_2.so): New targets.
6016 (common_test_3_pic.o, common_test_3.so): New targets.
6017 * testsuite/Makefile.in: Rebuild.
6020 * script.cc (read_input_script): If we see a new SECTIONS clause,
6021 and we have added an input section, give an error.
6022 * layout.h (class Layout): Add have_added_input_section function.
6023 Add have_added_input_section_ field.
6024 * layout.cc (Layout::Layout): Initialize
6025 have_added_input_section_.
6026 (Layout::layout): Set have_added_input_section_.
6027 (Layout::layout_eh_frame): Likewise.
6029 2009-12-30 Ian Lance Taylor <iant@google.com>
6032 * options.h (class General_options): Add --sort-common option.
6033 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
6034 * common.cc (Sort_common): Add sort_order parameter to
6035 constructor. Add sort_order_ field.
6036 (Sort_commons::operator): Check sort_order_.
6037 (Symbol_table::allocate_commons): Determine the sort order.
6038 (Symbol_table::do_allocate_commons): Add sort_order parameter.
6040 (Symbol_table::do_allocate_commons_list): Likewise.
6042 2009-12-30 Ian Lance Taylor <iant@google.com>
6045 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
6046 symbols from this object, don't change the visibility of an
6048 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
6050 2009-12-30 Ian Lance Taylor <iant@google.com>
6053 * script.h (class Version_script_info): Define Language enum.
6054 Update declarations. Define Glob, Exact, and Lookup types. Add
6055 new fields globals_, locals_, and is_finalized_.
6056 * script.cc: Various formatting fixes.
6057 (class Parser_closure): Change language_stack_ from a vector of
6058 std::string to one of Version_script_info::Language. Adjust all
6060 (class Lazy_demangler): Remove.
6061 (struct Version_expression): Change language from std::string to
6062 Version_script_info::Language.
6063 (Version_script_info::Version_script_info): New function.
6064 (Version_script_info::~Version_script_info): Don't call clear.
6065 (Version_script_info::finalize): New function.
6066 (Version_script_info::build_lookup_tables): New function.
6067 (Version_script_info::build_expression_list_lookup): New
6069 (Version_script_info::get_symbol_version_helper): Rewrite to use
6071 (Version_script_info::print_expression_list): Adjust to use
6072 Version_script_info::Language.
6073 (script_push_lex_into_version_mode): Check that the version script
6074 has not been finalized.
6075 (version_script_push_lang): Change language string to
6076 Version_script_info::Language.
6077 * options.cc (Command_line::version_script): New function.
6078 * options.h (class General_options): Add finalize_dynamic_list
6079 function. Change version_script from declaration to definition.
6080 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
6081 * testsuite/version_script.map: Remove duplicate def of foo.
6082 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
6084 * testsuite/Makefile.in: Rebuild.
6086 2009-12-30 Ian Lance Taylor <iant@google.com>
6089 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
6090 if the input symbol index is 0, make the output symbol index 0.
6092 2009-12-30 Ian Lance Taylor <iant@google.com>
6095 * options.h (class General_options): Add -x/--discard-all.
6096 * object.cc (Sized_relobj::do_count_local_symbols): Handle
6097 --discard-all. If the local symbol needs a dynamic entry, check
6098 that before handling --discard-locals.
6100 2009-12-30 Ian Lance Taylor <iant@google.com>
6103 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
6105 (Output_segment::add_output_section): Don't change the flags if
6109 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
6110 GNU hash table if they need a dynamic value. Otherwise, don't add
6111 them if they are defined in a dynamic object or are forced local.
6113 2009-12-29 Ian Lance Taylor <iant@google.com>
6116 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
6117 .gnu.hash table for a 32-bit target.
6120 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
6121 regular and a dynamic object only needs a dynamic symbol table
6122 entry if it is externally visible.
6125 * i386.cc (class Target_i386): Initialize global_offset_table_ in
6126 constructor. Add global_offset_table_ field.
6127 (Target_i386::got_section): Set global_offset_table_.
6128 (Target_i386::do_finalize_sections): Set global_offset_table_
6130 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
6131 in constructor. Add global_offset_table_ field.
6132 (Target_x86_64::got_section): Set global_offset_table_.
6133 (Target_x86_64::do_finalize_sections): Set global_offset_table_
6136 * layout.cc (Layout::Layout): Initialize increase_relro_.
6137 (Layout::get_output_section): Add is_relro, is_last_relro, and
6138 is_first_non_relro parameters. Change all callers.
6139 (Layout::choose_output_section): Likewise.
6140 (Layout::add_output_section_data): Likewise.
6141 (Layout::make_output_section): Likewise.
6142 (Layout::set_segment_offsets): Clear increase_relro when using a
6144 * layout.h (class Layout): Add increase_relro method. Add
6145 increase_relro_ field. Update declarations.
6146 * output.cc (Output_section::Output_section): Initialize
6147 is_last_relro_ and is_first_non_relro_.
6148 (Output_segment::add_output_section): Group relro sections is
6149 do_sort is true. Handle is_last_relro and is_first_non_relro.
6150 (Output_segment::maximum_alignment): Remove relro handling.
6151 (Output_segment::set_section_addresses): Add increase_relro
6152 parameter. Change all callers. Add initial alignment to align
6153 relro sections on separate page. Remove old relro handling.
6154 (Output_segment::set_section_list_addresses): Remove in_relro
6155 parameter. Change all callers.
6156 (Output_segment::set_offset): Add increase parameter. Change all
6157 callers. Remove old relro handling.
6158 * output.h (class Output_section): Add new methods: is_last_relro,
6159 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
6160 Add is_last_relro_ and is_first_non_relro_ fields.
6161 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
6162 Create separate .got.plt section. Call increase_relro.
6163 * x86_64.cc (Target_x86_64::got_section): Likewise.
6164 * testsuite/relro_script_test.t: Add .got.plt.
6167 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
6168 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
6169 (Layout::finalize): Call set_dynamic_symbol_size.
6170 (Layout::set_dynamic_symbol_size): New function.
6171 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
6172 set_dynamic_symbol_size.
6175 * output.h (class Output_section): Add is_entsize_zero_ field.
6176 * output.cc (Output_section::Output_section): Initialize
6178 (Output_section::set_entsize): If two different entsizes are
6179 requested, force it to zero.
6180 (Output_section::add_input_section): Set flags for .debug_str
6181 before updating section flags. Set entsize.
6182 (Output_section::update_flags_for_input_section): Set SHF_MERGE
6183 and SHF_STRING if all input sections have those flags.
6185 2009-12-29 Rafael Espindola <espindola@google.com>
6187 * main.cc (main): Fix the sys time reporting.
6188 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
6191 2009-12-29 Sriraman Tallam <tmsriram@google.com>
6193 * options.cc (General_options::parse_version): Allow -v to exit
6194 without an error if there is nothing to link.
6196 2009-12-29 Ian Lance Taylor <iant@google.com>
6198 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
6199 using a version of gcc before 4.1.
6200 * configure: Rebuild.
6202 2009-12-28 Chris Demetriou <cgd@google.com>
6204 * attributes.cc (Output_attributes_section_data::do_write): Use
6205 std::vector::front rather than std::vector::data.
6207 2009-12-28 Ian Lance Taylor <iant@google.com>
6209 * symtab.h (class Symbol_table): Add enum Defined.
6210 * resolve.cc (Symbol_table::should_override): Add defined
6211 parameter. Change all callers. Test whether object is NULL
6212 before calling a method on it.
6213 (Symbol_table::report_resolve_problem): Add defined parameter.
6215 (Symbol_table::should_override_with_special): Likewise.
6216 * symtab.cc (Symbol_table::define_in_output_data): Add defined
6217 parameter. Change all callers.
6218 (Symbol_table::do_define_in_output_data): Likewise.
6219 (Symbol_table::define_in_output_segment): Likewise.
6220 (Symbol_table::do_define_in_output_segment): Likewise.
6221 (Symbol_table::define_as_constant): Likewise.
6222 (Symbol_table::do_define_as_constant): Likewise.
6223 * script.h (class Symbol_assignment): Add is_defsym parameter to
6224 constructor; change all callers.
6225 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
6226 parameter. Change all callers. Add is_defsym_ field.
6227 (class Parser_closure): Add parsing_defsym parameter to
6228 constructor; change all callers. Add parsing_defsym accessor
6229 function. Add parsing_defsym_ field.
6231 2009-12-28 Ian Lance Taylor <iant@google.com>
6233 * gold.cc (queue_middle_tasks): Fix formatting.
6234 * object.cc (Relobj::is_section_name_included): Likewise.
6236 2009-12-23 Ian Lance Taylor <iant@google.com>
6238 * i386.cc (Target_i386::do_calls_non_split): Recognize
6239 -fsplit-stack prologue for a function with a static chain.
6240 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
6241 -fsplit-stack prologue when using %r11.
6243 2009-12-21 Sriraman Tallam <tmsriram@google.com>
6245 * options.cc (General_options::parse_version): Make -v continue and do
6246 the link like GNU ld does.
6248 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
6250 * Makefile.am (CCFILES): Add timer.cc.
6251 (HFILES): Add timer.h.
6252 * configure.ac: Check for sysconf and times.
6253 * main.cc: include timer.h.
6254 (main): Use Timer instead of get_run_time.
6257 * workqueue.cc: include timer.h.
6258 (Workqueue::find_and_run_task):
6259 Report user, sys and wall time.
6260 * Makefile.in: Regenerate.
6261 * config.in: Regenerate.
6262 * configure: Regenerate.
6264 2009-12-16 Doug Kwan <dougkwan@google.com>
6266 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
6268 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
6269 relaxed input sections.
6270 * output.cc (Output_section::find_relaxed_input_section): Change
6271 return type to Output_relaxed_input_section pointer. Adjust code
6272 for new type of relaxed_input_section_map_.
6273 * output.h (Output_section::find_relaxed_input_section): Change
6274 return type to Output_relaxed_input_section pointer.
6275 (Output_section::Output_relaxed_input_section_by_input_section_map):
6277 (Output_section::relaxed_input_section_map_): Change type to
6278 Output_section::Output_relaxed_input_section_by_input_section_map.
6279 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
6282 2009-12-15 Ian Lance Taylor <iant@google.com>
6284 * layout.cc (Layout::create_shstrtab): Only write out after input
6285 sections if we are compressing debug sections.
6287 2009-12-15 Ian Lance Taylor <iant@google.com>
6289 * archive.cc (Archive::add_symbols): Only look up a symbol without
6290 a version if there is, in fact, a version.
6292 2009-12-14 Ian Lance Taylor <iant@google.com>
6294 Revert -Wshadow changes, all changes from:
6295 2009-12-11 Doug Kwan <dougkwan@google.com>
6296 2009-12-11 Nick Clifton <nickc@redhat.com>
6297 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
6299 2009-12-11 Doug Kwan <dougkwan@google.com>
6301 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
6303 * attributes.cc (Object_attribute::size): Ditto.
6304 (Attributes_section_data::size): Ditto.
6305 (Attributes_section_data::Attributes_section_data): Ditto.
6306 (Output_attributes_section_data::do_write): Ditto.
6307 * attributes.h (Object_attribute::set_type): Ditto.
6308 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
6310 2009-12-11 Nick Clifton <nickc@redhat.com>
6312 * archive.cc: Fix shadowed variable warnings.
6314 * compressed_output.cc: Likewise.
6315 * compressed_output.h: Likewise.
6316 * configure: Likewise.
6317 * dwarf_reader.cc: Likewise.
6318 * dynobj.cc: Likewise.
6319 * dynobj.h: Likewise.
6320 * ehframe.cc: Likewise.
6321 * ehframe.h: Likewise.
6322 * errors.cc: Likewise.
6323 * expression.cc: Likewise.
6324 * fileread.cc: Likewise.
6325 * fileread.h: Likewise.
6326 * freebsd.h: Likewise.
6327 * i386.cc: Likewise.
6329 * incremental.h: Likewise.
6330 * layout.cc: Likewise.
6331 * layout.h: Likewise.
6332 * mapfile.cc: Likewise.
6333 * merge.cc: Likewise.
6334 * merge.h: Likewise.
6335 * object.cc: Likewise.
6336 * object.h: Likewise.
6337 * options.h: Likewise.
6338 * output.cc: Likewise.
6339 * output.h: Likewise.
6340 * parameters.cc: Likewise.
6341 * plugin.cc: Likewise.
6342 * powerpc.cc: Likewise.
6343 * reduced_debug_output.cc: Likewise.
6344 * reduced_debug_output.h: Likewise.
6345 * reloc.cc: Likewise.
6346 * reloc.h: Likewise.
6347 * resolve.cc: Likewise.
6348 * script-sections.cc: Likewise.
6349 * script.cc: Likewise.
6350 * script.h: Likewise.
6351 * sparc.cc: Likewise.
6352 * symtab.cc: Likewise.
6353 * symtab.h: Likewise.
6354 * target-select.cc: Likewise.
6355 * target-select.h: Likewise.
6356 * token.h: Likewise.
6357 * workqueue.cc: Likewise.
6358 * workqueue.h: Likewise.
6359 * x86_64.cc: Likewise.
6361 2009-12-10 Doug Kwan <dougkwan@google.com>
6363 * arm.cc (attributes.h): New include.
6364 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
6365 (Arm_relobj::~Arm_relobj): Delete object pointed by
6366 attributes_section_data_.
6367 (Arm_relobj::attributes_section_data): New method definition.
6368 (Arm_relobj::attributes_section_data_): New data member declaration.
6369 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
6370 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
6371 attributes_section_data_.
6372 (Arm_dynobj::attributes_section_data): New method definition.
6373 (Arm_dynobj::attributes_section_data_): New data member declaration.
6374 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
6375 initialization value of may_use_blx_ to false.
6376 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
6377 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
6378 object attributes to compute results instead of hard-coding.
6379 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
6380 Target_arm::get_secondary_compatible_arch,
6381 Target_arm::set_secondary_compatible_arch
6382 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
6383 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
6384 New method declarations.
6385 (Target_arm::get_aeabi_object_attribute): New method definition.
6386 (Target_arm::attributes_section_data_): New data member declaration.
6387 (read_arm_attributes_section): New template definition.
6388 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
6389 (Arm_dynobj::do_read_symbols): Ditto.
6390 (Target_arm::do_finalize_sections): Merge attributes sections from
6391 input. Check for BLX use after attributes section merging.
6392 Fix __exidx_start and __exidx_end visibility. Create an
6393 .ARM.attributes section if necessary.
6394 (Target_arm::get_secondary_compatible_arch,
6395 Target_arm::set_secondary_compatible_arch,
6396 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
6397 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
6398 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
6399 New method definitions.
6401 2009-12-09 Ian Lance Taylor <iant@google.com>
6403 * plugin.cc (Plugin::load): Don't cast from void* to a function
6406 2009-12-09 Ian Lance Taylor <iant@google.com>
6408 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
6411 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
6413 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
6414 Replace two_file_shared_1.so with two_file_shared_2.so.
6415 * testsuite/Makefile.in: Regenerated.
6417 2009-12-08 Doug Kwan <dougkwan@google.com>
6419 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
6420 (HFILES): Add attributes.h and int_encoding.h.
6421 * Makefile.in: Regenerate.
6422 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
6423 function definitions to int_encoding.cc
6424 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
6425 prototypes to int_encoding.h
6426 * reduced_debug_output.cc (int_encoding.h): New include.
6427 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
6428 function definitions to int_encoding.cc
6429 (insert_into_vector, read_from_pointer): Move template definitions to
6431 * attributes.cc: New file.
6432 * attributes.h: New file.
6433 * int_encoding.cc: New file.
6434 * int_encoding.h: New file.
6436 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
6439 * incremental-dump.cc (dump_incremental_inputs): New.
6440 (main): Use dump_incremental_inputs.
6442 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
6445 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
6446 checking elfcpp::STT_FUNC.
6447 (Target_i386::Relocate::relocate): Likewise.
6448 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
6450 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
6451 symbols from shared libraries into normal FUNC symbols.
6453 * symtab.h (Symbol): Add is_func and use it.
6455 2009-12-05 Doug Kwan <dougkwan@google.com>
6457 * arm.cc (Target_arm::arm_info): Initialize new fields
6458 attributes_section and attributes_vendor.
6459 * i386.cc (Target_i386::i386_info): Same.
6460 * object.cc (Sized_relobj::do_layout): Skip attribute section.
6461 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
6462 fields attributes_section and attributes_vendor.
6463 * sparc.cc (Target_sparc::sparc_info): Same.
6464 * target.h (Target::attributes_section, Target::attributes_vendor,
6465 Target::is_attributes_section, Target::attribute_arg_type,
6466 Target::attributes_order): New method definitions.
6467 (Target::Target_info::attributes_section,
6468 Target::Target_info::attributes_vendor): New fields.
6469 (Target::do_attribute_arg_type, Target::do_attributes_order): New
6470 virtual method definitions.
6471 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
6472 attributes_section and attributes_vendor.
6473 * testsuite/testfile.cc (Target_test::test_target_info): Same.
6475 2009-12-05 Doug Kwan <dougkwan@google.com>
6477 * arm.cc: Update comments about interworking and stub generation.
6478 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
6479 considered as non-PIC.
6480 (Arm_relocate_functions::base_abs): Fix formatting.
6481 (Arm_relocate_functions::got_prel): Fix comment. Change interface
6482 of function to use GOT entry address instead of offset.
6483 (Target_arm::Scan::global): Issue an error if a symbol would need a
6484 PLT does not get one because it is untyped. Remove code to create
6485 dynamic symbols for relative branches.
6486 (Target_arm::Relocate::relocate: Use 0 instead of false since function
6487 takes unsigned integer instead of boolean.
6489 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
6491 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
6492 (two_file_test_LDADD): Likewise.
6493 (common_test_1_LDADD): Likewise.
6494 (exception_test_LDADD) Likewise.
6495 (weak_test_LDADD): Likewise.
6496 (many_sections_test_LDADD): Likewise.
6497 (initpri1_LDADD): Likewise.
6498 (script_test_1_LDADD): Likewise.
6499 (script_test_2_LDADD): Likewise.
6500 (justsyms_LDADD): Likewise.
6501 (binary_test_LDADD): Likewise.
6502 (large_LDADD): Likewise.
6503 * testsuite/Makefile.in: Regenerated.
6505 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
6507 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
6508 (Symbol_table::override_with_special): Likewise.
6509 (Symbol_table::add_from_object): Likewise.
6511 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
6513 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
6514 Don't set the data_offset twice.
6516 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
6518 * testsuite/Makefile.in: Regenerate.
6520 2009-12-03 Doug Kwan <dougkwan@google.com>
6522 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
6523 (Target_arm::do_finalize_sections): Add parameter for symbol table
6524 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
6525 * i386.cc (Target_i386::do_finalize_sections): Add an additional
6526 parameter for symbol table pointer.
6527 * layout.cc (Layout::finalize): Call Target::finalize_sections with
6528 an additional parameter for a pointer to symbol table.
6529 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
6530 parameter for a symbol table pointer.
6531 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
6532 * target.h (Target::finalize_sections, Target::do_finalize_sections):
6534 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
6535 parameter for a symbol table pointer.
6537 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
6539 * incremental.cc (Incremental_inputs_header)
6540 (Incremental_inputs_header_write, Incremental_inputs_entry)
6541 (Incremental_inputs_entry_write): Move ...
6542 * incremental.h (Incremental_inputs_header)
6543 (Incremental_inputs_header_write, Incremental_inputs_entry)
6544 (Incremental_inputs_entry_write): here.
6546 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
6548 * incremental.cc (make_sized_incremental_binary): Set the target.
6549 Error if it is incompatible.
6550 * output.h (Output_file): Add filename method.
6552 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
6554 * incremental.cc (Incremental_inputs_entry): Remove unused argument
6555 from the get_* methods.
6557 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
6559 * incremental-dump.cc (main): Check that the offeset of a script is 0.
6560 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
6561 Write 0 for the data_offset of scripts.
6563 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
6565 * testsuite/Makefile.am: Add the incremental_test.sh test.
6566 * testsuite/incremental_test.sh: New.
6567 * testsuite/incremental_test_1.c: New.
6568 * testsuite/incremental_test_2.c: New.
6570 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
6572 * incremental-dump.cc (main): Fix typos.
6574 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
6577 * incremental-dump.cc (main): Use llu to print 64 bit values.
6579 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
6580 H.J. Lu <hongjiu.lu@intel.com>
6582 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
6584 (incremental_dump_LDADD): Likewise.
6585 * Makefile.in: Regenerated.
6587 2009-11-25 Doug Kwan <dougkwan@google.com>
6591 2009-11-25 Doug Kwan <dougkwan@google.com>
6593 * arm.cc (Target_arm::Target_arm): Move method definition
6594 outside of class definition. Add code to handle
6595 --target1-rel, --target1-abs and --target2= options.
6596 (Target_arm::get_reloc_reloc_type): Change method to be
6597 non-static and const.
6598 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
6599 New data member declaration.
6600 (Target_arm::Scan::local, Target_arm::Scan::global,
6601 Target_arm::Relocate::relocate,
6602 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6603 Adjust call to Target_arm::get_real_reloc_type.
6604 (Target_arm::get_real_reloc_type): Use command line options
6605 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
6606 * options.h (--target1-rel, --target1-abs, --target2): New
6609 2009-11-25 Doug Kwan <dougkwan@google.com>
6611 * arm.cc (Target_arm::Target_arm): Move method definition outside of
6612 class definition. Add code to handle --target1-rel, --target1-abs
6613 and --target2= options.
6614 (Target_arm::get_reloc_reloc_type): Change method to be non-static
6616 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
6618 (Target_arm::Scan::local, Target_arm::Scan::global,
6619 Target_arm::Relocate::relocate,
6620 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
6621 call to Target_arm::get_real_reloc_type.
6622 (Target_arm::get_real_reloc_type): Use command line options to
6623 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
6624 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
6627 2009-11-25 Doug Kwan <dougkwan@google.com>
6629 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
6630 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
6631 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
6633 (Arm_relocate_functions::thm_call): Replace body with a call to
6634 Arm_relocate_functions::thumb_branch_common.
6635 (Arm_relocate_functions::thm_jump24,
6636 Arm_relocate_functions::thm_xpc22): New method definitions.
6637 (Arm_relocate_functions::thumb_branch_common): New method definition.
6638 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
6640 (Target_arm::Relocate::relocate): Adjust call to thm_call.
6641 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
6643 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
6645 * Makefile.am: Build incremental-dump
6646 * Makefile.in: Regenerate.
6647 * incremental-dump.cc: New.
6648 * incremental.cc (Incremental_inputs_header_data,
6649 Incremental_inputs_entry_data): Move to incremental.h
6650 * incremental.h: (Incremental_inputs_header_data,
6651 Incremental_inputs_entry_data): Move from incremental.cc
6653 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
6655 * incremental.cc (Incremental_inputs_header,
6656 Incremental_inputs_header_write, Incremental_inputs_entry,
6657 Incremental_inputs_entry_write): Add a typedef with the data type.
6659 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
6661 * incremental.cc (Incremental_inputs_header,
6662 Incremental_inputs_header_write, Incremental_inputs_entry,
6663 Incremental_inputs_entry_write): Update comment about which
6664 type has the filed descriptions.
6666 2009-11-15 Doug Kwan <dougkwan@google.com>
6668 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
6669 (Arm_relocate_functions::arm_branch_common): Change method defintion
6670 in class definition to a method declaration and update list of formal
6672 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
6673 Arm_relocation_functions::jump24): Adjust call to
6674 Arm_relocate_functions::arm_branch_common. Update list of formal
6676 (Arm_relocate_functions::xpc25): New method definition.
6677 (Arm_relocate_functions::arm_branch_common): Move method defintion
6678 out from class definition. Use stubs for mode-switching and extending
6680 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
6681 specially. Change code to enable use of stubs in ARM branches.
6683 2009-11-10 Doug Kwan <dougkwan@google.com>
6685 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
6686 in method declaration.
6687 (Target_arm::relocate_stub): New method declaration.
6688 (Target_arm::default_target): Change to return a pointer instead of
6690 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
6691 Target_arm::default_target.
6692 (Arm_Relobj::do_relocate_sections): Remove options paramater in
6694 (Target_arm::relocate_section): Adjust view.
6695 (Target_arm::relocate_stub): New method definition.
6697 2009-11-10 Doug Kwan <dougkwan@google.com>
6699 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
6701 * incremental.cc (open_incremental_binary): Initialized local
6702 variables to avoid warnings.
6703 * object.cc (make_elf_object): Ditto.
6704 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
6707 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
6710 * testsuite/plugin_test.c: Include "config.h".
6712 2009-11-09 Doug Kwan <dougkwan@google.com>
6714 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
6715 (arm_symbol_value): Remove.
6716 (Arm_relocate_functions::arm_branch_common,
6717 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
6718 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
6719 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
6720 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
6721 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
6722 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
6723 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
6724 Arm_relocate_functions::thm_mobw_abs_nc,
6725 Arm_relocate_functions::thm_mov_abs,
6726 Arm_relocate_functions::movw_prel_nc,
6727 Arm_relocate_functions::thm_movt_abs,
6728 Arm_relocate_functions::movt_prel,
6729 Arm_relocate_functions::thm_movw_prel_nc,
6730 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
6731 (Target_arm::Relocate::relocate): Only decompose address into two
6732 parts if relocation type uses the thumb-bit and pass the actual
6733 bit instead of a flag indicating that the thumb-bit is used. Adjust
6734 calls to methods in Arm_relocate_functions for this change.
6736 2009-11-08 Ian Lance Taylor <iant@google.com>
6739 * reloc.cc: Instantiate
6740 Sized_relobj::initialize_input_to_output_maps and
6741 Sized_relobj:free_input_to_output_maps.
6743 2009-11-06 Ian Lance Taylor <iant@google.com>
6746 * defstd.cc (in_segment): Set only_if_ref true for "end".
6748 2009-11-06 Doug Kwan <dougkwan@google.com>
6750 * arm.cc (class Reloc_stub): Correct a comment.
6751 (Target_arm::Target_arm): Initialize arm_input_section_map_.
6752 (Target_arm::scan_section_for_stubs): New method declaration.
6753 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
6754 Change methods from private to protected.
6755 (Target_arm::do_may_relax): New method definition.
6756 (Target_arm::do_relax, Target_arm::group_sections,
6757 Target_arm::scan_reloc_for_stub,
6758 Target_arm::scan_reloc_section_for_stubs): New method declarations.
6759 (Target_arm::arm_input_section_map_): New data member declaration.
6760 (Target_arm::scan_reloc_for_stub,
6761 Target_arm::scan_reloc_section_for_stubs,
6762 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
6763 Target_arm::do_relax): New method definitions.
6765 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
6767 * configure.ac: Check for (struct stat)::st_mtim
6768 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
6769 * config.in: Regenerate.
6770 * configure: Regenerate.
6772 2009-11-05 Ian Lance Taylor <iant@google.com>
6775 * output.cc (Output_segment::add_output_section): Add missing
6778 2009-11-04 Ian Lance Taylor <iant@google.com>
6781 * object.h (class Object): Add is_needed and set_is_needed
6782 methods. Add is_needed_ field. Make bool fields into bitfields.
6783 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
6784 defined in a dynamic object and referenced by a regular object,
6785 set is_needed for the dynamic object.
6786 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
6787 if the file is marked with as_needed and it is not needed.
6789 2009-11-04 Ian Lance Taylor <iant@google.com>
6792 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
6793 tags if data is discarded by linker script.
6794 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6795 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6796 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6797 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6799 2009-11-04 Ian Lance Taylor <iant@google.com>
6801 * layout.cc (Layout::get_output_section): Add is_interp and
6802 is_dynamic_linker_section parameters. Change all callers.
6803 (Layout::choose_output_section): Likewise.
6804 (Layout::make_output_section): Likewise.
6805 (Layout::add_output_section_data): Add is_dynamic_linker_section
6806 parameter. Change all callers.
6807 * layout.h (class Layout): Update declarations.
6808 * output.h (class Output_section): Add is_interp, set_is_interp,
6809 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
6810 Add is_interp_, is_dynamic_linker_section_ fields. Change
6811 generate_code_fills_at_write_ to a bitfield.
6812 * output.cc (Output_section::Output_sections): Initialize new
6814 (Output_segment::add_output_section): Add do_sort parameter.
6817 2009-11-03 Ian Lance Taylor <iant@google.com>
6820 * options.h (class General_options): Add --warn-common.
6821 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
6822 merging two common symbols.
6823 (Symbol_table::should_override): Handle --warn-common when merging
6824 a common symbol with a defined symbol. Use report_resolve_problem
6825 for multiple definitions.
6826 (Symbol_table::report_resolve_problem): New function.
6827 * symtab.h (class Symbol_table): Declare report_resolve_problem.
6829 2009-11-03 Doug Kwan <dougkwan@google.com>
6831 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
6833 (Target_arm::stub_factory): New method definition.
6834 (Target_arm::new_arm_input_section,
6835 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
6836 Target_arm::reloc_uses_thumb_bit): New method declarations.
6837 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
6838 New type definitions.
6839 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
6840 member declarations.
6841 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
6842 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
6843 New method definitions.
6845 2009-11-03 Ian Lance Taylor <iant@google.com>
6847 * options.h (class General_options): Add --warn_constructors.
6849 2009-11-03 Ian Lance Taylor <iant@google.com>
6852 * defstd.cc (in_section): Add entries for __rel_iplt_start,
6853 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
6855 2009-11-03 Ian Lance Taylor <iant@google.com>
6858 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
6859 --msgid-bugs-address.
6860 (install-pdf): New target.
6861 (install-data_yes): Look up one directory to find mkinstalldirs.
6863 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
6865 * po/Make-in (.po.gmo): Don't generate .gmo files in source
6868 2009-10-30 Doug Kwan <dougkwan@google.com>
6870 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
6872 2009-10-30 Doug Kwan <dougkwan@google.com>
6874 * arm.cc (Stub_addend_reader): New struct template definition
6875 and partial specializations.
6876 (Stub_addend_reader::operator()): New method definition for a
6877 partially specialized template.
6879 2009-10-30 Doug Kwan <dougkwan@google.com>
6881 * arm.cc (Arm_relobj::processor_specific_flags): New method
6883 (Arm_relobj::do_read_symbols): New method declaration.
6884 (Arm_relobj::processor_specific_flags_): New data member declaration.
6885 (Arm_dynobj): New class definition.
6886 (Target_arm::do_finalize_sections): Add input_objects parameter.
6887 (Target_arm::do_adjust_elf_header): New method declaration.
6888 (Target_arm::are_eabi_versions_compatible,
6889 (Target_arm::merge_processor_specific_flags): New method declaration.
6890 (Target_arm::do_make_elf_object): New overloaded method definitions
6892 (Arm_relobj::do_read_symbols): New method definition.
6893 (Arm_dynobj::do_read_symbols): Ditto.
6894 (Target_arm::do_finalize_sections): Add input_objects parameters.
6895 Merge processor-specific flags from all input objects.
6896 (Target_arm::are_eabi_versions_compatible,
6897 Target_arm::merge_processor_specific_flags,
6898 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
6899 New method definitions.
6900 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
6901 Input_objects pointer type parameter.
6902 * layout.cc (Layout::finalize): Pass input objects to target's.
6903 finalize_sections function.
6904 * output.cc (Output_file_header::do_sized_write): Set ELF file
6905 header's processor-specific flags.
6906 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
6907 Input_objects pointer type parameter.
6908 * sparc.cc (Target_sparc::do_finalize_sections): Same.
6909 * target.h (Input_objects): New forward class declaration.
6910 (Target::processor_specific_flags,
6911 Target::are_processor_specific_flags_sect): New method definitions.
6912 (Target::finalize_sections): Add input_objects parameter.
6913 (Target::Target): Initialize processor_specific_flags_ and
6914 are_processor_specific_flags_set_.
6915 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
6917 (Target::set_processor_specific_flags): New method definition.
6918 (Target::processor_specific_flags_,
6919 Target::are_processor_specific_flags_set_): New data member
6921 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
6922 Input_objects pointer type parameter.
6924 2009-10-30 Doug Kwan <dougkwan@google.com>
6926 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
6928 2009-10-28 Ian Lance Taylor <iant@google.com>
6930 * object.h (class Relobj): Drop options parameter from
6931 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
6932 do_scan_relocs, do_relocate. Change all callers.
6933 (class Sized_relobj): Drop options parameters from
6934 do_gc_process_relocs, do_scan_relocs, do_relocate,
6935 do_relocate_sections, relocate_sections, emit_relocs_scan,
6936 emit_relocs_scan_reltype. Change all callers.
6937 (struct Relocate_info): Remove options field and all references to
6939 * reloc.h (class Read_relocs): Remove options constructor
6940 parameter and options_ field. Change all callers.
6941 (class Gc_process_relocs, class Scan_relocs): Likewise.
6942 (class Relocate_task): Likewise.
6943 * target-reloc.h (scan_relocs): Remove options parameter. Change
6945 (scan_relocatable_relocs): Likewise.
6946 * target.h (class Sized_target): Remove options parameter from
6947 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
6949 * gc.h (gc_process_relocs): Remove options parameter. Change all
6951 * arm.cc: Update functions to remove options parameters.
6952 * i386.cc: Likewise.
6953 * powerpc.cc: Likewise.
6954 * sparc.cc: Likewise.
6955 * x86_64.cc: Likewise.
6956 * testsuite/testfile.cc: Likewise.
6958 2009-10-28 Doug Kwan <dougkwan@google.com>
6960 * arm.cc (Arm_relobj): New class definition.
6961 (Arm_relobj::scan_sections_for_stubs,
6962 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
6963 New method definitions.
6965 2009-10-28 Cary Coutant <ccoutant@google.com>
6967 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
6968 (Plugin::cleanup_done_): New member.
6969 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
6970 (Plugin_manager::cleanup_done_): Remove.
6971 (Plugin_manager::add_input_file): Edit error message.
6972 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
6973 (Plugin_manager::cleanup): Remove use of cleanup_done_.
6975 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
6977 * fileread.cc: (File_read::View::~View): Use the new
6978 data_ownership_ filed.
6979 (File_read::~File_read): Dispose the new whole_file_view_.
6980 (File_read::open): Mmap the whole file if needed.
6981 (File_read::open): Use whole_file_view_ instead of contents_.
6982 (File_read::find_view): Use whole_file_view_ if applicable.
6983 (File_read::do_read): Use whole_file_view_ instead of contents_.
6984 (File_read::make_view): Use whole_file_view_ instead of contents_,
6985 update File_read::View::View call.
6986 (File_read::find_or_make_view): Update File_read::View::View
6988 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
6990 (File_read::View::Data_ownership): New enum.
6991 (File_read::View::View): Replace bool mapped_ with Data_ownership
6993 (File_read::View::mapped_): Remove (replaced by data_ownership_).
6994 (File_read::View::data_ownership_): New field.
6995 (File_read::contents_): Remove (replaced by whole_file_view_).
6996 (File_read::whole_file_view_): New field.
6997 * options.h (class General_options): Add --keep-files-mapped.
6999 2009-10-27 Cary Coutant <ccoutant@google.com>
7001 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
7002 * testsuite/Makefile.am (plugin_test_5): New test case.
7003 * testsuite/Makefile.in: Regenerate.
7005 2009-10-25 Doug Kwan <dougkwan@google.com>
7007 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
7008 from private to protected to allow access by child class.
7009 (Sized_relobj::do_relocate_sections): New method declaration.
7010 (Sized_relobj::relocate_sections): Virtualize.
7011 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
7012 Sized_relobj::relocate_sections. Instantiate template explicitly
7013 for different target sizes and endianity.
7015 2009-10-24 Doug Kwan <dougkwan@google.com>
7017 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
7018 (Arm_input_section::as_arm_input_section): New method.
7019 (Arm_output_section): New class definition.
7020 (Arm_output_section::create_stub_group,
7021 Arm_output_section::group_sections): New method definitions.
7023 2009-10-22 Doug Kwan <dougkwan@google.com>
7025 * arm.cc (Arm_input_section): New class definition.
7026 (Arm_input_section::init, Arm_input_section:do_write,
7027 Arm_input_section::set_final_data_size,
7028 Arm_input_section::do_reset_address_and_file_offset): New method
7031 2009-10-21 Doug Kwan <dougkwan@google.com>
7033 * arm.cc (Stub_table, Arm_input_section): New forward class
7035 (Stub_table): New class defintion.
7036 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
7037 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
7038 New method definition.
7040 2009-10-21 Doug Kwan <dougkwan@google.com>
7042 * arm.cc: Update copyright comments.
7043 (Target_arm): New forward class template declaration.
7044 (Arm_address): New type.
7045 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
7046 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
7047 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
7049 (Insn_template): Same.
7050 (DEF_STUBS): New macro.
7051 (Stub_type): New enum type.
7052 (Stub_template): New class definition.
7055 (Stub_factory): Same.
7056 (Target_arm::Target_arm): Initialize may_use_blx_ and
7057 should_force_pic_veneer_.
7058 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
7059 Target_arm::should_force_pic_veneer,
7060 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
7061 Target_arm::using_thumb_only, Target_arm:;default_target): New
7063 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
7064 New data member declarations.
7065 (Insn_template::size, Insn_template::alignment): New method defintions.
7066 (Stub_template::Stub_template): New method definition.
7067 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
7068 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
7069 (Stub_factory::Stub_factory): New method definition.
7070 * gold.h (string_hash): New template.
7071 * output.h (Input_section_specifier::hash_value): Use
7073 (Input_section_specifier::string_hash): Remove.
7074 * stringpool.cc (Stringpool_template::string_hash): Use
7077 2009-10-20 Doug Kwan <dougkwan@google.com>
7079 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
7080 symbols of relaxed input sections.
7081 * output.h (Output_section::find_relaxed_input_section): Make
7084 2009-10-16 Doug Kwan <dougkwan@google.com>
7086 * dynobj.cc (Versions::Versions): Initialize version_script_.
7087 Only insert base version symbol definition for a shared object
7088 if version script defines any version versions.
7089 (Versions::define_base_version): New method definition.
7090 (Versions::add_def): Check that base version is not needed.
7091 (Versions::add_need): Define base version lazily.
7092 * dynobj.h (Versions::define_base_version): New method declaration.
7093 (Versions::needs_base_version_): New data member declaration.
7094 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
7095 (check_DATA): Add no_version_test.stdout.
7096 (libno_version_test.so, no_version_test.o no_version_test.stdout):
7098 * testsuite/Makefile.in: Regenerate.
7099 * testsuite/no_version_test.c: New file.
7100 * testsuite/no_version_test.sh: Ditto.
7102 2009-10-16 Doug Kwan <dougkwan@google.com>
7104 * expression.cc (class Segment_start_expression): New class definition.
7105 (Segment_start_expression::value): New method definition.
7106 (script_exp_function_segment_start): Return a new
7107 Segment_start_expression.
7108 * gold/script-c.h (script_saw_segment_start_expression): New function
7110 * script-sections.cc (Script_sections::Script_sections): Initialize
7111 SAW_SEGMENT_START_EXPRESSION_ to false.
7112 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
7113 and -Tbbs options to specify section addresses if given in
7114 command line and no SEGMENT_START expression is seen in a script.
7115 * script-sections.h (Script_sections::saw_segment_start_expression,
7116 Script_sections::set_saw_segment_start_expression): New method
7118 (Script_sections::saw_segment_start_expression_): New data member
7120 * script.cc (script_saw_segment_start_expression): New function.
7121 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
7122 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
7123 script_test_7.sh and script_test_8.sh.
7124 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
7125 script_test_8.stdout.
7126 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
7127 (script_test_6, script_test_6.stdout, script_test_7,
7128 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
7129 * Makefile.in: Regenerate.
7130 * testsuite/script_test_6.sh: New file.
7131 * testsuite/script_test_6.t: Same.
7132 * testsuite/script_test_7.sh: Same.
7133 * testsuite/script_test_7.t: Same.
7134 * testsuite/script_test_8.sh: Same.
7136 2009-10-16 Doug Kwan <dougkwan@google.com>
7138 * output.cc (Output_segment::set_section_list_address): Cast
7139 expressions to unsigned long long type to avoid format warnings.
7141 2009-10-15 Ian Lance Taylor <iant@google.com>
7143 * script.cc (Script_options::add_symbol_assignment): Always add a
7144 dot assignment to script_sections_.
7145 * script-sections.cc (Script_sections::add_dot_assignment):
7146 Initialize if necessary.
7148 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
7149 program headers with no load segment if there is a linker script.
7151 * layout.cc (Layout::set_segment_offsets): Align the file offset
7152 to the segment aligment for -N or -n with no load segment.
7153 * output.cc (Output_segment::add_output_section): Don't crash if
7154 the first section is a TLS section.
7155 (Output_segment::set_section_list_addresses): Print an error
7156 message if the address moves backward in a linker script.
7157 * script-sections.cc
7158 (Output_section_element_input::set_section_addresses): Don't
7159 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
7160 (Orphan_output_section::set_section_addresses): Likewise.
7162 2009-10-15 Doug Kwan <dougkwan@google.com>
7164 * layout.cc (Layout::finish_dynamic_section): Generate tags
7165 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
7166 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
7167 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
7169 2009-10-14 Ian Lance Taylor <iant@google.com>
7171 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
7173 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
7174 data_shdr fields of relinfo.
7175 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
7176 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
7177 R_386_TLS_LDO_32, adjust based on section flags.
7178 (Target_i386::Relocate::fix_up_ldo): Remove.
7180 2009-10-13 Ian Lance Taylor <iant@google.com>
7182 Add support for -pie.
7183 * options.h (class General_options): Add -pie and
7185 (General_options::output_is_position_independent): Test -pie.
7186 (General_options::output_is_executable): Return true if not shared
7187 and not relocatable.
7188 (General_options::output_is_pie): Remove.
7189 * options.cc (General_options::finalize): Reject incompatible uses
7191 * gold.cc (queue_middle_tasks): A -pie link is not static.
7192 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
7193 * symtab.cc (Symbol::final_value_is_known): Return false if
7194 output_is_position_independent.
7195 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
7196 output_is_position_independent.
7197 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
7198 output_is_position_independent.
7199 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
7200 output_is_position_independent.
7201 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
7203 (basic_pie_test.o, basic_pie_test): New targets.
7204 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
7205 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
7206 (two_file_pie_test): New target.
7207 * testsuite/Makefile.in: Rebuild.
7208 * README: Remove note saying that -pie is not supported.
7210 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
7212 * options.h (class General_options): Add -init and -fini.
7213 * layout.cc (Layout::finish_dynamic_section): Emit
7214 given init and fini functions.
7216 2009-10-13 Sriraman Tallam <tmsriram@google.com>
7218 * gc.h (gc_process_relocs): Check if icf is enabled using new
7220 * gold.cc (queue_initial_tasks): Likewise.
7221 (queue_middle_tasks): Likewise.
7222 * object.cc (do_layout): Likewise.
7223 * symtab.cc (is_section_folded): Likewise.
7224 * main.cc (main): Likewise.
7225 * reloc.cc (Read_relocs::run): Likewise.
7226 (Sized_relobj::do_scan_relocs): Likewise.
7227 * icf.cc (is_function_ctor_or_dtor): New function.
7228 (Icf::find_identical_sections): Check if function is ctor or dtor when
7230 * options.h (General_options::icf): Change option to be an enum.
7231 (Icf_status): New enum.
7232 (icf_enabled): New method.
7233 (icf_safe_folding): New method.
7234 (set_icf_status): New method.
7235 (icf_status_): New variable.
7236 * (options.cc) (General_options::finalize): Set icf_status_.
7237 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
7238 icf_test and icf_keep_unique_test to use the --icf enum flag.
7239 * testsuite/icf_safe_test.sh: New file.
7240 * testsuite/icf_safe_test.cc: New file.
7242 2009-10-12 Sriraman Tallam <tmsriram@google.com>
7244 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
7245 includes to gc.h and icf.h.
7246 * arm.cc: Include gc.h.
7247 * gold.cc: Likewise.
7248 * i386.cc: Likewise.
7249 * powerpc.cc: Likewise.
7250 * sparc.cc: Likewise.
7251 * x86_64.cc: Likewise.
7252 * gc.h: Include icf.h.
7254 2009-10-11 Ian Lance Taylor <iant@google.com>
7256 * plugin.cc: Include "gold.h" before other header files.
7258 2009-10-10 Chris Demetriou <cgd@google.com>
7260 * options.h (Input_file_argument::Input_file_type): New enum.
7261 (Input_file_argument::is_lib_): Replace with...
7262 (Input_file_argument::type_): New member.
7263 (Input_file_argument::Input_file_argument): Take Input_file_type
7264 'type' rather than boolean 'is_lib' as second argument.
7265 (Input_file_argument::is_lib): Use type_.
7266 (Input_file_argument::is_searched_file): New function.
7267 (Input_file_argument::may_need_search): Handle is_searched_file.
7268 * options.cc (General_options::parse_library): Support -l:filename.
7269 (General_options::parse_just_symbols): Update for Input_file_argument
7271 (Command_line::process): Likewise.
7272 * archive.cc (Archive::get_file_and_offset): Likewise.
7273 * plugin.cc (Plugin_manager::release_input_file): Likewise.
7274 * script.cc (read_script_file, script_add_file): Likewise.
7275 * fileread.cc (Input_file::Input_file): Likewise.
7276 (Input_file::will_search_for): Handle is_searched_file.
7277 (Input_file::open): Likewise.
7278 * readsyms.cc (Read_symbols::get_name): Likewise.
7279 * testsuite/Makefile.am (searched_file_test): New test.
7280 * testsuite/Makefile.in: Regenerate.
7281 * testsuite/searched_file_test.cc: New file.
7282 * testsuite/searched_file_test_lib.cc: New file.
7284 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7285 Ian Lance Taylor <iant@google.com>
7287 * descriptor.cc: Include <cstdio> and "binary-io.h".
7288 (Descriptors::open): Open the files in binary mode always.
7289 * script.cc (Lex::get_token): Treat \r as whitespace.
7291 2009-10-09 Ian Lance Taylor <iant@google.com>
7293 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
7295 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7296 Ian Lance Taylor <iant@google.com>
7298 * configure.ac: Check for readv function also.
7299 * fileread.cc (readv): Define if not HAVE_READV.
7300 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
7302 * config.in: Regenerate.
7303 * configure: Regenerate.
7305 2009-10-09 Doug Kwan <dougkwan@google.com>
7307 * layout.cc (Layout::make_output_section): Call target hook to make
7308 ordinary output section.
7309 (Layout::finalize): Adjust parameter list of call the
7310 Target::may_relax().
7311 * layout.h (class Layout::section_list): New method.
7312 * merge.h (Output_merge_base::entsize): Change visibility to public.
7313 (Output_merge_base::is_string, Output_merge_base::do_is_string):
7315 (Output_merge_string::do_is_string): New method.
7316 * object.cc (Sized_relobj::do_setup): renamed from
7317 Sized_relobj::set_up.
7318 * object.h (Sized_relobj::adjust_shndx,
7319 Sized_relobj::initializ_input_to_output_maps,
7320 Sized_relobj::free_input_to_output_maps): Change visibilities to
7322 (Sized_relobj::setup): Virtualize.
7323 (Sized_relobj::do_setup): New method declaration.
7324 (Sized_relobj::invalidate_section_offset,
7325 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
7326 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
7327 * options.cc (parse_int): New function.
7328 * options.h (parse_int): New declaration.
7329 (DEFINE_int): New macro.
7330 (stub_group_size): New option.
7331 * output.cc (Output_section::Output_section): Initialize memebers
7332 merge_section_map_, merge_section_by_properties_map_,
7333 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
7334 (Output_section::add_input_section): Handled deferred code-fill
7335 generation and remove an old comment.
7336 (Output_section::add_relaxed_input_section): New method definition.
7337 (Output_section::add_merge_input_section): Use merge section by
7338 properties map to speed to search. Update merge section maps
7340 (Output_section::build_relaxation_map): New method definition.
7341 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7343 (Output_section::relax_input_section): Renamed to
7344 Output_section::convert_input_sections_to_relaxed_sections and change
7345 interface to take a vector of pointers to relaxed sections.
7346 (Output_section::find_merge_section,
7347 Output_section::find_relaxed_input_section): New method definitions.
7348 (Output_section::is_input_address_mapped,
7349 Output_section::output_offset, Output_section::output_address):
7350 Use output section data maps to speed up searching.
7351 (Output_section::find_starting_output_address): Add comments.
7352 (Output_section::do_write,
7353 Output_section::write_to_postprocessing_buffer): Do code-fill
7354 generation as appropriate.
7355 (Output_section::get_input_sections): Invalidate relaxed input section
7357 (Output_section::restore_states): Adjust type of checkpoint .
7358 Invalidate relaxed input section map.
7359 * output.h (Output_merge_base): New class declaration.
7360 (Input_section_specifier): New class defintion.
7361 (class Output_relaxed_input_section) Change base class to
7362 Output_section_data_build.
7363 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
7364 base class initializer.
7365 (Output_section::add_relaxed_input_section): New method declaration.
7366 (Output_section::Input_section): Change visibility to protected.
7367 (Output_section::Input_section::relobj,
7368 Output_section::Input_section::shndx): Handle relaxed input sections.
7369 Output_section::input_sections) Change visibility to protected. Also
7370 define overload to return a non-const pointer.
7371 (Output_section::Merge_section_properties): New class defintion.
7372 (Output_section::Merge_section_by_properties_map,
7373 Output_section::Output_section_data_by_input_section_map,
7374 Output_section::Relaxation_map): New types.
7375 (Output_section::relax_input_section): Rename method to
7376 Output_section::convert_input_sections_to_relaxed_sections and change
7377 interface to take a vector of relaxed section pointers.
7378 (Output_section::find_merge_section,
7379 Output_section::find_relaxed_input_section,
7380 Output_section::build_relaxation_map,
7381 Output_section::convert_input_sections_in_list_to_relaxed_sections):
7382 New method declarations.
7383 (Output_section::merge_section_map_
7384 Output_section::merge_section_by_properties_map_,
7385 Output_section::relaxed_input_section_map_,
7386 Output_section::is_relaxed_input_section_map_valid_,
7387 Output_section::generate_code_fills_at_write_): New data members.
7388 * script-sections.cc
7389 (Output_section_element_input::set_section_addresses): Call
7390 current_data_size and addralign methods of relaxed input sections.
7391 (Orphan_output_section::set_section_addresses): Call current_data_size
7392 and addralign methods of relaxed input sections.
7393 * symtab.cc (Symbol_table::compute_final_value): Extract template
7394 from the body of Symbol_table::sized_finalize_symbol.
7395 (Symbol_table::sized_finalized_symbol): Call
7396 Symbol_table::compute_final_value.
7397 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
7398 (Symbol_table::compute_final_value): New templated method declaration.
7399 * target.cc (Target::do_make_output_section): New method defintion.
7400 * target.h (Target::make_output_section): New method declaration.
7401 (Target::relax): Add more parameters for input objects, symbol table
7402 and layout. Adjust call to do_relax.
7403 (Target::do_make_output_section): New method declaration.
7404 (Target::do_relax): Add parameters for input objects, symbol table
7407 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7409 * pread.c: Include stdio.h.
7411 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7413 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
7416 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7418 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7419 Change read_shndx type to unsigned int.
7420 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
7422 (Sized_dwarf_line_info::read_line_mappings): Likewise.
7423 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
7424 Change read_shndx type to unsigned int.
7425 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
7427 (Sized_dwarf_line_info::read_line_mappings): Likewise.
7428 * layout.cc (Layout::create_symtab_sections): Cast the result of
7429 local_symcount * symsize to off_t in the gold_assert.
7431 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7433 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
7434 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
7436 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
7437 (Arm_relocate_functions::thm_abs5): New function.
7438 (Arm_relocate_functions::abs12): New function.
7439 (Arm_relocate_functions::abs16): New function.
7440 (Arm_relocate_functions::base_abs): New function.
7441 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
7442 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
7443 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
7445 (Scan::global): Likewise.
7446 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
7447 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
7448 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
7449 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
7452 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7454 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
7455 (Arm_relocate_functions::movt_prel): New function.
7456 (Arm_relocate_functions::thm_movw_prel_nc): New function.
7457 (Arm_relocate_functions::thm_movt_prel): New function.
7458 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
7459 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
7460 (Scan::global, Relocate::relocate): Likewise.
7461 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7463 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
7465 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
7466 Incremental_checker.
7467 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
7469 (class Incremental_inputs_header): New class.
7470 (Incremental_inputs_header_writer): Edit comment.
7471 (Incremental_inputs_entry): New class.
7472 (Incremental_inputs_entry_writer): Edit comment.
7473 (Sized_incremental_binary::do_find_incremental_inputs_section):
7474 Add *strtab_shndx parameter, fill it.
7475 (Sized_incremental_binary::do_check_inputs): New method.
7476 (Incremental_checker::can_incrementally_link_output_file): Use
7477 Sized_incremental_binary::check_inputs.
7478 (Incremental_inputs::report_command_line): Save command line in
7481 (Incremental_binary::find_incremental_inputs_section): New
7483 (Incremental_binary::do_find_incremental_inputs_section): Add
7484 strtab_shndx parameter.
7485 (Incremental_binary::do_check_inputs): New pure virtual method.
7486 (Sized_incremental_binary::do_check_inputs): Declare.
7487 (Incremental_checker::Incremental_checker): Add incremental_inputs
7488 parameter, use it to initialize incremental_inputs_.
7489 (Incremental_checker::incremental_inputs_): New field.
7490 (Incremental_checker::command_line): New method.
7491 (Incremental_checker::inputs): New method.
7492 (Incremental_checker::command_line_): New field.
7494 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
7496 * incremental.cc: Include <cstdarg> and "target-select.h".
7497 (vexplain_no_incremental): New function.
7498 (explain_no_incremental): New function.
7499 (Incremental_binary::error): New method.
7500 (Sized_incremental_binary::do_find_incremental_inputs_section): New
7502 (make_sized_incremental_binary): New function.
7503 (open_incremental_binary): New function.
7504 (can_incrementally_link_file): Add checks if output is ELF and has
7506 * incremental.h: Include "elfcpp_file.h" and "output.h".
7507 (Incremental_binary): New class.
7508 (Sized_incremental_binary): New class.
7509 (open_incremental_binary): Declare.
7510 * object.cc (is_elf_object): Use
7511 elfcpp::Elf_recognizer::is_elf_file.
7512 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
7513 * output.h (Output_file::filesize): New method.
7515 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7517 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
7519 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
7520 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
7522 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
7524 (Arm_relocate_functions::movw_abs_nc): New function.
7525 (Arm_relocate_functions::movt_abs): New function.
7526 (Arm_relocate_functions::thm_movw_abs_nc): New function.
7527 (Arm_relocate_functions::thm_movt_abs): New function.
7528 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
7529 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
7530 (Scan::global): Likewise.
7531 (Relocate::relocate): Likewise.
7532 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7534 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7536 * arm.cc (Arm_relocate_functions::got_prel) New function.
7537 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
7538 (Relocate::relocate): Likewise.
7539 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7541 2009-10-06 Ian Lance Taylor <iant@google.com>
7543 * options.h (class General_options): Define
7544 split_stack_adjust_size parameter.
7545 * object.h (class Object): Add uses_split_stack_ and
7546 has_no_split_stack_ fields. Add uses_split_stack and
7547 has_no_split_stack accessor functions. Declare
7548 handle_split_stack_section.
7549 (class Reloc_symbol_changes): Define.
7550 (class Sized_relobj): Define Function_offsets. Declare
7551 split_stack_adjust, split_stack_adjust_reltype, and
7553 * object.cc (Object::handle_split_stack_section): New function.
7554 (Sized_relobj::do_layout): Call handle_split_stack_section.
7555 * dynobj.cc (Sized_dynobj::do_layout): Call
7556 handle_split_stack_section.
7557 * reloc.cc (Sized_relobj::relocate_sections): Call
7558 split_stack_adjust for executable sections in split_stack
7559 objects. Pass reloc_map to relocate_section.
7560 (Sized_relobj::split_stack_adjust): New function.
7561 (Sized_relobj::split_stack_adjust_reltype): New function.
7562 (Sized_relobj::find_functions): New function.
7563 * target-reloc.h: Include "object.h".
7564 (relocate_section): Add reloc_symbol_changes parameter. Change
7566 * target.h (class Target): Add calls_non_split method. Declare
7567 do_calls_non_split virtual method. Declare match_view and
7569 * target.cc: Include "elfcpp.h".
7570 (Target::do_calls_non_split): New function.
7571 (Target::match_view): New function.
7572 (Target::set_view_to_nop): New function.
7573 * gold.cc (queue_middle_tasks): Give an error if mixing
7574 split-stack and non-split-stack objects with -r.
7575 * i386.cc (Target_i386::relocate_section): Add
7576 reloc_symbol_changes parameter.
7577 (Target_i386::do_calls_non_split): New function.
7578 * x86_64.cc (Target_x86_64::relocate_section): Add
7579 reloc_symbol_changes parameter.
7580 (Target_x86_64::do_calls_non_split): New function.
7581 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
7583 * powerpc.cc (Target_powerpc::relocate_section): Add
7584 reloc_symbol_changes parameter.
7585 * sparc.cc (Target_sparc::relocate_section): Add
7586 reloc_symbol_changes parameter.
7587 * configure.ac: Call AM_CONDITIONAL for the default target.
7588 * configure: Rebuild.
7589 * testsuite/Makefile.am (TEST_AS): New variable.
7590 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
7591 (check_DATA): Add split_i386 and split_x86_64 files.
7592 (SPLIT_DEFSYMS): Define.
7593 (split_i386_[1234n].o): New targets.
7594 (split_i386_[124]): New targets.
7595 (split_i386_[1234r].stdout): New targets.
7596 (split_x86_64_[1234n].o): New targets.
7597 (split_x86_64_[124]): New targets.
7598 (split_x86_64_[1234r].stdout): New targets.
7599 (MOSTLYCLEANFILES): Add new executables.
7600 * testsuite/split_i386.sh: New file.
7601 * testsuite/split_x86_64.sh: New file.
7602 * testsuite/split_i386_1.s: New file.
7603 * testsuite/split_i386_2.s: New file.
7604 * testsuite/split_i386_3.s: New file.
7605 * testsuite/split_i386_4.s: New file.
7606 * testsuite/split_i386_n.s: New file.
7607 * testsuite/split_x86_64_1.s: New file.
7608 * testsuite/split_x86_64_2.s: New file.
7609 * testsuite/split_x86_64_3.s: New file.
7610 * testsuite/split_x86_64_4.s: New file.
7611 * testsuite/split_x86_64_n.s: New file.
7612 * testsuite/testfile.cc (Target_test): Update relocation_section
7614 * testsuite/Makefile.in: Rebuild.
7616 2009-10-06 Ian Lance Taylor <iant@google.com>
7618 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
7619 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
7620 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
7621 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
7622 the address on ldo_addrs_.
7623 (Target_i386::Relocate::fix_up_ldo): New function.
7625 2009-10-06 Rafael Espindola <espindola@google.com>
7627 * plugin.cc (add_input_library): New.
7628 (Plugin::load): Add add_input_library to tv.
7629 (Plugin_manager::add_input_file): Add the is_lib argument.
7630 (add_input_file): Update call to Plugin_manager::add_input_file.
7631 (add_input_library): New.
7632 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
7634 2009-09-30 Doug Kwan <dougkwan@google.com>
7636 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
7637 symbol and call Symbol::may_need_copy_reloc to determine if
7638 a copy reloc is needed.
7639 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
7640 nocopyreloc is given in command line.
7641 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
7642 given in command line.
7643 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
7644 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
7645 of the removed Target_i386::may_need_copy_reloc.
7646 * options.h (copyreloc): New option with default value false.
7647 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
7648 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
7649 instead of the removed Target_powerpc::may_need_copy_reloc.
7650 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
7651 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
7652 instead of the removed Target_sparc::may_need_copy_reloc.
7653 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
7654 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
7655 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
7656 instead of the removed Target_x86_64::may_need_copy_reloc.
7658 2009-09-30 Ian Lance Taylor <iant@google.com>
7660 * object.h (class Object): Remove target_ field, and target,
7661 sized_target, and set_target methods.
7662 (Object::sized_target): Remove.
7663 (class Sized_relobj): Update declarations. Remove sized_target.
7664 * object.cc (Sized_relobj::setup): Remove target parameter.
7666 (Input_objects::add_object): Don't do anything with the target.
7667 (make_elf_sized_object): Add punconfigured parameter. Change all
7668 callers. Set or test parameter target.
7669 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
7671 * parameters.cc (Parameters::set_target): Change parameter type to
7673 (Parameters::default_target): Remove.
7674 (set_parameters_target): Change parameter type to be non-const.
7675 (parameters_force_valid_target): New function.
7676 (parameters_clear_target): New function.
7677 * parameters.h (class Parameters): Update declarations. Remove
7678 default_target method. Add sized_target and clear_target
7679 methods. Change target_ to be non-const.
7680 (set_parameters_target): Update declaration.
7681 (parameters_force_valid_target): Declare.
7682 (parameters_clear_target): Declare.
7683 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
7684 as NULL if we aren't searching.
7685 (Add_symbols::run): Don't check for compatible target.
7686 * fileread.cc (Input_file::open_binary): Call
7687 parameters_force_valid_target.
7688 * gold.cc (queue_middle_tasks): Likewise.
7689 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
7690 set_target on object.
7691 * dynobj.h (class Sized_dynobj): Update declarations.
7692 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
7693 make_elf_object returns NULL.
7694 (Archive::include_member): Don't check whether object target is
7696 * output.cc (Output_section::add_input_section): Get target from
7698 (Output_section::relax_input_section): Likewise.
7699 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
7701 (Sized_relobj::do_scan_relocs): Likewise.
7702 (Sized_relobj::relocate_sections): Likewise.
7703 * resolve.cc (Symbol_table::resolve): Likewise.
7704 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
7705 parameter. Change all callers.
7706 (Symbol_table::add_from_object): Get target from parameters.
7707 (Symbol_table::add_from_relobj): Don't check object target.
7708 (Symbol_table::add_from_dynobj): Likewise.
7709 (Symbol_table::define_special_symbol): Get target from
7711 * symtab.h (class Symbol_table): Update declaration.
7712 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
7713 parameter. Change all callers. Clear parameter target.
7714 (Binary_test): Test target here.
7715 * testsuite/object_unittest.cc (gold_testsuite): Remove
7716 target_test_pointer parameter. Change all callers.
7717 (Object_test): Test target here.
7719 2009-09-26 Ian Lance Taylor <iant@google.com>
7721 * testsuite/initpri1.c: Don't try to use constructor priorities if
7722 compiling with gcc before 4.3.
7724 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
7726 * testsuite/retain_symbols_file_test.sh (check_present): Change
7727 output file name to retain_symbols_file_test.stdout.
7728 (check_absent): Likewise.
7730 2009-09-18 Craig Silverstein <csilvers@google.com>
7732 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
7733 * options.cc: Include <cerrno> and <fstream>.
7734 (General_options::finalize): Parse -retain-symbols-file tag.
7735 * options.h: New flag.
7736 (General_options): New method should_retain_symbol, new
7737 variable symbols_to_retain.
7738 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
7739 should_retain_symbol map.
7740 * testsuite/Makefile.am (retain_symbols_file_test): New test.
7741 * testsuite/Makefile.in: Regenerate.
7742 * testsuite/retain_symbols_file_test.sh: New file.
7744 2009-09-18 Nick Clifton <nickc@redhat.com>
7746 * po/es.po: Updated Spanish translation.
7748 2009-09-17 Doug Kwan <dougkwan@google.com>
7750 * debug.h (DEBUG_RELAXATION): New constant.
7751 (DEBUG_ALL): Add DEBUG_RELAXATION.
7752 (debug_string_to_enum): Add relaxation debug option.
7754 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
7755 Layout::Relaxation_debug_check::read_sections,
7756 Layout::Relaxation_debug_check::read_sections): New method definitions.
7757 (Layout::Layout): Initialize data members
7758 record_output_section_data_from_scrips_,
7759 script_output_section_data_list_ and relaxation_debug_check_.
7760 (Layout::save_segments, Layout::restore_segments,
7761 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7762 Layout::relaxation_loop_body): New method definitions.
7763 (Layout::finalize): Support relaxation. Move section layout code to
7764 Layout::relaxation_loop_body.
7765 (Layout::set_asection_address_from_script): Move code for orphan
7766 section placement out.
7767 (Layout::place_orphan_sections_in_script): New method definition.
7768 * layout.h (Output_segment_headers, Output_file_header):
7769 New forward class declarations.
7770 (Layout::~Layout): Define.
7771 (Layout::new_output_section_data_from_script): New method definition.
7772 (Layout::place_orphan_sections_in_script): New method declaration.
7773 (Layout::Segment_states): New type declaration.
7774 (Layout::save_segments, Layout::restore_segments,
7775 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7776 Layout::relaxation_loop_body): New method declarations.
7777 (Layout::Output_section_data_list): New type declaration.
7778 (Layout::Relaxation_debug_check): New class definition.
7779 (Layout::record_output_section_data_from_script_,
7780 Layout::script_output_section_data_list_, Layout::segment_states_,
7781 Layout::relaxation_debug_check_): New data members.
7782 * output.cc: (Output_section_headers::do_size): New method definition.
7783 (Output_section_headers::Output_section_headers): Move size
7784 computation to Output_section_headers::do_size.
7785 (Output_segment_headers::do_size): New method definition.
7786 (Output_file_header::Output_file_header): Move size computation to
7787 Output_file_header::do_size and call it.
7788 (Output_file_header::do_size): New method definition.
7789 (Output_data_group::Output_data_group): Adjust call to
7790 Output_section_data.
7791 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
7792 (Output_symtab_xindex::do_write): Add array bound check.
7793 (Output_section::Input_section::print_to_mapfile): Handle
7794 RELAXED_INPUT_SECTION_CODE.
7795 (Output_section::Output_section): Initialize data member checkpoint_.
7796 (Output_section::~Output_section): Delete checkpoint object pointed
7798 (Output_section::add_input_section): Always add an Input_section if
7800 (Output_section::add_merge_input_section): Add assert.
7801 (Output_section::relax_input_section): New method definition.
7802 (Output_section::set_final_data_size): Set load address to zero for
7803 an unallocated section.
7804 (Output_section::do_address_and_file_offset_have_reset_values):
7805 New method definition.
7806 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
7807 Handle relaxed input section.
7808 (Output_section::sort_attached_input_sections): Checkpoint input
7809 section list lazily.
7810 (Output_section::get_input_sections): Change type of input_sections to
7811 list of Simple_input_section pointers. Checkpoint input section list
7812 lazily. Also handle relaxed input sections.
7813 (Output_section::add_input_section_for_script): Take a reference to
7814 a Simple_input_section object instead of Relobj pointer and section
7815 index as parameter. Handle relaxed input sections.
7816 (Output_section::save_states, Output_section::restore_states): New
7818 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
7819 (Output_data::is_data_size_fixed): New method definition.
7820 (Output_data::reset_addresss_and_file_offset): Do not reset data size
7822 (Output_data::address_and_file_offset_have_reset_values): New method
7824 (Output_data::do_address_and_file_offset_have_reset_values): New method
7826 (Output_data::set_data_size): Check that data size is not fixed.
7827 (Output_data::fix_data_size): New method definition.
7828 (Output_data::is_data_size_fixed_): New data member.
7829 (Output_section_headers::set_final_data_size): New method definition.
7830 (Output_section_headers::do_size): New method declaration.
7831 (Output_segment_headers::set_final_data_size): New method definition.
7832 (Output_segment_headers::do_size): New method declaration.
7833 (Output_file_header::set_final_data_size)::New method definition.
7834 (Output_file_header::do_size)::New method declaration.
7835 (Output_section_data::Output_section_data): Add new parameter
7836 is_data_size_fixed and use it to fix data size.
7837 (Output_data_const::Output_data_const): Adjust call to base class
7838 constructor and fix data size.
7839 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
7840 base class constructor and fix data size.
7841 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
7842 base class constructor and fix data size.
7843 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
7844 class constructor and fix data size.
7845 (Output_data_group::set_final_data_size): New method definition.
7846 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
7847 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
7848 class constructor and fix data size.
7849 (Output_relaxed_input_section): New class definition.
7850 (Output_section::Simple_input_section): New class definition.
7851 (Output_section::get_input_sections): Adjust parameter list.
7852 (Output_section::add_input_section_for_script): Same.
7853 (Output_section::save_states, Output_section::restore_states,
7854 Output_section::do_address_and_file_offset_have_reset_values,
7855 (Output_section::Input_section::Input_section): Handle
7856 RELAXED_INPUT_SECTION_CODE. Add new overload for
7857 Output_relaxed_input_section.
7858 (Output_section::Input_section::is_input_section,
7859 Output_section::Input_section::set_output_section): Handle relaxed
7861 (Output_section::Input_section::is_relaxed_input_section,
7862 Output_section::Input_section::output_section_data,
7863 Output_section::Input_section::relaxed_input_section): New method
7865 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
7867 (Output_section::Input_section::u1_): Update comments.
7868 (Output_section::Input_section::u2_): Add new union member poris.
7869 (Output_section::Checkpoint_output_section): New classs definition.
7870 (Output_section::relax_input_section): New method declaration.
7871 (Output_section::checkpoint_): New data member.
7872 (Output_segment): Update comments.
7873 (Output_segment::Output_segment): Un-privatize copy constructor.
7874 (Output_segment::operator=): Un-privatize.
7875 * script-sections.cc (Output_section_element::Input_section_list):
7876 Change element type to Output_section::Simple_input_section.
7877 (Output_section_element_dot_assignment::set_section_addresses):
7878 Register output section data for relaxation clean up.
7879 (Output_data_exression::Output_data_expression): Adjust call to base
7880 constructor to fix data size.
7881 (Output_section_element_data::set_section_addresses): Register
7882 Output_data_expression object for relaxation clean up.
7883 (struct Input_section_info): Replace Relobj pointer and section index
7884 pair with Output_section::Simple_input_section and Convert struct to a
7886 (Input_section_sorter::operator()): Adjust access to
7887 Input_section_info data member to use accessors.
7888 (Output_section_element_input::set_section_addresses): Use layout
7889 parameter. Adjust code to use Output_section::Simple_input_section
7890 and Input_secction_info classes. Register filler for relaxation
7892 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
7893 and section index pair with Output_section::Simple_input_section
7894 class. Adjust code accordingly.
7895 (Phdrs_element::release_segment): New method definition.
7896 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
7898 (Script_sections::release_segments): New method definition.
7899 * gold/script-sections.h (Script_sections::release_segments): New
7901 * gold/target.h (Target::may_relax, Target::relax,
7902 Target::do_may_relax, Target::do_relax): New method definitions.
7904 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7906 * arm.cc (has_signed_unsigned_overflow): New function.
7907 (Arm_relocate_functions::abs8): New function.
7908 (Target_arm::Scan::local): Handle R_ARM_ABS8.
7909 (Target_arm::Scan::global): Likewise.
7910 (Target_arm::relocate::relocate): Likewise.
7911 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7914 2009-09-16 Cary Coutant <ccoutant@google.com>
7916 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
7917 * testsuite/Makefile.in: Regenerate.
7919 2009-09-11 Nick Clifton <nickc@redhat.com>
7921 * po/gold.pot: Updated by the Translation project.
7923 2009-09-08 Cary Coutant <ccoutant@google.com>
7925 * output.cc (Output_file::open): Add execute permission to empty file.
7926 * testsuite/Makefile.am (permission_test): New test.
7927 * testsuite/Makefile.in: Regenerate.
7929 2009-09-02 Ian Lance Taylor <iant@google.com>
7931 * output.cc (Output_file::resize): Call map_no_anonymous rather
7934 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
7936 * gold.cc: Include "incremental.h".
7937 (queue_initial_tasks): Call Incremental_checker methods.
7938 * incremental.cc: Include "output.h".
7939 (Incremental_checker::can_incrementally_link_output_file): New
7941 * incremental.h (Incremental_checker): New class.
7943 * output.cc (Output_file::open_for_modification): New method.
7944 (Output_file::map_anonymous): Changed return type to bool. Record
7946 (Output_file::map_no_anonymous): New method, broken out of map.
7947 (Output_file::map): Use map_no_anonymous and map_anonymous.
7948 * output.h (class Output_file): Update declarations.
7950 2009-08-24 Cary Coutant <ccoutant@google.com>
7952 * options.h (Command_line::Pre_options): New class.
7953 (Command_line::pre_options): New member.
7954 * options.cc (gold::options::ready_to_register): New variable.
7955 (One_option::register_option): Do nothing if not registering options.
7956 Assert if same short option registered twice.
7957 (General_options::General_options): Turn off option registration when
7959 (Command_line::Pre_options::Pre_options): New constructor.
7961 2009-08-24 Cary Coutant <ccoutant@google.com>
7963 * options.h (General_options::no_keep_memory): Remove incorrect
7966 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7968 * Makefile.am (am__skiplex, am__skipyacc): New.
7969 * Makefile.in: Regenerate.
7971 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7973 * Makefile.am (AM_CPPFLAGS): Renamed from ...
7974 (INCLUDES): ... this.
7975 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
7976 (AM_CPPFLAGS): Renamed from ...
7977 (INCLUDE): ... this.
7978 * Makefile.in, testsuite/Makefile.in: Regenerate.
7980 * Makefile.in: Regenerate.
7981 * aclocal.m4: Likewise.
7982 * config.in: Likewise.
7983 * configure: Likewise.
7984 * testsuite/Makefile.in: Likewise.
7986 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7987 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7988 * Makefile.in: Regenerate.
7989 * testsuite/Makefile.in: Regenerate.
7991 2009-08-19 Cary Coutant <ccoutant@google.com>
7993 * resolve.cc (Symbol_table::resolve): Don't complain about defined
7994 symbols in shared libraries overridden by hidden or internal symbols
7995 in the main program.
7997 2009-08-19 Chris Demetriou <cgd@google.com>
7999 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
8000 checking source file names in error messages.
8002 2009-08-18 Doug Kwan <dougkwan@google.com>
8004 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
8005 an elcpp::Ehdr as parameter. Adjust call to set_target.
8006 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
8007 an elfcpp::Ehdr as parameter.
8008 * object.cc (Object::set_target): Remove the version that looks up
8009 a target and sets it.
8010 (Sized_relobj::setup): Take a Target object instead of
8011 an elfcpp::Ehdr as parameter. Adjust call to set_target.
8012 (make_elf_sized_object): Find target and ask target to
8014 * object.h: (Object::set_target): Remove the version that looks up
8015 a target and sets it.
8016 (Sized_relobj::setup): Take a Target object instead of
8017 an elfcpp:Ehdr as parameter.
8018 * target.cc: Include dynobj.h.
8019 (Target::do_make_elf_object_implementation): New.
8020 (Target::do_make_elf_object): New.
8021 * target.h (Target::make_elf_object): New template declaration.
8022 (Target::do_make_elf_object): New method declarations.
8023 (Target::do_make_elf_object_implementation): New template declaration.
8025 2009-08-14 Ian Lance Taylor <iant@google.com>
8027 * gold.h (FUNCTION_NAME): Define.
8028 (gold_unreachable): Use FUNCTION_NAME.
8030 2009-08-12 Sriraman Tallam <tmsriram@google.com>
8032 * icf.cc (Icf::find_identical_sections): Issue a warning when a
8033 symbol in the --keep-unique list is not found.
8035 2009-08-12 Sriraman Tallam <tmsriram@google.com>
8037 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
8038 been maked as --keep-unique.
8039 (Icf::unfold_section): New function.
8040 * icf.h (Icf::unfold_section): New function.
8041 * options.h (General_options::keep_unique): New option.
8042 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
8043 * testsuite/Makefile.in: Regenerate.
8044 * testsuite/icf_keep_unique_test.sh: New file.
8045 * testsuite/icf_keep_unique_test.cc: New file.
8047 2009-08-12 Cary Coutant <ccoutant@google.com>
8050 * resolve.cc (Symbol_table::resolve): Check for references from
8051 dynamic objects to hidden and internal symbols.
8052 * testsuite/Makefile.am (hidden_test.sh): New test.
8053 * testsuite/Makefile.in: Regenerate.
8054 * testsuite/hidden_test.sh: New script.
8055 * testsuite/hidden_test_1.c: New test source.
8056 * testsuite/hidden_test_main.c: New test source.
8058 2009-08-11 Doug Kwan <dougkwan@google.com>
8060 * arm.cc: Update comments.
8061 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
8062 segment to locate the .ARM.exidx section if present.
8064 2009-08-09 Doug Kwan <dougkwan@google.com>
8066 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
8069 2009-08-07 Sriraman Tallam <tmsriram@google.com>
8070 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
8073 2009-08-06 Sriraman Tallam <tmsriram@google.com>
8075 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
8076 valid tls_segment only for non-debug-section relocations.
8077 * testsuite/Makefile.am: Add gc_tls_test.
8078 * testsuite/Makefile.in: Regenerate.
8079 * testsuite/gc_tls_test.cc: New file.
8080 * testsuite/gc_tls_test.sh: New file.
8082 2009-08-05 Sriraman Tallam <tmsriram@google.com>
8086 * Makefile.am (CCFILES): Add icf.cc.
8088 * Makefile.in: Regenerate.
8089 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
8090 * gc.h (gc_process_relocs): Populate lists used by icf to contain
8091 section, symbol and addend information for the relocs.
8092 * gold.cc (queue_middle_tasks): Call identical code folding.
8093 * gold.h: Add defines for multimap.
8094 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
8095 to the call of finalize_local_symbols.
8096 * main.cc (main): Create object of class Icf.
8097 * object.cc (Sized_relobj::do_layout): Allow this function to be
8098 called twice during icf.
8099 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
8100 to sections marked as identical by icf.
8101 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
8103 (Sized_relobj::do_section_entsize): New function.
8104 * object.h (Object::section_entsize): New function.
8105 (Object::do_section_entsize): New pure virtual function.
8106 (Relobj::finalize_local_symbols): Add new parameter.
8107 (Relobj::do_section_entsize): New function.
8108 * options.h (General_options::icf): New option.
8109 (General_options::icf_iterations): New option.
8110 (General_options::print_icf_sections): New option.
8111 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
8112 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
8113 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
8115 * symtab.cc (Symbol_table::is_section_folded): New function.
8116 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
8117 to sections marked as identical by icf.
8118 * symtab.h (Symbol_table::set_icf): New function.
8119 (Symbol_table::icf): New function.
8120 (Symbol_table::is_section_folded): New function.
8121 (Symbol_table::icf_): New data member.
8122 * target-reloc.h (relocate_section): Ignore sections folded by icf.
8123 * testsuite/Makefile.am: Add commands to build icf_test.
8124 * testsuite/Makefile.in: Regenerate.
8125 * testsuite/icf_test.sh: New file.
8126 * testsuite/icf_test.cc: New file.
8128 2009-07-24 Chris Demetriou <cgd@google.com>
8130 * layout.cc (is_compressible_debug_section): Fix incorrect
8131 comment about compressed section names.
8133 2009-07-20 Ian Lance Taylor <ian@airs.com>
8136 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
8138 2009-07-16 Ian Lance Taylor <iant@google.com>
8141 * layout.h: #include <map>.
8142 (class Kept_section): Change from struct to class. Add accessors
8143 and setters. Add section size to Comdat_group mapping. Change
8144 Comdat_group to std::map. Add is_comdat_ field. Add
8145 linkonce_size field in union.
8146 (class Layout): Update declaration of find_or_add_kept_section.
8147 Don't declare find_kept_object.
8148 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
8149 parameter. Add object, shndx, is_comdat, and is_group_name
8150 parameters. Change all callers. Adjust for new Kept_section.
8151 (Layout::find_kept_object): Remove.
8152 * object.cc (Sized_relobj::include_section_group): Update use of
8153 Kept_section. Rename secnum to shndx. Only record
8154 Kept_comdat_section if sections are the same size.
8155 (Sized_relobj::include_linkonce_section): Update use of
8156 Kept_section. Only record Kept_comdat_section if sections are the
8157 same size. Set size of linkonce section.
8158 (Sized_relobj::map_to_kept_section): Update call to
8159 get_kept_comdat_section.
8160 * object.h (class Sized_relobj): Rename fields in
8161 Kept_comdat_section to drop trailing underscores; change object
8162 field to Relobj*. Change Kept_comdat_section_table to store
8163 struct rather than pointer.
8164 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
8165 Add kept_object and kept_shndx parameters. Change all callers.
8166 (Sized_relobj::get_kept_comdat_section): Change return type to
8167 bool. Add kept_object and kept_shndx parameters. Change all
8169 * plugin.cc (Pluginobj::include_comdat_group): Update call to
8170 Layout::find_or_add_kept_section.
8172 2009-07-09 Ian Lance Taylor <iant@google.com>
8174 * merge.cc (Object_merge_map::initialize_input_to_output_map):
8175 Reserve space in the hash table.
8177 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
8179 * fileread.cc (File_read::get_mtime): New method.
8180 * fileread.h (Timespec): New structure.
8181 (File_read::get_mtime): New method.
8182 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
8183 Renamed from timestamp_nsec.
8184 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
8186 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
8188 (Incremental_inputs::report_archive): Save mtime; style fix.
8189 (Incremental_inputs::report_obejct): Save mtime; style fix.
8190 (Incremental_inputs::report_script): Save mtime; style fix.
8191 (Incremental_inputs::finalize_inputs): Style fix.
8192 (Incremental_inputs::finalize): Style fix.
8193 (Incremental_inputs::create_input_section_data): Store inputs
8195 * incremental.h (Incremental_inputs::report_script): Add mtime
8197 (Incremental_inputs::Input_info::Input_info): Intialize only one
8199 (Incremental_inputs::Input_info::archive): Move to nameless
8201 (Incremental_inputs::Input_info::obejct): Move to nameless union.
8202 (Incremental_inputs::Input_info::script): Move to nameless union.
8203 (Incremental_inputs::mtime): New field.
8204 * script.cc (read_input_script): Pass file mtime to
8206 * script.h (Script_info::inputs): Style fix.
8208 2009-07-01 Ian Lance Taylor <ian@airs.com>
8210 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
8213 2009-06-24 Ian Lance Taylor <iant@google.com>
8216 * layout.cc (Layout::choose_output_section): If we find an
8217 existing section, update the flags.
8218 (Layout::create_notes): New function, broken out of
8220 (Layout::finalize): Don't create note sections.
8221 (Layout::create_note): Don't crash if linker script discards
8223 (Layout::create_gold_note): Likewise.
8224 (Layout::create_build_id): Likewise. Don't set
8225 after_input_sections on the section.
8226 (Layout::create_executable_stack_info): Remove target parameter.
8228 * layout.h (class Layout): Declare create_notes. Update
8229 declaration of create_executable_stack_info.
8230 * gold.cc (queue_middle_tasks): Call create_notes.
8231 * output.cc (Output_section::update_flags_for_input_section): Move
8232 here from output.h. If SHF_ALLOC flag is newly set, mark address
8234 * output.h (Output_data::mark_address_invalid): New function.
8235 (class Output_section): Only declare, not define,
8236 update_flags_for_input_section. Remove set_flags.
8238 2009-06-24 Ian Lance Taylor <iant@google.com>
8240 * script-sections.cc (Output_section_definition::
8241 set_section_addresses): Rename shadowing local load_address to
8244 2009-06-24 Ian Lance Taylor <iant@google.com>
8247 * reloc.cc (relocate_sections): Skip empty relocation sections.
8249 2009-06-23 Ian Lance Taylor <iant@google.com>
8252 * layout.cc (Layout::create_note): Use choose_output_section
8253 rather than make_output_section.
8255 2009-06-23 Ian Lance Taylor <iant@google.com>
8258 * options.cc (General_options::parse_V): Set printed_version_.
8259 (General_options::General_options): Initialize printed_version_.
8260 * options.h (class General_options): Add printed_version_ field.
8261 * gold.cc (queue_initial_tasks): If there are no input files,
8262 don't give a fatal error if we printed the version information.
8263 (queue_middle_tasks): If using -r with a shared object, give a
8264 fatal error rather than an ordinary error.
8266 2009-06-23 Ian Lance Taylor <iant@google.com>
8269 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
8270 (Layout::make_output_section): Set have_stabstr_section_ if we see
8271 a .stab*str section.
8272 (Layout::finalize): Call link_stabs_sections.
8273 (Layout::link_stabs_sections): New file.
8274 * layout.h (class Layout): Add have_stabstr_section_ field.
8275 Declare link_stabs_sections.
8277 2009-06-23 Doug Kwan <dougkwan@google.com>
8279 * Makefile.am (libgold_a_LIBADD): New.
8280 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
8281 * Makefile.in: Regenerate.
8282 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
8283 * configure: Regenerate.
8284 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
8285 * fileread.cc: Include sys/state.h
8286 * gold.h: Declare memmem and strndup if found missing.
8287 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
8289 2009-06-23 Ian Lance Taylor <iant@google.com>
8291 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
8292 * configure: Rebuild.
8294 2009-06-23 Ian Lance Taylor <iant@google.com>
8297 * object.cc (Object::section_contents): Don't try to get a view if
8298 the section has length zero.
8299 (Object::handle_gnu_warning_section): If the section is empty, use
8300 the name of the section as the warning.
8302 2009-06-23 Ian Lance Taylor <iant@google.com>
8305 * stringpool.h (class Stringpool_template): Add optimize_ field.
8306 (Stringpool_template::set_optimize): New function.
8307 * stringpool.cc (Stringpool_template::Stringpool_template):
8308 Initialize optimize_ field.
8309 (Stringpool_template::set_string_offsets): Test local optimize
8310 fild rather than parameter.
8311 * layout.cc (Layout::Layout): Call set_optimize on the section
8314 2009-06-22 Ian Lance Taylor <iant@google.com>
8317 * yyscript.y: Parse TARGET.
8318 * script.cc (script_set_target): New function.
8319 * script-c.h (script_set_target): Declare.
8320 * options.cc (General_options::string_to_object_format): Rename
8321 from string_to_object_format in anonymous namespace. Change
8323 * options.h (class General_options): Declare
8324 string_to_object_format.
8326 2009-06-22 Ian Lance Taylor <iant@google.com>
8328 * script-sections.cc (Script_sections::create_segments): Don't put
8329 program headers in a PT_LOAD segment if -n or -N.
8331 2009-06-22 Ian Lance Taylor <iant@google.com>
8334 * options.h (class General_options): Add -z lazy and -z now. Sort
8335 -z options into alphabetical order.
8336 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
8338 2009-06-21 Ian Lance Taylor <iant@google.com>
8340 * layout.cc (Layout::make_output_section): Call
8341 Target::new_output_section.
8342 (Layout::attach_allocated_section_to_segment): Put large section
8343 sections in a separate load segment with the large segment flag
8345 (Layout::segment_precedes): Sort large data segments after other
8347 (align_file_offset): New static function.
8348 (Layout::set_segment_offsets): Use align_file_offset.
8349 * output.h (class Output_section): Add is_small_section_ and
8350 is_large_section_ fields.
8351 (Output_section::is_small_section): New function.
8352 (Output_section::set_is_small_section): New function.
8353 (Output_section::is_large_section): New function.
8354 (Output_section::set_is_large_section): New function.
8355 (Output_section::is_large_data_section): New function.
8356 (class Output_segment): Add is_large_data_segment_ field.
8357 (Output_segment::is_large_data_segment): New function.
8358 (Output_segment::set_is_large_data_segment): New function.
8359 * output.cc (Output_section::Output_section): Initialize new
8361 (Output_segment::Output_segment): Likewise.
8362 (Output_segment::add_output_section): Add assertion that large
8363 data sections always go in large data segments. Force small data
8364 sections to the end of the list of data sections. Force small BSS
8365 sections to the start of the list of BSS sections. For large BSS
8366 sections to the end of the list of BSS sections.
8367 * symtab.h (class Symbol): Declare is_common_shndx.
8368 (Symbol::is_defined): Check Symbol::is_common_shndx.
8369 (Symbol::is_common): Likewise.
8370 (class Symbol_table): Define enum Commons_section_type. Update
8371 declarations. Add small_commons_ and large_commons_ fields.
8372 * symtab.cc (Symbol::is_common_shndx): New function.
8373 (Symbol_table::Symbol_table): Initialize new fields.
8374 (Symbol_table::add_from_object): Put small and large common
8375 symbols in the right list.
8376 (Symbol_table::sized_finalized_symbol): Check
8377 Symbol::is_common_shndx.
8378 (Symbol_table::sized_write_globals): Likewise.
8379 * common.cc (Symbol_table::do_allocate_commons): Allocate new
8380 common symbol lists. Don't call do_allocate_commons_list if the
8382 (Symbol_table::do_allocate_commons_list): Remove is_tls
8383 parameter. Add comons_section_type parameter. Change all
8384 callers. Handle small and large common symbols.
8385 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
8386 Symbol::is_common_shndx.
8387 * resolve.cc (symbol_to_bits): Likewise.
8388 * target.h (Target::small_common_shndx): New function.
8389 (Target::small_common_section_flags): New function.
8390 (Target::large_common_shndx): New function.
8391 (Target::large_common_section_flags): New function.
8392 (Target::new_output_section): New function.
8393 (Target::Target_info): Add small_common_shndx, large_common_shndx,
8394 small_common_section_flags, and large_common_section_flags
8396 (Target::do_new_output_section): New virtual function.
8397 * arm.cc (Target_arm::arm_info): Initialize new fields.
8398 * i386.cc (Target_i386::i386_info): Likewise.
8399 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
8401 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
8402 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
8403 (Target_x86_64::do_new_output_section): New function.
8404 * configure.ac: Define conditional MCMODEL_MEDIUM.
8405 * testsuite/Makefile.am (check_PROGRAMS): Add large.
8406 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
8407 (large_LDFLAGS): Define.
8408 * testsuite/large.c: New file.
8409 * testsuite/testfile.cc (Target_test::test_target_info):
8410 Initialize new fields.
8411 * configure, testsuite/Makefile.in: Rebuild.
8413 2009-06-05 Doug Kwan <dougkwan@google.com>
8415 * Makefile.am (CCFILES): Add target.cc.
8416 * Makefile.in: Regenerate.
8417 * i386.cc (class Target_i386): Define new virtual method to
8418 override do_is_local_label_name in parent.
8419 * object.cc (Sized_relobj::do_count_local_symbols): Discard
8420 local symbols if --discard-locals or -X is given.
8421 * options.h (class General_options): Declare new options
8422 '--discard-locals' and '-X' for discarding locals.
8423 * target.h (class Target): Define new methods is_local_label_name.
8424 Declare new virtual method do_is_local_label_name.
8425 * target.cc: New file.
8426 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
8427 (check_SCRIPTS): Add discard_locals_test.sh.
8428 (check_DATA): Add discard_local_tests.syms.
8429 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
8430 (discard_local_tests.syms, discard_locals_test.o): New make rules.
8431 * testsuite/Makefile.in: Regenerate.
8432 * testsuite/discard_locals_test.c: New file.
8433 * testsuite/discard_locals_test.sh: Same.
8435 2009-06-05 Doug Kwan <dougkwan@google.com>
8437 * object.cc (Sized_relobj::Sized_relobj): Initialize
8438 discarded_eh_frame_shndx_ to -1U.
8439 (Sized_relobj::do_layout): Record index of a discard .eh_frame
8441 (Sized_relobj::do_count_local_symbols): Skip local symbols in
8442 a discarded .eh_frame section.
8443 (Sized_relobj::do_finalize_local_symbols): Ditto.
8444 * object.h (class Sized_relobj): Declare new member
8445 discarded_eh_frame_shndx_.
8446 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
8447 (local_labels_test.o, local_labels_test): New rules.
8448 * testsuite/Makefile.in: Regenerate.
8450 2009-06-04 Doug Kwan <dougkwan@google.com>
8452 * layout.cc (Layout::section_name_mapping): Add mapping for
8453 special ARM sections.
8455 2009-06-03 Doug Kwan <dougkwan@google.com>
8457 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
8458 (utils::has_overflow): Same.
8460 2009-06-03 Ian Lance Taylor <iant@google.com>
8462 * layout.cc (Layout::section_name_mapping): New array, replacing
8463 Layout::linkonce_mapping.
8464 (Layout::section_name_mapping_count): New variable, replacing
8465 Layout::linkonce_mapping_count.
8466 (Layout::linkonce_output_name): Remove.
8467 (Layout::output_section_name): Rewrite.
8468 * layout.h (class Layout): Rename Linkonce_mapping to
8469 Section_name_mapping, linkonce_mapping to section_name_mapping,
8470 linkonce_mapping_count to section_name_mapping_count. Don't
8471 declare linkonce_output_name.
8473 2009-06-03 Doug Kwan <dougkwan@google.com>
8475 * gold/arm.cc (namespace utils): New.
8476 (Target_arm::reloc_is_non_pic): Define new method.
8477 (class Arm_relocate_functions): New.
8478 (Target_arm::Relocate::relocate): Handle relocation types used by
8481 2009-06-03 Ian Lance Taylor <iant@google.com>
8483 * arm.cc (Target_arm::scan::global): Use || instead of |.
8485 2009-06-02 Doug Kwan <dougkwan@google.com>
8487 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
8488 issued_non_pic_error_.
8489 (class Target_arm::Scan): Declare new method check_non_pic.
8490 Define new method symbol_needs_plt_entry.
8491 Declare new data member issued_non_pic_error_.
8492 (class Target_arm::Relocate): Declare new method
8493 should_apply_static_reloc.
8494 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
8495 (Target_arm::Scan::check_non_pic): Define new method.
8496 (Target_arm::Scan::local): Handle a small subset of reloc types used
8498 (Target_arm::Scan::local): Same.
8499 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
8501 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
8503 * incremental.cc (Incremental_inputs::report_command_line): Filter
8504 out --incremental-* options.
8506 2009-05-29 Doug Kwan <dougkwan@google.com>
8508 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
8510 (class Target_arm): Update comment.
8511 (Target_arm::Target_arm): Initialize new data members GOT_,
8512 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
8513 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
8514 and Target_arm::rel_dyn_section.
8515 Declare new_enum Target_arm::Got_type.
8516 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
8518 Update commments for member do_dynsym_value.
8519 (Target_arm::got_size, Target_arm::plt_section,
8520 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
8521 new methods inside class defintion.
8522 (Target_arm::got_section): Define new method.
8523 (Target_arm::rel_dyn_section): Same.
8524 (Output_data_plt_arm): New template class.
8525 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
8526 (Output_data_plt_arm:do_adjust_output_section): Define new method.
8527 (Output_data_plt_arm::add_entry): Same.
8528 (Output_data_plt_arm::first_plt_entry): Define new
8529 static data member for PLT instruction template.
8530 (Output_data_plt_arm::plt_entry): Same.
8531 (Output_data_plt_arm::do_write): Define new method.
8532 (Target_arm::make_plt_entry): Same.
8533 (Target_arm::do_finalize_sections): Same.
8534 (Target_arm::do_dynsym_value): Same.
8536 2009-05-28 Doug Kwan <dougkwan@google.com>
8538 * Makefile.am (TARGETSOURCES): Add arm.cc.
8539 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
8540 * Makefile.in: Regenerate.
8542 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
8544 2009-05-26 Doug Kwan <dougkwan@google.com>
8546 * options.cc (General_options::parse_exclude_libs). Fix a comment.
8547 (General_options::check_excluded_libs): Strip off directories in
8548 archive name before matching like GNU ld does.
8549 * testsuite/Makefile.am (MOSTLYCLEANFILES,
8550 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
8551 (exclude_libs_test_LDFLAGS): Add linker option
8552 -Wl,--exclude-libs,libexclude_libs_test_3
8553 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
8554 an explicit archive without using -l.
8555 (alt/libexclude_libs_test_3.a): New make rule.
8556 * testsuite/Makefile.in: Regenerate.
8557 * testsuite/exclude_libs_test.c : Declare lib3_default().
8559 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
8560 * exclude_libs_test_3.c: New file.
8562 2009-05-26 Nick Clifton <nickc@redhat.com>
8564 * po/id.po: New Indonesian translation.
8565 * po/gold.pot: Updated template file.
8567 2009-05-22 Sriraman Tallam <tmsriram@google.com>
8569 * testsuite/Makefile.am: Add -ffunction-sections to compile
8570 gc_comdat_test files. Add -Wl,--gc-sections to build
8572 * testsuite/Makefile.in: Regenerate.
8573 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
8575 2009-05-21 Sriraman Tallam <tmsriram@google.com>
8577 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
8578 kept comdat section was garbage collected.
8579 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
8580 * testsuite/Makefile.in: Regenerate.
8581 * testsuite/gc_comdat_test.sh: New file.
8582 * testsuite/gc_comdat_test_1.cc: New file.
8583 * testsuite/gc_comdat_test_2.cc: New file.
8585 2009-05-19 Doug Kwan <dougkwan@google.com>
8587 * archive.cc (Archive::Archive): Move constructor from archive.h
8588 to here. Initialize no_export_.
8589 (Archive::get_elf_object_for_member): Set no_export flag of object.
8590 * archive.h (Archive::Archive): Move constructor body to
8592 (Archive::no_export): New method.
8593 (Archive::no_export_): New field.
8594 * object.h (Object::Object): Initialize no_export_ to false.
8595 (Object::no_export, Object::set_no_export): New methods.
8596 (Object::no_export_): New field.
8597 * options.cc (General_options::parse_exclude_libs): New method.
8598 (General_options::check_excluded_libs) Same.
8599 * options.h (exclude_libs): New option.
8600 (General_options::check_excluded_libs): New method declaration.
8601 (General_options::excluded_libs_): New field.
8602 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
8603 default or protected visibility if an object has no-export flag set.
8604 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
8605 (check_SCRIPTS): Add exclude_libs_test.sh.
8606 (check_DATA): Add exclude_libs_test.syms.
8607 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
8608 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
8609 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
8610 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
8611 (exclude_libs_test.syms, libexclude_libs_test_1.a,
8612 libexclude_libs_test_2.a): New rules.
8613 * testsuite/Makefile.in: Regenerate.
8614 * testsuite/exclude_libs_test.c: New file.
8615 * testsuite/exclude_libs_test.sh: Ditto.
8616 * testsuite/exclude_libs_test_1.c: Ditto.
8617 * testsuite/exclude_libs_test_2.c: Ditto.
8619 2009-05-15 Ian Lance Taylor <iant@google.com>
8621 * configure.ac: Check for declarations for cases where libiberty.h
8622 checks HAVE_DECL_xxx.
8623 * configure, config.in: Rebuild.
8625 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
8627 * gold.h (Incremental_argument_list): Remove (invalid) forward
8629 * incremental.cc (Incremental_inputs::report_achive): New method.
8630 (Incremental_inputs::report_object): New method.
8631 (Incremental_inputs::report_script): New method.
8632 (Incremental_inputs::finalize_inputs): New method.
8633 (Incremental_inputs::finalize): Call finalize_inputs().
8634 (Incremental_inputs::sized_create_incremental_inputs_section_data):
8635 Create inputs entries.
8636 * incremental.h (Incremental_input_type): New enum.
8637 (Incremental_inputs::Incremental_input): Initialize new fields.
8638 (Incremental_inputs::report_inputs): New method.
8639 (Incremental_inputs::report_achive): New method.
8640 (Incremental_inputs::report_object): New method.
8641 (Incremental_inputs::report_script): New method.
8642 (Incremental_inputs::finalize_inputs): New method.
8643 (Incremental_inputs::Input_info): New struct.
8644 (Incremental_inputs::Input_info_map): New typedef.
8645 (Incremental_inputs::lock_): New field.
8646 (Incremental_inputs::Inputs_): New field.
8647 (Incremental_inputs::Inputs_map): New field.
8648 * main.cc (main): Call Incremental_input::report_inputs.
8649 * options.h (Input_argument_list): Typedef moved from
8651 (Input_file_group::Files): Remove, use ::Input_argument_list.
8652 (Input_file_group::Input_argument_list): Remove, use
8653 ::Input_argument_list.
8654 * plugin.cc (Plugin_manager::add_input_file): Add error in
8656 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
8658 * script.cc (read_input_script): Call
8659 Incremental_input::report_script.
8660 * script.h (Script_info): New class.
8662 2009-04-27 Ian Lance Taylor <iant@google.com>
8664 * x86_64.cc (do_adjust_output_section): Set entsize to
8667 2009-04-23 Elliott Hughes <enh@google.com>
8669 * output.cc (Output_file::close): After short writes, continue
8670 writing from the correct offset in the buffer being written.
8672 2009-04-23 Chris Demetriou <cgd@google.com>
8674 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
8675 * configure: Regenerate.
8676 * config.in: Regenerate.
8677 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
8678 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
8680 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
8682 * incremental.cc (Incremental_inputs_header_data): Renamed from
8683 Incremental_input_header_data.
8684 (Incremental_inputs_header_data::data_size): New field.
8685 (Incremental_inputs_header_data::put_input_file_count): Renamed
8686 from input_file_count.
8687 (Incremental_inputs_header_data::put_command_line_offset): Renamed
8688 from command_line_offset.
8689 (Incremental_inputs_header_data::put_reserved): Renamed from
8691 (Incremental_inputs_entry_data): Renamed from
8692 Incremental_input_entry_data.
8693 (Incremental_inputs_entry_data::data_size): New field.
8694 (Incremental_inputs::report_command_line): New method.
8695 (Incremental_inputs::finalize): New method.
8696 (Incremental_inputs::create_incremental_inputs_data): New method.
8697 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
8698 * incremental.h: New file.
8699 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
8700 (Layout::finalize): Create incremental inputs section in
8702 (Layout::create_incremental_info_sections): New method.
8703 * layout.h (Layout::incremental_inputs): New method.
8704 (Layout::create_incremental_info_sections): New method.
8705 (Layout::incremental_inputs_): New field.
8706 * main.cc (main): Notify Incremental_input of the command line.
8708 2009-04-01 Ian Lance Taylor <iant@google.com>
8709 Mikolaj Zalewski <mikolajz@google.com>
8711 * gold.h (reserve_unordered_map): Define, three versions, one for
8712 each version of Unordered_map.
8713 * layout.cc (Layout::Layout): Remove options parameter. Add
8714 number_of_input_files parameter. Don't initialize options_.
8715 Initialize number_of_input_files_ and resized_signatures_. Move
8716 sections_are_attached_.
8717 (Layout::layout_group): Reserve space for group_signatures_.
8718 (Layout::find_or_add_kept_section): Change name parameter to be a
8719 reference. Resize signatures_ map when it gets large enough.
8720 (Layout::layout_eh_frame): Use parameters->options() instead of
8722 (Layout::make_output_section): Likewise.
8723 (Layout::attach_allocated_section_to_segment): Likewise.
8724 (Layout::finalize, Layout::create_executable_stack): Likewise.
8725 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
8726 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
8727 * layout.h (class Layout): Update declarations. Remove options_
8728 field. Add number_of_input_files_ and resized_signatures_
8729 fields. Move sections_are_attached_ field.
8730 * main.cc (main): Pass number of input files to Layout
8731 constructor. Don't pass options.
8733 2009-03-30 Ian Lance Taylor <iant@google.com>
8735 * ffsll.c (ffsll): Correct implementation.
8737 2009-03-27 Ian Lance Taylor <iant@google.com>
8739 * ffsll.c: New file.
8740 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
8741 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
8742 * ftruncate.c (ftruncate): Declare before definition.
8743 * mremap.c (mremap): Likewise.
8744 * pread.c (pread): Likewise.
8745 * configure, Makefile.in, config.in: Rebuild.
8747 * mremap.c: New file.
8748 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
8749 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
8750 (mremap): Declare if HAVE_MREMAP is not defined.
8751 * configure, Makefile.in, config.in: Rebuild.
8753 2009-03-27 Cary Coutant <ccoutant@google.com>
8755 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
8756 position independent.
8757 * sparc.cc (Target_sparc::check_non_pic): Likewise.
8758 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
8760 2009-03-24 Cary Coutant <ccoutant@google.com>
8762 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
8764 (needs_dynamic_reloc): Likewise.
8766 2009-03-24 Ian Lance Taylor <iant@google.com>
8768 * yyscript.y (file_cmd): Recognize EXTERN.
8769 (extern_name_list, extern_name_list_body): New nonterminals.
8770 * script.cc (script_add_extern): Define.
8771 * script-c.h (script_add_extern): Declare.
8773 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
8775 * object.cc (is_elf_object): Define.
8776 * object.h (is_elf_object): Declare.
8777 * archive.cc (Archive::get_elf_object_for_member): Call
8779 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
8781 2009-03-24 Elliott Hughes <enh@google.com>
8783 * output.cc (Output_file::map_anonymous): Define.
8784 (Output_file::map): Use map_anonymous. If the regular mmap fails,
8785 try an anonymous one. Report the size if the mmap fails.
8786 * output.h (class Output_file): Declare map_anonymous.
8788 2009-03-24 Ian Lance Taylor <iant@google.com>
8790 * target-select.cc (instantiate_target): Don't acquire the lock if
8791 the instantiated_target_ field has already been set.
8793 2009-03-23 Ian Lance Taylor <iant@google.com>
8795 * gold-threads.h (class Initialize_lock): Define.
8796 * gold-threads.cc (class Initialize_lock_once): Define.
8797 (initialize_lock_control): New static variable.
8798 (initialize_lock_pointer): New static variable.
8799 (initialize_lock_once): New static function.
8800 (Initialize_lock::Initialize_lock): Define.
8801 (Initialize_lock::initialize): Define.
8802 * target-select.h: Include "gold-threads.h".
8803 (class Target_selector): Add lock_ and initialize_lock_ fields.
8804 Don't define instantiate_target, just declare it.
8805 * target-select.cc (Target_selector::Target_selector): Initialize
8807 (Target_selector::instantiate_target): Define.
8808 * descriptors.h: Include "gold-threads.h".
8809 (class Descriptors): Add initialize_lock_ field.
8810 * descriptors.cc (Descriptors::Descriptors): Initialize new
8812 (Descriptors::open): Use initialize_lock_ field
8813 * errors.h (class Errors): Add initialize_lock_ field.
8814 * errors.cc (Errors::Errors): Initialize new field.
8815 (Errors::initialize_lock): Use initialize_lock_ field.
8816 * powerpc.cc (class Target_selector_powerpc): Remove
8817 instantiated_target_ field. In do_recognize call
8818 instantiate_target rather than do_instantiate_target. In
8819 do_instantiate_target just allocate a new target.
8820 * sparc.cc (class Target_selector_sparc): Likewise.
8822 * freebsd.h: New file.
8823 * i386.cc: Include "freebsd.h".
8824 (Target_i386): Derive from Target_freebsd rather than
8826 (Target_selector_i386): Derive from Target_selector_freebsd rather
8827 than Target_selector.
8828 * x86_64.cc: Include "freebsd.h".
8829 (Target_x86_64): Derive from Target_freebsd rather than
8831 (Target_selector_x86_64): Derive from Target_selector_freebsd
8832 rather than Target_selector.
8833 * target.h (class Target): Add adjust_elf_header and
8834 do_adjust_elf_header.
8835 * output.cc (Output_file_header:: do_sized_write): Call target
8836 adjust_elf_header routine.
8837 * configure.tgt: Set targ_osabi.
8838 * configure.ac: Define GOLD_DEFAULT_OSABI.
8839 * parameters.cc (Parameters::default_target): Pass
8840 GOLD_DEFAULT_OSABI to select_target.
8841 * target-select.h (class Target_selector): Make instantiate_target
8842 protected rather than private.
8843 * Makefile.am (HFILES): Add freebsd.h.
8844 * configure, Makefile.in, config.in: Rebuild.
8846 * merge.cc (do_add_input_section): Correct pend value. Change
8847 message about last entry not being null terminated from error to
8850 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
8852 * incremental.cc: New file.
8853 * Makefile.am (CCFILES): Add incremental.cc.
8854 * Makefile.in: Rebuild.
8856 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
8858 * layout.cc (Layout::output_section_name): Preserve names
8859 of '.note.' sections.
8861 2009-03-19 Ian Lance Taylor <iant@google.com>
8863 * descriptors.cc (Descriptors::open): Check that the options are
8864 valid before using them.
8866 2009-03-18 Ian Lance Taylor <iant@google.com>
8868 * script-sections.h: Include <list>.
8869 (class Script_sections): Change Sections_elements from std::vector
8870 to std::list. Typedef public Elements_iterator. Add
8871 orphan_section_placement_, data_segment_align_start_, and
8872 saw_data_segment_align_ fields. Remove data_segment_align_index_
8874 * script-sections.cc (class Orphan_section_placement): New class.
8875 (class Sections_element): Add virtual functions is_relro and
8876 orphan_section_init. Remove virtual function place_orphan_here.
8877 (class Output_section_definition): Add is_relro and
8878 orphan_section_init. Remove place_orphan_here.
8879 (class Orphan_output_section): Likewise.
8880 (Script_sections::Script_sections): Update for field changes.
8881 (Script_sections::data_segment_align): Set saw_data_segment_align_
8882 and data_segment_align_start_, not data_segment_align_index.
8883 (Script_sections::data_segment_relro_end): Check
8884 saw_data_segment_align_. Use data_segment_align_start_ rather
8885 than data_segment_align_index_.
8886 (Script_sections::place_orphan): Rewrite to use
8887 Orphan_section_placement.
8889 2009-03-17 Ian Lance Taylor <iant@google.com>
8891 * archive.cc (Archive::add_symbols): Check for a version attached
8892 to the symbol name in the archive map.
8893 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
8894 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
8895 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
8896 (ver_test_11.a): New target.
8897 * testsuite/Makefile.in: Rebuild.
8899 * configure.ac: Check for chsize and posix_fallocate. Replace
8901 * ftruncate.c: New file, from gnulib.
8902 * output.cc (posix_fallocate): Define dummy version if not
8903 HAVE_POSIX_FALLOCATE.
8904 (Output_file::map): Call posix_fallocate rather than lseek and
8906 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
8907 * configure, Makefile.in, config.in: Rebuild.
8909 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
8911 * layout.h (Layout::create_note): Add section_name parameter.
8912 * layout.cc (Layout::create_note): Likewise.
8913 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
8915 2009-03-17 Ian Lance Taylor <iant@google.com>
8917 * descriptors.cc: Include "options.h".
8918 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
8919 (Descriptors::open): Always use O_CLOEXEC when opening a new
8920 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
8921 then set FD_CLOEXEC.
8923 * sparc.cc (class Target_sparc): Add has_got_section.
8924 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
8925 make sure we have a GOT section.
8927 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
8928 (Target_sparc::Scan::local): Likewise.
8929 (Target_sparc::Scan::global): Likewise.
8930 (Target_sparc::Relocate::relocate): Likewise.
8931 (Target_sparc::Relocate::relocate_tls): Likewise.
8933 * symtab.cc (Symbol_table::define_default_version): New function,
8934 broken out of add_from_object.
8935 (Symbol_table::add_from_object): Call define_default_version.
8936 (Symbol_table::define_special_symbol): Add resolve_oldsym
8937 parameter. Change all callers. If the version for a symbol comes
8938 from a version script, resolve it with the symbol with the same
8939 name with no version. Also add the symbol without a version if
8941 (do_define_in_output_data): If resolving with oldsym, don't delete
8943 (do_define_in_output_segment): Likewise.
8944 (do_define_as_constant): Likewise.
8945 * symtab.h (class Symbol_table): Update declarations.
8947 2009-03-13 Ian Lance Taylor <iant@google.com>
8949 * readsyms.cc (Read_symbols::incompatible_warning): New function.
8950 (Read_symbols::requeue): New function.
8951 (Read_symbols::do_read_symbols): If make_elf_object fails because
8952 the target type is not configured, and the file was searched for,
8953 issue a warning and retry with the next directory.
8954 (Add_symbols::run): If the file has an incompatible format, and
8955 it was searched for, requeue the Read_symbols task. On error,
8957 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
8958 dirindex parameter to constructor. Change all callers. Declare
8959 incompatible_warning and requeue.
8960 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
8961 input_argument_ and input_group_ fields. Add them to
8962 constructor. Change all callers.
8963 (class Read_script): Add dirindex_ field. Add it to constructor.
8965 * archive.cc (Archive::setup): Remove input_objects parameter.
8967 (Archive::get_file_and_offset): Likewise.
8968 (Archive::read_all_symbols): Likewise.
8969 (Archive::read_symbols): Likewise.
8970 (Archive::get_elf_object_for_member): Remove input_objects
8971 parameter. Add punconfigured parameter. Change all callers.
8972 (Archive::add_symbols): Change return type to bool. Check return
8973 value of include_member.
8974 (Archive::include_all_members): Likewise.
8975 (Archive::include_member): Change return type to bool. Return
8976 false if first included object has incompatible target. Set
8977 included_member_ field.
8978 (Add_archive_symbols::run): If add_symbols returns false, requeue
8980 * archive.h (class Archive): Add included_member_ field.
8981 Initialize it in constructor. Add input_file and searched_for
8982 methods. Update declarations.
8983 (class Add_archive_symbols): Add dirpath_, dirindex_, and
8984 input_argument_ fields. Add them to constructor. Change all
8986 * script.cc: Include "target-select.h".
8987 (class Parser_closure): Add skip_on_incompatible_target_ and
8988 found_incompatible_target_ fields. Add
8989 skip_on_incompatible_target parameter to constructor. Change all
8990 callers. Add methods skip_on_incompatible_target,
8991 clear_skip_on_incompatible_target, found_incompatible_target, and
8992 set_found_incompatible_target.
8993 (read_input_script): Add dirindex parameter. Change all callers.
8994 If parser finds an incompatible target, requeue Read_symbols
8996 (script_set_symbol): Clear skip_on_incompatible_target in
8998 (script_add_assertion, script_parse_option): Likewise.
8999 (script_start_sections, script_add_phdr): Likewise.
9000 (script_check_output_format): New function.
9001 * script.h (read_input_script): Update declaration.
9002 * script-c.h (script_check_output_format): Declare.
9003 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
9004 (ignore_cmd): Remove OUTPUT_FORMAT.
9005 * fileread.cc (Input_file::Input_file): Add explicit this.
9006 (Input_file::will_search_for): New function.
9007 (Input_file::open): Add pindex parameter. Change all callers.
9008 * fileread.h (class Input_file): Add input_file_argument method.
9009 Declare will_search_for. Update declarations.
9010 * object.cc (make_elf_object): Add punconfigured parameter.
9012 * object.h (class Object): Make input_file public. Add
9013 searched_for method.
9014 (make_elf_object): Update declaration.
9015 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
9017 * dirsearch.h (class Dirsearch): Update declaration.
9018 * options.h (class General_options): Add --warn-search-mismatch.
9019 * parameters.cc (Parameters::is_compatible_target): New function.
9020 * parameters.h (class Parameters): Declare is_compatible_target.
9021 * workqueue.cc (Workqueue::add_blocker): New function.
9022 * workqueue.h (class Workqueue): Declare add_blocker.
9024 * fileread.cc (Input_file::open): Remove options parameter.
9026 (Input_file::open_binary): Likewise.
9027 * script.cc (read_input_script): Likewise.
9028 * readsyms.h (class Read_symbols): Remove options_ field. Remove
9029 options parameter from constructor. Change all callers.
9030 (class Read_script): Likewise.
9031 * fileread.h (class Input_file): Update declarations.
9032 * script.h (read_input_script): Update declaration.
9034 2009-03-10 Nick Clifton <nickc@redhat.com>
9036 * po/es.po: New Spanish translation.
9038 2009-03-06 Cary Coutant <ccoutant@google.com>
9040 * options.cc (parse_short_option): Keep dash_z from registering itself.
9042 2009-03-03 Ian Lance Taylor <iant@google.com>
9045 * target-reloc.h (relocate_section): Pass output_section to
9047 * i386.cc (Target_i386::should_apply_static_reloc): Add
9048 output_section parameter. Change all callers.
9049 (Target_i386::Relocate::relocate): Add output_section parameter.
9050 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9051 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
9052 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
9053 * testsuite/two_file_shared.sh: New script.
9054 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
9055 (check_DATA): Add two_file_shared.dbg.
9056 (two_file_shared.dbg): New target.
9057 * testsuite/Makefile.in: Rebuild.
9059 2009-03-01 Ian Lance Taylor <iant@google.com>
9061 * configure.ac: Check for byteswap.h.
9062 * configure: Rebuild.
9063 * config.in: Rebuild.
9065 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
9067 * layout.cc (Layout::find_or_add_kept_section): New function.
9068 (Layout::add_comdat): Removed.
9069 * layout.h (struct Kept_section): Move out of class Layout.
9070 Remove trailing underscores from field names. Add group_sections
9071 field. Rename group_ field to is_group. Change all uses.
9072 (class Layout): Declare find_or_add_kept_section, not add_comdat.
9073 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
9074 comdat_groups_ field.
9075 (Sized_relobj::include_section_group): Use
9076 find_or_add_kept_section and Kept_section::group_sections.
9077 (Sized_relobj::include_linkonce_section): Likewise.
9078 * object.cc (class Sized_relobj): Don't define Comdat_group or
9079 Comdat_group_table. Remove find_comdat_group and
9080 add_comdat_group. Remove comdat_groups_ field.
9081 * plugin.cc (include_comdat_group): Use
9082 Layout::find_or_add_kept_section.
9084 2009-02-28 Ian Lance Taylor <iant@google.com>
9086 * README: --gc-sections and map files are now supported. Document
9087 some build requirements.
9090 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
9091 relocatable link set the value of the section symbol to zero.
9092 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
9093 relocatable link don't include the section address in the local
9096 2009-02-27 Ian Lance Taylor <iant@google.com>
9099 * options.h (class Search_directory): Add is_system_directory.
9100 (class General_options): Declare is_in_system_directory.
9101 * options.cc (get_relative_sysroot): Make static.
9102 (get_default_sysroot): Make static.
9103 (General_optoins::is_in_system_directory): New function.
9104 * fileread.cc (Input_file::is_in_system_directory): New function.
9105 * fileread.h (class Input_file): Declare is_in_system_directory.
9106 * object.h (class Object): Add is_in_system_directory.
9107 (class Input_objects): Remove system_library_directory_ field.
9108 * object.cc (Input_objects::add_object): Don't set
9109 system_library_directory_.
9110 (input_objects::found_in_system_library_directory): Remove.
9111 * symtab.cc (Symbol_table::write_globals): Remove input_objects
9112 parameter. Change all callers.
9113 (Symbol_table::sized_write_globals): Likewise.
9114 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
9115 Call Object::is_in_system_directory.
9116 * symtab.h (class Symbol_table): Update declarations.
9119 * descriptors.h (Open_descriptor): Add is_on_stack field.
9120 * descriptors.cc (Descriptors::open): If the descriptor is on the
9121 top of the stack, remove it. Initialize is_on_stack field.
9122 (Descriptors::release): Only add pod to stack if it is not on the
9124 (Descriptors::close_some_descriptor): Clear stack_next and
9128 * output.cc (Output_section::find_starting_output_address): Rename
9129 from starting_output_address; add PADDR parameter; change return
9131 * output.h (class Output_section): Declare
9132 find_starting_output_address instead of starting_output_address.
9133 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
9134 section symbol for which we can't find a merge section.
9137 * symtab.cc (Symbol_table::add_from_object): If the visibility is
9138 hidden or internal, force the symbol to be local.
9139 * resolve.cc (Symbol::override_visibility): Define.
9140 (Symbol::override_base): Use override_visibility.
9141 (Symbol_table::resolve): Likewise.
9142 (Symbol::override_base_with_special): Likewise.
9143 (Symbol_table::override_with_special): If the visibility is hidden
9144 or internal, force the symbol to be local.
9145 * symtab.h (class Symbol): Add set_visibility and
9146 override_visibility.
9147 * testsuite/ver_test_1.sh: New file.
9148 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
9149 (check_DATA): Add ver_test_1.syms.
9150 (ver_test_1.syms): New target.
9151 * testsuite/Makefile.in: Rebuild.
9153 2009-02-25 Cary Coutant <ccoutant@google.com>
9155 * layout.cc (Layout::choose_output_section): Don't rename sections
9156 when using a linker script that has a SECTIONS clause.
9157 * Makefile.in: Regenerate.
9159 * testsuite/Makefile.am (script_test_5.sh): New test case.
9160 * testsuite/Makefile.in: Regenerate.
9161 * testsuite/script_test_5.cc: New file.
9162 * testsuite/script_test_5.sh: New file.
9163 * testsuite/script_test_5.t: New file.
9165 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
9167 * archive.cc (Archive::include_member): Update calls to add_symbols.
9168 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
9169 the Layout argument.
9170 * dynobj.h (do_add_symbols): Add the Layout argument.
9171 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
9173 * object.h (Object::add_symbols): Add the Layout argument.
9174 (Object::do_add_symbols): Add the Layout argument.
9175 (Sized_relobj::do_add_symbols): Add the Layout argument.
9176 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
9177 Unify the two versions.
9178 (Add_plugin_symbols): Remove.
9179 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
9180 (Sized_pluginobj::do_add_symbols): Unify the two versions.
9181 (Add_plugin_symbols): Remove.
9182 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
9183 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
9184 (Add_symbols::run): Make it work with Pulginobj.
9186 2009-02-06 Ian Lance Taylor <iant@google.com>
9188 * object.cc (Sized_relobj::do_layout): Make info message start
9189 with lower case letter.
9191 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
9193 * binary.cc: Fix file comment.
9195 * options.h (enum Incremental_disposition): Define.
9196 (class General_options): Add new options: --incremental,
9197 --incremental_changed, --incremental_unchanged,
9198 --incremental_unknown. Add incremental_disposition_ and
9199 implicit_incremental_ fields.
9200 (General_options::incremental_disposition): New function.
9201 (class Position_dependent_options): Add incremental_disposition
9203 (Position_dependent_options::copy_from_options): Set incremental
9205 * options.cc (General_options::parse_incremental_changed): New
9207 (General_options::parse_incremental_unchanged): New function.
9208 (General_options::parse_incremental_unknown): New function.
9209 (General_options::General_options): Initialize new fields
9210 incremental_disposition_ and implicit_incremental_.
9211 (General_options::finalize): Check for uasge of --incremental-*
9212 without --incremental.
9214 2009-02-06 Chris Demetriou <cgd@google.com>
9216 * gold.h (gold_undefined_symbol): Change to take only a Symbol
9217 pointer and to report location as the file name associated with
9219 (gold_undefined_symbol_at_location): New function to replace the
9220 old gold_undefined_symbol functionality.
9221 * target-reloc.h (relocate_section): Update to use
9222 gold_undefined_symbol_at_location.
9223 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9224 Call gold_undefined_symbol function rather than gold_error.
9225 * errors.h (Errors::undefined_symbol): Take location as a
9226 string, rather than calculating it from a relocation.
9227 * errors.cc (Errors::fatal): Print "fatal error:" before the
9229 (Errors::error, Errors::error_at_location): Print "error: "
9230 before the formatted message.
9231 (Errors::undefined_symbol): Take location as a string, rather
9232 than calculating it from a relocation.
9233 (gold_undefined_symbol_at_location): New function akin to
9234 old gold_undefined_symbol, calculates location from relocation.
9235 (gold_undefined_symbol): Change to take only a Symbol pointer
9236 and to report location as the file name associated with the symbol.
9237 * testsuite/debug_msg.sh: Update for changed error messages.
9238 * testsuite/undef_symbol.sh: Likewise.
9240 2009-02-04 Duncan Sands <baldrick@free.fr>
9243 * reduced_debug_output.h
9244 (Output_reduced_debug_abbrev_section::failed): Use format for
9246 (Output_reduced_debug_info_section::faild): Likewise.
9248 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
9250 * script.cc (Lazy_demangler): New class.
9251 (Version_script_info::get_symbol_version_helper): Demangle a
9254 2009-01-29 Cary Coutant <ccoutant@google.com>
9256 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
9258 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9260 2009-01-28 Ian Lance Taylor <iant@google.com>
9262 * version.cc (version_string): Bump to 1.9.
9264 * gold.h: Include <cstring> and <stdint.h>.
9265 * version.cc: Include <cstdio>.
9266 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
9268 * reduced_debug_output.cc (insert_into_vector): Rename from
9269 Insert_into_vector; change all callers. Use Swap_unaligned to
9270 avoid aliasing issue; remove union since it is unnecessary.
9272 2009-01-27 Sriraman Tallam <tmsriram@google.com>
9274 * Makefile.am (CCFILES): Add gc.cc.
9276 * Makefile.in: Regenerate.
9277 * gold.cc (Gc_runner): New class.
9278 (queue_initial_tasks): Call garbage collection related tasks
9279 when corresponding options are invoked.
9280 (queue_middle_gc_tasks): New function.
9281 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
9282 processed early before laying out sections during garbage collection.
9283 * gold.h (queue_middle_gc_tasks): New function.
9284 (is_prefix_of): Move from "layout.cc".
9285 * i386.cc (Target_i386::gc_process_relocs): New function.
9286 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
9287 * main.cc (main): Create object of class "Garbage_collection".
9288 * object.cc (Relobj::copy_symbols_data): New function.
9289 (Relobj::is_section_name_included): New function.
9290 (Sized_relobj::do_layout): Allow this function to be called twice
9291 during garbage collection and defer layout of section during the
9293 * object.h (Relobj::get_symbols_data): New function.
9294 (Relobj::is_section_name_included): New function.
9295 (Relobj::copy_symbols_data): New function.
9296 (Relobj::set_symbols_data): New function.
9297 (Relobj::get_relocs_data): New function.
9298 (Relobj::set_relocs_data): New function.
9299 (Relobj::is_output_section_offset_invalid): New pure virtual function.
9300 (Relobj::gc_process_relocs): New function.
9301 (Relobj::do_gc_process_relocs): New pure virtual function.
9302 (Relobj::sd_): New data member.
9303 (Sized_relobj::is_output_section_offset_invalid): New function.
9304 (Sized_relobj::do_gc_process_relocs): New function.
9305 * options.h (General_options::gc_sections): Modify to not be a no-op.
9306 (General_options::print_gc_sections): New option.
9307 * plugin.cc (Plugin_finish::run): Remove function call to
9308 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
9309 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
9310 * reloc.cc (Read_relocs::run): Add task to process relocs and
9311 determine unreferenced sections when doing garbage collection.
9312 (Gc_process_relocs): New class.
9313 (Sized_relobj::do_gc_process_relocs): New function.
9314 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
9315 sections that are garbage collected.
9316 * reloc.h (Gc_process_relocs): New class.
9317 * sparc.cc (Target_sparc::gc_process_relocs): New function.
9318 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
9319 symbols whose corresponding sections are garbage collected.
9320 (Symbol_table::Symbol_table): Add new parameter for the garbage
9322 (Symbol_table::gc_mark_undef_symbols): New function.
9323 (Symbol_table::gc_mark_symbol_for_shlib): New function.
9324 (Symbol_table::gc_mark_dyn_syms): New function.
9325 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
9327 (Symbol_table::add_from_object): Likewise.
9328 (Symbol_table::add_from_relobj): When building shared objects, do not
9329 treat externally visible symbols as garbage.
9330 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
9331 table information for static and relocatable links.
9332 * symtab.h (Symbol_table::set_gc): New function.
9333 (Symbol_table::gc): New function.
9334 (Symbol_table::gc_mark_undef_symbols): New function.
9335 (Symbol_table::gc_mark_symbol_for_shlib): New function.
9336 (Symbol_table::gc_mark_dyn_syms): New function.
9337 (Symbol_table::gc_): New data member.
9338 * target.h (Sized_target::gc_process_relocs): New pure virtual
9340 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
9341 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
9343 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
9345 * options.h (General_options::gc_sections): Define as a no-op for now.
9346 (General_options::no_keep_memory): Ditto.
9347 (General_options::Bshareable): Define.
9348 * options.cc (General_options::finalize): Honor -Bshareable.
9350 2009-01-20 Andreas Schwab <schwab@suse.de>
9352 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
9353 read the value in the contents, since we don't use it. Use the
9354 template endianness when writing.
9355 (Relocate::relocate): Use it for R_PPC_REL16_HA.
9357 2009-01-19 Andreas Schwab <schwab@suse.de>
9359 * configure.tgt (powerpc64-*): Fix targ_obj.
9361 2009-01-15 Ian Lance Taylor <iant@google.com>
9363 * object.cc (Sized_relobj::write_local_symbols): Don't write out
9364 local symbols when stripping all symbols.
9366 2009-01-14 Cary Coutant <ccoutant@google.com>
9368 * output.cc (Output_reloc): Add explicit instantiations.
9370 2009-01-14 Cary Coutant <ccoutant@google.com>
9372 * archive.cc (Archive::get_elf_object_for_member): Remove call
9373 to File_read::claim_for_plugin.
9374 * descriptors.cc (Descriptors::open): Remove reference to
9376 (Descriptors::claim_for_plugin): Remove.
9377 * descriptors.h (Descriptors::claim_for_plugin): Remove.
9378 (Descriptors::is_claimed): Remove.
9379 (claim_descriptor_for_plugin): Remove.
9380 * fileread.cc (File_read::claim_for_plugin): Remove.
9381 * fileread.h (File_read::claim_for_plugin): Remove.
9382 (File_read::descriptor): Reopen descriptor if necessary.
9383 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
9384 (Plugin_manager::all_symbols_read): Add task parameter. Change
9386 (Plugin_manager::get_input_file): New function.
9387 (Plugin_manager::release_input_file): New function.
9388 (Pluginobj::Pluginobj): Add filesize parameter and initialize
9389 corresponding data member.
9390 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
9391 and pass to base constructor. Change all callers.
9392 (get_input_file, release_input_file): New functions.
9393 (make_sized_plugin_object): Add filesize parameter. Change all callers.
9394 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
9395 (Plugin_manager::all_symbols_read): Add task parameter.
9396 (Plugin_manager::get_input_file): New function.
9397 (Plugin_manager::release_input_file): New function.
9398 (Plugin_manager::task_): New data member.
9399 (Pluginobj::Pluginobj): Add filesize parameter.
9400 (Pluginobj::filename): New function.
9401 (Pluginobj::descriptor): New function.
9402 (Pluginobj::filesize): New function.
9403 (Pluginobj::filesize_): New data member.
9404 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
9405 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
9406 File_read::claim_for_plugin; use Object::unlock to unlock the file.
9408 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
9409 with archive libraries.
9410 * testsuite/Makefile.in: Regenerate.
9411 * testsuite/plugin_test.c (struct sym_info): New type.
9412 (get_input_file, release_input_file): New static variables.
9413 (onload): Capture new transfer vector entries.
9414 (claim_file_hook): Stop reading at end of file according to filesize.
9415 Factor out parsing of readelf output into separate function.
9416 (all_symbols_read_hook): Exercise get_input_file and release_input_file
9417 APIs and get the source file name from the symbol table. Convert
9418 source file name to corresponding object file name. Print info
9419 message when adding new input files.
9420 (parse_readelf_line): New function.
9421 * testsuite/plugin_test_1.sh: Add checks for new info messages.
9422 * testsuite/plugin_test_2.sh: Likewise.
9423 * testsuite/plugin_test_3.sh: Likewise.
9424 * testsuite/plugin_test_4.sh: New test case.
9426 2009-01-07 Ian Lance Taylor <iant@google.com>
9428 * version.cc (version_string): Bump to 1.8.
9430 2008-12-23 Cary Coutant <ccoutant@google.com>
9432 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
9433 * plugin.cc (Plugin_manager::finish): Rename as
9434 layout_deferred_objects. Move cleanup to separate function.
9435 (Plugin_manager::cleanup): New function.
9436 (Plugin_finish::run): Call layout_deferred_objects and cleanup
9438 * plugin.h (Plugin_manager::finish): Rename as
9439 layout_deferred_objects.
9440 (Plugin_manager::cleanup): New function.
9441 (Plugin_manager::cleanup_done): New field.
9443 2008-12-23 Cary Coutant <ccoutant@google.com>
9445 * plugin.cc (is_visible_from_outside): New function.
9446 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
9447 so we don't return "IR only" status for exported symbols or -r links.
9449 * testsuite/Makefile.am (plugin_test_3): New test case.
9450 * testsuite/Makefile.in: Regenerate.
9451 * testsuite/plugin_test_3.sh: New file.
9453 2008-12-22 Cary Coutant <ccoutant@google.com>
9455 * object.cc (Sized_relobj::layout_section): New function.
9456 (Sized_relobj::do_layout): Defer layout of input sections until after
9457 plugin has provided replacement files.
9458 (Sized_relobj::do_layout_deferred_sections): New function.
9459 * object.h (Relobj::set_section_offset): Remove virtual keyword.
9460 (Relobj::layout_deferred_sections): New function.
9461 (Relobj::do_layout_deferred_sections): New function.
9462 (Sized_relobj::do_layout_deferred_sections): New function.
9463 (Sized_relobj::layout_section): New function.
9464 (Sized_relobj::Deferred_layout): New structure.
9465 (Sized_relobj::deferred_layout_): New field.
9466 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
9467 Change all callers. Layout deferred sections.
9468 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
9470 (Plugin_hook::run): Move code from do_plugin_hook inline.
9471 (Plugin_hook::do_plugin_hook): Remove.
9472 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
9473 (Plugin_manager::finish): Renamed, was cleanup.
9474 (Plugin_manager::should_defer_layout): New function.
9475 (Plugin_manager::add_deferred_layout_object): New function.
9476 (Plugin_manager::Deferred_layout_list): New type.
9477 (Plugin_manager::deferred_layout_objects_): New field.
9478 (Plugin_hook::do_plugin_hook): Remove.
9480 2008-12-17 Ian Lance Taylor <iant@google.com>
9482 * options.h (class General_options): Add --no case for
9485 2008-12-16 Cary Coutant <ccoutant@google.com>
9487 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
9489 (Plugin_manager::claim_file): Create plugin object even if
9490 plugin did not call the add_symbols callback.
9491 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
9492 asking for more symbols than were added.
9493 * testsuite/Makefile.am (plugin_test_1): Add test case with
9495 (empty.syms): New target.
9496 * testsuite/Makefile.in: Regenerate.
9497 * testsuite/plugin_test.c (claim_file_hook): Add new debug
9498 message. Don't call add_symbols if no globals.
9499 (all_symbols_read_hook): Don't provide replacement for empty
9502 2008-12-12 Ian Lance Taylor <iant@google.com>
9504 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
9505 r_type == 0 for a local symbol with r_sym == 0.
9506 (scan_relocatable_relocs): Pass r_sym to
9507 local_non_section_strategy.
9508 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
9511 * configure.ac: Update test for TLS descriptors: they are
9512 supported as of glibc 2.9.
9513 * configure: Rebuild.
9515 2008-12-11 Ian Lance Taylor <iant@google.com>
9518 * target-reloc.h (Default_scan_relocatable_relocs): For each
9519 function, map r_type == 0 to RELOC_DISCARD.
9521 2008-12-10 Cary Coutant <ccoutant@google.com>
9523 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
9524 object to override a kept COMDAT group from a plugin object.
9526 2008-12-09 Ian Lance Taylor <iant@google.com>
9529 * yyscript.y (file_cmd): Handle INPUT.
9531 * testsuite/initpri1.c: Change all declarations to be full
9532 prototypes by adding void, to avoid compiler warnings.
9534 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
9536 * options.cc (General_options::parse_plugin_opt): New.
9537 (General_options::add_plugin): The argument now is just the filename.
9538 (General_options::add_plugin_option): New.
9539 * options.h (plugin_opt): New.
9540 (add_plugin): Change argument name.
9541 (add_plugin_option): New.
9542 * plugin.cc (Plugin::load): Don't parse the plugin option.
9543 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
9544 (Plugin::add_option): New.
9545 (Plugin::args_): Change type.
9546 (Plugin::filename_): New.
9547 (Plugin_manager::add_plugin_option): New.
9548 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
9549 * testsuite/Makefile.in: Regenerate.
9551 2008-12-05 Cary Coutant <ccoutant@google.com>
9553 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
9554 Handle --strip-lto-sections option.
9555 * options.h (strip_lto_sections): New option.
9557 2008-12-01 Cary Coutant <ccoutant@google.com>
9559 * plugin.cc (ld_plugin_message): Change format parameter to const.
9560 Fix mismatch between new[] and delete.
9562 2008-11-14 Cary Coutant <ccoutant@google.com>
9564 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
9567 2008-11-05 Craig Silverstein <csilvers@google.com>
9569 * options.cc (General_options::parse_dynamic_list): New function.
9570 * options.h (General_options): New flags dynamic_list,
9571 dynamic_list_data, dynamic_list_cpp_new, and
9572 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
9573 (General_options::in_dynamic_list): New function.
9574 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
9575 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
9576 (Lex::can_continue_name): Likewise.
9578 (read_script_file): New parameter script_options.
9579 (read_dynamic_list): New function.
9580 (Script_options::define_dynamic_list): New function.
9581 (dynamic_list_keyword_parsecodes): New variable.
9582 (dynamic_list_keywords): New variable.
9583 * script.h (Script_options::define_dynamic_list): New function
9585 (read_dynamic_list): New function prototype.
9586 * symtab.cc (strprefix): New macro.
9587 (Symbol::should_add_dynsym_entry): Support dynamic_list,
9588 dynamic_list_data, dynamic_list_cpp_new, and
9589 dynamic_list_cpp_typeinfo.
9590 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
9591 (dynamic_list_expr): New rule.
9592 (dynamic_list_nodes): Likewise.
9593 (dynamic_list_node): Likewise.
9594 * testsuite/Makefile.am (dynamic_list): New test.
9595 * testsuite/Makefile.in: Regenerated.
9596 * testsuite/dynamic_list.t: New file.
9597 * testsuite/dynamic_list.sh: New file.
9599 2008-11-05 Craig Silverstein <csilvers@google.com>
9601 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
9602 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
9603 (t11_last): Likewise.
9604 * testsuite/ver_test_6.c (main): Likewise.
9606 2008-10-07 Cary Coutant <ccoutant@google.com>
9608 * options.c (General_options::finalize): Add check for -static and
9610 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
9613 2008-10-02 Cary Coutant <ccoutant@google.com>
9615 * plugin.cc (make_sized_plugin_object): Fix conditional
9616 compilation to work when not all targets are enabled.
9618 2008-09-29 Cary Coutant <ccoutant@google.com>
9620 * archive.cc (Archive::get_file_and_offset): Use filename instead
9621 of name to get library path.
9622 (Archive::include_member): Unlock external member of a thin archive.
9624 * testsuite/Makefile.am (TEST_AR): New variable.
9625 (thin_archive_test_1): New test.
9626 (thin_archive_test_2): New test.
9627 * testsuite/Makefile.in: Regenerate.
9628 * testsuite/thin_archive_main.cc: New file.
9629 * testsuite/thin_archive_test_1.cc: New file.
9630 * testsuite/thin_archive_test_2.cc: New file.
9631 * testsuite/thin_archive_test_3.cc: New file.
9632 * testsuite/thin_archive_test_4.cc: New file.
9634 2008-09-29 Cary Coutant <ccoutant@google.com>
9636 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
9637 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
9639 (Sized_relobj::do_finalize_local_symbols): Likewise.
9640 (Sized_relobj::map_to_kept_section): Likewise.
9641 * object.h (Sized_relobj::invalid_address): New constant.
9642 (Sized_relobj::do_output_section_offset): Check for invalid_address
9644 * output.cc (Output_reloc::local_section_offset): Use constant
9645 invalid_address instead of -1U.
9646 (Output_reloc::get_address): Likewise.
9647 (Output_section::output_address): Change -1U to -1ULL.
9648 * output.h (Output_reloc::invalid_address): New constant.
9649 * reloc.cc (Sized_relobj::write_sections): Use constant
9650 invalid_address instead of -1U.
9651 (Sized_relobj::relocate_sections): Likewise.
9652 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
9653 values for merge sections.
9654 * target-reloc.h (relocate_for_relocatable): Use constant
9655 invalid_address instead of -1U.
9657 2008-09-19 Cary Coutant <ccoutant@google.com>
9659 Add plugin functionality for link-time optimization (LTO).
9660 * configure.ac (plugins): Add --enable-plugins option.
9661 * configure: Regenerate.
9662 * config.in: Regenerate.
9663 * Makefile.am (LIBDL): New variable.
9664 (CCFILES): Add plugin.cc.
9665 (HFILES): Add plugin.h.
9666 (ldadd_var): Add LIBDL.
9667 * Makefile.in: Regenerate.
9669 * archive.cc: Include "plugin.h".
9670 (Archive::setup): Don't preread archive symbols when using a plugin.
9671 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
9672 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
9674 (Archive::include_member): Add symbols from plugin objects.
9675 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
9676 * descriptors.cc (Descriptors::open): Check for file descriptors
9677 abandoned by plugins.
9678 (Descriptors::claim_for_plugin): New function.
9679 * descriptors.h (Descriptors::claim_for_plugin): New function.
9680 (Open_descriptor::is_claimed): New field.
9681 (claim_descriptor_for_plugin): New function.
9682 * fileread.cc (File_read::claim_for_plugin): New function.
9683 * fileread.h (File_read::claim_for_plugin): New function.
9684 (File_read::descriptor): New function.
9685 * gold.cc: Include "plugin.h".
9686 (queue_initial_tasks): Add task to call plugin hooks for generating
9688 * main.cc: Include "plugin.h".
9689 (main): Load plugin libraries.
9690 * object.h (Pluginobj): Declare.
9691 (Object::pluginobj): New function.
9692 (Object::do_pluginobj): New function.
9693 (Object::set_target): New function.
9694 * options.cc: Include "plugin.h".
9695 (General_options::parse_plugin): New function.
9696 (General_options::General_options): Initialize plugins_ field.
9697 (General_options::add_plugin): New function.
9698 * options.h (Plugin_manager): Declare.
9699 (General_options): Add --plugin option.
9700 (General_options::has_plugins): New function.
9701 (General_options::plugins): New function.
9702 (General_options::add_plugin): New function.
9703 (General_options::plugins_): New field.
9704 * plugin.cc: New file.
9705 * plugin.h: New file.
9706 * readsyms.cc: Include "plugin.h".
9707 (Read_symbols::do_read_symbols): Check for archive before checking
9708 for ELF file. Call plugin hooks to claim files.
9709 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
9710 from a real object file; force override when processing replacement
9712 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
9713 (Symbol::init_base_object): Likewise.
9714 (Symbol::init_base_output_data): Likewise.
9715 (Symbol::init_base_output_segment): Likewise.
9716 (Symbol::init_base_constant): Likewise.
9717 (Symbol::init_base_undefined): Likewise.
9718 (Symbol::output_section): Assert that object is not a plugin.
9719 (Symbol_table::add_from_pluginobj): New function.
9720 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
9722 (Symbol_table::sized_write_globals): Likewise.
9723 (Symbol_table::add_from_pluginobj): Instantiate template.
9724 * symtab.h (Sized_pluginobj): Declare.
9725 (Symbol::in_real_elf): New function.
9726 (Symbol::set_in_real_elf): New function.
9727 (Symbol::in_real_elf_): New field.
9728 (Symbol_table::add_from_pluginobj): New function.
9730 * testsuite/Makefile.am (AM_CFLAGS): New variable.
9731 (LIBDL): New variable.
9733 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
9734 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
9735 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
9736 (MOSTLYCLEANFILES): Likewise.
9737 * testsuite/Makefile.in: Regenerate.
9738 * testsuite/plugin_test.c: New file.
9739 * testsuite/plugin_test_1.sh: New file.
9740 * testsuite/plugin_test_2.sh: New file.
9742 2008-09-16 Ian Lance Taylor <iant@google.com>
9744 * target-reloc.h (relocate_section): Check whether a symbol is
9745 defined by the ABI before reporting an undefined symbol error.
9746 * target.h (Target::is_defined_by_abi): Make parameter const.
9747 (Target::do_is_defined_by_abi): Likewise.
9748 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
9749 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
9750 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
9751 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
9752 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
9753 * testsuite/Makefile.in: Rebuild.
9755 * fileread.cc (make_view): Add casts to avoid warning.
9757 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
9759 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
9760 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
9762 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
9764 * options.h (General_options::output_is_executable): New.
9765 (General_options::output_is_pie): New.
9766 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
9767 for shared libraries.
9768 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
9770 2008-09-11 Chris Demetriou <cgd@google.com>
9772 * options.h (origin): New -z option.
9773 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
9774 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
9777 2008-09-05 Cary Coutant <ccoutant@google.com>
9779 * fileread.cc (File_read::make_view): Add check for attempt to map
9782 2008-09-05 Cary Coutant <ccoutant@google.com>
9784 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
9785 explicit instantiations.
9787 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
9790 * options.cc (General_options::finalize): Allow undefined symbols
9791 in shlibs if linking -shared.
9794 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
9795 symbols as not needing a dynsym entry.
9797 2008-08-20 Craig Silverstein <csilvers@google.com>
9799 * fileread.cc (File_read::open): Do not lock the file unless it
9800 was successfully opened.
9802 2008-08-14 Cary Coutant <ccoutant@google.com>
9804 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
9805 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
9806 * testsuite/tls_test.cc (struct int128): 128-bit struct
9807 for testing TLS relocs with non-zero addend.
9808 (v12): New TLS variable.
9810 (t_last): Add check for v12.
9811 * testsuite/tls_test.h (t12): New function.
9812 * testsuite/tls_test_main.cc (thread_routine): Call new test.
9814 2008-08-13 Ian Lance Taylor <iant@google.com>
9816 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
9817 set tls_segment_ or relro_segment_.
9818 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
9820 * output.h (Output_section::clear_is_relro): New function.
9821 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
9822 sections specially even when output_data_ is empty.
9823 (Output_segment::maximum_alignment): When first section is relro,
9824 only force alignment for PT_LOAD segments.
9825 * script.cc (script_data_segment_align): New function.
9826 (script_data_segment_relro_end): New function.
9827 * script-c.h (script_data_segment_align): Declare.
9828 (script_data_segment_relro_end): Declare.
9829 * script-sections.h (class Script_sections): Declare
9830 data_segment_align and data_segment_relro_end. Add fields
9831 segment_align_index_ and saw_relro_end_.
9832 * script-sections.cc (class Sections_element): Add set_is_relro
9833 virtual function. Add new bool* parameter to place_orphan_here.
9834 Add get_output_section virtual function.
9835 (class Output_section_definition): Add set_is_relro. Add new
9836 bool* parameter to place_orphan_here. Add get_output_section.
9837 Add is_relro_ field.
9838 (Output_section_definition::Output_section_definition): Initialize
9839 evaluated_address_, evaluated_load_address, evaluated_addralign_,
9840 and is_relro_ fields.
9841 (Output_section_definition::place_orphan_here): Add is_relro
9843 (Output_section_definition::set_section_addresses): Set relro for
9845 (Output_section_definition::alternate_constraint): Likewise.
9846 (class Orphan_output_section): Add new bool* parameter to
9847 place_orphan_here. Add get_output_section.
9848 (Orphan_output_section::place_orphan_here): Add is_relro
9850 (Script_sections::Script_sections): Initialize
9851 data_segment_align_index_ and saw_relro_end_.
9852 (Script_sections::data_segment_align): New function.
9853 (Script_sections::data_segment_relro_end): New function.
9854 (Script_sections::place_orphan): Set or clear is_relro.
9855 (Script_sections::set_section_addresses): Force alignment of first
9857 * yyscript.y (exp): Call script_data_segment_align and
9858 script_data_segment_relro_end.
9859 * testsuite/relro_script_test.t: New file.
9860 * testsuite/relro_test.cc (using_script): Declare.
9861 (t1, t2): Test using_script.
9862 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
9863 (relro_script_test_SOURCES): Define.
9864 (relro_script_test_DEPENDENCIES): Define.
9865 (relro_script_test_LDFLAGS): Define.
9866 (relro_script_test_LDADD): Define.
9867 (relro_script_test.so): New target.
9868 * testsuite/Makefile.in: Rebuild.
9870 2008-08-06 Cary Coutant <ccoutant@google.com>
9872 * archive.cc (Archive::total_archives, Archive::total_members)
9873 (Archive::total_members_loaded): New variables.
9874 (Archive::setup): Add parameter. Add option to preread
9876 (Archive::read_armap): Add counter.
9877 (Archive::get_file_and_offset): New function.
9878 (Archive::get_elf_object_for_member): New function.
9879 (Archive::read_all_symbols): New function.
9880 (Archive::read_symbols): New function.
9881 (Archive::add_symbols): Add counters.
9882 (Archive::include_all_members): Use armap to find members if it's
9884 (Archive::include_member): Skip reading symbols if already read.
9885 Factored code into Archive::get_file_and_offset and
9886 Archive::get_elf_object_for_member. Changed call to
9887 Mapfile::report_include_archive_member.
9888 (Archive::print_stats): New function.
9889 * archive.h: Declare Object and Read_symbols_data classes.
9890 (Archive::Archive): Add initializers for new members.
9891 (Archive::setup): Add parameter.
9892 (Archive::print_stats): New function.
9893 (Archive::total_archives, Archive::total_members)
9894 (Archive::total_members_loaded): New variables.
9895 (Archive::get_file_and_offset): New function.
9896 (Archive::get_elf_object_for_member): New function.
9897 (Archive::read_all_symbols): New function.
9898 (Archive::read_symbols): New function.
9899 (Archive::Archive_member): New class.
9900 (Archive::members_): New member.
9901 (Archive::num_members_): New member.
9902 * main.cc: Include archive.h.
9903 (main): Call Archive::print_stats.
9904 * mapfile.cc (Mapfile::report_include_archive_member): Delete
9905 archive parameter; member_name is now the fully-decorated name.
9906 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
9907 * options.h: (General_options): Add --preread-archive-symbols option.
9908 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
9911 2008-08-04 Ian Lance Taylor <iant@google.com>
9913 * symtab.h (Symbol::use_plt_offset): New function.
9914 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
9915 * powerpc.cc (Relocate::relocate): Likewise.
9916 * sparc.cc (Relocate::relocate): Likewise.
9917 * x86_64.cc (Relocate::relocate): Likewise.
9918 * testsuite/weak_plt.sh: New test.
9919 * testsuite/weak_plt_main.cc: New test.
9920 * testsuite/weak_plt_shared.cc: New test.
9921 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
9922 (check_PROGRAMS): Add weak_plt.
9923 (check_DATA): Add weak_plt_shared.so.
9924 (weak_plt_main_pic.o, weak_plt): New targets.
9925 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
9926 * testsuite/Makefile.in: Rebuild.
9928 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
9930 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
9931 * testsuite/Makefile.in: Rebuild.
9933 2008-08-04 Alan Modra <amodra@bigpond.net.au>
9935 * Makefile.am (POTFILES.in): Set LC_ALL=C.
9936 * Makefile.in: Regenerate.
9937 * po/POTFILES.in: Regenerate.
9939 2008-07-29 Ian Lance Taylor <iant@google.com>
9941 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
9942 symbols before other symbols.
9943 * testsuite/script_test_2.cc (test_addr): Declare.
9944 (test_addr_alias): Declare.
9945 (main): Check that test_addr and test_addr_alias have the right
9947 * testsuite/script_test_2.t: Define test_addr_alias and
9950 2008-07-24 Ian Lance Taylor <iant@google.com>
9953 * descriptors.cc: New file.
9954 * descriptors.h: New file.
9955 * gold-threads.h (class Hold_optional_lock): New class.
9956 * fileread.cc: Include "descriptors.h".
9957 (File_read::~File_read): Release descriptor rather than closing
9959 (File_read::open) [file]: Call open_descriptor rather than open.
9960 Set is_descriptor_opened_.
9961 (File_read::open) [memory]: Assert that descriptor is not open.
9962 (File_read::reopen_descriptor): New function.
9963 (File_read::release): Release descriptor.
9964 (File_read::do_read): Make non-const. Reopen descriptor.
9965 (File_read::read): Make non-const.
9966 (File_read::make_view): Reopen descriptor.
9967 (File_read::do_readv): Likewise.
9968 * fileread.h (class File_read): Add is_descriptor_opened_ field.
9969 Update declarations.
9970 * layout.cc: Include "descriptors.h".
9971 (Layout::create_build_id): Use open_descriptor rather than open.
9972 * output.cc: Include "descriptors.h".
9973 (Output_file::open): Use open_descriptor rather than open.
9974 * archive.cc (Archive::const_iterator): Change Archive to be
9976 (Archive::begin, Archive::end): Make non-const.
9977 (Archive::count_members): Likewise.
9978 * archive.h (class Archive): Update declarations.
9979 * object.h (Object::read): Make non-const.
9980 * Makefile.am (CCFILES): Add descriptors.cc.
9981 (HFILES): Add descriptors.h.
9982 * Makefile.in: Rebuild.
9985 * gold.h: Always include <clocale>. Add Solaris workarounds
9986 following code in binutils/sysdep.h.
9989 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
9990 this->eh_frame_hdr_ is NULL before using it.
9992 * dynobj.cc (Versions::Versions): Update comment.
9994 * dynobj.cc (Versions::Versions): If there is an soname, use it as
9995 the base version name.
9997 * stringpool.cc (Stringpool_template::add_with_length): Set key to
9998 array size plus one.
9999 (Stringpool_template::set_string_offsets): Subtract one from key
10000 before using it as an array index.
10001 (Stringpool_template::get_offset_with_length): Likewise.
10002 (Stringpool_template::write_to_buffer): Likewise.
10003 * stringpool.h (Stringpool_template::get_offset_from_key):
10006 2008-07-23 Ian Lance Taylor <iant@google.com>
10009 * object.h (Merged_symbol_value::value): Do our best to handle a
10013 * script.cc (Version_script_info::get_versions): Don't add empty
10014 version tag to return value.
10015 (Version_script_info::get_symbol_version_helper): Change return
10016 type to bool. Add pversion parameter. Change all callers.
10017 (script_register_vers_node): Don't require a non-NULL tag.
10018 * script.h (class Version_script_info): Update declarations.
10019 (Version_script_info::get_symbol_version): Change return type to
10020 bool. Add version parameter. Change all callers.
10021 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
10022 handling. Handle an empty version from a version script.
10023 (Symbol_table::define_special_symbol): Likewise.
10024 * testsuite/ver_test_10.script: New file.
10025 * testsuite/ver_test_10.sh: New file.
10026 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
10027 (check_DATA): Add ver_test_10.syms.
10028 (ver_test_10.syms, ver_test_10.so): New target.
10029 * testsuite/Makefile.in: Rebuild.
10031 2008-07-23 Simon Baldwin <simonb@google.com>
10033 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
10034 to zero for undefined symbols from dynamic libraries.
10036 2008-07-23 Ian Lance Taylor <iant@google.com>
10038 * symtab.cc (Symbol_table::resolve): Remove version parameter.
10039 Change all callers.
10040 * symtab.h (class Symbol_table): Update declaration.
10041 * testsuite/ver_test_9.cc: New file.
10042 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
10043 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
10044 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
10045 (ver_test_9.so, ver_test_9.o): New targets.
10046 * testsuite/Makefile.in: Rebuild.
10048 2008-07-22 Ian Lance Taylor <iant@google.com>
10050 * options.h (class General_options): Define --check-sections.
10051 * layout.cc (Layout::set_segment_offsets): Handle
10054 * options.h (class General_options): Define -n/--nmagic and
10056 * options.cc (General_options::finalize): For -n/--nmagic or
10057 -N/--omagic, set -static.
10058 * layout.cc (Layout::attach_allocated_section_to_segment): If
10059 -N/--omagic, don't put read-only and read-write sections in
10060 different segments.
10061 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
10062 finding a read-only segment.
10063 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
10064 don't set the minimum segment alignment to the common page size,
10065 and don't set the file offset to the address modulo the page size.
10066 * script-sections.cc (Script_sections::create_segments): If
10067 -n/--omagic, don't put read-only and read-write sections in
10068 different segments.
10070 * cref.cc: New file.
10071 * cref.h: New file.
10072 * options.h (class General_options): Add --print-symbol-counts.
10073 * main.cc (main): Issue defined symbol report if requested.
10074 * archive.cc (Archive::interpret_header): Make into a const member
10076 (Archive::add_symbols): Call Input_objects::archive_start and
10078 (Archive::const_iterator): Define new class.
10079 (Archive::begin, Archive::end): New functions.
10080 (Archive::include_all_members): Rewrite to use iterator.
10081 (Archive::count_members): New function.
10082 * archive.h (class Archive): Update declarations.
10083 (Archive::filename): New function.
10084 * object.cc: Include "cref.h".
10085 (Sized_relobj::Sized_relobj): Initialize defined_count_.
10086 (Sized_relobj::do_get_global_symbol_counts): New function.
10087 (Input_objects::add_object): Add object to cross-referencer.
10088 (Input_objects::archive_start): New function.
10089 (Input_objects::archive_stop): New function.
10090 (Input_objects::print_symbol_counts): New function.
10091 * object.h: Declare Cref and Archive.
10092 (Object::get_global_symbol_counts): New function.
10093 (Object::do_get_global_symbol_counts): New pure virtual function.
10094 (class Sized_relobj): Add defined_count_ field. Update
10096 (class Input_objects): Add cref_ field. Update constructor.
10097 Update declarations.
10098 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
10100 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
10102 (Sized_dynobj::do_get_global_symbol_counts): New function.
10103 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
10104 defined_count_. Update declarations. Define Symbols typedef.
10105 * symtab.cc (Symbol_table::add_from_relobj): Add defined
10106 parameter. Change all callers.
10107 (Symbol_table::add_from_dynobj): Add sympointers and defined
10108 parameters. Change all callers.
10109 * symtab.h (class Symbol_table): Update declarations.
10110 * Makefile.am (CCFILES): Add cref.cc.
10111 (HFILES): Add cref.h.
10112 * Makefile.in: Rebuild.
10114 2008-07-22 Simon Baldwin <simonb@google.com>
10116 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
10117 to zero when writing undefined symbols.
10119 2008-07-22 Ian Lance Taylor <iant@google.com>
10121 * output.cc (Output_section::add_input_section): Don't try to
10122 merge empty merge sections.
10124 2008-07-21 Craig Silverstein <csilvers@google.com>
10126 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10127 Include symbol version in error message.
10129 2008-07-20 Chris Demetriou <cgd@google.com>
10131 * configure.ac (gold_cv_c_random_seed): New configured variable.
10132 (RANDOM_SEED_CFLAGS): New substituted variable.
10133 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
10134 * configure: Rebuild.
10135 * Makefile.in: Likewise.
10136 * testsuite/Makefile.in: Likewise.
10138 2008-07-18 Ian Lance Taylor <iant@google.com>
10140 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
10141 where we see NAME/NULL and NAME/VERSION as separate symbols.
10142 * testsuite/ver_test_main.cc (main): Call t4.
10143 (t4, t4_2a): Define.
10144 * testsuite/ver_test_2.cc (t4_2): Define.
10145 * testsuite/ver_test_2.script: Put t4_2a in VER2.
10146 * testsuite/ver_test_4.cc (t4_2a): Define.
10147 * testsuite/ver_test_4.script: Put t4_2a in VER2.
10148 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
10150 2008-07-17 Ian Lance Taylor <iant@google.com>
10152 * dynobj.cc (Versions::add_def): If we give an error about a
10153 missing version, go ahead and create the version anyhow.
10155 2008-07-10 Ian Lance Taylor <iant@google.com>
10157 Handle output sections with more than 0x7fffffff bytes.
10158 * object.h (class Relobj): Change map_to_output_ to
10159 output_sections_, and just keep a section pointer. Change all
10160 uses. Move comdat group support to Sized_relobj.
10161 (Relobj::is_section_specially_mapped): Remove.
10162 (Relobj::output_section): Remove poff parameter. Change all
10164 (Relobj::output_section_offset): New function.
10165 (Relobj::set_section_offset): Rewrite.
10166 (Relobj::map_to_output): Remove.
10167 (Relobj::output_sections): New function.
10168 (Relobj::do_output_section_offset): New pure virtual function.
10169 (Relobj::do_set_section_offset): Likewise.
10170 (class Sized_relobj): Add section_offsets_ field. Add comdat
10171 group support from Relobj. Update declarations.
10172 (Sized_relobj::get_output_section_offset): New function.
10173 (Sized_relobj::do_output_section_offset): New function.
10174 (Sized_relobj::do_set_section_offset): New function.
10175 * object.cc (Relobj::output_section_address): Remove.
10176 (Sized_relobj::Sized_relobj): Initialize new fields.
10177 (Sized_relobj::include_section_group): Cast find_kept_object to
10179 (Sized_relobj::include_linkonce_section): Likewise.
10180 (Sized_relobj::do_layout): Use separate arrays for output section
10182 (Sized_relobj::do_count_local_symbols): Change map_to_output to
10184 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
10185 output_sections and section_offsets.
10186 (Sized_relobj::write_local_symbols): Likewise.
10187 (map_to_kept_section): Compute output address directly.
10188 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
10189 output_sections and section_offsets.
10190 (Sized_relobj::write_sections): Likewise.
10191 (Sized_relobj::relocate_sections): Likewise.
10192 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
10193 * output.h (class Output_reloc): Update declarations. Change
10194 u2_.relobj to Sized_relobj*.
10195 (class Output_data_reloc): Change add functions to use
10197 * output.cc (Output_reloc::Output_reloc): Change relobj to
10199 (Output_reloc::local_section_offset): Change return type to
10200 Elf_Addr. Use get_output_section_offset.
10201 (Output_reloc::get_address): Likewise.
10202 (Output_section::is_input_address_mapped): Don't call
10203 is_section_specially_mapped.
10204 (Output_section::output_offset): Likewise.
10205 (Output_section::output_address): Likewise.
10206 (Output_section::starting_output_address): Likewise.
10207 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
10208 parameter to Sized_relobj*.
10209 (Copy_relocs::need_copy_reloc): Likewise.
10210 (Copy_relocs::save): Likewise.
10211 * copy-relocs.h (class Copy_relocs): Update declarations.
10212 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
10213 Sized_relobj*. Change relobj_ field to Sized_relobj*.
10214 * target-reloc.h (relocate_for_relocatable): Change
10215 offset_in_output_section type to Elf_Addr. Change code that uses
10217 * layout.cc (Layout::layout): Always set *off.
10218 * mapfile.cc (Mapfile::print_input_section): Use
10219 output_section_offset.
10220 * i386.cc (Target_i386::copy_reloc): Change object parameter to
10222 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
10223 * sparc.cc (Target_sparc::copy_reloc): Likewise.
10224 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
10226 2008-07-03 Ian Lance Taylor <iant@google.com>
10228 * layout.cc (Layout::include_section): Do not discard unrecognized
10229 SHT_STRTAB sections.
10231 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
10233 * script.cc (Lex::can_continue_name): Make '?' allowable in
10234 version-script names.
10235 * testsuite/version_script.map: Change glob pattern to use '?'
10237 2008-06-30 Manish Singh <yosh@gimp.org>
10240 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
10243 2008-06-30 Ian Lance Taylor <iant@google.com>
10247 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
10248 versions]: Don't try to read the value in the contents, since we
10249 don't use it. Use the template endianness when writing.
10251 2008-06-25 Cary Coutant <ccoutant@google.com>
10253 * fileread.cc (File_read::make_view): Assert on zero-length view.
10254 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
10255 symbol table when there are no symbols to read.
10257 2008-06-23 Craig Silverstein <csilvers@google.com>
10259 * version.cc (version_string): Bump to 1.7
10261 2008-06-18 Craig Silverstein <csilvers@google.com>
10263 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
10264 constant 0xFFFF to type Valtype.
10265 (Powerpc_relocate_functions::rel16_ha): Likewise.
10267 2008-06-17 Ian Lance Taylor <iant@google.com>
10269 * output.h (Output_section::Input_section): Initialize p2align_ to
10270 zero for Output_section_data constructors.
10271 (Output_section::Input_section::addralign): If not an input
10272 section, return the alignment of the Output_section_data.
10273 * testsuite/copy_test.cc: New file.
10274 * testsuite/copy_test_1.cc: New file.
10275 * testsuite/copy_test_2.cc: New file.
10276 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
10277 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
10278 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
10279 (copy_test_1_pic.o, copy_test_1.so): New targets.
10280 (copy_test_2_pic.o, copy_test_2.so): New targets.
10281 * testsuite/Makefile.in: Rebuild.
10283 * script-sections.cc (Script_sections::place_orphan): Initialize
10284 local variable exact.
10286 2008-06-13 David Edelsohn <edelsohn@gnu.org>
10288 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
10290 2008-06-12 David Edelsohn <edelsohn@gnu.org>
10291 David S. Miller <davem@davemloft.net>
10293 * powerpc.cc: New file.
10294 * Makefile.am (TARGETSOURCES): Add powerpc.cc
10295 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
10296 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
10297 * Makefile.in: Rebuild.
10299 2008-06-09 Ian Lance Taylor <iant@google.com>
10301 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
10303 (throwing, orig_terminate): New static variables.
10304 (terminate_handler): New static function.
10305 (t2): Set terminate handler.
10307 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
10310 * binary.cc (Binary_to_elf::sized_convert): Fix .data
10313 2008-05-30 Cary Coutant <ccoutant@google.com>
10315 * archive.cc (Archive::include_all_members) Correct to step
10316 over symbol table and extended name table in thin archives.
10318 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
10321 * target-reloc.h (relocate_for_relocatable): Fix new_offset
10324 2008-05-28 Caleb Howe <cshowe@google.com>
10326 * reduced_debug_output.cc: New file.
10327 * reduced_debug_output.h: New file.
10328 * options.h (class General_options): Add --strip-debug-non-line.
10329 * options.cc (General_options::finalize): Add strip_debug_non_line
10330 to the strip heirarchy.
10331 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
10333 * layout.cc: Include "reduced_debug_output.h".
10334 (Layout::Layout): Initialize new fields.
10335 (line_only_debug_sections): New static array.
10336 (is_lines_only_debug_sections): New static inline function.
10337 (Layout::include_section): Handle --strip-debug-non-line.
10338 (Layout::make_output_section): If --strip-debug-non-line, build
10339 new output sections for .debug_abbrev and .debug_info.
10340 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
10341 gold. Warn about possible overflow.
10342 (read_signed_LEB_128): Likewise.
10343 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
10344 (read_signed_LEB_128): Declare.
10345 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
10346 (HFILES): Add reduced_debug_output.h.
10347 * Makefile.in: Rebuild.
10349 2008-05-21 Ian Lance Taylor <iant@google.com>
10351 * mapfile.cc: New file.
10352 * mapfile.h: New file.
10353 * options.h (class General_options): Add -M/--print-map and -Map.
10354 * options.cc (General_options::finalize): Make -M equivalent to
10356 * main.cc: Include <cstdio> and "mapfile.h".
10357 (main): Open mapfile if requested.
10358 * gold.cc (class Middle_runner): Add mapfile_ field. Update
10359 constructor. Change caller.
10360 (queue_initial_tasks): Add mapfile parameter. Change caller.
10361 (queue_middle_tasks): Likewise.
10362 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
10364 * archive.cc: Include "mapfile.h".
10365 (Archive::add_symbols): Add mapfile parameter. Change all
10366 callers. Pass mapfile, symbol, and reason to include_member.
10367 (Archive::include_all_members): Add mapfile parameter. Change all
10369 (Archive::include_member): Add mapfile, sym, and why parameters.
10370 Change all callers. Report inclusion to map file.
10371 * archive.h: Include "fileread.h".
10372 (class Archive): Update declarations.
10373 (Archive::file): New const method.
10374 (class Add_archive_symbols): Add mapfile_ field. Update
10375 constructor. Change all callers.
10376 * readsyms.h (class Read_symbols): Likewise.
10377 (class Finish_group): Likewise.
10378 (class Read_script): Likewise.
10379 * common.cc: Include "mapfile.h".
10380 (Symbol_table::allocate_commons): Add mapfile parameter. Change
10382 (Symbol_table::do_allocate_commons): Likewise.
10383 (Symbol_table::do_allocate_commons_list): Likewise. Report common
10384 symbol allocation to mapfile.
10385 * common.h (class Allocate_commons_task): Add mapfile_ field.
10386 Update constructor. Change all callers.
10387 * symtab.h (class Symbol_table): Update declarations.
10388 * layout.cc: Include "mapfile.h".
10389 (Layout_task_runner::run): Print information to mapfile.
10390 (Layout::create_gold_note): Change Output_data_fixed_space to
10391 Output_data_zero_fill.
10392 (Layout::create_build_id): Likewise.
10393 (Layout::print_to_mapfile): New function.
10394 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
10395 constructor. Change caller.
10396 (class Layout): Declare print_to_mapfile.
10397 * output.cc (Output_section::Input_section::print_to_mapfile): New
10399 (Output_section::add_input_section): If producing a map, always
10400 add to input_sections_ list.
10401 (Output_section::do_print_to_mapfile): New function.
10402 (Output_segment::print_sections_to_mapfile): New function.
10403 (Output_segment::print_section_list_to_mapfile): New function.
10404 * output.h: Include "mapfile.h".
10405 (Output_data::print_to_mapfile): New function.
10406 (Output_data::do_print_to_mapfile): New virtual function.
10407 (Output_segment_headers::do_print_to_mapfile): New function.
10408 (Output_file_header::do_print_to_mapfile): New function.
10409 (Output_data_const::do_print_to_mapfile): New function.
10410 (class Output_data_const_buffer): Add map_name_ field. Update
10411 constructor. Change all callers. Add do_print_to_mapfile
10413 (class Output_data_fixed_space): Likewise.
10414 (class Output_data_space): Likewise.
10415 (class Output_data_zero_fill): New class.
10416 (Output_data_strtab::do_print_to_mapfile): New function.
10417 (Output_data_reloc_base::do_print_to_mapfile): New function.
10418 (Output_relocatable_relocs::do_print_to_mapfile): New function.
10419 (Output_data_group::do_print_to_mapfile): New function.
10420 (Output_data_got::do_print_to_mapfile): New function.
10421 (Output_data_dynamic::do_print_to_mapfile): New function.
10422 (Output_symtab_xindex::do_print_to_mapfile): New function.
10423 (class Output_section): Declare do_print_to_mapflie. Declare
10424 print_to_mapfile in Input_section.
10425 (class Output_segment): Declare new functions.
10426 * object.h (Sized_relobj::symbol_count): New function.
10427 * script-sections.cc
10428 (Output_section_element_dot_assignment::set_section_addresses):
10429 Change Output_data_fixed_space to Output_data_zero_fill.
10430 (Output_data_expression::do_print_to_mapfile): New function.
10431 * script.cc (read_input_script): Add mapfile parameter. Change
10433 * script.h (read_input_script): Update declaration.
10434 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
10435 (Eh_frame::do_print_to_mapfile): New function.
10436 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
10437 (Output_merge_string::do_print_to_mapfile): New function.
10438 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
10440 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
10442 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
10444 * Makefile.am (CCFILES): Add mapfile.cc.
10445 (HFILES): Add mapfile.h.
10446 * Makefile.in: Rebuild.
10448 2008-05-19 Ian Lance Taylor <iant@google.com>
10450 * options.h (class General_options): Add -z relro.
10451 * layout.cc (Layout::Layout): Initialize relro_segment_.
10452 (Layout::add_output_section_data): Return the output section.
10453 (Layout::make_output_section): Rcognize relro sections and mark
10454 them appropriately.
10455 (Layout::attach_allocated_section_to_segment): Put relro sections
10456 in a PT_GNU_RELRO segment.
10457 (Layout::create_initial_dynamic_sections): Mark the .dynamic
10459 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
10461 (Layout::linkonce_mapping): Map d.rel.ro.local to
10462 .data.rel.ro.local.
10463 (Layout::output_section_name): Us .data.rel.ro.local for any
10464 section which begins with that.
10465 * layout.h (class Layout): Update add_output_section_data
10466 declaration. Add relro_segment_ field.
10467 * output.cc (Output_section::Output_section): Initialize is_relro_
10468 and is_relro_local_ fields.
10469 (Output_segment::add_output_section): Group relro sections.
10470 (Output_segment::is_first_section_relro): New function.
10471 (Output_segment::maximum_alignment): If there is a relro section,
10472 align the segment to the common page size.
10473 (Output_segment::set_section_addresses): Track whether we are
10474 looking at relro sections. If the last section is a relro
10475 section, align to the common page size.
10476 (Output_segment::set_section_list_addresses): Add in_relro
10477 parameter. Change all callers. Align to the page size when
10478 moving from relro to non-relro section.
10479 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
10481 * output.h (class Output_section): Add is_relro_ and
10482 is_relro_local_ fields.
10483 (Output_section::is_relro): New function.
10484 (Output_section::set_is_relro): New function.
10485 (Output_section::is_relro_local): New function.
10486 (Output_section::set_is_relro_local): New function.
10487 (class Output_segment): Update declarations.
10488 * i386.cc (Target_i386::got_section): Mark .got section as relro.
10489 * sparc.cc (Target_sparc::got_section): Likewise.
10490 * x86_64.cc (Target_x86_64::got_section): Likewise.
10491 * testsuite/relro_test_main.cc: New file.
10492 * testsuite/relro_test.cc: New file.
10493 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
10494 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
10495 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
10496 (relro_test.so, relro_test_pic.o): New targets.
10497 * testsuite/Makefile.in: Rebuild.
10499 2008-05-16 Ian Lance Taylor <iant@google.com>
10501 * output.cc (Output_segment::add_output_section): Remove front
10503 * output.h (class Output_segment): Remove
10504 add_initial_output_section and overloaded add_output_section.
10505 Update declaration of remaining add_output_section.
10506 * layout.cc (Layout::create_interp): Call add_output_section
10507 rather than add_initial_output_section.
10508 (Layout::finish_dynamic_section): Likewise.
10510 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
10511 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
10512 know the dynamic type.
10513 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
10514 field. Initialize it in constructor.
10515 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
10516 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
10517 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
10520 * output.cc (Output_reloc::get_address): Change return type to
10522 * output.h (class Output_reloc): Update get_address declaration.
10523 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
10524 for section addresses.
10526 2008-05-09 Ian Lance Taylor <iant@google.com>
10529 * gold.cc (gold_nomem): Use return value of write.
10531 2008-05-08 Ian Lance Taylor <iant@google.com>
10533 * symtab.c (Symbol::init_base_output_data): Add version
10534 parameter. Change all callers.
10535 (Symbol::init_base_output_segment): Likewise.
10536 (Symbol::init_base_constant): Likewise.
10537 (Symbol::init_base_undefined): Likewise.
10538 (Sized_symbol::init_output_data): Likewise.
10539 (Sized_symbol::init_output_segment): Likewise.
10540 (Sized_symbol::init_constant): Likewise.
10541 (Sized_symbol::init_undefined): Likewise.
10542 (Symbol_table::do_define_in_output_data): If the new symbol has a
10543 version, mark it as the default.
10544 (Symbol_table::do_define_in_output_segment): Likewise.
10545 (Symbol_table::do_define_as_constant): Likewise.
10546 * symtab.h (class Symbol): Update declarations.
10547 (class Sized_symbol): Likewise.
10548 * resolve.cc (Symbol::override_version): New function.
10549 (Symbol::override_base): Call override_version.
10550 (Symbol::override_base_with_special): Likewise.
10551 * testsuite/ver_script_8.script: New file.
10552 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
10553 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
10554 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
10555 (ver_test_8_1.so, ver_test_8_2.so): New targets.
10557 2008-05-06 Ian Lance Taylor <iant@google.com>
10560 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
10562 (class General_options): Remove existing --undefined, and add
10563 --no-undefined instead. Add new --undefined as synonym for -u.
10564 * archive.cc (Archive::add_symbols): Check whether symbol was
10566 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
10567 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
10568 all uses. Add IS_UNDEFINED. Update declarations to split
10569 different versions of init_base. Declare init_base_undefined.
10570 (Symbol::is_defined): Handle IS_UNDEFINED.
10571 (Symbol::is_undefined): Likewise.
10572 (Symbol::is_weak_undefined): Call is_undefined.
10573 (Symbol::is_absolute): Handle IS_CONSTANT.
10574 (class Sized_symbol): Update declarations to split different
10575 versions of init. Declare init_undefined.
10576 (class Symbol_table): Declare new functions.
10577 * symtab.cc (Symbol::init_base_object): Rename from init_base.
10578 Change all callers.
10579 (Symbol::init_base_output_data): Likewise.
10580 (Symbol::init_base_output_segment): Likewise.
10581 (Symbol::init_base_constant): Likewise.
10582 (Symbol::init_base_undefined): New function.
10583 (Sized_symbol::init_object): Rename from init. Change all
10585 (Sized_symbol::init_output_data): Likewise.
10586 (Sized_symbol::init_output_segment): Likewise.
10587 (Sized_symbol::init_constant): Likewise.
10588 (Sized_symbol::init_undefined): New function.
10589 (Symbol_table::add_undefined_symbols_from_command_line): New
10591 (Symbol_table::do_add_undefined_symbols_from_command_line): New
10593 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
10594 (Symbol::output_section): Likewise.
10595 (Symbol::set_output_section): Likewise.
10596 (Symbol_table::sized_finalize_symbol): Likewise.
10597 (Symbol_table::sized_write_globals): Likewise.
10598 * resolve.cc (Symbol_table::should_override): Likewise.
10599 (Symbol::override_base_with_special): Likewise.
10601 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
10602 symbol, change it to have default visibility.
10603 * testsuite/protected_1.cc: New file.
10604 * testsuite/protected_2.cc: New file.
10605 * testsuite/protected_3.cc: New file.
10606 * testsuite/protected_main_1.cc: New file.
10607 * testsuite/protected_main_2.cc: New file.
10608 * testsuite/protected_main_3.cc: New file.
10609 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
10610 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
10611 (protected_1_LDFLAGS, protected_1_LDADD): Define.
10612 (protected_1.so): New target.
10613 (protected_1_pic.o, protected_2_pic.o): New targets.
10614 (protected_3_pic.o): New target.
10615 (check_PROGRAMS): Add protected_2.
10616 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
10617 (protected_2_LDFLAGS, protected_2_LDADD): Define.
10618 * testsuite/Makefile.in: Rebuild.
10620 * options.h (DEFINE_var): Add set_user_set_##varname__.
10621 (DEFINE_bool_alias): New macro.
10622 (class General_options): Define -Bstatic using DEFINE_bool_alias
10623 rather than DEFINE_special. Add --undefined as an alias for -z
10625 * options.cc (General_options::parse_Bstatic): Remove.
10627 * options.h (class General_options): Add --fatal-warnings.
10628 * main.cc (main): Implement --fatal-warnings.
10629 * errors.h (Errors::warning_count): New function.
10631 * options.h (class General_options): Add -Bsymbolic-functions.
10632 * symtab.h (Symbol::is_preemptible): Check for
10633 -Bsymbolic-functions.
10635 2008-05-05 Ian Lance Taylor <iant@google.com>
10637 * options.h (DEFINE_bool): For DASH_Z, create the negative option
10638 as noVARNAME rather than no-VARNAME.
10639 (class General_options): Add option -z combreloc.
10640 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
10642 (Output_reloc::sort_before) [SHT_REL]: New function.
10643 (Output_reloc::sort_before) [SHT_RELA]: New function.
10644 (class Output_data_reloc_base): Add sort_relocs_ field. Define
10645 Sort_relocs_comparison.
10646 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
10647 parameter. Change all callers.
10648 (Output_data_reloc::Output_data_reloc) [both versions]: Add
10649 sort_relocs parameter. Change all callers.
10650 * output.cc (Output_reloc::get_address): New function, broken out
10652 (Output_reloc::write_rel): Call it.
10653 (Output_reloc::compare): New function.
10654 (Output_data_reloc_base::do_write): Optionally sort relocs.
10656 * configure.ac: If targ_extra_obj is set, link it in.
10657 * configure.tgt: Initialize all variables.
10658 (x86_64*): Set targ_extra_obj and targ_extra_size.
10659 * configure: Rebuild.
10661 * object.cc (Sized_relobj::include_section_group): Adjust section
10662 indexes read from group data. Build vector to pass to
10664 * layout.cc (Layout::layout_group): Add flags and shndxes
10665 parameters. Remove contents parameter. Change caller. Update
10666 explicit instantiations.
10667 * layout.h (class Layout): Update layout_group declaration.
10668 * output.cc (Output_data_group::Output_data_group): Add flags and
10669 input_shndxes parameters. Remove contents parameter. Change
10671 (Output_data_group::do_write): Change input_sections_ to
10673 * output.h (class Output_data_group): Update constructor
10674 declaration. Rename input_sections_ to input_shndxes_.
10675 * testsuite/many_sections_test.cc: Add template.
10677 2008-04-30 Cary Coutant <ccoutant@google.com>
10679 * target-reloc.h (relocate_section): Fix dead-pointer bug.
10681 * layout.cc (Layout::include_section): Refactored check for debug
10683 (Layout::add_comdat): Add new parameters. Change type
10684 of signature parameter. Add object and shndx to signatures table.
10685 (Layout::find_kept_object): New function.
10686 * layout.h: Include <cstring>.
10687 (Layout::is_debug_info_section): New function.
10688 (Layout::add_comdat): Add new parameters.
10689 (Layout::find_kept_object): New function.
10690 (Layout::Kept_section): New struct.
10691 (Layout::Signatures): Change type of map range.
10692 * object.cc (Relobj::output_section_address): New function.
10693 (Sized_relobj::include_section_group): Add new parameters. Change
10694 calls to Layout::add_comdat. Change to build table of kept comdat
10695 groups and table mapping discarded sections to kept sections.
10696 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
10697 (Sized_relobj::do_layout): Change calls to include_section_group and
10698 include_linkonce_section.
10699 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
10700 value to zero when section is discarded.
10701 (Sized_relobj::map_to_kept_section): New function.
10702 * object.h (Relobj::output_section_address): New function.
10703 (Relobj::Comdat_group): New type.
10704 (Relobj::find_comdat_group): New function.
10705 (Relobj::Comdat_group_table): New type.
10706 (Relobj::Kept_comdat_section): New type.
10707 (Relobj::Kept_comdat_section_table): New type.
10708 (Relobj::add_comdat_group): New function.
10709 (Relobj::set_kept_comdat_section): New function.
10710 (Relobj::get_kept_comdat_section): New function.
10711 (Relobj::comdat_groups_): New field.
10712 (Relobj::kept_comdat_sections_): New field.
10713 (Symbol_value::input_value): Update comment.
10714 (Sized_relobj::map_to_kept_section) New function.
10715 (Sized_relobj::include_linkonce_section): Add new parameter.
10716 * target-reloc.h (Comdat_behavior): New type.
10717 (get_comdat_behavior): New function.
10718 (relocate_section): Add code to map a discarded section to the
10719 corresponding kept section when applying a relocation.
10721 2008-04-30 Craig Silverstein <csilvers@google.com>
10723 * dwarf_reader.cc (next_generation_count): New static var.
10724 (Addr2line_cache_entry): New struct.
10725 (addr2line_cache): New static var.
10726 (Dwarf_line_info::one_addr2line): Added caching.
10727 (Dwarf_line_info::clear_addr2line_cache): New function.
10728 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
10729 cache-size parameter.
10730 (Dwarf_line_info::one_addr2line_cache): New function.
10731 * symtab.cc (Symbol_table::detect_odr_violations): Pass
10732 new cache-size argument to one_addr2line(), and clear cache.
10734 2008-04-28 Cary Coutant <ccoutant@google.com>
10736 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
10737 R_386_PC8 relocations.
10739 2008-04-23 Ian Lance Taylor <iant@google.com>
10741 * object.cc (Sized_relobj::include_section_group): Check for
10742 invalid section group.
10744 * object.cc (make_elf_object): Correct test for 64-bit ELF file
10747 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
10748 than read for file header.
10749 * archive.cc (Archive::include_member): Likewise.
10751 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
10753 * aclocal.m4: Regenerate.
10754 * configure: Regenerate.
10756 2008-04-19 Ian Lance Taylor <iant@google.com>
10758 * version.cc (version_string): Bump to 1.6.
10760 * testsuite/Makefile.am (many_sections_r_test): New target.
10761 (many_sections_r_test_SOURCES): Remove.
10762 (many_sections_r_test_DEPENDENCIES): Remove.
10763 (many_sections_r_test_LDFLAGS): Remove.
10764 (many_sections_r_test_LDADD): Remove.
10766 * object.cc (Sized_relobj::do_add_symbols): Always pass
10767 local_symbol_count_ to add_from_relobj.
10769 * testsuite/Makefile.am (many_sections_check.h): Only check one in
10770 every thousand variables.
10771 * testsuite/Makefile.in: Rebuild.
10773 * object.cc (Xindex::initialize_symtab_xindex): New function.
10774 (Xindex::read_symtab_xindex): New function.
10775 (Xindex::sym_xindex_to_shndx): New function.
10776 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
10778 (Sized_relobj::do_initialize_xindex): New function.
10779 (Sized_relobj::do_read_symbols): Adjust section links.
10780 (Sized_relobj::symbol_section_and_value): Add is_ordinary
10781 parameter. Change all callers.
10782 (Sized_relobj::include_section_group): Adjust section links and
10783 symbol section indexes.
10784 (Sized_relobj::do_layout): Adjust section links.
10785 (Sized_relobj::do_count_local_symbols): Adjust section links and
10786 symbol section indexes.
10787 (Sized_relobj::do_finalize_local_symbols): Distinguish between
10788 ordinary and special symbols.
10789 (Sized_relobj::write_local_symbols): Add symtab_xindex and
10790 dynsym_xindex parameters. Change all callers. Adjust section
10791 links. Use SHN_XINDEX when needed.
10792 (Sized_relobj::get_symbol_location_info): Adjust section links.
10793 Don't get fooled by special symbols.
10794 * object.h (class Xindex): Define.
10795 (class Object): Add xindex_ parameter. Declare virtual functoin
10796 do_initialize_xindex.
10797 (Object::adjust_sym_shndx): New function.
10798 (Object::set_xindex): New protected function.
10799 (class Symbol_value): Add is_ordinary_shndx_ field.
10800 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
10801 (Symbol_value::value): Assert ordinary section.
10802 (Symbol_value::initialize_input_to_output_map): Likewise.
10803 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
10804 Change all callers.
10805 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
10807 (class Sized_relobj): Update declarations.
10808 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
10809 parameter. Change all callers.
10810 (Sized_relobj::adjust_shndx): New function.
10811 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
10813 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
10814 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
10815 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
10816 (Sized_dynobj::read_dynsym_section): Adjust section links.
10817 (Sized_dynobj::read_dynamic): Likewise.
10818 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
10820 (Sized_dynobj::do_initialize_xindex): New function.
10821 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
10822 do_initialize_xindex.
10823 (Sized_dynobj::adjust_shndx): New function.
10824 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
10825 dynsym_xindex_ fields.
10826 (Layout::finalize): Add a call to set_section_indexes before
10827 creating the symtab sections.
10828 (Layout::set_section_indexes): Don't do anything if the section
10829 already has a section index.
10830 (Layout::create_symtab_sections): Add shnum parameter. Change
10831 caller. Create .symtab_shndx section if needed.
10832 (Layout::create_shdrs): Add shstrtab_section parameter. Change
10834 (Layout::allocated_output_section_count): New function.
10835 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
10837 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
10838 fields. Update declarations.
10839 (Layout::symtab_xindex): New function.
10840 (Layout::dynsym_xindex): New function.
10841 (class Write_symbols_task): Add layout_ field.
10842 (Write_symbols_task::Write_symbols_task): Add layout parameter.
10844 * output.cc (Output_section_headers::Output_section_headers): Add
10845 shstrtab_section parameter. Change all callers.
10846 (Output_section_headers::do_sized_write): Store overflow values
10847 for section count and section string table section index in
10848 section header zero.
10849 (Output_file_header::do_sized_write): Check for overflow of
10850 section count and section string table section index.
10851 (Output_symtab_xindex::do_write): New function.
10852 (Output_symtab_xindex::endian_do_write): New function.
10853 * output.h (class Output_section_headers): Add shstrtab_section_.
10854 Update declarations.
10855 (class Output_symtab_xindex): Define.
10856 (Output_section::has_out_shndx): New function.
10857 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
10859 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
10860 Change all callers.
10861 (Sized_symbol::init): Likewise.
10862 (Symbol::output_section): Check for ordinary symbol.
10863 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
10864 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
10866 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
10867 Change all callers. Simplify handling of symbols from sections
10868 not included in the link.
10869 (Symbol_table::add_from_dynobj): Handle ordinary symbol
10871 (Weak_alias_sorter::operator()): Assert that symbols are
10873 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
10875 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
10876 parameters. Change all callers.
10877 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
10878 symbol distinction. Use SHN_XINDEX when needed.
10879 (Symbol_table::write_section_symbol): Add symtab_xindex
10880 parameter. Change all callers.
10881 (Symbol_table::sized_write_section_symbol): Likewise. Use
10882 SHN_XINDEX when needed.
10883 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
10885 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
10886 (Symbol::is_defined): Check is_ordinary.
10887 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
10888 (Symbol::is_absolute, Symbol::is_common): Likewise.
10889 (class Sized_symbol): Update declarations.
10890 (class Symbol_table): Update declarations.
10891 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
10892 parameters. Change all callers.
10893 (Sized_symbol::override): Likewise.
10894 (Symbol_table::override): Likewise.
10895 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
10896 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
10897 is_ordinary, and orig_st_shndx parameters. Change all callers.
10898 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
10899 to be in an ordinary section.
10900 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
10901 object and is_ordinary parameters. Change all callers.
10902 (Sized_dwarf_line_info::read_relocs): Add object parameter.
10903 Change all callers. Don't add undefined or non-ordinary symbols
10905 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
10906 Change all callers.
10907 * dwarf_reader.h (class Sized_dwarf_line_info): Update
10909 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
10910 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
10911 (Sized_relobj::relocate_sections): Likewise.
10912 * target-reloc.h (scan_relocs): Adjust section symbol index.
10913 (scan_relocatable_relocs): Likewise.
10914 * i386.cc (Scan::local): Check for ordinary symbols.
10915 * sparc.cc (Scan::local): Likewise.
10916 * x86_64.cc (Scan::local): Likewise.
10917 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
10918 to symbol_section_and_value.
10919 * testsuite/many_sections_test.cc: New file.
10920 * testsuite/Makefile.am (BUILT_SOURCES): Define.
10921 (check_PROGRAMS): Add many_sections_test.
10922 (many_sections_test_SOURCES): Define.
10923 (many_sections_test_DEPENDENCIES): Define.
10924 (many_sections_test_LDFLAGS): Define.
10925 (BUILT_SOURCES): Add many_sections_define.h.
10926 (many_sections_define.h): New target.
10927 (BUILT_SOURCES): Add many_sections_check.h.
10928 (many_sections_check.h): New target.
10929 (check_PROGRAMS): Add many_sections_r_test.
10930 (many_sections_r_test_SOURCES): Define.
10931 (many_sections_r_test_DEPENDENCIES): Define.
10932 (many_sections_r_test_LDFLAGS): Define.
10933 (many_sections_r_test_LDADD): Define.
10934 (many_sections_r_test.o): New target.
10935 * testsuite/Makefile.in: Rebuild.
10937 2008-04-17 Cary Coutant <ccoutant@google.com>
10939 * errors.cc (Errors::info): New function.
10940 (gold_info): New function.
10941 * errors.h (Errors::info): New function.
10942 * gold.h (gold_info): New function.
10943 * object.cc (Input_objects::add_object): Print trace output.
10944 * options.cc (options::parse_set): New function.
10945 (General_options::parse_wrap): Deleted.
10946 (General_options::General_options): Deleted initializer.
10947 * options.h (options::String_set): New typedef.
10948 (options::parse_set): New function.
10949 (DEFINE_set): New macro.
10950 (General_options::wrap): Changed to use DEFINE_set. Changed
10951 callers of any_wrap_symbols and is_wrap_symbol.
10952 (General_options::trace, General_options::trace_symbol):
10954 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
10955 (General_options::wrap_symbols_): Deleted.
10956 * symtab.cc (Symbol_table::add_from_object): Print trace output.
10958 2008-04-17 David S. Miller <davem@davemloft.net>
10960 * options.cc (General_options::parse_V): New function.
10961 * options.h: Add entries for -V and -Qy.
10963 2008-04-17 Ian Lance Taylor <iant@google.com>
10965 * common.cc (Symbol_table::allocate_commons): Remove options
10966 parameter. Change caller.
10967 (Symbol_table::do_allocate_commons): Remove options parameter.
10968 Change caller. Just call do_allocate_commons_list twice.
10969 (Symbol_table::do_allocate_commons_list): New function, broken out
10970 of do_allocate_commons.
10971 * common.h (class Allocate_commons_task): Remove options_ field.
10972 Update constructor.
10973 * symtab.cc (Symbol_table::Symbol_table): Initialize
10975 (Symbol_table::add_from_object): Put TLS common symbols on
10977 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
10978 which are IN_OUTPUT_DATA.
10979 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
10980 allocate_commons and do_allocate_commons declarations. Declare
10981 do_allocate_commons_list.
10982 * gold.cc (queue_middle_tasks): Update creation of
10983 Allocate_commons_task to not pass options.
10984 * testsuite/Makefile.am (INCLUDES): Add -I.. .
10985 (TLS_TEST_C_FLAGS): New variable.
10986 (tls_test_c_pic.o): New target.
10987 (tls_test_shared.so): Link in tls_test_c_pic.o.
10988 (tls_test_c_pic_ie.o): New target.
10989 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
10990 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
10991 (tls_test_c.o): New target.
10992 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
10993 (tls_pic_test_LDADD): Likewise.
10994 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
10995 (tls_shared_gd_to_ie_test_LDADD): Likewise.
10996 (tls_test_c_gnu2.o): New target.
10997 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
10999 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
11000 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
11001 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
11002 * testsuite/tls_test.cc: Include "config.h".
11003 (t_last): Call t11_last.
11004 * testsuite/tls_test.h (t11, t11_last): Declare.
11005 * testsuite/tls_test_c.c: New file.
11006 * testsuite/tls_test_main.cc (thread_routine): Call t11.
11007 * configure.ac: Check for OpenMP support.
11008 * configure, config.in, Makefile.in: Rebuild.
11009 * testsuite/Makefile.in: Rebuild.
11011 2008-04-16 Cary Coutant <ccoutant@google.com>
11013 * i386.cc (Target_i386::define_tls_base_symbol): New function.
11014 (Target_i386::tls_base_symbol_defined_): New field.
11015 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11016 (Target_i386::Scan::global): Likewise.
11017 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
11018 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
11019 (Target_x86_64::tls_base_symbol_defined_): New field.
11020 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11021 (Target_x86_64::Scan::global): Likewise.
11023 2008-04-16 Cary Coutant <ccoutant@google.com>
11025 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
11026 (Symbol::needs_plt_entry): Allow weak undefined symbols.
11027 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
11028 building shared libraries.
11029 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
11030 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
11031 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
11032 * testsuite/Makefile.in: Rebuild.
11033 * testsuite/weak_undef.h: New file.
11034 * testsuite/weak_undef_file1.cc: Add extra test cases.
11035 * testsuite/weak_undef_file2.cc: Likewise.
11036 * testsuite/weak_undef_test.cc: Likewise.
11038 2008-04-16 David S. Miller <davem@davemloft.net>
11040 * sparc.cc (Target_sparc::Scan): Change from struct to class.
11041 Add issued_non_pic_error_ field. Declare check_non_pic.
11042 (Target_sparc::Scan::check_non_pic): New function.
11043 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
11044 (Target_sparc::Scan::global): Likewise.
11046 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
11047 * configure: Rebuild.
11049 * options.h (DEFINE_enable): New macro.
11050 (new_dtags): New enable option.
11051 (initfirst, interpose, loadfltr, nodefaultlib,
11052 nodelete, nodlopen, nodump): New -z options.
11053 * layout.cc (Layout:finish_dynamic_section): If new
11054 dtags enabled, emit DT_RUNPATH. Also, emit a
11055 DT_FLAGS_1 containing any specified -z flags.
11057 2008-04-16 Ian Lance Taylor <iant@google.com>
11059 * copy-relocs.cc: New file.
11060 * copy-relocs.h: New file.
11061 * reloc.cc: Remove Copy_relocs code.
11062 * reloc.h: Likewise.
11063 * reloc-types.h (struct Reloc_types) [both versions]: Add
11064 get_reloc_addend_noerror.
11065 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
11066 variants of add_global which take an addend which must be zero.
11067 * i386.cc: Include "copy-relocs.h".
11068 (class Target_i386): Change type of copy_relocs_ to variable,
11069 update initializer.
11070 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
11071 Change all callers.
11072 (Target_i386::do_finalize_sections): Change handling of
11074 * sparc.cc: Include "copy-relocs.h".
11075 (class Target_sparc): Change type of copy_relocs_ to variable,
11076 update initializer.
11077 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
11078 Change all callers.
11079 (Target_sparc::do_finalize_sections): Change handling of
11081 * x86_64.cc: Include "copy-relocs.h".
11082 (class Target_x86_64): Change type of copy_relocs_ to variable,
11083 update initializer.
11084 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
11085 class. Change all callers.
11086 (Target_x86_64::do_finalize_sections): Change handling of
11088 * Makefile.am (CCFILES): Add copy-relocs.cc.
11089 (HFILES): Add copy-relocs.h.
11091 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
11093 * testsuite/script_test_4.sh: Permit leading zeroes.
11095 2008-04-15 Ian Lance Taylor <iant@google.com>
11097 * script-sections.cc (Script_sections::create_segments): Use
11098 header_size_adjustment even when there is enough room for the
11100 * testsuite/script_test_4.sh: New file.
11101 * testsuite/script_test_4.t: New file.
11102 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
11103 (check_DATA): Add script_test_4.stdout.
11104 (MOSTLYCLEANFILES): Likewise.
11105 (script_test_4): New target.
11106 (script_test_4.stdout): New target.
11107 * testsuite/Makefile.in: Rebuild.
11109 * sparc.cc: Add definitions for Output_data_plt_sparc class
11112 2008-04-14 David S. Miller <davem@davemloft.net>
11114 * sparc.cc: New file.
11115 * Makefile.am (TARGETSOURCES): Add sparc.cc
11116 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
11117 * configure.tgt: Document targ_extra_size and
11118 targ_extra_big_endian. Add entries for sparc-* and
11120 * configure.ac: Handle targ_extra_size and
11121 targ_extra_big_endian.
11122 * Makefile.in: Rebuild.
11123 * configure: Likewise.
11124 * po/POTFILES.in: Likewise.
11125 * po/gold.pot: Likewise.
11127 2008-04-14 Ian Lance Taylor <iant@google.com>
11129 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
11130 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
11131 in the name/type/flags to section mapping. Don't call
11132 allocate_output_section.
11133 (Layout::choose_output_section): Change parameter from adjust_name
11134 to is_input_section. Don't permit input sections after sections
11135 are attached to segments. Don't call allocate_output_section.
11136 (Layout::layout_eh_frame): Call update_flags_for_input_section,
11137 not write_enable_output_section.
11138 (Layout::make_output_section): Don't push to
11139 unattached_section_list_ nor call attach_to_segment. Call
11140 attach_section_to_segment if sections are attached.
11141 (Layout::attach_sections_to_segments): New function.
11142 (Layout::attach_section_to_segment): New function.
11143 (Layout::attach_allocated_section_to_segment): Rename from
11144 attach_to_segment. Remove flags parameter.
11145 (Layout::allocate_output_section): Remove function.
11146 (Layout::write_enable_output_section): Remove function.
11147 * layout.h (class Layout): Update for above changes. Add new
11148 field sections_are_attached_.
11149 * output.h (Output_section::update_flags_for_input_section): New
11151 * output.cc (Output_section::add_input_section): Call
11152 update_flags_for_input_section.
11153 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
11155 2008-04-11 Cary Coutant <ccoutant@google.com>
11157 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
11158 thought unnecessary.
11159 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
11161 2008-04-11 Ian Lance Taylor <iant@google.com>
11163 * output.h (class Output_section_data): Remove inline definition
11165 * output.cc (Output_section_data::set_addralign): New function.
11167 2008-04-11 Cary Coutant <ccoutant@google.com>
11169 Add support for TLS descriptors for i386 and x86_64.
11170 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
11171 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
11172 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
11174 (Target_i386::got_mod_index_entry): Remove unnecessary code.
11175 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
11176 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
11178 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
11179 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
11180 Fix problem with initial-exec relocations.
11181 (Target_i386::Relocate::relocate_tls): Likewise.
11182 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
11184 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
11185 support for section-plus-offset dynamic table entries.
11186 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
11187 (Output_data_dynamic::Dynamic_entry): Add support for
11188 section-plus-offset dynamic table entries.
11189 (Output_data_dynamic::Classification): Likewise.
11190 (Output_data_dynamic::classification_): Renamed offset_.
11191 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
11192 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
11193 (Target_x86_64::make_plt_section): New function.
11194 (Target_x86_64::reserve_tlsdesc_entries): New function.
11195 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
11196 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
11197 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
11198 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
11199 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
11200 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
11201 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
11202 add extra PLT entry for TLS descriptors.
11203 (Output_data_plt_x86_64::got_): New field.
11204 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
11205 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
11207 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
11209 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
11210 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
11211 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
11212 R_386_TLS_DESC_CALL relocations.
11213 (Target_x86_64::Scan::global): Likewise.
11214 (Target_x86_64::do_finalize_sections): Add dynamic table entries
11215 for TLS descriptors.
11216 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
11217 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
11218 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
11219 GD-to-IE relaxation.
11220 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
11221 and TLS_DESCRIPTORS.
11222 * Makefile.in: Rebuild.
11223 * configure: Rebuild.
11224 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
11225 (tls_test_shared2.so): New target.
11226 (tls_shared_gd_to_ie_test_SOURCES): New variable.
11227 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
11228 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
11229 (tls_shared_gd_to_ie_test_LDADD): New variable.
11230 (tls_shared_gnu2_gd_to_ie_test): New target.
11231 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
11233 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
11234 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
11235 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
11236 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
11237 (tls_shared_gnu2_test): New target.
11238 (tls_test_gnu2_shared.so): New target.
11239 (tls_shared_gnu2_test_SOURCES): New variable.
11240 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
11241 (tls_shared_gnu2_test_LDFLAGS): New variable.
11242 (tls_shared_gnu2_test_LDADD): New variable.
11243 * testsuite/Makefile.in: Rebuild.
11244 * testsuite/Makefile.
11246 2008-04-11 Ian Lance Taylor <iant@google.com>
11248 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
11250 * testsuite/Makefile.in: Rebuild.
11252 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
11254 * testsuite/script_test_2.cc (main): Adjust test.
11256 2008-04-11 David S. Miller <davem@davemloft.net>
11257 Ian Lance Taylor <iant@google.com>
11259 * options.h (General_options): Add entries for '-Y' and
11261 * options.cc (General_options:finalize): If -Y was used, add those
11262 entries to the library path instead of the default "/lib" and
11265 2008-04-11 David S. Miller <davem@davemloft.net>
11267 * testsuite/justsyms.t: Start at 0x100.
11268 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
11269 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
11271 * testsuite/script_test_2.cc: Adjust string and section length
11274 2008-04-09 Ian Lance Taylor <iant@google.com>
11277 * script-sections.cc (Sections_element::allocate_to_segment): Add
11279 (Output_section_definition::allocate_to_segment): Likewise.
11280 (Orphan_output_section::allocate_to_segment): Likewise.
11281 (Script_sections::attach_sections_using_phdrs_clause): Don't
11282 propagate non-PT_LOAD segments to orphan sections.
11283 * testsuite/Makefile.am (script_test_3.stdout): Generate using
11284 readelf rather than objdump.
11285 * testsuite/script_test_3.sh: Adjust accordingly. Test that
11286 .interp section and PT_INTERP segment are the same size.
11287 * testsuite/Makefile.in: Rebuild.
11289 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
11290 aliases for symbols defined in the same object.
11291 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
11292 (weak_alias_test_SOURCES): New variable.
11293 (weak_alias_test_DEPENDENCIES): New variable.
11294 (weak_alias_test_LDFLAGS): New variable.
11295 (weak_alias_test_LDADD): New variable.
11296 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
11297 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
11298 (weak_alias_test_3.o): New target.
11299 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
11300 * testsuite/weak_alias_test_main.cc: New file.
11301 * testsuite/weak_alias_test_1.cc: New file.
11302 * testsuite/weak_alias_test_2.cc: New file.
11303 * testsuite/weak_alias_test_3.cc: New file.
11305 2008-04-08 Ian Lance Taylor <iant@google.com>
11307 * options.h (class General_options): Add --noinhibit-exec option.
11308 * main.cc (main): Check --noinhibit-exec.
11310 * options.h (class General_options): Define --wrap as a special
11311 option. Add wrap_symbols_ field.
11312 (General_options::any_wrap_symbols): New function.
11313 (General_options::is_wrap_symbol): New function.
11314 * options.cc (General_options::parse_wrap): New function.
11315 (General_options::General_options): Initialize wrap_symbols_.
11316 * symtab.cc (Symbol_table::wrap_symbol): New function.
11317 (Symbol_table::add_from_object): Handle --wrap.
11318 * symtab.h (class Symbol_table): Declare wrap_symbol.
11319 * target.h (Target::wrap_char): New function.
11320 (Target::Target_info): Add wrap_char field.
11321 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
11322 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11323 * testsuite/testfile.cc (Target_test::test_target_info):
11326 * errors.cc (Errors::undefined_symbol): Mention symbol version if
11329 * layout.h (class Layout): Add added_eh_frame_data_ field.
11330 * layout.cc (Layout::Layout): Initialize new field.
11331 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
11332 output section until we find a section we merged successfully.
11333 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
11334 that the size be non-zero.
11336 * merge.cc (Object_merge_map::get_output_offset): Remove inline
11339 2008-04-08 Craig Silverstein <csilvers@google.com>
11341 * configure.ac: Export new conditional variable HAVE_ZLIB.
11342 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
11344 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
11345 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11347 2008-04-07 Ian Lance Taylor <iant@google.com>
11349 * version.cc (version_string): Set to "1.5".
11351 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
11352 Add issued_non_pic_error_ field. Declare check_non_pic.
11353 (Target_x86_64::Scan::check_non_pic): New function.
11354 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
11355 (Target_x86_64::Scan::global): Likewise.
11357 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
11358 addend parameter. Change caller. Handle merge sections.
11359 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
11360 Address to Addend. Don't add in the result of
11361 local_section_offset, pass down the addend and use the returned
11363 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
11364 Update declarations of local_section_offset and symbol_value.
11365 * testsuite/two_file_test_1.cc (t18): New function.
11366 * testsuite/two_file_test_2.cc (f18): New function.
11367 * testsuite/two_file_test_main.cc (main): Call t18.
11368 * testsuite/two_file_test.h (t18, f18): Declare.
11370 * configure.ac: Don't test for objdump, c++filt, or readelf.
11371 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
11373 (TEST_READELF): New variable.
11374 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
11375 (check_PROGRAMS): Add two_file_strip_test.
11376 (two_file_strip_test): New target.
11377 (check_PROGRAMS): Add two_file_same_shared_strip_test.
11378 (two_file_same_shared_strip_test_SOURCES): New variable.
11379 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
11380 (two_file_same_shared_strip_test_LDFLAGS): New variable.
11381 (two_file_same_shared_strip_test_LDADD): New variable.
11382 (two_file_shared_strip.so): New target.
11383 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
11384 (ver_test_5.syms, ver_test_7.syms): Likewise.
11385 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
11386 (strip_test_3.stdout): Use TEST_OBJDUMP.
11387 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11389 2008-04-04 Cary Coutant <ccoutant@google.com>
11391 * symtab.h (Symbol::is_weak_undefined): New function.
11392 (Symbol::is_strong_undefined): New function.
11393 (Symbol::is_absolute): New function.
11394 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
11395 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
11397 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
11398 (weak_undef_test): New target.
11399 * testsuite/Makefile.in: Rebuild.
11400 * testsuite/weak_undef_file1.cc: New file.
11401 * testsuite/weak_undef_file2.cc: New file.
11402 * testsuite/weak_undef_test.cc: New file.
11404 2008-04-03 Craig Silverstein <csilvers@google.com>
11406 * compressed_output.h (class Output_compressed_section): Use
11408 * compressed_output.cc (zlib_compress): Use unsigned buffers,
11410 (zlib_compressed_suffix): Removed.
11411 (Output_compressed_section::set_final_data_size): Use unsigned
11413 * testsuite/Makefile.am (flagstest_compress_debug_sections):
11414 Fix linker invocation.
11415 (flagstest_o_specialfile_and_compress_debug_sections):
11417 * testsuite/Makefile.in: Regenerated.
11419 2008-04-02 David S. Miller <davem@davemloft.net>
11421 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
11422 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
11424 2008-04-02 Craig Silverstein <csilvers@google.com>
11428 2008-04-02 Ian Lance Taylor <iant@google.com>
11430 * fileread.cc (File_read::find_view): Add byteshift and vshifted
11431 parameters. Update for new key type to views_. Change all
11433 (File_read::read): Adjust for byteshift in returned view.
11434 (File_read::add_view): New function, broken out of
11435 find_and_make_view.
11436 (File_read::make_view): New function, broken out of
11437 find_and_make_view.
11438 (File_read::find_or_make_view): Add offset and aligned
11439 parameters. Rewrite accordingly. Change all callers.
11440 (File_read::get_view): Add offset and aligned parameters. Adjust
11441 for byteshift in return value.
11442 (File_read::get_lasting_view): Likewise.
11443 * fileread.h (class File_read): Update declarations.
11444 (class File_read::View): Add byteshift_ field. Add byteshift to
11445 constructor. Add byteshift method.
11446 * archive.h (Archive::clear_uncached_views): New function.
11447 (Archive::get_view): Add aligned parameter. Change all callers.
11448 * object.h (Object::get_view): Add aligned parameter. Change all
11450 (Object::get_lasting_view): Likewise.
11452 * fileread.cc (File_read::release): Don't call clear_views if
11453 there are multiple objects.
11454 * fileread.h (File_read::clear_uncached_views): New function.
11455 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
11458 2008-03-31 Cary Coutant <ccoutant@google.com>
11460 Add thin archive support.
11461 * archive.cc (Archive::armagt): New const.
11462 (Archive::setup): Remove task parameter and calls to unlock.
11463 (Archive::unlock_nested_archives): New function.
11464 (Archive::read_header): Add nested_off parameter. Change
11466 (Archive::interpret_header): Likewise.
11467 (Archive::include_all_members): Change to handle thin
11469 (Archive::include_member): Likewise.
11470 * archive.h (Archive::Archive): Add new parameters and
11472 (Archive::armagt): New const.
11473 (Archive::setup): Remove task parameter.
11474 (Archive::unlock_nested_archives): New function.
11475 (Archive::read_header): Add nested_off parameter.
11476 (Archive::interpret_header): Likewise.
11477 (Archive::Nested_archive_table): New typedef.
11478 (Archive::is_thin_archive_): New field.
11479 (Archive::nested_archives_): New field.
11480 (Archive::options_): New field.
11481 (Archive::dirpath_): New field.
11482 (Archive::task_): New field.
11483 * readsyms.cc (Read_symbols::do_read_symbols): Add check
11484 for thin archives. Pass additional parameters to
11485 Archive::Archive. Unlock the archive file after calling
11488 2008-03-29 Ian Lance Taylor <iant@google.com>
11490 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
11491 version symbol to be local.
11492 * testsuite/ver_test_4.sh: New file.
11493 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
11494 (check_DATA): Add ver_test_4.syms.
11495 (ver_test_4.syms): New target.
11496 * testsuite/Makefile.in: Rebuild.
11499 (Output_section::Input_section_sort_entry::has_priority): New
11501 (Output_section::Input_section_sort_entry::match_file_name): New
11503 (Output_section::Input_section_sort_entry::match_section_name):
11505 (Output_section::Input_section_sort_entry::match_section_name_prefix):
11507 (Output_section::Input_section_sort_entry::match_section_file):
11509 (Output_section::Input_section_sort_compare::operator()): Rewrite
11510 using new Input_section_sort_entry functions. Sort crtbegin and
11511 crtend first. Sort sections with no priority before sections with
11513 * testsuite/initpri1.c (d3): Check j != 4.
11514 (cd5): New constructor/destructor function.
11515 (main): Check j != 2.
11517 * symtab.cc (Symbol_table::add_from_object): If we don't use the
11518 new symbol when resolving, don't call set_is_default.
11519 * testsuite/ver_test_7.cc: New file.
11520 * testsuite/ver_test_7.sh: New file.
11521 * testsuite/Makefile.am (ver_test_7.so): New target.
11522 (ver_test_7.o): New target.
11523 (check_SCRIPTS): Add ver_test_7.sh.
11524 (check_DATA): Add ver_test_7.syms.
11525 (ver_test_7.syms): New target.
11527 2008-03-28 Ian Lance Taylor <iant@google.com>
11529 * layout.cc (Layout::layout): If we see an input section with a
11530 name that needs sorting, set the must_sort flag for the output
11532 (Layout::make_output_section): If the name of the output section
11533 indicates that it might require sorting, set the may_sort flag.
11534 * output.h (Output_section::may_sort_attached_input_sections): New
11536 (Output_section::set_may_sort_attached_input_sections): New
11538 (Output_section::must_sort_attached_input_sections): New
11540 (Output_section::set_must_sort_attached_input_sections): New
11542 (class Output_section): Declare Input_section_sort_entry. Define
11543 Input_section_sort_compare. Declare
11544 sort_attached_input_sections. Add new fields:
11545 may_sort_attached_input_sections_,
11546 must_sort_attached_input_sections_,
11547 attached_input_sections_are_sorted_.
11548 * output.cc (Output_section::Output_section): Initialize new
11550 (Output_section::add_input_section): Add an entry to
11551 input_sections_ if may_sort or must_sort are true.
11552 (Output_section::set_final_data_size): Call
11553 sort_attached_input_sections if necessary.
11554 (Output_section::Input_section_sort_entry): Define new class.
11555 (Output_section::Input_section_sort_compare::operator()): New
11557 (Output_section::sort_attached_input_sections): New function.
11558 * configure.ac: Check whether the compiler supports constructor
11559 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
11560 * testsuite/initpri1.c: New file.
11561 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
11562 CONSTRUCTOR_PRIORITY.
11563 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
11564 (initpri1_LDFLAGS): New variable.
11565 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11567 2008-03-27 Ian Lance Taylor <iant@google.com>
11569 * common.cc (Sort_commons::operator): Correct sorting algorithm.
11570 * testsuite/common_test_1.c: New file.
11571 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
11572 (common_test_1_SOURCES): New variable.
11573 (common_test_1_DEPENDENCIES): New variable.
11574 (common_test_1_LDFLAGS): New variable.
11576 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
11577 and commons_ correctly when NAME/VERSION does not override
11579 * testsuite/ver_test_6.c: New file.
11580 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
11581 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
11582 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
11584 2008-03-26 Ian Lance Taylor <iant@google.com>
11586 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
11587 of an undefined symbol from a version script.
11588 * testsuite/Makefile.am (ver_test_5.so): New target.
11589 (ver_test_5.o): New target.
11590 (check_SCRIPTS): Add ver_test_5.sh.
11591 (check_DATA): Add ver_test_5.syms.
11592 (ver_test_5.syms): New target.
11593 * testsuite/ver_test_5.cc: New file.
11594 * testsuite/ver_test_5.script: New file.
11595 * testsuite/ver_test_5.sh: New file.
11596 * Makefile.in, testsuite/Makefile.in: Rebuild.
11599 Fix problems building gold with gcc 4.3.0.
11600 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
11601 (gold_error_at_location, gold_warning_at_location): Use it.
11602 * configure.ac: Check whether we can compile and use a template
11603 function with a printf attribute.
11604 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
11605 when jumping over bytes.
11606 * object.cc: Instantiate Object::read_section_data.
11607 * debug.h: Include <cstring>
11608 * dwarf_reader.cc: Include <algorithm>
11609 * main.cc: Include <cstring>.
11610 * options.cc: Include <cstring>.
11611 * output.cc: Include <cstring>.
11612 * script.cc: Include <cstring>.
11613 * script.h: Include <string>.
11614 * symtab.cc: Include <cstring> and <algorithm>.
11615 * target-select.cc: Include <cstring>.
11616 * version.cc: Include <string>.
11617 * testsuite/testmain.cc: Include <cstdlib>.
11618 * configure, config.in: Rebuild.
11620 2008-03-25 Ian Lance Taylor <iant@google.com>
11622 * options.cc: Include "../bfd/bfdver.h".
11623 (options::help): Print bug reporting address.
11625 * version.cc (print_version): Adjust output for current value of
11626 BFD_VERSION_STRING.
11630 * options.cc (options::help): Print list of supported targets.
11631 * target-select.h: Include <vector>.
11632 (class Target_selector): Make machine_, size_, and is_big_endian_
11633 fields const. Add bfd_name_ and instantiated_target_ fields.
11634 (Target_selector::Target_selector): Add bfd_name parameter.
11635 (Target_selector::recognize): Make non-virtual, call
11637 (Target_selector::recognize_by_name): Make non-virtual, call
11638 do_recognize_by_name.
11639 (Target_selector::supported_names): New function.
11640 (Target_selector::bfd_name): New function.
11641 (Target_selector::do_instantiate_target): New pure virtual
11643 (Target_selector::do_recognize): New virtual function.
11644 (Target_selector::do_recognize_by_name): New virtual function.
11645 (Target_selector::instantiate_target): New private function.
11646 (supported_target_names): Declare.
11647 * target-select.cc (Target_selector::Target_selector): Update for
11648 new parameter and fields.
11649 (select_target_by_name): Check that the name matches before
11650 calling recognize_by_name.
11651 (supported_target_names): New function.
11652 * i386.cc (class Target_selector_i386): Update Target_selector
11653 constructor call. Remove recognize and recognize_by_name. Add
11654 do_instantiate_target.
11655 * x86_64.cc (class Target_selector_x86_64): Likewise.
11656 * testsuite/testfile.cc (class Target_selector_test): Update for
11657 changes to Target_selector.
11659 * README: Rewrite, with some notes on unsupported features.
11661 2008-03-24 Cary Coutant <ccoutant@google.com>
11663 * i386.cc (Target_i386::Got_type): New enum declaration.
11664 (Target_i386::Scan::local): Updated callers of Output_data_got
11666 (Target_i386::Scan::global): Likewise.
11667 (Target_i386::Relocate::relocate): Likewise.
11668 (Target_i386::Relocate::relocate_tls): Likewise.
11669 * object.h (Got_offset_list): New class.
11670 (Sized_relobj::local_has_got_offset): Added got_type parameter.
11671 (Sized_relobj::local_got_offset): Likewise.
11672 (Sized_relobj::set_local_got_offset): Likewise.
11673 (Sized_relobj::local_has_tls_got_offset): Removed.
11674 (Sized_relobj::local_tls_got_offset): Removed.
11675 (Sized_relobj::set_local_tls_got_offset): Removed.
11676 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
11677 * output.cc (Output_data_got::add_global): Added got_type parameter.
11678 (Output_data_got::add_global_with_rel): Likewise.
11679 (Output_data_got::add_global_with_rela): Likewise.
11680 (Output_data_got::add_global_pair_with_rel): New function.
11681 (Output_data_got::add_global_pair_with_rela): New function.
11682 (Output_data_got::add_local): Added got_type parameter.
11683 (Output_data_got::add_local_with_rel): Likewise.
11684 (Output_data_got::add_local_with_rela): Likewise.
11685 (Output_data_got::add_local_pair_with_rel): New function.
11686 (Output_data_got::add_local_pair_with_rela): New function.
11687 (Output_data_got::add_global_tls): Removed.
11688 (Output_data_got::add_global_tls_with_rel): Removed.
11689 (Output_data_got::add_global_tls_with_rela): Removed.
11690 (Output_data_got::add_local_tls): Removed.
11691 (Output_data_got::add_local_tls_with_rel): Removed.
11692 (Output_data_got::add_local_tls_with_rela): Removed.
11693 * output.h (Output_data_got::add_global): Added got_type parameter.
11694 (Output_data_got::add_global_with_rel): Likewise.
11695 (Output_data_got::add_global_with_rela): Likewise.
11696 (Output_data_got::add_global_pair_with_rel): New function.
11697 (Output_data_got::add_global_pair_with_rela): New function.
11698 (Output_data_got::add_local): Added got_type parameter.
11699 (Output_data_got::add_local_with_rel): Likewise.
11700 (Output_data_got::add_local_with_rela): Likewise.
11701 (Output_data_got::add_local_pair_with_rel): New function.
11702 (Output_data_got::add_local_pair_with_rela): New function.
11703 (Output_data_got::add_global_tls): Removed.
11704 (Output_data_got::add_global_tls_with_rel): Removed.
11705 (Output_data_got::add_global_tls_with_rela): Removed.
11706 (Output_data_got::add_local_tls): Removed.
11707 (Output_data_got::add_local_tls_with_rel): Removed.
11708 (Output_data_got::add_local_tls_with_rela): Removed.
11709 * resolve.cc (Symbol::override_base_with_special): Removed
11710 reference to has_got_offset_ field.
11711 * symtab.cc (Symbol::init_fields): Replaced initialization
11712 of got_offset_ with got_offsets_. Removed initialization
11714 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
11715 (Symbol::got_offset): Likewise.
11716 (Symbol::set_got_offset): Likewise.
11717 (Symbol::has_tls_got_offset): Removed.
11718 (Symbol::tls_got_offset): Removed.
11719 (Symbol::set_tls_got_offset): Removed.
11720 (Symbol::got_offset_): Removed.
11721 (Symbol::tls_mod_got_offset_): Removed.
11722 (Symbol::tls_pair_got_offset_): Removed.
11723 (Symbol::got_offsets_): New field.
11724 (Symbol::has_got_offset): Removed.
11725 (Symbol::has_tls_mod_got_offset): Removed.
11726 (Symbol::has_tls_pair_got_offset): Removed.
11727 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
11728 (Target_x86_64::Scan::local): Updated callers of Output_data_got
11730 (Target_x86_64::Scan::global): Likewise.
11731 (Target_x86_64::Relocate::relocate): Likewise.
11732 (Target_x86_64::Relocate::relocate_tls): Likewise.
11734 2008-03-25 Ben Elliston <bje@au.ibm.com>
11736 * yyscript.y: Fix spelling error in comment.
11738 2008-03-24 Ian Lance Taylor <iant@google.com>
11740 * options.h (class General_options): Define build_id option.
11741 * layout.h (class Layout): Declare write_build_id, create_note,
11742 create_build_id. Add build_id_note_ member.
11743 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
11744 "libiberty.h", "md5.h", "sha1.h".
11745 (Layout::Layout): Initialize eh_frame_data_,
11746 eh_frame_hdr_section_, and build_id_note_.
11747 (Layout::finalize): Call create_build_id.
11748 (Layout::create_note): New function, broken out of
11749 Layout::create_gold_note.
11750 (Layout::create_gold_note): Call create_note.
11751 (Layout::create_build_id): New function.
11752 (Layout::write_build_id): New function.
11753 (Close_task_runner::run): Call write_build_id.
11755 * x86_64.cc: Correct license to GPLv3.
11757 2008-03-23 Ian Lance Taylor <iant@google.com>
11759 * options.cc: Include "demangle.h".
11760 (parse_optional_string): New function.
11761 (parse_long_option): Handle takes_optional_argument.
11762 (parse_short_option): Update dash_z initializer. Handle
11763 takes_optional_argument.
11764 (General_options::General_options): Initialize do_demangle_.
11765 (General_options::finalize): Set do_demangle_. Handle demangling
11767 * options.h (parse_optional_string): Declare.
11768 (struct One_option): Add optional_arg field. Update constructor.
11769 Update call constructor calls. Add takes_optional_argument
11771 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
11772 (DEFINE_optional_string): Define.
11773 (General_options::demangle): Change from DEFINE_bool to
11774 DEFINE_optional_string.
11775 (General_options::no_demangle): New function.
11776 (General_options::do_demangle): New function.
11777 (General_options::set_do_demangle): New function.
11778 (General_options::execstack_status_): Move definition to end of
11780 (General_options::static_): Likewise.
11781 (General_options::do_demangle_): New field.
11782 * object.cc (big_endian>::get_symbol_location_info): Call
11783 Options::do_demangle, not Options::demangle.
11784 * symtab.cc (demangle): Likewise.
11786 2008-03-22 Ian Lance Taylor <iant@google.com>
11788 * gold.h: Include <cstddef> and <sys/types.h>
11789 * options.h: Include <cstring>.
11791 2008-03-21 Ian Lance Taylor <iant@google.com>
11793 * Added source code to GNU binutils.