1 2011-07-05 Doug Kwan <dougkwan@google.com>
4 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
5 Arm_Address type for relocation result.
6 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
8 (Arm_relocate_functions::abs32): Use unaligned access.
9 (Arm_relocate_functions::rel32): Ditto.
10 (Arm_relocate_functions::prel31): Ditto.
11 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
12 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
13 static data relocations.
14 * testsuite/Makefile.in: Regnerate.
15 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
17 2011-07-05 Ian Lance Taylor <iant@google.com>
20 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
22 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
24 2011-07-05 Ian Lance Taylor <iant@google.com>
27 * resolve.cc (Symbol::override_base_with_special): Simply override
28 version with special symbol version, ignoring previous version.
30 2011-07-05 Ian Lance Taylor <iant@google.com>
32 * object.cc (Sized_relobj_file::include_section_group): Add
33 information to comment about signature location.
35 2011-07-02 Ian Lance Taylor <iant@google.com>
38 * options.h (class General_options): Add -f and -F.
39 * options.cc (General_options::finalize): Fatal error if -f/-F
40 are used without -shared.
41 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
43 2011-07-02 Ian Lance Taylor <iant@google.com>
45 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
47 2011-07-01 Ian Lance Taylor <iant@google.com>
51 * resolve.cc (Symbol::override_base_with_special): Don't override
52 the version if the overriding symbol has a different name.
53 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
54 all callers. If we give an error about an undefined version,
55 define the base version if necessary.
56 * dynobj.h (class Versions): Update declaration.
57 * testsuite/weak_alias_test_5.cc: New file.
58 * testsuite/weak_alias_test.script: New file.
59 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
60 and versioned_alias have the right value, and call t2.
61 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
63 (weak_alias_test_LDADD): Likewise.
64 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
65 * testsuite/Makefile.in: Rebuild.
67 2011-07-01 Ian Lance Taylor <iant@google.com>
70 * options.h (class General_options): Support -z notext.
71 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
73 (two_file_shared_nonpic.so): Likewise.
74 (two_file_shared_mixed.so): Likewise.
75 (two_file_shared_mixed_1.so): Likewise.
76 (weak_undef_lib_nonpic.so): Likewise.
77 (alt/weak_undef_lib_nonpic.so): Likewise.
78 (tls_test_shared_nonpic.so): Likewise.
79 * testsuite/Makefile.in: Rebuild.
81 2011-07-01 Ian Lance Taylor <iant@google.com>
84 * configure.ac: Test whether static linking works, setting
85 the automake conditional HAVE_STATIC.
86 * testsuite/Makefile.am: Disable tests using -static if
87 HAVE_STATIC is not true.
88 * configure, testsuite/Makefile.in: Rebuild.
90 2011-07-01 Ian Lance Taylor <iant@google.com>
93 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
94 Assert if we see DW_EH_PE_indirect.
95 * target.h (Target::ehframe_datarel_base): New function.
96 (Target::do_ehframe_datarel_base): New target function.
97 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
98 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
101 2011-07-01 Ian Lance Taylor <iant@google.com>
104 * options.h (class General_options): Add
105 --ld-generated-unwind-info.
106 * ehframe.cc (Fde::write): Add address parameter. Change all
107 callers. If associated with PLT, fill in address and size.
108 (Cie::set_output_offset): Only add merge mapping if there is an
110 (Cie::write): Add address parameter. Change all callers.
111 (Eh_frame::add_ehframe_for_plt): New function.
112 * ehframe.h (class Fde): Update declarations. Move shndx_ and
113 input_offset_ fields into union u_, with new plt field.
114 (Fde::Fde): Adjust for new union field.
115 (Fde::Fde) [Output_data version]: New constructor.
116 (Fde::add_mapping): Only add merge mapping if there is an object.
117 (class Cie): Update declarations.
118 (class Eh_frame): Declare add_ehframe_for_plt.
119 * layout.cc (Layout::layout_eh_frame): Break out code into
120 make_eh_frame_section, and call it.
121 (Layout::make_eh_frame_section): New function.
122 (Layout::add_eh_frame_for_plt): New function.
123 * layout.h (class Layout): Update declarations.
124 * merge.cc (Merge_map::add_mapping): Add assertion.
125 * i386.cc: Include "dwarf.h".
126 (class Output_data_plt_i386): Make first_plt_entry,
127 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
128 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
129 and plt_eh_frame_fde.
130 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
131 boundary. Call add_eh_frame_for_plt if appropriate.
132 * x86_64.cc: Include "dwarf.h".
133 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
134 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
135 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
136 and plt_eh_frame_fde.
137 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
140 2011-06-29 Ian Lance Taylor <iant@google.com>
143 * object.cc (Sized_relobj_file::layout_section): Change shdr
144 parameter to be const.
145 (Sized_relobj_file::layout_eh_frame_section): New function, broken
147 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
148 appropriate. Call layout_eh_frame_section.
149 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
151 * object.h (class Sized_relobj_file): Update declarations.
153 2011-06-29 Ian Lance Taylor <iant@google.com>
156 * script.cc (Token::integer_value): Accept trailing M/m/K/k
158 (Lex::gather_token): Accept trailing M/m/K/k for integers.
160 2011-06-29 Ian Lance Taylor <iant@google.com>
163 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
165 * layout.cc (Layout::layout_eh_frame): Likewise.
167 2011-06-29 Ian Lance Taylor <iant@google.com>
170 * layout.cc (Layout::symtab_section_shndx): New function.
171 * layout.h (class Layout): Declare symtab_section_shndx.
172 * output.cc (Output_section::write_header): Call it.
174 2011-06-29 Ian Lance Taylor <iant@google.com>
177 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
178 symbols which are not used in a relocation.
180 2011-06-28 Ian Lance Taylor <iant@google.com>
183 * layout.cc (Layout::segment_precedes): Don't crash if a linker
184 script create indistinguishable segments.
185 (Layout::set_segment_offsets): Use stable_sort when sorting
186 segments. Pass this to Compare_segments constructor.
187 * layout.h (class Layout): Make segment_precedes non-static.
188 (class Compare_segments): Change from struct to class. Add
189 layout_ field. Add constructor.
191 (Script_sections::attach_sections_using_phdrs_clause): Rename
192 local orphan to is_orphan. Don't report failure to put empty
193 section in segment. On attachment failure, report name of
194 section, and attach to first PT_LOAD segment.
196 2011-06-28 Ian Lance Taylor <iant@google.com>
199 * target-select.cc (Target_selector::Target_selector): Add
200 emulation parameter. Change all callers.
201 (select_target_by_bfd_name): Rename from select_target_by_name.
203 (select_target_by_emulation): New function.
204 (supported_emulation_names): New function.
205 * target-select.h (class Target_selector): Add emulation_ field.
207 (Target_selector::recognize_by_bfd_name): Rename from
208 recognize_by_name. Change all callers.
209 (Target_selector::supported_bfd_names): Rename from
210 supported_names. Change all callers.
211 (Target_selector::recognize_by_emulation): New function.
212 (Target_selector::supported_emulations): New function.
213 (Target_selector::emulation): New function.
214 (Target_selector::do_recognize_by_bfd_name): Rename from
215 do_recognize_by_name. Change all callers.
216 (Target_selector::do_supported_bfd_names): Rename from
217 do_supported_names. Change all callers.
218 (Target_selector::do_recognize_by_emulation): New function.
219 (Target_selector::do_supported_emulations): New function.
220 (select_target_by_bfd_name): Change name in declaration.
221 (select_target_by_emulation): Declare.
222 (supported_emulation_names): Declare.
223 * parameters.cc (parameters_force_valid_target): Try to find
224 target based on emulation from -m option.
225 * options.h (class General_options): Change doc string for -m.
226 * options.cc (help): Print emulations.
227 (General_options::parse_V): Likewise.
228 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
229 Add emulation parameter. Change all callers.
231 2011-06-28 Ian Lance Taylor <iant@google.com>
233 * target.h (class Target): Add osabi_ field.
234 (Target::osabi): New function.
235 (Target::set_osabi): New function.
236 (Target::Target): Initialize osabi_.
237 (Target::do_adjust_elf_header): Make pure virtual.
238 (Sized_target::do_adjust_elf_header): Declare.
239 * target.cc (Sized_target::do_adjust_elf_header): New function.
240 (class Sized_target): Instantiate all versions.
241 * freebsd.h (class Target_freebsd): Remove.
242 (Target_selector_freebsd::do_recognize): Call set_osabi on
244 (Target_selector_freebsd::do_recognize_by_name): Likewise.
245 (Target_selector_freebsd::set_osabi): Remove.
246 * i386.cc (class Target_i386): Inherit from Sized_target rather
248 * x86_64.cc (class Target_x86_64): Likewise.
250 2011-06-28 Ian Lance Taylor <iant@google.com>
252 * target.h (Target::can_check_for_function_pointers): Rewrite.
254 (Target::can_icf_inline_merge_sections): Likewise.
255 (Target::section_may_have_icf_unsafe_poineters): Likewise.
256 (Target::Target_info): Add can_icf_inline_merge_sections field.
257 (Target::do_can_check_for_function_pointers): New virtual
259 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
260 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
261 from can_check_for_function_pointers, move in file.
262 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
263 section_may_have_icf_unsafe_poineters, move in file.
264 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
265 * i386.cc (Target_i386::do_can_check_for_function_pointers):
266 Rename from can_check_for_function_pointers, move in file.
267 (Target_i386::can_icf_inline_merge_sections): Remove.
268 (Target_i386::i386_info): Initialize
269 can_icf_inline_merge_sections.
270 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
271 Initialize can_icf_inline_merge_sections.
272 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
273 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
274 Rename from can_check_for_function_pointers, move in file.
275 (Target_x86_64::can_icf_inline_merge_sections): Remove.
276 (Target_x86_64::x86_64_info): Initialize
277 can_icf_inline_merge_sections.
278 * testsuite/testfile.cc (Target_test::test_target_info):
280 * icf.cc (get_section_contents): Correct formatting.
282 2011-06-27 Ian Lance Taylor <iant@google.com>
284 * symtab.cc (Symbol::versioned_name): New function.
285 (Symbol_table::add_to_final_symtab): Use versioned_name when
287 (Symbol_table::sized_write_symbol): Likewise.
288 * symtab.h (class Symbol): Declare versioned_name.
289 * stringpool.h (class Stringpool_template): Add variant of add
290 which takes a std::basic_string.
291 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
292 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
293 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
294 (ver_test_12.o): New target.
295 * testsuite/Makefile.in: Rebuild.
297 2011-06-27 Doug Kwan <dougkwan@google.com>
299 * arm.cc (Arm_relocate_functions::thm_jump8,
300 Arm_relocate_functions::thm_jump11): Use a wider signed
301 type to compute offset.
302 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
304 * testsuite/Makefile.in: Regenerate.
305 * testsuite/arm_branch_in_range.sh: Check test results of
306 arm_thm_jump11 and arm_thm_jump8.
307 * testsuite/arm_thm_jump11.s: New test source file.
308 * testsuite/arm_thm_jump11.t: New linker script.
309 * testsuite/arm_thm_jump8.s: New test source file.
310 * testsuite/arm_thm_jump8.t: New linker script.
312 2011-06-24 Ian Lance Taylor <iant@google.com>
314 * layout.cc: Include "object.h".
315 (ctors_sections_in_init_array): New static variable.
316 (Layout::is_ctors_in_init_array): New function.
317 (Layout::layout): Add entry to ctors_sections_in_init_array if
319 * layout.h (class Layout): Declare is_ctors_in_init_array.
320 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
321 is_ctors_reverse_view is set.
322 (Sized_relobj_file::write_sections): Add layout parameter. Change
323 all callers. Set is_ctors_reverse_view field of View_size.
324 (Sized_relobj_file::reverse_words): New function.
325 * object.h (Sized_relobj_file::View_size): Add
326 is_ctors_reverse_view field.
327 (class Sized_relobj_file): Update declarations.
328 * testsuite/initpri3.c: New test.
329 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
331 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
332 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
333 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
334 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
335 * testsuite/Makefile.in: Rebuild.
337 2011-06-24 Cary Coutant <ccoutant@google.com>
339 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
340 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
341 (debug_msg_cdebug.err): New targets.
342 * testsuite/Makefile.in: Regenerate.
343 * testsuite/debug_msg.sh: Check output of link with compressed debug.
344 Fix checks for link with shared library.
346 2011-06-24 Doug Kwan <dougkwan@google.com>
348 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
349 skip empty text sections.
350 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
352 2011-06-22 Ian Lance Taylor <iant@google.com>
355 * options.h (class General_options): Add --ctors-in-init-array.
356 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
357 friends as SHT_PROGBITS for merging sections.
358 (Layout::layout): Remove special handling of .init_array and
359 friends. Don't sort if doing relocatable link. Sort for .ctors
360 and .dtors if ctors_in_init_array.
361 (Layout::make_output_section): Force correct section types for
362 .init_array and friends. Don't sort if doing relocatable link,
363 Don't sort .ctors and .dtors if ctors_in_init_array.
364 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
365 (Layout::output_section_name): Add relobj parameter. Change all
366 callers. Handle .ctors. and .dtors. in code rather than table.
367 Handle .ctors and .dtors if ctors_in_init_array.
368 (Layout::match_file_name): New function, moved from output.cc.
369 * layout.h (class Layout): Update declarations.
370 * output.cc: Include "layout.h".
371 (Input_section_sort_entry::get_priority): New function.
372 (Input_section_sort_entry::match_file_name): Just call
373 Layout::match_file_name.
374 (Output_section::Input_section_sort_init_fini_compare::operator()):
375 Handle .ctors and .dtors. Sort by explicit priority rather than
377 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
378 * testsuite/initpri2.c: New test.
379 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
380 (check_PROGRAMS): Add initpri2.
381 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
382 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
383 * configure, testsuite/Makefile.in: Rebuild.
385 2011-06-19 Ian Lance Taylor <iant@google.com>
388 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
389 .interp section to a PT_INTERP segment even if we have seen a
390 --dynamic-linker option. Don't do it if we have seen a PHDRS
391 clause in a linker script.
392 (Layout::finalize): Don't create a .interp section if we've
393 already create a PT_INTERP segment.
394 (Layout::create_interp): Always call choose_output_section (revert
395 patch of 2011-06-17). Don't create PT_INTERP segment.
397 (Script_sections::create_note_and_tls_segments): Add a .interp
398 section to a PT_INTERP segment even if we have seen a
399 --dynamic-linker option.
401 2011-06-18 Ian Lance Taylor <iant@google.com>
403 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
404 merely because a non-PT_LOAD segment has a dynamic reloc.
406 2011-06-18 Ian Lance Taylor <iant@google.com>
408 * layout.cc (Layout::finish_dynamic_section): Don't create
409 DT_FLAGS entry if not needed.
411 2011-06-18 Ian Lance Taylor <iant@google.com>
414 * layout.cc (Layout::layout_eh_frame): Correct handling of
415 writable .eh_frame section.
417 2011-06-17 Ian Lance Taylor <iant@google.com>
420 * resolve.cc (Symbol_table::resolve): Don't give an error if a
421 symbol is redefined with the exact same object and value.
423 2011-06-17 Ian Lance Taylor <iant@google.com>
426 * layout.h (class Layout): Add interp_segment_ field.
427 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
428 (Layout::attach_allocated_section_to_segment): If making shared
429 library, put .interp section in PT_INTERP segment.
430 (Layout::finalize): Also call create_interp if -dynamic-linker
432 (Layout::create_interp): Assert that there is no PT_INTERP
433 segment. If not using a SECTIONS clause, use make_output_section.
434 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
436 (Script_sections::create_note_and_tls_segments): If making shared
437 library, put .interp section in PT_INTERP segment.
439 2011-06-17 Ian Lance Taylor <iant@google.com>
441 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
442 when making a shared library.
444 2011-06-17 Ian Lance Taylor <iant@google.com>
446 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
447 parameter. Change all callers. Don't issue warning about PC32
448 against locally defined symbol.
450 2011-06-16 Ian Lance Taylor <iant@google.com>
452 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
453 occurs in same object.
455 2011-06-14 Alan Modra <amodra@gmail.com>
457 * po/POTFILES.in: Regenerate.
459 2011-06-09 Ian Lance Taylor <iant@google.com>
462 (Orphan_output_section::set_section_addresses): For a relocatable
463 link set address to 0.
465 2011-06-09 Cary Coutant <ccoutant@google.com>
468 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
469 used with --compress-debug-sections.
470 * gold/object.cc (Sized_relobj_file::do_layout): Report
471 uncompressed size of compressed input sections.
473 2011-06-08 Cary Coutant <ccoutant@google.com>
476 * testsuite/two_file_test_2_v1.cc: Change initialization of
477 v2 to keep it in .data.
479 2011-06-07 Cary Coutant <ccoutant@google.com>
481 * common.cc (Symbol_table::do_allocate_commons_list): Call
483 * errors.cc (Errors::fatal): Adjust call to gold_exit.
484 (Errors::fallback): New function.
485 (gold_fallback): New function.
486 * errors.h (Errors::fallback): New function.
487 * gold.cc (gold_exit): Change status parameter to enum; adjust
489 (queue_initial_tasks): Call gold_fallback.
490 * gold.h: Include cstdlib.
491 (Exit_status): New enum type.
492 (gold_exit): Change status parameter to enum.
493 (gold_fallback): New function.
494 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
495 (Layout::create_symtab_sections): Likewise.
496 (Layout::create_shdrs): Likewise.
497 * main.cc (main): Adjust call to gold_exit.
498 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
499 (Output_data_got::add_got_entry_pair): Likewise.
500 (Output_section::add_input_section): Likewise.
501 (Output_section::add_output_section_data): Likewise.
502 (Output_segment::set_section_list_addresses): Likewise.
503 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
505 2011-06-07 Cary Coutant <ccoutant@google.com>
507 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
508 for incremental links.
509 * output.cc (Output_segment::set_section_list_addresses): Remove
510 FIXME and test for TLS or BSS.
512 2011-06-07 Cary Coutant <ccoutant@google.com>
514 * testsuite/Makefile.am: Add incremental_copy_test,
515 incremental_common_test_1.
516 * testsuite/Makefile.in: Regenerate.
517 * testsuite/common_test_1_v1.c: New source file.
518 * testsuite/common_test_1_v2.c: New source file.
519 * testsuite/copy_test_v1.cc: New source file.
521 2011-06-07 Cary Coutant <ccoutant@google.com>
523 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
524 update, allocate common from bss section's free list.
525 * incremental-dump.cc (dump_incremental_inputs): Print flag for
526 linker-defined symbols.
527 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
528 Skip GOT and PLT entries that are no longer referenced.
529 (Output_section_incremental_inputs::write_info_blocks): Mark
530 linker-defined symbols.
531 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
532 * output.cc (Output_section::allocate): New function.
533 * output.h (Output_section::allocate): New function.
534 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
535 linker-defined symbols.
536 (Symbol::override_base_with_special): Copy is_predefined_ flag.
537 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
538 (Symbol::init_base_output_data): Likewise.
539 (Symbol::init_base_output_segment): Likewise.
540 (Symbol::init_base_constant): Likewise.
541 (Sized_symbol::init_output_data): Likewise.
542 (Sized_symbol::init_output_segment): Likewise.
543 (Sized_symbol::init_constant): Likewise.
544 (Symbol_table::do_define_in_output_data): Likewise.
545 (Symbol_table::do_define_in_output_segment): Likewise.
546 (Symbol_table::do_define_as_constant): Likewise.
547 * symtab.h (Symbol::is_predefined): New function.
548 (Symbol::init_base_output_data): Add is_predefined parameter.
549 (Symbol::init_base_output_segment): Likewise.
550 (Symbol::init_base_constant): Likewise.
551 (Symbol::is_predefined_): New data member.
552 (Sized_symbol::init_output_data): Add is_predefined parameter.
553 (Sized_symbol::init_output_segment): Likewise.
554 (Sized_symbol::init_constant): Likewise.
555 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
557 2011-06-07 Cary Coutant <ccoutant@google.com>
559 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
560 instead of emit_copy_reloc.
561 (Copy_relocs::emit_copy_reloc): Refactor.
562 (Copy_relocs::make_copy_reloc): New function.
563 (Copy_relocs::add_copy_reloc): Remove.
564 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
566 (Copy_relocs::make_copy_reloc): New function.
567 (Copy_relocs::add_copy_reloc): Remove.
568 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
569 unchanged input files.
570 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
571 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
572 Reserve BSS space for COPY relocations.
573 (Sized_incremental_binary::do_emit_copy_relocs): New function.
574 (Output_section_incremental_inputs::write_info_blocks): Record
575 whether a symbol is copied from a shared object.
576 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
577 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
578 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
579 (Incremental_input_entry_reader::get_output_symbol_index): Add
581 (Incremental_binary::emit_copy_relocs): New function.
582 (Incremental_binary::do_emit_copy_relocs): New function.
583 (Sized_incremental_binary::Sized_incremental_binary): Initialize
585 (Sized_incremental_binary::add_copy_reloc): New function.
586 (Sized_incremental_binary::do_emit_copy_relocs): New function.
587 (Sized_incremental_binary::Copy_reloc): New struct.
588 (Sized_incremental_binary::Copy_relocs): New typedef.
589 (Sized_incremental_binary::copy_relocs_): New data member.
590 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
591 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
592 * target.h (Sized_target::emit_copy_reloc): New function.
593 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
595 2011-06-02 Cary Coutant <ccoutant@google.com>
598 * gold/archive.cc (Archive::Archive): Initialize new data member.
599 (Archive::include_all_members): Return if archive has already been
601 * gold/archive.h (Archive::include_all_members_): New data member.
603 2011-06-02 Nick Clifton <nickc@redhat.com>
605 * dynobj.h: Fix spelling mistake in comment.
606 * output.cc: Likewise.
608 2011-05-31 Doug Kwan <dougkwan@google.com>
612 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
613 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
614 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
615 redundant arm_exidx_test.so.
616 * testsuite/Makefile.in: Regenerate.
617 (check_SCRIPTS): Add pr12826.sh
618 (check_DATA): Add pr12826.stdout
619 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
620 * testsuite/pr12826.sh: New file.
621 * testsuite/pr12826_1.s: Ditto.
622 * testsuite/pr12826_1.s: Ditto.
624 2011-05-30 Ian Lance Taylor <iant@google.com>
626 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
629 2011-05-29 Ian Lance Taylor <iant@google.com>
632 * testsuite/Makefile.am: Use different file name for two_file_test
633 temporary file for each incremental test.
634 * testsuite/Makefile.in: Rebuild.
636 2011-05-29 Ian Lance Taylor <iant@google.com>
638 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
639 binary input file is empty.
641 2011-05-27 Ian Lance Taylor <iant@google.com>
643 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
644 (ver_test_9.so): Likewise.
645 * testsuite/Makefile.in: Rebuild.
647 2011-05-26 Cary Coutant <ccoutant@google.com>
649 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
650 * incremental.cc (Incremental_inputs::report_input_section): Fix
651 comment, indentation.
652 (Incremental_inputs::report_comdat_group): New function.
653 (Output_section_incremental_inputs::set_final_data_size): Adjust size
654 of data for incremental input file entry.
655 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
656 group count, COMDAT group signatures.
657 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
658 an unchanged input file.
659 * incremental.h (Incremental_object_entry::Incremental_object_entry):
660 Initialize new data member.
661 (Incremental_object_entry::add_comdat_group): New function.
662 (Incremental_object_entry::get_comdat_group_count): New function.
663 (Incremental_object_entry::get_comdat_signature_key): New function.
664 (Incremental_object_entry::groups_): New data member.
665 (Incremental_inputs::report_comdat_group): New function.
666 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
667 data for incremental input file entry.
668 (Incremental_input_entry_reader::get_comdat_group_count): New function.
669 (Incremental_input_entry_reader::get_input_section): Adjust size of
670 data for incremental input file entry.
671 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
672 (Incremental_input_entry_reader::get_comdat_group_signature): New
674 * object.cc (Sized_relobj::include_section_group): Report kept
675 COMDAT groups for incremental links.
677 2011-05-24 David Meyer <pdox@google.com>
679 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
680 with name parameter. Add found_name parameter.
681 * fileread.cc (Input_file::find_file): Adjust code accordingly.
682 * dirsearch.h (class Dirsearch): Update declaration.
684 2011-05-24 Ian Lance Taylor <iant@google.com>
686 * archive.cc (Library_base::should_include_member): Pull in object
687 from archive if it defines the entry symbol.
688 * parameters.cc (Parameters::entry): New function.
689 * parameters.h (class Parameters): Declare entry.
690 * output.h (class Output_file_header): Remove entry_ field.
691 * output.cc (Output_file_header::Output_file_header): Remove entry
692 parameter. Change all callers.
693 (Output_file_header::entry): Use parameters->entry.
694 * gold.cc (queue_middle_tasks): Likewise.
695 * plugin.cc (Plugin_hook::run): Likewise.
697 2011-05-24 Cary Coutant <ccoutant@google.com>
699 * gold.cc (queue_initial_tasks): Pass incremental base filename
700 to Output_file::open_base_file; don't print error message.
701 * incremental-dump.cc (main): Adjust call to
702 Output_file::open_for_modification.
703 * incremental-dump.cc (main): Likewise.
704 * incremental.cc (Incremental_inputs::report_command_line):
705 Ignore --incremental-base option when comparing command lines.
706 Ignore parameter when given as separate argument.
707 * options.h (class General_options): Add --incremental-base.
708 * output.cc (Output_file::Output_file):
709 (Output_file::open_base_file): Add base_name and writable parameters;
710 read base file into new file; print error message here.
711 (Output_file::map_no_anonymous): Add writable parameter; adjust all
713 * output.h (Output_file::open_for_modification): Rename to...
714 (Output_file::open_base_file): ...this; add base_name and
715 writable parameters; adjust all callers.
716 (Output_file::map_no_anonymous): Add writable parameter; adjust all
718 * testsuite/Makefile.am (incremental_test_4): Test
720 * testsuite/Makefile.in: Regenerate.
722 2011-05-24 Cary Coutant <ccoutant@google.com>
724 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
726 * testsuite/Makefile.in: Regenerate.
727 * testsuite/two_file_test_1_v1.cc: New test source file.
728 * testsuite/two_file_test_1b_v1.cc: New test source file.
729 * testsuite/two_file_test_2_v1.cc: New test source file.
731 2011-05-24 Cary Coutant <ccoutant@google.com>
733 * dynobj.h (Dynobj::do_dynobj): New function.
734 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
735 flag and soname for shared objects.
736 * incremental.cc (Incremental_inputs::report_object): Make
737 either Incremental_object_entry or Incremental_dynobj_entry; add
738 soname to string table.
739 (Incremental_inputs::report_input_section): Add assertion.
740 (Output_section_incremental_inputs::set_final_data_size): Adjust
741 type of input file entry for shared libraries; adjust size of
742 shared library info entry.
743 (Output_section_incremental_inputs::write_input_files): Write
744 as_needed flag for shared libraries.
745 (Output_section_incremental_inputs::write_info_blocks): Adjust type
746 of input file entry for shared libraries; write soname.
747 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
748 soname from incremental info.
749 * incremental.h (enum Incremental_input_flags): Add
750 INCREMENTAL_INPUT_AS_NEEDED.
751 (Incremental_input_entry::Incremental_input_entry): Initialize new
753 (Incremental_input_entry::set_as_needed): New function.
754 (Incremental_input_entry::as_needed): New function.
755 (Incremental_input_entry::do_dynobj_entry): New function.
756 (Incremental_input_entry::as_needed_): New data member.
757 (Incremental_object_entry::Incremental_object_entry): Don't check
759 (Incremental_object_entry::do_type): Likewise.
760 (class Incremental_dynobj_entry): New class.
761 (Incremental_input_entry_reader::as_needed): New function.
762 (Incremental_input_entry_reader::get_soname): New function.
763 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
764 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
765 size of shared library info entry.
766 * layout.cc (Layout::finish_dynamic_section): Don't test for
767 incremental link when adding DT_NEEDED entries.
768 * object.h (Object::Object): Initialize new data member.
769 (Object::dynobj): New function.
770 (Object::set_as_needed): New function.
771 (Object::as_needed): New function.
772 (Object::do_dynobj): New function.
773 (Object::as_needed_): New data member.
775 2011-05-24 Cary Coutant <ccoutant@google.com>
777 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
778 info; adjust display of GOT entries.
779 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
780 vector of input objects; remove file_status_.
781 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
782 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
783 got_plt reader; call target hooks to reserve GOT entries.
784 (Output_section_incremental_inputs::set_final_data_size): Adjust size
785 of input file info header and GOT info entry.
786 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
788 (Got_plt_view_info::got_descriptor): Remove.
789 (Got_plt_view_info::sym_index): New data member.
790 (Got_plt_view_info::input_index): New data member.
791 (Local_got_offset_visitor::visit): Write input file index.
792 (Global_got_offset_visitor::visit): Write 0 for input file index.
793 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
794 with sym_index and input_index.
795 (Output_section_incremental_inputs::write_got_plt): Adjust size of
796 incremental info GOT entry; replace got_descriptor with input_index.
797 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
798 map from input file index to object.
799 (Sized_relobj_incr::do_layout): Replace direct data member reference
800 with accessor function.
801 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
802 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
803 Adjust size of input file info header.
804 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
805 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
806 (Incremental_input_entry_reader::get_input_section): Adjust size of
807 input file info header.
808 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
809 of incremental info GOT entry.
810 (Incremental_got_plt_reader::get_got_desc): Remove.
811 (Incremental_got_plt_reader::get_got_symndx): New function.
812 (Incremental_got_plt_reader::get_got_input_index): New function.
813 (Sized_incremental_binary::Sized_incremental_binary): Remove
814 file_status_; add input_objects_.
815 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
816 (Sized_incremental_binary::set_file_is_unchanged): Remove.
817 (Sized_incremental_binary::file_is_unchanged): Remove.
818 (Sized_incremental_binary::set_input_object): New function.
819 (Sized_incremental_binary::input_object): New function.
820 (Sized_incremental_binary::file_status_): Remove.
821 (Sized_incremental_binary::input_objects_): New data member.
822 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
824 (Sized_relobj_incr::invalid_address): Move to base class.
825 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
827 (Sized_relobj_incr::do_output_section_offset): Likewise.
828 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
829 (Sized_relobj_incr::section_offsets_): Likewise.
830 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
832 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
833 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
834 with accessor function.
835 (Sized_relobj_file::do_layout): Likewise.
836 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
837 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
838 (Sized_relobj_file::compute_final_local_value): Replace refs to
839 section_offsets_ with accessor function.
840 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
841 * object.h (Relobj::Relobj): Initialize new data members.
842 (Relobj::add_dyn_reloc): New function.
843 (Relobj::first_dyn_reloc): New function.
844 (Relobj::dyn_reloc_count): New function.
845 (Relobj::first_dyn_reloc_): New data member.
846 (Relobj::dyn_reloc_count_): New data member.
847 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
849 (Sized_relobj::Address): New typedef.
850 (Sized_relobj::invalid_address): Move here from child class.
851 (Sized_relobj::Sized_relobj): Initialize new data members.
852 (Sized_relobj::sized_relobj): New function.
853 (Sized_relobj::is_output_section_offset_invalid): Move here from
855 (Sized_relobj::get_output_section_offset): Likewise.
856 (Sized_relobj::local_has_got_offset): Likewise.
857 (Sized_relobj::local_got_offset): Likewise.
858 (Sized_relobj::set_local_got_offset): Likewise.
859 (Sized_relobj::do_for_all_local_got_entries): Likewise.
860 (Sized_relobj::clear_got_offsets): New function.
861 (Sized_relobj::section_offsets): Move here from child class.
862 (Sized_relobj::do_output_section_offset): Likewise.
863 (Sized_relobj::do_set_section_offset): Likewise.
864 (Sized_relobj::Local_got_offsets): Likewise.
865 (Sized_relobj::local_got_offsets_): Likewise.
866 (Sized_relobj::section_offsets_): Likewise.
867 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
869 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
871 (Sized_relobj_file::sized_relobj): New function
872 (Sized_relobj_file::local_has_got_offset): Move to base class.
873 (Sized_relobj_file::local_got_offset): Likewise.
874 (Sized_relobj_file::set_local_got_offset): Likewise.
875 (Sized_relobj_file::get_output_section_offset): Likewise.
876 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
877 (Sized_relobj_file::do_output_section_offset): Likewise.
878 (Sized_relobj_file::do_set_section_offset): Likewise.
879 (Sized_relobj_file::Local_got_offsets): Likewise.
880 (Sized_relobj_file::local_got_offsets_): Likewise.
881 (Sized_relobj_file::section_offsets_): Likewise.
882 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
884 (set_needs_dynsym_index): Convert relobj to derived class pointer.
885 (Output_reloc::get_symbol_index): Likewise.
886 (Output_reloc::local_section_offset): Likewise.
887 (Output_reloc::get_address): Likewise.
888 (Output_reloc::symbol_value): Likewise.
889 (Output_data_got::reserve_slot): Move to class definition.
890 (Output_data_got::reserve_local): New function.
891 (Output_data_got::reserve_slot_for_global): Remove.
892 (Output_data_got::reserve_global): New function.
893 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
894 (all constructors, two instantiations).
895 (Output_reloc::get_relobj): New function (two instantiations).
896 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
897 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
898 (Output_data_reloc::add_global): Adjust type of relobj.
899 (Output_data_reloc::add_global_relative): Likewise.
900 (Output_data_reloc::add_symbolless_global_addend): Likewise.
901 (Output_data_reloc::add_local): Likewise.
902 (Output_data_reloc::add_local_relative): Likewise.
903 (Output_data_reloc::add_symbolless_local_addend): Likewise.
904 (Output_data_reloc::add_local_section): Likewise.
905 (Output_data_reloc::add_output_section): Likewise.
906 (Output_data_reloc::add_absolute): Likewise.
907 (Output_data_reloc::add_target_specific): Likewise.
908 (Output_data_got::reserve_slot): Move definition here.
909 (Output_data_got::reserve_local): New function.
910 (Output_data_got::reserve_global): New function.
911 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
912 section_offsets_ with accessor function.
913 (Sized_relobj_file::write_sections): Likewise.
914 (Sized_relobj_file::do_relocate_sections): Likewise.
915 * target.h (Sized_target::reserve_local_got_entry): New function.
916 (Sized_target::reserve_global_got_entry): New function.
917 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
918 (Target_x86_64::reserve_global_got_entry): New function.
919 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
921 2011-05-23 Cary Coutant <ccoutant@google.com>
923 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
924 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
925 bit when checking got_type.
926 * incremental.cc (Sized_incremental_binary::setup_readers):
927 Store symbol table and string table locations; initialize bit vector
928 of file status flags.
929 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
931 (Sized_incremental_binary::do_process_got_plt): New function.
932 (Sized_incremental_binary::get_symtab_view): Use stored locations.
933 (Output_section_incremental_inputs::set_final_data_size): Record
934 file index for each input file.
935 (Output_section_incremental_inputs::write_got_plt): Store file index
936 instead of input entry offset for each GOT entry.
938 (Incremental_input_entry::Incremental_input_entry): Initialize new
940 (Incremental_input_entry::set_offset): Store file index.
941 (Incremental_input_entry::get_file_index): New function.
942 (Incremental_input_entry::file_index_): New data member.
943 (Incremental_binary::process_got_plt): New function.
944 (Incremental_binary::do_process_got_plt): New function.
945 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
947 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
948 (Sized_incremental_binary::set_file_is_unchanged): New function.
949 (Sized_incremental_binary::file_is_unchanged): New function.
950 (Sized_incremental_binary::do_process_got_plt): New function.
951 (Sized_incremental_binary::file_status_): New data member.
952 (Sized_incremental_binary::main_symtab_loc_): New data member.
953 (Sized_incremental_binary::main_strtab_loc_): New data member.
954 * output.cc (Output_data_got::Got_entry::write): Add case
956 (Output_data_got::add_global): Call add_got_entry.
957 (Output_data_got::add_global_plt): Likewise.
958 (Output_data_got::add_global_with_rel): Likewise.
959 (Output_data_got::add_global_with_rela): Likewise.
960 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
961 (Output_data_got::add_global_pair_with_rela): Likewise.
962 (Output_data_got::add_local): Call add_got_entry.
963 (Output_data_got::add_local_plt): Likewise.
964 (Output_data_got::add_local_with_rel): Likewise.
965 (Output_data_got::add_local_with_rela): Likewise.
966 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
967 (Output_data_got::add_local_pair_with_rela): Likewise.
968 (Output_data_got::reserve_slot): New function.
969 (Output_data_got::reserve_slot_for_global): New function.
970 (Output_data_got::add_got_entry): New function.
971 (Output_data_got::add_got_entry_pair): New function.
972 (Output_section::add_output_section_data): Edit FIXME.
974 (Output_section_data_build::Output_section_data_build): New
975 constructor with size parameter.
976 (Output_data_space::Output_data_space): Likewise.
977 (Output_data_got::Output_data_got): Initialize new data member; new
978 constructor with size parameter.
979 (Output_data_got::add_constant): Call add_got_entry.
980 (Output_data_got::reserve_slot): New function.
981 (Output_data_got::reserve_slot_for_global): New function.
982 (class Output_data_got::Got_entry): Add RESERVED_CODE.
983 (Output_data_got::add_got_entry): New function.
984 (Output_data_got::add_got_entry_pair): New function.
985 (Output_data_got::free_list_): New data member.
986 * target.h (Sized_target::init_got_plt_for_update): New function.
987 (Sized_target::register_global_plt_entry): New function.
988 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
989 Initialize new data member; call init; add constructor with PLT count.
990 (Output_data_plt_x86_64::init): New function.
991 (Output_data_plt_x86_64::add_relocation): New function.
992 (Output_data_plt_x86_64::reserve_slot): New function.
993 (Output_data_plt_x86_64::free_list_): New data member.
994 (Target_x86_64::init_got_plt_for_update): New function.
995 (Target_x86_64::register_global_plt_entry): New function.
996 (Output_data_plt_x86_64::add_entry): Allocate from free list for
998 (Output_data_plt_x86_64::add_relocation): New function.
999 * testsuite/object_unittest.cc (Object_test): Set default options.
1001 2011-05-16 Ian Lance Taylor <iant@google.com>
1003 * options.h (class General_options): Make -i a synonym for -r.
1005 2011-05-16 Ian Lance Taylor <iant@google.com>
1007 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
1009 2011-05-10 Cary Coutant <ccoutant@google.com>
1011 * object.cc (Sized_relobj::do_count_local_symbols): Check for
1014 2011-05-06 Ian Lance Taylor <iant@google.com>
1016 * layout.cc (Layout::layout): If the output section flags change,
1017 update the ordering.
1019 2011-04-25 Cary Coutant <ccoutant@google.com>
1021 * incremental-dump.cc (dump_incremental_inputs): Print local
1022 symbol info for each input file.
1024 (Output_section_incremental_inputs::set_final_data_size): Add local
1025 symbol info to input file entries in incremental info.
1026 (Output_section_incremental_inputs::write_info_blocks): Likewise.
1027 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
1028 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
1029 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
1031 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
1032 (Sized_incr_relobj::do_relocate): Write the local symbols.
1033 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
1034 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
1035 Adjust size of input file header.
1036 (Incremental_inputs_reader::get_local_symbol_offset): New function.
1037 (Incremental_inputs_reader::get_local_symbol_count): New function.
1038 (Incremental_inputs_reader::get_input_section): Adjust size of input
1040 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
1041 (Sized_incr_relobj::This): New typedef.
1042 (Sized_incr_relobj::sym_size): New const data member.
1043 (Sized_incr_relobj::Local_symbol): New struct.
1044 (Sized_incr_relobj::do_output_local_symbol_count): New function.
1045 (Sized_incr_relobj::do_local_symbol_offset): New function.
1046 (Sized_incr_relobj::local_symbol_count_): New data member.
1047 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
1048 (Sized_incr_relobj::local_symbol_index_): New data member.
1049 (Sized_incr_relobj::local_symbol_offset_): New data member.
1050 (Sized_incr_relobj::local_dynsym_offset_): New data member.
1051 (Sized_incr_relobj::local_symbols_): New data member.
1052 * object.h (Relobj::output_local_symbol_count): New function.
1053 (Relobj::local_symbol_offset): New function.
1054 (Relobj::do_output_local_symbol_count): New function.
1055 (Relobj::do_local_symbol_offset): New function.
1056 (Sized_relobj::do_output_local_symbol_count): New function.
1057 (Sized_relobj::do_local_symbol_offset): New function.
1059 2011-04-22 Vladimir Simonov <sv@sw.ru>
1061 * descriptors.cc (set_close_on_exec): New function.
1062 (Descriptors::open): Use set_close_on_exec.
1063 * output.cc (S_ISLNK): Define if not defined.
1065 2011-04-22 Cary Coutant <ccoutant@google.com>
1067 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1069 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
1070 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
1071 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
1073 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
1074 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
1075 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
1077 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
1079 (Incremental_binary::apply_incremental_relocs): New function.
1080 (Incremental_binary::do_apply_incremental_relocs): New function.
1081 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
1083 (Sized_incremental_binary::add_global_symbol): New function.
1084 (Sized_incremental_binary::global_symbol): New function.
1085 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
1086 (Sized_incremental_binary::symbol_map_): New data member.
1087 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
1088 * target.h (Sized_target::apply_relocation): New function.
1089 * target-reloc.h (apply_relocation): New function.
1090 * x86_64.cc (Target_x86_64::apply_relocation): New function.
1092 2011-04-22 Doug Kwan <dougkwan@google.com>
1094 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
1095 flag of a SHT_ARM_EXIDX section.
1096 * testsuite/Makefile.am (arm_exidx_test): New test rules.
1097 * testsuite/Makefile.in: Regenerate.
1098 * testsuite/arm_exidx_test.s: New file.
1099 * testsuite/arm_exidx_test.sh: Same.
1101 2011-04-20 Cary Coutant <ccoutant@google.com>
1104 * archive.h (Incremental_archive_entry::Archive_member):
1105 Initialize arg_serial_ (second constructor).
1107 2011-04-17 Ian Lance Taylor <iant@google.com>
1109 * object.cc (Relocate_info::location): Simplify location string.
1110 * errors.cc (Errors::error_at_location): Don't print program
1112 (Errors::warning_at_location): Likewise.
1113 (Errors::undefined_symbol): Likewise.
1114 * testsuite/debug_msg.sh: Update accordingly.
1116 2011-04-14 Cary Coutant <ccoutant@google.com>
1118 * gold/layout.cc (Layout::symtab_section_offset): New function.
1119 * gold/layout.h (Layout::symtab_section_offset): New function.
1120 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
1122 2011-04-12 Ian Lance Taylor <iant@google.com>
1124 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
1125 with MREMAP_MAYMOVE.
1126 * output.h (class Output_file): Add map_is_allocated_ field.
1127 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
1128 not available, provide stubs. If mremap is not available, #define
1130 (MREMAP_MAYMOVE): Define if not defined.
1131 (Output_file::Output_file): Initialize map_is_allocated_.
1132 (Output_file::resize): Check map_is_allocated_.
1133 (Output_file::map_anonymous): If mmap fails, use malloc.
1134 (Output_file::unmap): Don't do anything for an anonymous map.
1135 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
1136 is not available, provide stubs.
1137 (File_read::View::~View): Use free rather than delete[].
1138 (File_read::make_view): Use malloc rather than new[]. If mmap
1140 (File_read::find_or_make_view): Use malloc rather than new[].
1141 * gold.h: Remove HAVE_REMAP code.
1142 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
1143 exists. Rename mremap to gold_mremap. If mmap is not available
1145 * configure, config.in: Rebuild.
1147 2011-04-11 Ian Lance Taylor <iant@google.com>
1149 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
1150 initialize local variable v.
1152 2011-04-11 Cary Coutant <ccoutant@google.com>
1154 * archive.cc (Archive::include_member): Adjust call to
1156 (Add_archive_symbols::run): Track argument serial numbers.
1157 (Lib_group::include_member): Likewise.
1158 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
1159 * archive.h (Incremental_archive_entry::Archive_member):
1160 Initialize arg_serial_.
1161 (Archive_member::arg_serial_): New data member.
1162 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
1163 (Sized_dynobj::do_add_symbols): Track symbols when doing an
1165 (Sized_dynobj::do_for_all_local_got_entries): New function.
1166 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
1168 * fileread.cc (get_mtime): New function.
1169 * fileread.h (get_mtime): New function.
1170 * gold.cc (queue_initial_tasks): Check for incremental update.
1171 (process_incremental_input): New function.
1172 (queue_middle_tasks): Don't force valid target for incremental
1174 * incremental-dump.cc (find_input_containing_global): Adjust
1175 size of symbol info entry.
1176 (dump_incremental_inputs): Dump argument serial number and
1177 in_system_directory flag; bias shndx by 1; print symbol names
1178 when dumping per-file symbol lists; use new symbol info readers.
1180 (Output_section_incremental_inputs:update_data_size): New function.
1181 (Sized_incremental_binary::setup_readers): Setup input readers
1182 for each input file; build maps for files added from libraries
1184 (Sized_incremental_binary::check_input_args): New function.
1185 (Sized_incremental_binary::do_check_inputs): Build map of argument
1186 serial numbers to input arguments.
1187 (Sized_incremental_binary::do_file_has_changed): Rename
1188 do_file_is_unchanged to this; compare file modification times.
1189 (Sized_incremental_binary::do_init_layout): New function.
1190 (Sized_incremental_binary::do_reserve_layout): New function.
1191 (Sized_incremental_binary::do_get_input_reader): Remove.
1192 (Sized_incremental_binary::get_symtab_view): New function.
1193 (Incremental_checker::can_incrementally_link_output_file): Remove.
1194 (Incremental_inputs::report_command_line): Exclude --debug options.
1195 (Incremental_inputs::report_archive_begin): Add parameter; track
1196 argument serial numbers; don't put input file entry for archive
1197 before archive members.
1198 (Incremental_inputs::report_archive_end): Put input file entry
1199 for archive after archive members.
1200 (Incremental_inputs::report_object): Add parameter; track argument
1201 serial numbers and in_system_directory flag.
1202 (Incremental_inputs::report_script): Add parameter; track argument
1204 (Output_section_incremental_inputs::set_final_data_size): Adjust
1205 size of symbol info entry; check for forwarding symbols.
1206 (Output_section_incremental_inputs::write_input_files): Write
1207 in_system_directory flag and argument serial number.
1208 (Output_section_incremental_inputs::write_info_blocks): Map section
1209 indices between incremental info and original input file; store
1210 input section index for each symbol.
1211 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
1212 change operator() to visit().
1213 (class Global_got_offset_visitor): Likewise.
1214 (class Global_symbol_visitor_got_plt):
1215 (Output_section_incremental_inputs::write_got_plt): Use new visitor
1217 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
1218 (Sized_incr_relobj::do_read_symbols): New function.
1219 (Sized_incr_relobj::do_layout): New function.
1220 (Sized_incr_relobj::do_layout_deferred_sections): New function.
1221 (Sized_incr_relobj::do_add_symbols): New function.
1222 (Sized_incr_relobj::do_should_include_member): New function.
1223 (Sized_incr_relobj::do_for_all_global_symbols): New function.
1224 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
1225 (Sized_incr_relobj::do_section_size): New function.
1226 (Sized_incr_relobj::do_section_name): New function.
1227 (Sized_incr_relobj::do_section_contents): New function.
1228 (Sized_incr_relobj::do_section_flags): New function.
1229 (Sized_incr_relobj::do_section_entsize): New function.
1230 (Sized_incr_relobj::do_section_address): New function.
1231 (Sized_incr_relobj::do_section_type): New function.
1232 (Sized_incr_relobj::do_section_link): New function.
1233 (Sized_incr_relobj::do_section_info): New function.
1234 (Sized_incr_relobj::do_section_addralign): New function.
1235 (Sized_incr_relobj::do_initialize_xindex): New function.
1236 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
1237 (Sized_incr_relobj::do_read_relocs): New function.
1238 (Sized_incr_relobj::do_gc_process_relocs): New function.
1239 (Sized_incr_relobj::do_scan_relocs): New function.
1240 (Sized_incr_relobj::do_count_local_symbols): New function.
1241 (Sized_incr_relobj::do_finalize_local_symbols): New function.
1242 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
1243 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
1244 (Sized_incr_relobj::do_relocate): New function.
1245 (Sized_incr_relobj::do_set_section_offset): New function.
1246 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
1247 (Sized_incr_dynobj::do_read_symbols): New function.
1248 (Sized_incr_dynobj::do_layout): New function.
1249 (Sized_incr_dynobj::do_add_symbols): New function.
1250 (Sized_incr_dynobj::do_should_include_member): New function.
1251 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
1252 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
1253 (Sized_incr_dynobj::do_section_size): New function.
1254 (Sized_incr_dynobj::do_section_name): New function.
1255 (Sized_incr_dynobj::do_section_contents): New function.
1256 (Sized_incr_dynobj::do_section_flags): New function.
1257 (Sized_incr_dynobj::do_section_entsize): New function.
1258 (Sized_incr_dynobj::do_section_address): New function.
1259 (Sized_incr_dynobj::do_section_type): New function.
1260 (Sized_incr_dynobj::do_section_link): New function.
1261 (Sized_incr_dynobj::do_section_info): New function.
1262 (Sized_incr_dynobj::do_section_addralign): New function.
1263 (Sized_incr_dynobj::do_initialize_xindex): New function.
1264 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
1265 (make_sized_incremental_object): New function.
1266 (Incremental_library::copy_unused_symbols): New function.
1267 (Incremental_library::do_for_all_unused_symbols): New function.
1268 * incremental.h (enum Incremental_input_flags): New type.
1269 (class Incremental_checker): Remove.
1270 (Incremental_input_entry::Incremental_input_entry): Add argument
1272 (Incremental_input_entry::arg_serial): New function.
1273 (Incremental_input_entry::set_is_in_system_directory): New function.
1274 (Incremental_input_entry::is_in_system_directory): New function.
1275 (Incremental_input_entry::arg_serial_): New data member.
1276 (Incremental_input_entry::is_in_system_directory_): New data member.
1277 (class Script_info): Move here from script.h.
1278 (Script_info::Script_info): Add filename parameter.
1279 (Script_info::filename): New function.
1280 (Script_info::filename_): New data member.
1281 (Incremental_script_entry::Incremental_script_entry): Add argument
1283 (Incremental_object_entry::Incremental_object_entry): Likewise.
1284 (Incremental_object_entry::add_input_section): Build list of input
1285 sections with map to original shndx.
1286 (Incremental_object_entry::get_input_section_index): New function.
1287 (Incremental_object_entry::shndx_): New data member.
1288 (Incremental_object_entry::name_key_): Rename; adjust all refs.
1289 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
1290 (Incremental_archive_entry::Incremental_archive_entry): Add argument
1292 (Incremental_inputs::report_archive_begin): Likewise.
1293 (Incremental_inputs::report_object): Likewise.
1294 (Incremental_inputs::report_script): Likewise.
1295 (class Incremental_global_symbol_reader): New class.
1296 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
1297 and store flags and input file type.
1298 (Incremental_input_entry_reader::arg_serial): New function.
1299 (Incremental_input_entry_reader::type): Extract type from flags.
1300 (Incremental_input_entry_reader::is_in_system_directory): New function.
1301 (Incremental_input_entry_reader::get_input_section_count): Call
1302 accessor function for type.
1303 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
1304 function for type; adjust size of global symbol entry.
1305 (Incremental_input_entry_reader::get_global_symbol_count): Call
1306 accessor function for type.
1307 (Incremental_input_entry_reader::get_object_count): Likewise.
1308 (Incremental_input_entry_reader::get_object_offset): Likewise.
1309 (Incremental_input_entry_reader::get_member_count): Likewise.
1310 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
1311 (Incremental_input_entry_reader::get_member_offset): Likewise.
1312 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
1313 (Incremental_input_entry_reader::Global_symbol_info): Remove.
1314 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
1315 (Incremental_input_entry_reader::get_global_symbol_reader): New
1317 (Incremental_input_entry_reader::get_output_symbol_index): New
1319 (Incremental_input_entry_reader::type_): Remove.
1320 (Incremental_input_entry_reader::flags_): New data member.
1321 (Incremental_inputs_reader::input_file_offset): New function.
1322 (Incremental_inputs_reader::input_file_index): New function.
1323 (Incremental_inputs_reader::input_file): Call input_file_offset.
1324 (Incremental_inputs_reader::input_file_at_offset): New function.
1325 (Incremental_relocs_reader::get_r_type): Reformat.
1326 (Incremental_relocs_reader::get_r_shndx): Reformat.
1327 (Incremental_relocs_reader::get_r_offset): Reformat.
1328 (Incremental_relocs_reader::data): New function.
1329 (Incremental_binary::Incremental_binary): Initialize new data members.
1330 (Incremental_binary::check_inputs): Add cmdline parameter.
1331 (Incremental_binary::file_is_unchanged): Remove.
1332 (Input_reader::arg_serial): New function.
1333 (Input_reader::get_unused_symbol_count): New function.
1334 (Input_reader::get_unused_symbol): New function.
1335 (Input_reader::do_arg_serial): New function.
1336 (Input_reader::do_get_unused_symbol_count): New function.
1337 (Input_reader::do_get_unused_symbol): New function.
1338 (Incremental_binary::input_file_count): New function.
1339 (Incremental_binary::get_input_reader): Change signature to use
1340 index instead of filename.
1341 (Incremental_binary::file_has_changed): New function.
1342 (Incremental_binary::get_input_argument): New function.
1343 (Incremental_binary::get_library): New function.
1344 (Incremental_binary::get_script_info): New function.
1345 (Incremental_binary::init_layout): New function.
1346 (Incremental_binary::reserve_layout): New function.
1347 (Incremental_binary::output_file): New function.
1348 (Incremental_binary::do_check_inputs): New function.
1349 (Incremental_binary::do_file_is_unchanged): Remove.
1350 (Incremental_binary::do_file_has_changed): New function.
1351 (Incremental_binary::do_init_layout): New function.
1352 (Incremental_binary::do_reserve_layout): New function.
1353 (Incremental_binary::do_input_file_count): New function.
1354 (Incremental_binary::do_get_input_reader): Change signature.
1355 (Incremental_binary::input_args_map_): New data member.
1356 (Incremental_binary::library_map_): New data member.
1357 (Incremental_binary::script_map_): New data member.
1358 (Sized_incremental_binary::Sized_incremental_binary): Initialize
1360 (Sized_incremental_binary::output_section): New function.
1361 (Sized_incremental_binary::inputs_reader): Add const.
1362 (Sized_incremental_binary::symtab_reader): Add const.
1363 (Sized_incremental_binary::relocs_reader): Add const.
1364 (Sized_incremental_binary::got_plt_reader): Add const.
1365 (Sized_incremental_binary::get_symtab_view): New function.
1366 (Sized_incremental_binary::Inputs_reader): New typedef.
1367 (Sized_incremental_binary::Input_entry_reader): New typedef.
1368 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
1369 (Sized_incremental_binary::do_file_is_unchanged): Remove.
1370 (Sized_incremental_binary::do_file_has_changed): New function.
1371 (Sized_incremental_binary::do_init_layout): New function.
1372 (Sized_incremental_binary::do_reserve_layout): New function.
1373 (Sized_input_reader::Inputs_reader): Remove.
1374 (Sized_input_reader::Input_entry_reader): Remove.
1375 (Sized_input_reader::do_arg_serial): New function.
1376 (Sized_input_reader::do_get_unused_symbol_count): New function.
1377 (Sized_input_reader::do_get_unused_symbol): New function.
1378 (Sized_incremental_binary::do_input_file_count): New function.
1379 (Sized_incremental_binary::do_get_input_reader): Change signature;
1380 use index instead of filename.
1381 (Sized_incremental_binary::section_map_): New data member.
1382 (Sized_incremental_binary::input_entry_readers_): New data member.
1383 (class Sized_incr_relobj): New class.
1384 (class Sized_incr_dynobj): New class.
1385 (make_sized_incremental_object): New function.
1386 (class Incremental_library): New class.
1387 * layout.cc (Free_list::num_lists): New static data member.
1388 (Free_list::num_nodes): New static data member.
1389 (Free_list::num_removes): New static data member.
1390 (Free_list::num_remove_visits): New static data member.
1391 (Free_list::num_allocates): New static data member.
1392 (Free_list::num_allocate_visits): New static data member.
1393 (Free_list::init): New function.
1394 (Free_list::remove): New function.
1395 (Free_list::allocate): New function.
1396 (Free_list::dump): New function.
1397 (Free_list::print_stats): New function.
1398 (Layout_task_runner::run): Resize output file for incremental updates.
1399 (Layout::Layout): Initialize new data members.
1400 (Layout::set_incremental_base): New function.
1401 (Layout::init_fixed_output_section): New function.
1402 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
1403 incremental updates.
1404 (Layout::create_gold_note): Do not create gold note section for
1405 incremental updates.
1406 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
1407 for incremental updates.
1408 (Layout::set_section_offsets): For incremental updates, allocate space
1410 (Layout::create_symtab_sections): Layout with offsets relative to
1411 start of section; for incremental updates, allocate space from free
1413 (Layout::create_shdrs): For incremental updates, allocate space from
1415 (Layout::finish_dynamic_section): For incremental updates, do not
1416 check --as-needed (fixed in subsequent patch).
1417 * layout.h (class Free_list): New class.
1418 (Layout::set_incremental_base): New function.
1419 (Layout::incremental_base): New function.
1420 (Layout::init_fixed_output_section): New function.
1421 (Layout::allocate): New function.
1422 (Layout::incremental_base_): New data member.
1423 (Layout::free_list_): New data member.
1424 * main.cc (main): Print Free_list statistics.
1425 * object.cc (Relobj::finalize_incremental_relocs): Add
1426 clear_counts parameter; clear counts only when clear_counts is set.
1427 (Sized_relobj::Sized_relobj): Initialize new base class.
1428 (Sized_relobj::do_layout): Don't report special sections.
1429 (Sized_relobj::do_for_all_local_got_entries): New function.
1430 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
1431 symtab_off to all symbol table offsets.
1432 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
1433 * object.h (class Got_offset_list): Move to top of file.
1434 (Object::Object): Allow case where input_file == NULL.
1435 (Object::~Object): Likewise.
1436 (Object::input_file): Assert that input_file != NULL.
1437 (Object::lock): Allow case where input_file == NULL.
1438 (Object::unlock): Likewise.
1439 (Object::is_locked): Likewise.
1440 (Object::token): Likewise.
1441 (Object::release): Likewise.
1442 (Object::is_incremental): New function.
1443 (Object::get_mtime): New function.
1444 (Object::for_all_local_got_entries): New function.
1445 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
1446 (Object::set_is_in_system_directory): New function.
1447 (Object::is_in_system_directory): New function.
1448 (Object::do_is_incremental): New function.
1449 (Object::do_get_mtime): New function.
1450 (Object::do_for_all_local_got_entries): New function.
1451 (Object::is_in_system_directory_): New data member.
1452 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
1453 (class Sized_relobj_base): New class.
1454 (class Sized_relobj): Derive from Sized_relobj_base.
1455 (class Sized_relobj::Symbols): Redeclare from base class.
1456 (class Sized_relobj::local_got_offset_list): Remove.
1457 (class Sized_relobj::Output_sections): Redeclare from base class.
1458 (class Sized_relobj::do_for_all_local_got_entries): New function.
1459 (class Sized_relobj::write_local_symbols): Add offset parameter.
1460 (class Sized_relobj::local_symbol_offset_): Update comment.
1461 (class Sized_relobj::local_dynsym_offset_): Update comment.
1462 * options.cc (Input_arguments::add_file): Remove const.
1463 * options.h (Input_file_argument::Input_file_argument):
1464 Initialize arg_serial_ (all constructors).
1465 (Input_file_argument::set_arg_serial): New function.
1466 (Input_file_argument::arg_serial): New function.
1467 (Input_file_argument::arg_serial_): New data member.
1468 (Input_arguments::Input_arguments): Initialize file_count_.
1469 (Input_arguments::add_file): Remove const.
1470 (Input_arguments::number_of_input_files): New function.
1471 (Input_arguments::file_count_): New data member.
1472 (Command_line::number_of_input_files): Call
1473 Input_arguments::number_of_input_files.
1474 * output.cc (Output_segment_headers::Output_segment_headers):
1476 (Output_section::Input_section::current_data_size): New function.
1477 (Output_section::Output_section): Initialize new data members.
1478 (Output_section::add_input_section): Don't do merge sections for
1479 an incremental link; allocate space from free list for an
1481 (Output_section::add_output_section_data): Allocate space from
1482 free list for an incremental update.
1483 (Output_section::update_data_size): New function.
1484 (Output_section::set_fixed_layout): New function.
1485 (Output_section::reserve): New function.
1486 (Output_segment::set_section_addresses): Remove const.
1487 (Output_segment::set_section_list_addresses): Remove const; allocate
1488 space from free list for an incremental update.
1489 (Output_segment::set_offset): Adjust size of RELRO segment for an
1491 * output.h (Output_data::current_data_size): Move here from
1493 (Output_data::pre_finalize_data_size): New function.
1494 (Output_data::update_data_size): New function.
1495 (Output_section_headers::update_data_size): new function.
1496 (Output_section_data_build::current_data_size): Move to Output_data.
1497 (Output_data_strtab::update_data_size): New function.
1498 (Output_section::current_data_size): Move to Output_data.
1499 (Output_section::set_fixed_layout): New function.
1500 (Output_section::has_fixed_layout): New function.
1501 (Output_section::reserve): New function.
1502 (Output_section::update_data_size): New function.
1503 (Output_section::has_fixed_layout_): New data member.
1504 (Output_section::free_list_): New data member.
1505 (Output_segment::set_section_addresses): Remove const.
1506 (Output_segment::set_section_list_addresses): Remove const.
1507 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
1509 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
1511 * readsyms.cc (Read_symbols::do_read_symbols): Add library
1512 parameter when calling Add_symbols constructor; store argument
1513 serial number for members of a lib group.
1514 (Add_symbols::locks): Allow case where token == NULL.
1515 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
1516 (Read_member::~Read_member): New function.
1517 (Read_member::is_runnable): New function.
1518 (Read_member::locks): New function.
1519 (Read_member::run): New function.
1520 (Check_script::~Check_script): New function.
1521 (Check_script::is_runnable): New function.
1522 (Check_script::locks): New function.
1523 (Check_script::run): New function.
1524 (Check_library::~Check_library): New function.
1525 (Check_library::is_runnable): New function.
1526 (Check_library::locks): New function.
1527 (Check_library::run): New function.
1528 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
1529 (Add_symbols::library_): New data member.
1530 (class Read_member): New class.
1531 (class Check_script): New class.
1532 (class Check_library): New class.
1533 * reloc.cc (Read_relocs::is_runnable): Allow case where
1535 (Read_relocs::locks): Likewise.
1536 (Scan_relocs::locks): Likewise.
1537 (Relocate_task::locks): Likewise.
1538 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
1540 (Sized_relobj::incremental_relocs_scan): Fix comment.
1541 (Sized_relobj::do_relocate): Pass output file offset to
1542 write_local_symbols.
1543 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
1544 from class declaration.
1545 * script.cc (read_input_script): Allocate Script_info; pass
1546 argument serial number to report_script.
1547 * script.h (class Script_info): Move to incremental.h.
1548 * symtab.cc (Symbol_table::add_from_incrobj): New function.
1549 * symtab.h (Symbol_table::add_from_incrobj): New function.
1550 (Symbol_table::set_file_offset): New function.
1552 2011-04-05 Cary Coutant <ccoutant@google.com>
1554 * incremental-dump.cc (dump_incremental_inputs): Change signature
1555 to take a Sized_incremental_binary; change caller. Use readers
1556 in Sized_incremental_binary.
1558 (Sized_incremental_binary::find_incremental_inputs_sections):
1559 Rename do_find_incremental_inputs_sections to this.
1560 (Sized_incremental_binary::setup_readers): New function.
1561 (Sized_incremental_binary::do_check_inputs): Check
1562 has_incremental_info_ flag; move setup code to setup_readers;
1564 (Sized_incremental_binary::do_file_is_unchanged): New function.
1565 (Sized_incremental_binary::do_get_input_reader): New function.
1566 * incremental.h (class Incremental_binary): Move to end of file.
1567 (Incremental_binary::file_is_unchanged): New function.
1568 (Incremental_binary::do_file_is_unchanged): New function.
1569 (Incremental_binary::Input_reader): New class.
1570 (Incremental_binary::get_input_reader): New function.
1571 (class Sized_incremental_binary): Move to end of file.
1572 (Sized_incremental_binary::Sized_incremental_binary): Setup the
1573 input section reader classes.
1574 (Sized_incremental_binary::has_incremental_info): New function.
1575 (Sized_incremental_binary::inputs_reader): New function.
1576 (Sized_incremental_binary::symtab_reader): New function.
1577 (Sized_incremental_binary::relocs_reader): New function.
1578 (Sized_incremental_binary::got_plt_reader): New function.
1579 (Sized_incremental_binary::do_file_is_unchanged): New function.
1580 (Sized_incremental_binary::Sized_input_reader): New class.
1581 (Sized_incremental_binary::get_input_reader): New function.
1582 (Sized_incremental_binary::find_incremental_inputs_sections):
1583 Rename do_find_incremental_inputs_sections to this.
1584 (Sized_incremental_binary::setup_readers): New function.
1585 (Sized_incremental_binary::has_incremental_info_): New data member.
1586 (Sized_incremental_binary::inputs_reader_): New data member.
1587 (Sized_incremental_binary::symtab_reader_): New data member.
1588 (Sized_incremental_binary::relocs_reader_): New data member.
1589 (Sized_incremental_binary::got_plt_reader_): New data member.
1590 (Sized_incremental_binary::current_input_file_): New data member.
1592 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
1595 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
1598 2011-03-30 Cary Coutant <ccoutant@google.com>
1600 * archive.cc (Archive::include_member): Adjust call to report_object.
1601 (Add_archive_symbols::run): Add script_info to call to
1602 report_archive_begin.
1603 (Lib_group::include_member): Adjust call to report_object.
1604 (Add_lib_group_symbols::run): Adjust call to report_object.
1605 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
1606 blocks. Add object count for script input files.
1607 * incremental.cc (Incremental_inputs::report_archive_begin): Add
1608 script_info parameter; change all callers.
1609 (Incremental_inputs::report_object): Add script_info parameter;
1611 (Incremental_inputs::report_script): Store backpointer to
1612 incremental info entry.
1613 (Output_section_incremental_inputs::set_final_data_size): Record
1614 additional information for scripts.
1615 (Output_section_incremental_inputs::write_info_blocks): Likewise.
1616 * incremental.h (Incremental_script_entry::add_object): New function.
1617 (Incremental_script_entry::get_object_count): New function.
1618 (Incremental_script_entry::get_object): New function.
1619 (Incremental_script_entry::objects_): New data member; adjust
1621 (Incremental_inputs::report_archive_begin): Add script_info parameter.
1622 (Incremental_inputs::report_object): Add script_info parameter.
1623 (Incremental_inputs_reader::get_object_count): New function.
1624 (Incremental_inputs_reader::get_object_offset): New function.
1625 * options.cc (Input_arguments::add_file): Return reference to
1627 * options.h (Input_argument::set_script_info): New function.
1628 (Input_argument::script_info): New function.
1629 (Input_argument::script_info_): New data member; adjust all
1631 (Input_file_group::add_file): Return reference to new input argument.
1632 (Input_file_lib::add_file): Likewise.
1633 (Input_arguments::add_file): Likewise.
1634 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
1635 * script.cc (Parser_closure::Parser_closure): Add script_info
1636 parameter; adjust all callers.
1637 (Parser_closure::script_info): New function.
1638 (Parser_closure::script_info_): New data member.
1639 (read_input_script): Report scripts earlier to incremental info.
1640 (script_add_file): Set script_info in Input_argument.
1641 (script_add_library): Likewise.
1642 * script.h (Script_options::Script_info): Rewrite class.
1644 2011-03-29 Cary Coutant <ccoutant@google.com>
1646 * archive.cc (Library_base::should_include_member): Move
1647 method here from class Archive.
1648 (Archive::Archive): Initialize base class.
1649 (Archive::should_include_member): Move to base class.
1650 (Archive::do_for_all_unused_symbols): New function.
1651 (Add_archive_symbols::run): Remove redundant access to
1653 (Lib_group::Lib_group): Initialize base class.
1654 (Lib_group::do_filename): New function.
1655 (Lib_group::include_member): Pass pointer to Lib_group to
1657 (Lib_group::do_for_all_unused_symbols): New function.
1658 (Add_lib_group_symbols::run): Report archive information for
1660 * archive.h (class Library_base): New base class.
1661 (class Archive): Derive from Library_base.
1662 (Archive::filename): Move to base class.
1663 (Archive::set_incremental_info): Likewise.
1664 (Archive::incremental_info): Likewise.
1665 (Archive::Should_include): Likewise.
1666 (Archive::should_include_member): Likewise.
1667 (Archive::Armap_entry): Remove.
1668 (Archive::Unused_symbol_iterator): Remove.
1669 (Archive::unused_symbols_begin): Remove.
1670 (Archive::unused_symbols_end): Remove.
1671 (Archive::do_filename): New function.
1672 (Archive::do_get_mtime): New function.
1673 (Archive::do_for_all_unused_symbols): New function.
1674 (Archive::task_): Move to base class.
1675 (Archive::incremental_info_): Likewise.
1676 (class Lib_group): Derive from Library_base.
1677 (Lib_group::do_filename): New function.
1678 (Lib_group::do_get_mtime): New function.
1679 (Lib_group::do_for_all_unused_symbols): New function.
1680 (Lib_group::task_): Move to base class.
1681 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
1683 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
1685 * incremental.cc (Incremental_inputs::report_archive_begin):
1686 Use Library_base; call library's get_mtime; add incremental inputs
1687 entry before members.
1688 (class Unused_symbol_visitor): New class.
1689 (Incremental_inputs::report_archive_end): Use Library_base; use
1690 visitor class to record unused symbols; don't add incremental inputs
1691 entry after members.
1692 (Incremental_inputs::report_object): Use Library_base.
1694 (Incremental_archive_entry::Incremental_archive_entry): Remove
1695 unused Archive parameter.
1696 (Incremental_inputs::report_archive_begin): Use Library_base.
1697 (Incremental_inputs::report_archive_end): Likewise.
1698 (Incremental_inputs::report_object): Likewise.
1699 * object.cc (Sized_relobj::do_for_all_global_symbols): New
1701 * object.h (Object::for_all_global_symbols): New function.
1702 (Object::do_for_all_global_symbols): New function.
1703 (Sized_relobj::do_for_all_global_symbols): New function.
1704 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
1706 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
1709 2011-03-27 Ian Lance Taylor <iant@google.com>
1711 * archive.cc (Archive::interpret_header): Return -1 if something
1712 goes wrong. Change callers accordingly.
1714 2011-03-25 Cary Coutant <ccoutant@google.com>
1716 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
1717 * testsuite/Makefile.in: Regenerate.
1719 2010-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
1721 * plugin.cc (get_view): New.
1722 (Plugin::load): Pass get_view to the plugin.
1723 (Plugin_manager::get_view): New.
1725 2011-03-21 Ian Lance Taylor <iant@google.com>
1727 * testsuite/final_layout.sh: Rewrite to not use dc.
1728 * testsuite/relro_test.sh: Fail if dc is not present.
1730 2011-03-21 Sriraman Tallam <tmsriram@google.com>
1732 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
1734 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
1735 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
1737 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
1738 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
1740 2011-03-14 Ian Lance Taylor <iant@google.com>
1742 * script-sections.cc (Sort_output_sections::script_compare):
1743 Rename from is_before, change return type.
1744 (Sort_output_sections::operator()): Adjust accordingly.
1746 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
1749 * testsuite/odr_violation2.cc: Add comment to make all error line
1750 numbers double digits.
1751 * testsuite/debug_msg.sh: Adjust expected errors.
1753 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
1755 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
1756 but mark earlier ones as non-canonical
1757 (offset_to_iterator): Update search target and example
1758 (do_addr2line): Return extra lines in a vector*
1759 (format_file_lineno): Extract from do_addr2line
1760 (one_addr2line): Add vector* out-param
1761 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
1762 when a lineno entry appeared last for its instruction
1763 (Dwarf_line_info): Add vector* out-param
1764 * object.cc (Relocate_info): Pass NULL for the vector* out-param
1765 * symtab.cc (Odr_violation_compare): Include the lineno in the
1767 (linenos_from_loc): New. Combine the canonical line for an
1768 address with its other lines.
1769 (True_if_intersect): New. Helper functor to make
1770 std::set_intersection a query.
1771 (detect_odr_violations): Compare sets of lines instead of just
1772 one line for each function. This became less deterministic, but
1773 has fewer false positives.
1774 * symtab.h: Declarations.
1775 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
1776 mix an optimized and non-optimized object in the same binary
1777 (odr_violation2.so): Same.
1778 * testsuite/Makefile.in: Regenerate from Makefile.am.
1779 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
1780 * testsuite/debug_msg.sh: Update line numbers and add
1782 * testsuite/odr_violation1.cc: Use OdrDerived, in a
1783 non-optimized context.
1784 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
1785 isn't inlined, and use OdrDerived in an optimized context.
1786 * testsuite/odr_header1.h: Defines OdrDerived, where
1787 optimization will change the
1788 first-instruction-in-the-destructor's file and line number.
1789 * testsuite/odr_header2.h: Defines OdrBase.
1791 2011-03-09 Ian Lance Taylor <iant@google.com>
1793 * fileread.cc (File_read::clear_views): Don't delete the whole
1796 2011-03-08 Ian Lance Taylor <iant@google.com>
1799 * fileread.cc: #include <climits>.
1800 (GOLD_IOV_MAX): Define.
1801 (File_read::read_multiple): Limit number of entries by iov_max.
1802 * fileread.h (class File_read): Always set max_readv_entries to
1805 2011-03-07 Ian Lance Taylor <iant@google.com>
1808 * options.h (class General_options): Add -dy and -dn.
1810 2011-03-02 Cary Coutant <ccoutant@google.com>
1812 * testsuite/script_test_9.t: Add TLS segment.
1814 2011-03-02 Simon Baldwin <simonb@google.com>
1816 * configure.ac: Add check for gnu_indirect_function support in
1817 the toolchain building binutils.
1818 * configure: Rebuild.
1820 2010-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
1822 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
1823 plugin only symbols.
1824 (Symbol_table::sized_finalize_symbol) Mark symbol only present
1825 in plugin files as not needed in the symbol table.
1827 2011-02-11 Sriraman Tallam <tmsriram@google.com>
1829 * output.cc (Output_section::add_input_section): Delay fill
1830 generation for section ordering.
1832 2011-02-09 Ian Lance Taylor <iant@google.com>
1835 * object.h (class Sized_relobj): Remove clear_local_symbols.
1836 * reloc.cc (Sized_relobj::do_relocate): Don't call
1837 clear_local_symbols.
1839 2010-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
1841 * plugin.cc (is_visible_from_outside): Return true for symbols
1844 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
1846 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
1849 2011-02-02 Sriraman Tallam <tmsriram@google.com>
1851 * icf.h (is_section_foldable_candidate): Change type of parameter
1853 * icf.cc (Icf::find_identical_sections): Change type of local variable
1854 section_name to be std::string.
1855 (is_function_ctor_or_dtor): Change type of parameter to std::string.
1857 2011-01-25 Ian Lance Taylor <iant@google.com>
1859 * script.cc (script_add_extern): Rewrite to use
1860 add_symbol_reference.
1862 2011-01-25 Doug Kwan <dougkwan@google.com>
1864 * icf.cc (get_section_contents): Always lock section's object.
1866 2011-01-24 Ian Lance Taylor <iant@google.com>
1868 * options.h (class General_options): Accept
1869 --no-detect-odr-violations.
1871 2011-01-24 Ian Lance Taylor <iant@google.com>
1873 * version.cc (version_string): Bump to 1.11.
1875 2011-01-24 Ian Lance Taylor <iant@google.com>
1877 * plugin.cc (class Plugin_rescan): Define new class.
1878 (Plugin_manager::claim_file): Set any_claimed_.
1879 (Plugin_manager::save_archive): New function.
1880 (Plugin_manager::save_input_group): New function.
1881 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
1883 (Plugin_manager::new_undefined_symbol): New function.
1884 (Plugin_manager::rescan): New function.
1885 (Plugin_manager::rescannable_defines): New function.
1886 (Plugin_manager::add_input_file): Set any_added_.
1887 * plugin.h (class Plugin_manager): define new fields rescannable_,
1888 undefined_symbols_, any_claimed_, and any_added_. Declare
1889 Plugin_rescan as friend. Declare new functions.
1890 (Plugin_manager::Rescannable): Define type.
1891 (Plugin_manager::Rescannable_list): Define type.
1892 (Plugin_manager::Undefined_symbol_list): Define type.
1893 (Plugin_manager::Plugin_manager): Initialize new fields.
1894 * archive.cc (Archive::defines_symbol): New function.
1895 (Add_archive_symbols::run): Pass archive to plugins if any.
1896 * archive.h (class Archive): Declare defines_symbol.
1897 * readsyms.cc (Input_group::~Input_group): New function.
1898 (Finish_group::run): Pass input_group to plugins if any.
1899 * readsyms.h (class Input_group): Declare destructor.
1900 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
1903 2011-01-10 Ian Lance Taylor <iant@google.com>
1905 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
1907 (Layout::set_segment_offsets): Reset increase_relro before calling
1908 set_section_addresses a second time.
1910 2011-01-04 Cary Coutant <ccoutant@google.com>
1912 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
1913 sections before NOBITS sections.
1915 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
1917 * version.cc (print_version): Update copyright to 2011.
1919 2010-12-23 Cary Coutant <ccoutant@google.com>
1921 * output.h (Output_data_reloc::add_output_section): Pass OD instead
1922 of OS to this->add. Add OD parameter to second form of the function.
1924 2010-12-20 Ian Lance Taylor <iant@google.com>
1926 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
1927 second of two consecutive entries with same offset.
1929 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1931 * testsuite/Makefile.am (ifuncmain2static_LDADD)
1932 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
1933 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
1934 to avoid unneeded links against $(LDADD).
1935 * testsuite/Makefile.in: Regenerate.
1937 2010-12-15 Ian Lance Taylor <iant@google.com>
1940 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
1941 for R_X86_64_32 and R_X86_64_PC32.
1942 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
1943 ver_matching_def_pic.o.
1944 (ver_matching_def_pic.o): New target.
1946 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1948 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
1949 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
1950 Move definition before File_read::View member definitions.
1951 (File_read::View::~View): Initialize and hold lock before
1952 updating current_mapped_bytes.
1954 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1956 * dwarf_reader.cc: Remove outdated comment.
1957 * gold-threads.cc: Fix typo in error message.
1958 * archive.cc: Fix typos in comments.
1959 * archive.h: Likewise.
1960 * arm-reloc-property.cc: Likewise.
1961 * arm-reloc-property.h: Likewise.
1962 * arm-reloc.def: Likewise.
1964 * attributes.h: Likewise.
1965 * cref.cc: Likewise.
1966 * ehframe.cc: Likewise.
1967 * fileread.h: Likewise.
1969 * i386.cc: Likewise.
1971 * incremental.h: Likewise.
1972 * int_encoding.cc: Likewise.
1973 * layout.h: Likewise.
1974 * main.cc: Likewise.
1975 * merge.h: Likewise.
1976 * object.cc: Likewise.
1977 * object.h: Likewise.
1978 * options.cc: Likewise.
1979 * readsyms.cc: Likewise.
1980 * reduced_debug_output.cc: Likewise.
1981 * reloc.cc: Likewise.
1982 * script-sections.cc: Likewise.
1983 * sparc.cc: Likewise.
1984 * symtab.h: Likewise.
1985 * target-reloc.h: Likewise.
1986 * target.cc: Likewise.
1987 * target.h: Likewise.
1988 * timer.cc: Likewise.
1989 * timer.h: Likewise.
1990 * x86_64.cc: Likewise.
1992 2010-12-09 Cary Coutant <ccoutant@google.com>
1994 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
1996 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
1997 parameter; change all callers.
1998 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
1999 * options.h (warn_execstack): New option.
2001 2010-12-07 Doug Kwan <dougkwan@google.com>
2003 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
2004 like function call relocations.
2006 2010-12-07 Ian Lance Taylor <iant@google.com>
2008 * archive.cc (Archive::get_elf_object_for_member): Permit
2009 punconfigured to be NULL.
2010 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
2011 (Archive::include_member): Pass NULL to get_elf_object_for_member
2012 if we searched for the archive and this is the first included
2015 2010-12-01 Ian Lance Taylor <iant@google.com>
2017 * dwarf_reader.h (class Sized_dwarf_line_info): Add
2018 track_relocs_type_ field.
2019 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2020 Set track_relocs_type_.
2021 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
2022 contents when using RELA relocs.
2023 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
2025 * reloc.cc (Track_relocs::next_addend): New function.
2026 * reloc.h (class Track_relocs): Declare next_addend.
2028 2010-12-01 Ian Lance Taylor <iant@google.com>
2030 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
2033 2010-12-01 Ian Lance Taylor <iant@google.com>
2035 * README: Update compilers known to work and fail.
2037 2010-11-23 Matthias Klose <doko@ubuntu.com>
2039 * configure.in: For --enable-gold, handle value `default' instead of
2040 `both*'. Always install ld as ld.bfd, install as ld if gold is
2042 * configure: Regenerate.
2044 2010-11-18 Doug Kwan <dougkwan@google.com>
2046 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
2047 and right_alignment to be zero. Store result alignment only if it is
2048 greater than existing alignment.
2050 2010-11-16 Cary Coutant <ccoutant@google.com>
2053 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2054 Check for ".zdebug_line".
2056 2010-11-16 Doug Kwan <dougkwan@google.com>
2057 Cary Coutant <ccoutant@google.com>
2059 * output.h (Output_segment::set_section_addresses): Pass increase_relro
2060 by reference; adjust all callers.
2061 * output.cc (Output_segment::set_section_addresses): Adjust references
2062 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
2064 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
2065 end at page boundary.
2067 2010-11-16 Cary Coutant <ccoutant@google.com>
2070 * layout.cc (Layout::choose_output_section): Transform names of
2071 compressed sections even when using a script with a SECTIONS clause.
2072 (Layout::output_section_name): Remove code to transform
2073 compressed debug section names.
2074 * output.cc (Output_section::add_input_section): Use uncompressed
2075 section size when tracking input sections.
2077 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
2079 * symtab.h (Symbol::NON_PIC_REF): Remove.
2080 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
2081 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
2082 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
2083 (Symbol::use_plt_offset): Take a flags argument and pass it
2084 directly to needs_dynamic_reloc. Restrict check for undefined
2085 weak symbols to function calls.
2086 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
2087 (Target_arm::Scan::global): Use it.
2088 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
2089 (Target_arm::Relocate::relocate): Likewise.
2090 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
2091 parameter with an r_type parameter. Use get_reference_flags
2093 (Target_arm::Relocate::relocate): Update accordingly.
2094 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
2095 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
2096 (Target_i386::Scan::global): Likewise.
2097 (Target_i386::Relocate::relocate): Likewise.
2098 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
2099 parameter with an r_type parameter. Use get_reference_flags
2101 (Target_i386::Relocate::relocate): Update accordingly.
2102 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
2103 (Target_powerpc::Scan::global): Use it.
2104 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
2105 (Target_powerpc::Relocate::relocate): Likewise.
2106 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
2107 (Target_sparc::Scan::global): Use it.
2108 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
2109 (Target_sparc::Relocate::relocate): Likewise.
2110 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
2111 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
2112 (Target_x86_64::Scan::global): Likewise.
2113 (Target_x86_64::Relocate::relocate): Likewise.
2115 2010-11-08 Doug Kwan <dougkwan@google.com>
2116 Cary Coutant <ccoutant@google.com>
2118 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
2119 (Arm_exidx_merge_section::section_contents_): New data member.
2120 (Arm_input_section::Arm_input_section): Initialize original_contents_.
2121 (Arm_input_section::~Arm_input_section): De-allocate memory.
2122 (Arm_input_section::original_contents_): New data member.
2123 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
2124 in parameters instead of calling Object::section_contents without
2126 (Arm_output_section::group_section): New parameter TASK. Pass it
2127 to callees that need locking objects.
2128 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
2129 to lock EXIDX input sections. Fix a formatting issue. Call
2130 Arm_exidx_merged_section::build_contents to create merged section
2132 (Arm_output_section::create_stub_group): New parameter TASK. Use it
2133 to lock object of stub table owner.
2134 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
2135 TEXT_SIZE to initialize data member TEXT_SIZE_.
2136 (Arm_exidx_input_section::addralign): Fix typo in comment.
2137 (Arm_exidx_input_section::text_size): New method.
2138 (Target_arm::do_relax): New parameter TASK. Pass it to callees
2139 that require locking objects. Lock objects before scanning for stubs
2140 and updating local symbols.
2141 (Arm_input_section<big_endian>::init): Copy contents of original
2143 (Arm_input_section<big_endian>::do_write): Use saved contents of
2144 original input section instead of calling Object::section_contents
2146 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
2147 size without calling Object::section_size().
2148 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
2149 for size. Allocate a buffer for merged EXIDX entries.
2150 (Arm_exidx_merged_section::build_contents): New method.
2151 (Arm_exidx_merged_section::do_write): Move merge section contents
2152 building code to Arm_exidx_merged_section::build_contetns. Write
2153 out contetns in buffer instead of building it on the fly.
2154 (Arm_relobj::make_exidx_input_section): Also pass text section size
2155 to Arm_exidx_input_section constructor.
2156 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
2157 (Arm_dynobj::do_read_symbols): Fix memory leak.
2158 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
2159 * target.h: (class Task): Add forward declaration.
2160 (Target::relax): Add new parameter TASK and pass it to
2162 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
2164 2010-11-05 Cary Coutant <ccoutant@google.com>
2167 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
2168 object when reading from the file.
2169 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
2171 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
2172 when reading section contents.
2173 (get_section_contents): Likewise.
2174 (icf::find_identical_sections): Likewise.
2175 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
2176 object when reading from the file.
2177 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
2178 the object when doing deferred section layout.
2180 2010-11-03 Nick Clifton <nickc@redhat.com>
2183 * script.h (class Symbol_assignment: name): New member. Returns
2184 the name of the symbol.
2185 * scrfipt.cc (Script_options::is_pending_assignment): New member.
2186 Returns true if the given symbol name is on the list of
2187 assignments wating to be processed.
2188 * archive.cc (should_incldue_member): If the symbol is undefined,
2189 check to see if it is on the list of symbols pending assignment.
2191 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
2193 * script-sections.cc (Script_sections::find_memory_region): Check
2194 for a NULL output section pointer.
2196 2010-10-29 Doug Kwan <dougkwan@google.com>
2198 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
2199 Output_section::add_relaxed_input_section.
2200 * output.cc (Output_section::add_relaxed_input_section): Add new
2201 arguments LAYOUT and NAME. Set section order index.
2202 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
2203 Copy section order index.
2204 * output.h (Output_section::add_relaxed_input_section): Add new
2205 arguments LAYOUT and NAME.
2207 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2209 * testsuite/Makefile.am: Move gcctestdir/ld rule to
2210 NATIVE_OR_CROSS_LINKER.
2211 * testsuite/Makefile.in: Regenerate.
2213 2010-10-20 Doug Kwan <dougkwan@google.com>
2215 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
2216 without SHF_LINK_ORDER flags.
2217 * layout.cc (Layout::choose_output_section): Do not filter
2218 SHF_LINK_ORDER flag in a relocatable link.
2220 2010-10-17 Cary Coutant <ccoutant@google.com>
2222 * output.h (Output_segment::set_section_addresses): Change function
2223 signature. Update all callers.
2224 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
2226 (Output_segment::set_section_addresses): Align after last TLS
2227 section. Add padding before last relro section instead of after.
2229 2010-10-17 Doug Kwan <dougkwan@google.com>
2231 * gold/arm.cc (Target_arm::got_section): Use correct order and set
2232 GOT output section to be writable.
2234 2010-10-14 Cary Coutant <ccoutant@google.com>
2236 * debug.h (DEBUG_INCREMENTAL): New flag.
2237 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
2238 * gold.cc (queue_initial_tasks): Check parameters for incremental link
2240 * incremental.cc (report_command_line): Ignore all forms of
2242 * layout.cc (Layout::Layout): Check parameters for incremental link
2244 * options.cc (General_options::parse_incremental): New function.
2245 (General_options::parse_no_incremental): New function.
2246 (General_options::parse_incremental_full): New function.
2247 (General_options::parse_incremental_update): New function.
2248 (General_options::incremental_mode_): New data member.
2249 (General_options::finalize): Check incremental_mode_.
2250 * options.h (General_options): Update help text for --incremental.
2251 Add --no-incremental, --incremental-full, --incremental-update.
2252 (General_options::Incremental_mode): New enum type.
2253 (General_options::incremental_mode): New function.
2254 (General_options::incremental_mode_): New data member.
2255 * parameters.cc (Parameters::incremental_mode_): New data member.
2256 (Parameters::set_options): Set incremental_mode_.
2257 (Parameters::set_incremental_full): New function.
2258 (Parameters::incremental): New function.
2259 (Parameters::incremental_update): New function.
2260 (set_parameters_incremental_full): New function.
2261 * parameters.h (Parameters::set_incremental_full): New function.
2262 (Parameters::incremental): New function.
2263 (Parameters::incremental_update): New function.
2264 (Parameters::incremental_mode_): New data member.
2265 (set_parameters_incremental_full): New function.
2266 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
2267 incremental link mode.
2268 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
2269 (Sized_relobj::do_relocate_sections): Likewise.
2270 * testsuite/Makefile.am (incremental_test): Use --incremental-full
2272 * testsuite/Makefile.in: Regenerate.
2273 * testsuite/incremental_test.sh: Filter all forms of --incremental.
2275 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2277 * script-sections.h (class Script_sections): Make
2278 Sections_elements typedef public.
2279 * script-sections.cc (class Sort_output_sections): Add elements_
2280 field. Add constructor which sets it; change all callers.
2281 (Sort_output_sections::is_before): New function.
2282 (Sort_output_sections::operator()): Call is_before.
2283 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
2285 * testsuite/script_test_10.sh: New test. Test script section
2287 * testsuite/script_test_10.t: Likewise.
2288 * testsuite/script_test_10.s: Likewise.
2289 * testsuite/Makefile.am: Wrap the cross linker tests and the
2290 common tests into NATIVE_OR_CROSS_LINKER.
2291 (check_SCRIPTS): Add script_test_10.sh.
2292 (check_DATA): Add script_test_10.stdout.
2293 (script_test_10.o, script_test_10): New targets.
2294 (script_test_10.stdout): New target.
2295 * configure, testsuite/Makefile.in: Regenerate.
2297 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2299 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
2300 error for the deprecated relocations.
2301 (Target_arm::Scan::global): Likewise.
2302 (Target_arm::Relocate::relocate): Likewise.
2304 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
2306 * fileread.cc (Input_file::find_file): Initialize *found_name
2307 and *namep when using the fallback search for case 4.
2309 2010-10-11 Cary Coutant <ccoutant@google.com>
2311 * options.h (class General_options): Redefine -z lazy as an alias for
2312 the negation of -z now.
2314 2010-10-11 Ian Lance Taylor <iant@google.com>
2316 * resolve.cc (symbol_to_bits): Report the value of the unsupported
2319 2010-10-06 Nick Clifton <nickc@redhat.com>
2321 * script-sections.cc(class Memory_region): Remove
2322 current_lma_offset_ field. Rename current_vma_offset_ to
2323 current_offset_. Add last_section_ field.
2324 (Memory_region::get_current_vma_address): Rename to
2325 get_current_address.
2326 (Memory_region::get_current_lma_address): Delete.
2327 (Memory_region::increment_vma_offset): Rename to
2329 (Memory_region::increment_lma_offset): Delete.
2330 (Memory_region::attributes_compatible): New method. Returns
2331 true if the provided section is compatible with the region.
2332 (Memory_region::get_last_section): New method. Returns the last
2333 section to use the region.
2334 (Memory_region::set_last_section): New method. Stores the last
2335 section to use the region.
2336 (Script_sections::block_in_region): New method. Returns true if
2337 a block of memory is contained within a region.
2338 (Script_sections::find_memory_region): New method. Locates a
2339 memory region to be used to set a VMA or LMA address.
2340 (Output_section_definition::set_section_addresses): Add code to
2341 check for addresses set by memory regions.
2342 (Output_segment::set_section_addresses): Remove memory region
2344 (Script_sections::create_segment): Add a warning if a header
2345 segment is created outside of any region.
2346 * script-sections.h (class Script_sections): Add prototypes for
2347 find_memory_region and block_in_region methods.
2348 * testsuite/memory_test.s: Use .long instead of .word.
2349 * testsuite/memory_test.t: Add some more output sections.
2350 * testsuite/memory_test.sh: Update expected output.
2352 2010-10-02 Doug Kwan <dougkwan@google.com>
2354 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
2355 defintion to symtab.h
2356 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
2357 declaration to defintion.
2359 2010-10-01 Nick Clifton <nickc@redhat.com>
2361 * expression.cc (eval): Replace dummy argument with NULL.
2362 (eval_maybe_dot): Check for a NULL result section pointer.
2363 (Symbol_expression::value): Likewise.
2364 (Dot_expression::value): Likewise.
2365 (BINARY_EXPRESSION): Likewise.
2366 (Max_expression::value): Likewise.
2367 (Min_expression::value): Likewise.
2368 (Absolute_expression::value): Likewise.
2369 (Addr_expression::value_from_output_section): Likewise.
2370 (Loaddddr_expression::value_from_output_section): Likewise.
2371 (Segment_start_expression::value): Likewise.
2372 * script-sections.cc
2373 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
2375 (Sections_elememt_dot_assignment::set_section_addresses):
2377 (Output_data_expression::do_write_to_buffer): Likewise.
2378 (Output_section_definition::finalize_symbols): Likewise.
2379 (Output_section_definition::set_section_addresses): Likewise.
2381 2010-09-30 Doug Kwan <dougkwan@google.com>
2383 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
2385 2010-09-28 Sriraman Tallam <tmsriram@google.com>
2387 * target.h (Target::can_icf_inline_merge_sections): New virtual
2389 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
2391 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
2393 * icf.cc (get_section_contents): Inline merge sections only when
2396 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2398 * configure: Regenerate.
2400 2010-09-17 Ian Lance Taylor <iant@google.com>
2402 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
2403 * testsuite/Makefile.am (memory_test.o): New target.
2404 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
2406 * testsuite/Makefile.in: Rebuild.
2408 2010-09-17 Doug Kwan <dougkwan@google.com>
2410 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
2411 defintion if relocation uses GOT entries of the symbol.
2412 * testsuite/icf_safe_test.sh: Fix test.
2413 * testsuite/icf_safe_so_test.sh: Fix test.
2415 2010-09-16 Cary Coutant <ccoutant@google.com>
2417 * script_sections.cc (class Memory_region): Remove "NULL" from
2418 vector initializations.
2420 2010-09-15 Cary Coutant <ccoutant@google.com>
2422 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
2423 Resolve forwarding symbols.
2425 2010-09-15 Doug Kwan <dougkwan@google.com>
2427 * gold/testsuite/script_test_3.t: Add ARM special sections.
2428 * gold/testsuite/script_test_4.t: Same.
2429 * gold/testsuite/script_test_5.t: Same.
2430 * gold/testsuite/script_test_6.t: Same.
2431 * gold/testsuite/script_test_7.t: Same.
2432 * gold/testsuite/script_test_7.t: Same.
2433 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
2435 2010-09-14 Cary Coutant <ccoutant@google.com>
2437 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
2438 (Target_x86_64::Relocate::relocate_tls): Replace check for
2439 saw_tls_block_reloc_ with test for executable section.
2441 2010-09-12 Cary Coutant <ccoutant@google.com>
2443 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
2444 position-independent executables to shared libraries need dynamic
2446 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
2447 position-independent executables.
2448 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
2449 * testsuite/Makefile.in: Regenerate.
2451 2010-09-10 Nick Clifton <nickc@redhat.com>
2454 * testsuite/memory_test.t: Discard any sections that are not
2457 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
2460 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
2461 "This::" to work around a bug in gcc 4.2.
2463 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
2465 2010-09-09 Rafael Espindola <espindola@google.com>
2467 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
2468 sections with different PF_X flags in the same segment.
2469 (Layout::find_first_load_seg): Search all segments to find the first
2471 * options.h (rosegment): New.
2473 2010-09-08 Rafael Espindola <espindola@google.com>
2475 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
2477 2010-09-08 Doug Kwan <dougkwan@google.com>
2479 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
2480 (Arm_relobj::do_relocate_sections): Add new parameter for output
2481 file to match the parent.
2482 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
2483 of local symbols instead of input values. Update code to track
2484 changes in gold::relocate_section.
2485 * object.cc (Sized_relobj::compute_final_local_value): New methods.
2486 (Sized_relobj::compute_final_local_value_internal): New methods.
2487 (Sized_relobj::do_finalize_local_symbols): Move code from loop
2488 body into private version of Sized_relobj::compute_final_local_value.
2489 Call the inline method.
2490 * object.h (Symbol_value::Symbol_value): Define destructor. Free
2491 merged symbol value if there is one.
2492 (Symbol_value::has_output_value): New method defintiion.
2493 (Sized_relobj::Compute_final_local_value_status): New enum type.
2494 (Sized_relobj::compute_final_local_value): New methods.
2495 (Sized_relobj::compute_final_local_value_internal): New methods.
2496 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
2497 and arm_cortex_a8.sh.
2498 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
2499 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
2501 * Makefile.in: Regenerate.
2502 * testsuite/arm_bl_out_of_range.s: Update test.
2503 * testsuite/thumb_bl_out_of_range.s: Ditto.
2504 * testsuite/thumb_blx_out_of_range.s: Ditto.
2505 * testsuite/arm_branch_out_of_range.sh: New file.
2506 * testsuite/arm_cortex_a8.sh: Ditto.
2507 * testsuite/arm_cortex_a8_b.s: Ditto.
2508 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
2509 * testsuite/arm_cortex_a8_b_local.s: Ditto.
2510 * testsuite/arm_cortex_a8_bl.s: Ditto.
2511 * testsuite/arm_cortex_a8_blx.s: Ditto.
2512 * testsuite/arm_cortex_a8_local.s: Ditto.
2513 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
2514 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
2516 2010-09-08 Rafael Espindola <espindola@google.com>
2518 * Makefile.am (memory_test.stdout): Run readelf with -W.
2519 * Makefile.in: Regenerate.
2520 * testsuite/memory_test.sh: Make the regexps accept both 32 and
2523 2010-09-08 Rafael Espindola <espindola@google.com>
2525 * script-sections.cc (Script_sections::add_memory_region): Convert
2526 field precision to int.
2527 * script.cc (script_set_section_region, script_set_section_region):
2528 Convert field precision to int.
2530 2010-09-08 Rafael Espindola <espindola@google.com>
2532 * arm.cc (do_finalize_sections): Create the __exidx_start and
2533 __exdix_end symbols even when the section is missing.
2535 2010-09-08 Nick Clifton <nickc@redhat.com>
2537 * README: Remove claim that MEMORY is not supported.
2538 * expression.cc (script_exp_function_origin)
2539 (script_exp_function_length): Move from here to ...
2540 * script.cc: ... here.
2541 (script_set_section_region, script_add_memory)
2542 (script_parse_memory_attr, script_include_directive): New
2544 * script-sections.cc
2545 (class Memory_region): New class.
2546 (class Output_section_definition): Add set_memory_region,
2547 set_section_vma, set_section_lma and get_section_name methods.
2548 (class Script_Sections): Add add_memory_region,
2549 find_memory_region, find_memory_region_origin,
2550 find_memory_region_length and set_memory_region methods.
2551 Have set_section_addresses method walk the list of set memory
2553 Extend the print methos to display memory regions.
2554 * script-sections.h: Add prototypes for new methods.
2555 Add enum for MEMORY region attributes.
2556 * yyscript.y: Add support for parsing MEMORY regions.
2557 * script-c.h: Add prototypes for new functions.
2558 * testsuite/Makefile.am: Add test of MEMORY region functionality.
2559 * testsuite/Makefile.in: Regenerate.
2560 * testsuite/memory_test.sh: New script.
2561 * testsuite/memory_test.s: New assembler source file.
2562 * testsuite/memory_test.t: New linker script.
2564 2010-08-27 Doug Kwan <dougkwan@google.com>
2566 * gold/resolve.cc (Symbol_table::should_override): Let a weak
2567 reference override an existing dynamic weak reference.
2568 * testsuite/Makefile.am: Add new test dyn_weak_ref.
2569 * testsuite/Makefile.in: Regenerate.
2570 * testsuite/dyn_weak_ref.sh: New file.
2571 * testsuite/dyn_weak_ref_1.c: Ditto.
2572 * testsuite/dyn_weak_ref_2.c: Ditto.
2574 2010-08-27 Ian Lance Taylor <iant@google.com>
2576 * incremental.h (class Incremental_input_entry): Add virtual
2579 2010-08-27 Ian Lance Taylor <iant@google.com>
2581 * testsuite/start_lib_test_3.c: Mark t3 as used.
2583 2010-08-27 Nick Clifton <nickc@redhat.com>
2585 * options.cc (version_script): Fix small typo in previous
2588 2010-08-25 Nick Clifton <nickc@redhat.com>
2590 * archive.cc: Formatting fixes: Remove whitespace between
2591 typename and following asterisk. Remove whitespace between
2592 function name and opening parenthesis.
2593 * archive.h: Likewise.
2595 * attributes.cc: Likewise.
2596 * attributes.h: Likewise.
2597 * common.cc: Likewise.
2598 * copy-relocs.cc: Likewise.
2599 * dirsearch.h: Likewise.
2600 * dynobj.cc: Likewise.
2601 * ehframe.cc: Likewise.
2602 * ehframe.h: Likewise.
2603 * expression.cc: Likewise.
2604 * fileread.cc: Likewise.
2605 * fileread.h: Likewise.
2607 * gold-threads.cc: Likewise.
2608 * gold.cc: Likewise.
2609 * i386.cc: Likewise.
2611 * incremental-dump.cc: Likewise.
2612 * incremental.cc: Likewise.
2613 * layout.cc: Likewise.
2614 * layout.h: Likewise.
2615 * main.cc: Likewise.
2616 * merge.cc: Likewise.
2617 * merge.h: Likewise.
2618 * object.cc: Likewise.
2619 * object.h: Likewise.
2620 * options.cc: Likewise.
2621 * options.h: Likewise.
2622 * output.cc: Likewise.
2623 * output.h: Likewise.
2624 * plugin.cc: Likewise.
2625 * plugin.h: Likewise.
2626 * powerpc.cc: Likewise.
2627 * reloc.cc: Likewise.
2628 * script-c.h: Likewise.
2629 * script-sections.cc: Likewise.
2630 * script.cc: Likewise.
2631 * stringpool.cc: Likewise.
2632 * symtab.cc: Likewise.
2633 * symtab.h: Likewise.
2634 * target.cc: Likewise.
2635 * timer.cc: Likewise.
2636 * timer.h: Likewise.
2637 * version.cc: Likewise.
2638 * x86_64.cc: Likewise.
2640 2010-08-24 Nick Clifton <nickc@redhat.com>
2643 * layout.cc (segment_precedes): Sort segments by their physical
2644 addresses, if they have been set.
2646 2010-08-23 Cary Coutant <ccoutant@google.com>
2648 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
2650 (Lib_group::include_member): Unlock object after deleting its
2652 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
2655 2010-08-19 Neil Vachharajani <nvachhar@google.com>
2656 Cary Coutant <ccoutant@google.com>
2658 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
2659 constructor, and set_blocker.
2660 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
2662 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
2663 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
2664 * testsuite/Makefile.am (start_lib_test): New test case.
2665 * testsuite/Makefile.in: Regenerate.
2666 * testsuite/start_lib_test_main.c: New file.
2667 * testsuite/start_lib_test_1.c: New file.
2668 * testsuite/start_lib_test_2.c: New file.
2669 * testsuite/start_lib_test_3.c: New file.
2671 2010-08-19 Ian Lance Taylor <iant@google.com>
2673 * Makefile.in: Rebuild with automake 1.11.1.
2674 * aclocal.m4: Likewise.
2675 * testsuite/Makefile.in: Likewise.
2677 2010-08-19 Ian Lance Taylor <iant@google.com>
2680 * i386.cc (class Output_data_plt_i386): Update declarations.
2681 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
2682 local_ifuncs_ fields.
2683 (Target_i386::do_plt_section_for_global): New function.
2684 (Target_i386::do_plt_section_for_local): New function.
2685 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
2686 parameter; change all callers. Initialize global_ifuncs_ and
2687 local_ifuncs_. If doing a static link define __rel_iplt_start and
2689 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
2690 (Output_data_plt_i386::add_local_ifunc_entry): New function.
2691 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
2693 (Target_i386::make_plt_section): New function, broken out of
2694 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
2695 (Target_i386::make_plt_entry): Call make_plt_section.
2696 (Target_i386::make_local_ifunc_plt_entry): New function.
2697 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
2698 (Target_i386::Scan::local): Handle IFUNC symbols. Add
2699 R_386_IRELATIVE to switch.
2700 (Target_i386::Scan::global): Likewise.
2701 (Target_i386::Relocate::relocate): Likewise.
2702 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
2704 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
2705 (Target_x86_64::do_plt_section_for_global): New function.
2706 (Target_x86_64::do_plt_section_for_local): New function.
2707 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
2708 parameter; change all callers. If doing a static link define
2709 __rela_iplt_start and __rela_iplt_end.
2710 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
2711 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
2712 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
2714 (Target_x86_64::make_local_ifunc_plt_entry): New function.
2715 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
2717 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
2718 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
2719 R_X86_64_IRELATIVE to switch.
2720 (Target_x86_64::Scan::global): Likewise.
2721 (Target_x86_64::Relocate::relocate): Likewise.
2722 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
2724 * target.h (class Target): Add plt_section_for_global and
2725 plt_section_for_local functions. Add do_plt_section_for_global
2726 and do_plt_section_for_local virtual functions.
2727 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
2728 clarifying comments.
2729 (Symbol::use_plt_offset): Handle IFUNC symbol.
2730 * object.cc (Sized_relobj::Sized_relobj): Initialize
2732 (Sized_relobj::local_has_plt_offset): New function.
2733 (Sized_relobj::local_plt_offset): New function.
2734 (Sized_relobj::set_local_plt_offset): New function.
2735 (Sized_relobj::do_count): Handle IFUNC symbol.
2736 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
2737 a bit away from input_shndx_ field. Add set_is_func_symbol and
2738 is_ifunc_symbol functions.
2739 (class Sized_relobj): Update declarations. Remove Tls_got_entry
2740 and Local_tls_got_offsets. Define Local_plt_offsets. Add
2741 local_plt_offsets_ field.
2742 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
2743 * output.h (class Output_section_data): Add non-const
2744 output_section function.
2745 (class Output_data_got): Update declarations.
2746 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
2747 Add use_plt_offset parameter to global and local constructors.
2748 Change all callers. Change local_sym_index_ field to 31 bits.
2749 Change GSYM_CODE and CONSTANT_CODE accordingly.
2750 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
2751 doing a static link don't set sh_link field.
2752 (Output_data_got::Got_entry::write): Use PLT offset if
2754 (Output_data_got::add_global_plt): New function.
2755 (Output_data_got::add_local_plt): New function.
2756 * target-reloc.h (relocate_section): Handle IFUNC symbol.
2757 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
2758 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
2759 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
2760 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
2762 * testsuite/ifunc-sel.h: New file.
2763 * testsuite/ifuncmain1.c: New file.
2764 * testsuite/ifuncmain1vis.c: New file.
2765 * testsuite/ifuncmod1.c: New file.
2766 * testsuite/ifuncdep2.c: New file.
2767 * testsuite/ifuncmain2.c: New file.
2768 * testsuite/ifuncmain3.c: New file.
2769 * testsuite/ifuncmod3.c: New file.
2770 * testsuite/ifuncmain4.c: New file.
2771 * testsuite/ifuncmain5.c: New file.
2772 * testsuite/ifuncmod5.c: New file.
2773 * testsuite/ifuncmain6pie.c: New file.
2774 * testsuite/ifuncmod6.c: New file.
2775 * testsuite/ifuncmain7.c: New file.
2776 * configure, testsuite/Makefile.in: Rebuild.
2778 2010-08-18 Ian Lance Taylor <iant@google.com>
2781 (Output_section_incremental_inputs::write_input_files): Add cast
2782 to avoid signed/unsigned comparison warning.
2783 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2785 2010-08-12 Cary Coutant <ccoutant@google.com>
2787 * common.cc (Sort_commons::operator()): Remove unnecessary code.
2789 2010-08-13 Ian Lance Taylor <iant@google.com>
2791 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
2793 2010-08-12 Cary Coutant <ccoutant@google.com>
2794 Doug Kwan <dougkwan@google.com>
2796 * resolve.cc (Symbol_table::should_override): When a weak dynamic
2797 defintion overrides non-weak undef, remember that the original undef
2799 * symtab.cc (Symbol_table::sized_write_global): For undef without
2800 an original weak binding, set binding to global in output.
2801 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
2802 * testsuite/Makefile.in: Regenerate.
2803 * testsuite/strong_ref_weak_def.sh: New file.
2804 * testsuite/strong_ref_weak_def_1.c: Ditto.
2805 * testsuite/strong_ref_weak_def_2.c: Ditto.
2807 2010-08-12 Cary Coutant <ccoutant@google.com>
2809 * testsuite/incremental_test.sh: Rewrite.
2810 * testsuite/incremental_test_1.c: Rewrite.
2811 * testsuite/incremental_test_2.c: Rewrite.
2813 2010-08-12 Cary Coutant <ccoutant@google.com>
2815 * arm.cc (Target_arm::got_size): Add const.
2816 (Target_arm::got_entry_count): New function.
2817 (Target_arm::plt_entry_count): New function.
2818 (Target_arm::first_plt_entry_offset): New function.
2819 (Target_arm::plt_entry_size): New function.
2820 (Output_data_plt_arm::entry_count): New function.
2821 (Output_data_plt_arm::first_plt_entry_offset): New function.
2822 (Output_data_plt_arm::get_plt_entry_size): New function.
2823 * i386.cc (Target_i386::got_size): Add const.
2824 (Target_i386::got_entry_count): New function.
2825 (Target_i386::plt_entry_count): New function.
2826 (Target_i386::first_plt_entry_offset): New function.
2827 (Target_i386::plt_entry_size): New function.
2828 (Output_data_plt_i386::entry_count): New function.
2829 (Output_data_plt_i386::first_plt_entry_offset): New function.
2830 (Output_data_plt_i386::get_plt_entry_size): New function.
2831 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
2832 find_incremental_inputs_sections. Dump incremental_got_plt section.
2833 * incremental.cc: Include target.h.
2834 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
2835 parameter. Adjust all callers. Find incremental_got_plt section.
2836 (Incremental_inputs::create_data_sections): Create incremental_got_plt
2838 (Output_section_incremental_inputs::set_final_data_size): Calculate
2839 size of incremental_got_plt section.
2840 (Output_section_incremental_inputs::do_write): Write the
2841 incremental_got_plt section.
2842 (Got_plt_view_info): New struct.
2843 (Local_got_offset_visitor): New class.
2844 (Global_got_offset_visitor): New class.
2845 (Global_symbol_visitor_got_plt): New class.
2846 (Output_section_incremental_inputs::write_got_plt): New function.
2847 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
2848 Add parameter. Adjust all callers.
2849 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2850 (Incremental_inputs::got_plt_section): New function.
2851 (Incremental_inputs::got_plt_section_): New data member.
2852 (Incremental_got_plt_reader): New class.
2853 * layout.cc (Layout::create_incremental_info_sections): Add the
2854 incremental_got_plt section.
2855 * object.h (Got_offset_list::get_list): New function.
2856 (Got offset_list::for_all_got_offsets): New function.
2857 (Sized_relobj::local_got_offset_list): New function.
2858 * powerpc.cc (Target_powerpc::got_size): Add const.
2859 (Target_powerpc::got_entry_count): New function.
2860 (Target_powerpc::plt_entry_count): New function.
2861 (Target_powerpc::first_plt_entry_offset): New function.
2862 (Target_powerpc::plt_entry_size): New function.
2863 (Output_data_plt_powerpc::entry_count): New function.
2864 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
2865 (Output_data_plt_powerpc::get_plt_entry_size): New function.
2866 * sparc.cc (Target_sparc::got_size): Add const.
2867 (Target_sparc::got_entry_count): New function.
2868 (Target_sparc::plt_entry_count): New function.
2869 (Target_sparc::first_plt_entry_offset): New function.
2870 (Target_sparc::plt_entry_size): New function.
2871 (Output_data_plt_sparc::entry_count): New function.
2872 (Output_data_plt_sparc::first_plt_entry_offset): New function.
2873 (Output_data_plt_sparc::get_plt_entry_size): New function.
2874 * symtab.h (Symbol::got_offset_list): New function.
2875 (Symbol_table::for_all_symbols): New function.
2876 * target.h (Sized_target::got_entry_count): New function.
2877 (Sized_target::plt_entry_count): New function.
2878 (Sized_target::plt_entry_size): New function.
2879 * x86_64.cc (Target_x86_64::got_size): Add const.
2880 (Target_x86_64::got_entry_count): New function.
2881 (Target_x86_64::plt_entry_count): New function.
2882 (Target_x86_64::first_plt_entry_offset): New function.
2883 (Target_x86_64::plt_entry_size): New function.
2884 (Output_data_plt_x86_64::entry_count): New function.
2885 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
2886 (Output_data_plt_x86_64::get_plt_entry_size): New function.
2888 2010-08-12 Cary Coutant <ccoutant@google.com>
2890 * archive.cc: Include incremental.h.
2891 (Archive::Archive): Initialize incremental_info_.
2892 (Archive::include_member): Record archive members in incremental info.
2893 (Add_archive_symbols::run): Record begin and end of an archive in
2895 (Lib_group::include_member): Record objects in incremental info.
2896 * archive.h (Incremental_archive_entry): Forward declaration.
2897 (Archive::set_incremental_info): New member function.
2898 (Archive::incremental_info): New member function.
2899 (Archive::Unused_symbol_iterator): New class.
2900 (Archive::unused_symbols_begin): New member function.
2901 (Archive::unused_symbols_end): New member function.
2902 (Archive::incremental_info_): New data member.
2903 * incremental-dump.cc (find_input_containing_global): New function.
2904 (dump_incremental_inputs): Dump new incremental info sections.
2905 * incremental.cc: Include symtab.h.
2906 (Output_section_incremental_inputs): New class.
2907 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
2908 new incremental info sections.
2909 (Sized_incremental_binary::do_check_inputs): Likewise.
2910 (Incremental_inputs::report_archive): Remove.
2911 (Incremental_inputs::report_archive_begin): New function.
2912 (Incremental_inputs::report_archive_end): New function.
2913 (Incremental_inputs::report_object): New function.
2914 (Incremental_inputs::finalize_inputs): Remove.
2915 (Incremental_inputs::report_input_section): New function.
2916 (Incremental_inputs::report_script): Rewrite.
2917 (Incremental_inputs::finalize): Do nothing but finalize string table.
2918 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2919 (Incremental_inputs::sized_create_inputs_section_data): Remove.
2920 (Incremental_inputs::create_data_sections): New function.
2921 (Incremental_inputs::relocs_entsize): New function.
2922 (Output_section_incremental_inputs::set_final_data_size): New function.
2923 (Output_section_incremental_inputs::do_write): New function.
2924 (Output_section_incremental_inputs::write_header): New function.
2925 (Output_section_incremental_inputs::write_input_files): New function.
2926 (Output_section_incremental_inputs::write_info_blocks): New function.
2927 (Output_section_incremental_inputs::write_symtab): New function.
2928 * incremental.h (Incremental_script_entry): Forward declaration.
2929 (Incremental_object_entry): Forward declaration.
2930 (Incremental_archive_entry): Forward declaration.
2931 (Incremental_inputs): Forward declaration.
2932 (Incremental_inputs_header_data): Remove.
2933 (Incremental_inputs_header): Remove.
2934 (Incremental_inputs_header_write): Remove.
2935 (Incremental_inputs_entry_data): Remove.
2936 (Incremental_inputs_entry): Remove.
2937 (Incremental_inputs_entry_write): Remove.
2938 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
2939 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
2940 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2941 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
2943 (Incremental_input_entry): New class.
2944 (Incremental_script_entry): New class.
2945 (Incremental_object_entry): New class.
2946 (Incremental_archive_entry): New class.
2947 (Incremental_inputs::Incremental_inputs): Initialize new data members.
2948 (Incremental_inputs::report_inputs): Remove.
2949 (Incremental_inputs::report_archive): Remove.
2950 (Incremental_inputs::report_archive_begin): New function.
2951 (Incremental_inputs::report_archive_end): New function.
2952 (Incremental_inputs::report_object): Change prototype.
2953 (Incremental_inputs::report_input_section): New function.
2954 (Incremental_inputs::report_script): Change prototype.
2955 (Incremental_inputs::get_reloc_count): New function.
2956 (Incremental_inputs::set_reloc_count): New function.
2957 (Incremental_inputs::create_data_sections): New function.
2958 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2959 (Incremental_inputs::inputs_section): New function.
2960 (Incremental_inputs::symtab_section): New function.
2961 (Incremental_inputs::relocs_section): New function.
2962 (Incremental_inputs::get_stringpool): Add const.
2963 (Incremental_inputs::command_line): Add const.
2964 (Incremental_inputs::inputs): Remove.
2965 (Incremental_inputs::command_line_key): New function.
2966 (Incremental_inputs::input_file_count): New function.
2967 (Incremental_inputs::input_files): New function.
2968 (Incremental_inputs::relocs_entsize): New function.
2969 (Incremental_inputs::sized_create_inputs_section_data): Remove.
2970 (Incremental_inputs::finalize_inputs): Remove.
2971 (Incremental_inputs::Input_info): Remove.
2972 (Incremental_inputs::lock_): Remove.
2973 (Incremental_inputs::inputs_): Change type.
2974 (Incremental_inputs::inputs_map_): Remove.
2975 (Incremental_inputs::current_object_entry_): New data member.
2976 (Incremental_inputs::inputs_section_): New data member.
2977 (Incremental_inputs::symtab_section_): New data member.
2978 (Incremental_inputs::relocs_section_): New data member.
2979 (Incremental_inputs::reloc_count_): New data member.
2980 (Incremental_inputs_reader): New class.
2981 (Incremental_symtab_reader): New class.
2982 (Incremental_relocs_reader): New class.
2983 * layout.cc (Layout::finalize): Move finalization of incremental info
2984 and creation of incremental info sections to follow finalization of
2985 symbol table. Set offsets for postprocessing sections.
2986 (Layout::create_incremental_info_sections): Call
2987 Incremental_inputs::create_data_sections. Add incremental symtab
2988 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
2989 sections to layout after input sections.
2990 * layout.h (struct Timespec): Forward declaration.
2991 (Layout::incremental_inputs): Add const.
2992 (Layout::create_incremental_info_sections): Add parameter.
2993 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
2994 * object.cc: Include incremental.h.
2995 (Relobj::finalize_incremental_relocs): New function.
2996 (Sized_relobj::do_layout): Record input sections in incremental info.
2997 * object.h (Object::output_section): New function.
2998 (Object::output_section_offset): Moved from Relobj.
2999 (Object::get_incremental_reloc_base): New function.
3000 (Object::get_incremental_reloc_count): New function.
3001 (Object::do_output_section): New function.
3002 (Object::do_output_section_offset): Moved from Relobj.
3003 (Object::do_get_incremental_reloc_base): New function.
3004 (Object::do_get_incremental_reloc_count): New function.
3005 (Object::Object): Initialize new data members.
3006 (Relobj::output_section): Renamed do_output_section and moved to
3008 (Relobj::output_section_offset): Moved to Object.
3009 (Relobj::do_get_incremental_reloc_base): New function.
3010 (Relobj::do_get_incremental_reloc_count): New function.
3011 (Relobj::allocate_incremental_reloc_counts): New function.
3012 (Relobj::count_incremental_reloc): New function.
3013 (Relobj::finalize_incremental_relocs): New function.
3014 (Relobj::next_incremental_reloc_index): New function.
3015 (Relobj::reloc_counts_): New data member.
3016 (Relobj::reloc_bases_): New data member.
3017 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
3018 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
3019 (Sized_relobj::incremental_relocs_scan): New function.
3020 (Sized_relobj::incremental_relocs_scan_reltype): New function.
3021 (Sized_relobj::incremental_relocs_write): New function.
3022 (Sized_relobj::incremental_relocs_write_reltype): New function.
3023 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
3025 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
3026 archives and object files elsewhere.
3027 (Add_symbols::run): Report object files here.
3028 (Finish_group::run): Report end of archive at end of group.
3029 * reloc.cc: Include layout.h, incremental.h.
3030 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
3031 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
3032 (Sized_relobj::incremental_relocs_scan): New function.
3033 (Sized_relobj::incremental_relocs_scan_reltype): New function.
3034 (Sized_relobj::do_relocate_sections): Write incremental relocations.
3035 (Sized_relobj::incremental_relocs_write): New function.
3036 (Sized_relobj::incremental_relocs_write_reltype): New function.
3037 * script.cc (read_input_script): Rewrite test for incremental link.
3038 Change call to Incremental_inputs::report_script.
3039 * symtab.h (Symbol_table::first_global_index): New function.
3040 (Symbol_table::output_count): New function.
3042 2010-08-12 Doug Kwan <dougkwan@google.com>
3044 * arm.cc (Target_arm::merge_object_attributes): Check command line
3045 options --no-wchar-size-warning and --no-enum-size-warning.
3046 * options.h (General_options): Add ld-compatible options
3047 --no-enum-size-warning and --no-wchar-size-warning.
3049 2010-08-04 Ian Lance Taylor <iant@google.com>
3051 * x86_64.cc (Target_x86_64::Scan::local): Use
3052 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
3053 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
3054 (Target_x86_64::Scan::global): Likewise.
3055 (Target_x86_64::Relocate::relocate): Likewise.
3056 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
3059 2010-08-03 Cary Coutant <ccoutant@google.com>
3061 * merge.cc (Output_merge_string::do_add_input_section): Count strings
3062 to reserve space in merged_strings vector. Keep total input size
3064 (Output_merge_string::do_print_merge_stats): Print total input size.
3065 * merge.h (Output_merge_string): Add input_size_ field.
3066 * stringpool.cc (Stringpool_template::string_length): Move
3067 implementations out of Stringpool_template class and place in
3069 * stringpool.h (string_length): Move out of Stringpool_template.
3071 2010-08-03 Ian Lance Taylor <iant@google.com>
3074 * layout.cc (relaxation_loop_body): If address of load segment is
3075 set, adjust address to include headers if possible.
3077 2010-08-03 Ian Lance Taylor <iant@google.com>
3079 * version.cc (version_string): Bump to 1.10.
3081 2010-08-03 Ian Lance Taylor <iant@google.com>
3084 * layout.h (enum Output_section_order): Define.
3085 (class Layout): Update declarations.
3086 * layout.cc (Layout::get_output_section): Add order parameter.
3087 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
3088 is_first_non_relro parameters. Change all callers.
3089 (Layout::choose_output_section): Likewise.
3090 (Layout::add_output_section_data): Likewise.
3091 (Layout::make_output_section): Likewise. Set order.
3092 (Layout::default_section_order): New function.
3093 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
3094 * output.cc (Output_section::Output_section): Initialize order_.
3095 Don't initialize deleted fields.
3096 (Output_segment::Output_segment): Don't initialize deleted
3098 (Output_segment::add_output_section_to_load): New function
3099 replacing add_output_section. Change all callers to call this or
3100 add_output_section_to_nonload.
3101 (Output_segment::add_output_section_to_nonload): New function.
3102 (Output_segment::remove_output_section): Rewrite.
3103 (Output_segment::add_initial_output_data): Likewise.
3104 (Output_segment::has_any_data_sections): Likewise.
3105 (Output_segment::is_first_section_relro): Likewise.
3106 (Output_segment::maximum_alignment): Likewise.
3107 (Output_segment::has_dynamic_reloc): New function replacing
3108 dynamic_reloc_count. Change all callers.
3109 (Output_segment::has_dynamic_reloc_list): New function replacing
3110 dynamic_reloc_count_list. Change all callers.
3111 (Output_segment::set_section_addresses): Rewrite.
3112 (Output_segment::set_offset): Rewrite.
3113 (Output_segment::find_first_and_last_list): Remove.
3114 (Output_segment::set_tls_offsets): Rewrite.
3115 (Output_segment::first_section_load_address): Likewise.
3116 (Output_segment::output_section_count): Likewise.
3117 (Output_segment::section_with_lowest_load_address): Likewise.
3118 (Output_segment::write_section_headers): Likewise.
3119 (Output_segment::print_sections_to_map): Likewise.
3120 * output.h (class Output_data): Remove dynamic_reloc_count_
3121 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
3122 (Output_data::add_dynamic_reloc): Rewrite.
3123 (Output_data::has_dynamic_reloc): New function.
3124 (Output_data::dynamic_reloc_count): Remove.
3125 (class Output_section): Add order_ field. Remvoe is_relro_local_,
3126 is_last_relro_, is_first_non_relro_, is_interp_,
3127 is_dynamic_linker_section_ fields. Add order and set_order
3128 functions. Remove is_relro_local, set_is_relro_local,
3129 is_last_relro, set_is_last_relro, is_first_non_relro,
3130 set_is_first_non_relro functions, is_interp, set_is_interp,
3131 is_dynamic_linker_section, and set_is_dynamic_linker_section
3133 (class Output_segment): Change Output_data_list from std::list to
3134 std:;vector. Add output_lists_ field. Remove output_data_ and
3135 output_bss_ fields. Update declarations.
3137 2010-08-02 Ian Lance Taylor <iant@google.com>
3139 * arm.cc (Target_arm::gc_process_relocs): Use typename.
3140 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
3141 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
3143 2010-08-02 Ian Lance Taylor <iant@google.com>
3146 * script.cc (Script_options::Script_options): Initialize
3147 symbol_definitions_ and symbol_references_.
3148 (Script_options::add_symbol_assignment): Update
3149 symbol_definitions_ and symbol_references_.
3150 (Script_options::add_symbol_reference): New function.
3151 (script_symbol): New function.
3152 * script.h (class Script_options): Add symbol_definitions_ and
3153 symbol_references_ fields.
3154 (Script_options::referenced_const_iterator): New type.
3155 (Script_options::referenced_begin): New function.
3156 (Script_options::referenced_end): New function.
3157 (Script_options::is_referenced): New function.
3158 (Script_options::any_unreferenced): New function.
3159 * script-c.h (script_symbol): Declare.
3160 * yyscript.y (exp): Call script_symbol.
3161 * symtab.cc: Include "script.h".
3162 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
3163 Change all callers. Check symbols referenced by scripts.
3164 (Symbol_table::add_undefined_symbols_from_command_line): Add
3165 layout parameter. Change all callers.
3166 (Symbol_table::do_add_undefined_symbols_from_command_line):
3167 Likewise. Break out loop body. Check symbols referenced by
3169 (Symbol_table::add_undefined_symbol_from_command_line): New
3170 function broken out of
3171 do_add_undefined_symbols_from_command_line.
3172 * symtab.h (class Symbol_table): Update declarations.
3173 * archive.cc: Include "layout.h".
3174 (Archive::should_include_member): Add layout parameter. Change
3175 all callers. Check for symbol mentioned in expression.
3176 * archive.h (class Archive): Update declaration.
3177 * object.cc (Sized_relobj::do_should_include_member): Add layout
3179 * object.h (Object::should_include_member): Add layout parameter.
3181 (Object::do_should_include_member): Add layout parameter.
3182 (class Sized_relobj): Update declaration.
3183 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
3185 * dynobj.h (class Sized_dynobj): Update declaration.
3186 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
3188 * plugin.h (class Sized_pluginobj): Update declaration.
3190 2010-08-02 Ian Lance Taylor <iant@google.com>
3193 * output.cc (Output_segment::set_offset): Search for the first and
3194 last sections rather than assuming that the list is in order.
3195 (Output_segment::find_first_and_last_list): New function.
3196 * output.h (class Output_segment): Update declarations.
3197 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
3198 (relro_strip_test_SOURCES): New variable.
3199 (relro_strip_test_DEPENDENCIES): New variable.
3200 (relro_strip_test_LDFLAGS): New variable.
3201 (relro_strip_test_LDADD): New variable.
3202 (relro_strip_test.so): New target.
3204 2010-08-02 Ian Lance Taylor <iant@google.com>
3206 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
3207 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
3208 (Target_i386::got_tlsdesc_section): New function.
3209 (Target_i386::got_section): Create space for GOT entries for
3210 TLSDESC relocations.
3211 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
3213 (Target_i386::Scan::global): Likewise.
3214 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
3216 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
3217 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
3218 (Target_x86_64::got_tlsdesc_section): New function.
3219 (Target_x86_64::got_section): Create space for GOT entries for
3220 TLSDESC relocations.
3221 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
3223 (Target_x86_64::Scan::global): Likewise.
3224 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
3227 2010-08-02 Ian Lance Taylor <iant@google.com>
3229 * testsuite/final_layout.sh: Use dc to convert from hex to
3232 2010-07-29 Sriraman Tallam <tmsriram@google.com>
3234 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
3235 paramter to the call to gold::gc_process_relocs.
3236 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
3237 paramter to the call to gold::gc_process_relocs.
3238 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
3239 parameter to the call to gold::gc_process_relocs.
3240 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
3241 template parameter to the call to gold::gc_process_relocs.
3242 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
3243 paramter to the call to gold::gc_process_relocs.
3244 * gc.h (get_embedded_addend_size): New function.
3245 (gc_process_relocs): Save the size of the reloc for use by ICF.
3246 * icf.cc (get_section_contents): Get the addend from the text section
3247 for SHT_REL relocation sections.
3248 * icf.h (Icf::Reloc_addend_size_info): New typedef.
3249 (Icf::Reloc_info): Add new member reloc_addend_size_info.
3250 * int_encoding.h (read_from_pointer): New overloaded function.
3251 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
3252 * testsuite/icf_sht_rel_addend_test.sh: New file.
3253 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
3254 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
3256 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3258 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
3259 * Makefile.in: Regenerate.
3260 * testsuite/Makefile.in: Regenerate.
3262 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
3264 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
3265 * gold/testsuite/debug_msg.cc: Likewise.
3266 * gold/testsuite/odr_violation1.cc
3267 * gold/testsuite/odr_violation2.cc
3269 2010-07-21 Cary Coutant <ccoutant@google.com>
3271 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
3272 string, and length fields.
3273 (Output_merge_string::Merged_strings_list): New type.
3274 (Output_merge_string::Merged_strings_lists): New typedef.
3275 (Output_merge_string): Replace merged_strings_ with
3276 merged_strings_lists_.
3277 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
3278 Merged_strings_list per input object and section. Don't store pointer
3279 to the string. Don't store length with each merged string entry.
3280 (Output_merge_string::finalize_merged_data): Loop over list of merged
3281 strings lists. Recompute length of each merged string.
3283 2010-07-15 Cary Coutant <ccoutant@google.com>
3285 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
3288 2010-07-14 Ian Lance Taylor <iant@google.com>
3290 * descriptors.cc (Descriptors::open): Report correct name in error
3293 2010-07-13 Doug Kwan <dougkwan@google.com>
3295 * arm.cc (Arm_input_section::Arm_input_section): For a
3296 SHT_ARM_EXIDX section, always keeps the input sections.
3297 (Arm_input_section::set_exidx_section_link): New method.
3298 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
3299 has_errors_ to false.
3300 (Arm_exidx_input_section::has_errors,
3301 Arm_exidx_input_section::set_has_errors): New methods.
3302 (Arm_exidx_input_section::has_errors_): New data member.
3303 (Arm_relobj::get_exidx_shndx_list): New method.
3304 (Arm_output_section::append_text_sections_to_list): Do not skip
3305 section without SHF_EXECINSTR.
3306 (Arm_output_section::fix_exidx_coverage): Skip input sections with
3308 (Arm_relobj::make_exidx_input_section): Add new parameter for text
3309 section header. Make error messages more verbose. Check for
3310 a non-executable section linked to an EXIDX section.
3311 (Arm_relobj::do_read_symbols): Remove error checking, which has been
3312 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
3313 check that there is no deferred EXIDX section if we exit early.
3314 Instead of not making an EXIDX section in case of an error, make one
3315 and set the has_errors flag of it.
3316 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
3317 in a relocatable link.
3318 (Target_arm::do_relax): Look for the EXIDX output section instead of
3319 assuming that it is called .ARM.exidx.
3320 (Target_arm::fix_exidx_coverage): Add a new parameter for input
3321 section list. Do not check for SHF_EXECINSTR section flags but
3322 skip any input section with errors.
3323 * output.cc (Output_section::Output_section): Initialize
3324 always_keeps_input_sections_ to false.
3325 (Output_section::add_input_section): Check for
3326 always_keeps_input_sections_.
3327 * output.h (Output_section::always_keeps_input_sections,
3328 Output_section::set_always_keeps_input_sections): New methods.
3329 (Output_section::always_keeps_input_sections): New data member.
3331 2010-07-13 Rafael Espindola <espindola@google.com>
3333 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
3334 * fileread.h (Input_file): Add try_extra_search_path and find_file.
3336 2010-07-13 Philip Herron <herron.philip@googlemail.com>
3337 Ian Lance Taylor <iant@google.com>
3339 * output.h (Output_section_lookup_maps::add_merge_section):
3340 Correct check of whether value was inserted.
3341 (Output_section_lookup_maps::add_merge_input_section): Likewise.
3342 (Output_section_lookup_maps::add_relaxed_input_section):
3344 * arm.cc (Target_arm::got_section): Remove used local os.
3345 * i386.cc (Target_i386::got_section): Likewise.
3346 * x86_64.cc (Target_x86_64::got_section): Likewise.
3347 * sparc.cc (Target_sparc::got_section): Likewise.
3348 (Target_sparc::relocate): Remove unused local have_got_offset.
3349 * powerpc.cc (Target_powerpc::relocate): Likewise.
3351 2010-07-13 Ian Lance Taylor <iant@google.com>
3353 * compressed_output.cc (zlib_decompress): Fix signature in
3356 * archive.cc (Archive::include_member): Unlock an external member
3357 of a thin archive. Don't bother to delete an object we know is
3360 2010-07-12 Cary Coutant <ccoutant@google.com>
3362 * compressed_output.cc (zlib_decompress): New function.
3363 (get_uncompressed_size): New function.
3364 (decompress_input_section): New function.
3365 * compressed_output.h (get_uncompressed_size): New function.
3366 (decompress_input_section): New function.
3367 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
3368 Handle compressed debug sections.
3369 * layout.cc (is_compressed_debug_section): New function.
3370 (Layout::output_section_name): Map compressed section names to
3372 * layout.h (is_compressed_debug_section): New function.
3373 (is_debug_info_section): Recognize compressed debug sections.
3374 * merge.cc: Include compressed_output.h.
3375 (Output_merge_data::do_add_input_section): Handle compressed
3377 (Output_merge_string::do_add_input_section): Handle compressed
3379 * object.cc: Include compressed_output.h.
3380 (Sized_relobj::Sized_relobj): Initialize new data members.
3381 (build_compressed_section_map): New function.
3382 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
3383 * object.h (Object::section_is_compressed): New method.
3384 (Object::do_section_is_compressed): New method.
3385 (Sized_relobj::Compressed_section_map): New type.
3386 (Sized_relobj::do_section_is_compressed): New method.
3387 (Sized_relobj::compressed_sections_): New data member.
3388 * output.cc (Output_section::add_input_section): Handle compressed
3390 * reloc.cc: Include compressed_output.h.
3391 (Sized_relobj::write_sections): Handle compressed debug sections.
3393 2010-07-08 Cary Coutant <ccoutant@google.com>
3395 * resolve.cc (Symbol_table::resolve): Remember whether undef was
3396 weak when resolving to a dynamic def.
3397 (Symbol_table::should_override): Add adjust_dyndef flag; set it
3398 for weak undef/dynamic def cases. Adjust callers.
3399 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
3400 undef_binding_weak_.
3401 (Symbol_table::sized_write_globals): Adjust symbol binding.
3402 (Symbol_table::sized_write_symbol): Add binding parameter.
3403 * symtab.h (Symbol::set_undef_binding): New method.
3404 (Symbol::is_undef_binding_weak): New method.
3405 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
3406 (Symbol_table::should_override): Add new parameter.
3407 (Symbol_table::sized_write_symbol): Add new parameter.
3409 * testsuite/weak_undef_file1.cc: Add new test case.
3410 * testsuite/weak_undef_file2.cc: Fix header comment.
3411 * testsuite/weak_undef_test.cc: Add new test case.
3413 2010-06-29 Doug Kwan <dougkwan@google.com>
3415 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
3416 Initialize USE_SYMBOL_.
3417 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
3419 (Arm_reloc_property::uses_symbol_): New data member declaration.
3420 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
3421 uses symbol value and symbol is undefined but not weakly undefined.
3423 2010-06-28 Rafael Espindola <espindola@google.com>
3425 * plugin.cc (Plugin::load): Use dlerror.
3427 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
3429 * symtab.cc (detect_odr_violations): When reporting an ODR
3430 violation, report an object where the symbol is defined.
3432 2010-06-25 Doug Kwan <dougkwan@google.com>
3434 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
3435 (Target_arm::section_may_have_icf_unsafe_pointers): New method
3437 (Target_arm::Scan::local_reloc_may_be_function_pointer,
3438 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
3439 target hook to detect function points.
3440 (Target_arm::Scan::possible_function_pointer_reloc): New method.
3441 * icf.h (Icf::check_section_for_function_pointers): Change type of
3442 parameter SECTION_NAME to const reference to std::string. Use
3443 target hook to determine if section may have unsafe pointers.
3444 * target.h (Target::section_may_have_icf_unsafe_pointers): New
3447 2010-06-21 Rafael Espindola <espindola@google.com>
3449 * fileread.cc (Input_file::find_fie): New
3450 (Input_file::open): Use Input_file::find_fie.
3451 * fileread.h (Input_file::find_fie): New
3452 * plugin.cc (set_extra_library_path): New.
3453 (Plugin::load): Add set_extra_library_path to the transfer vector.
3454 (Plugin_manager::set_extra_library_path): New.
3455 (Plugin_manager::add_input_file): Use the extra search path if set.
3456 (set_extra_library_path(): New.
3457 * plugin.h (Plugin_manager): Add set_extra_library_path and
3460 2010-06-19 Cary Coutant <ccoutant@google.com>
3462 * layout.cc (gdb_sections): Add .debug_types.
3463 (lines_only_debug_sections): Likewise.
3465 2010-06-18 Rafael Espindola <espindola@google.com>
3467 * plugin.cc (add_input_file,add_input_library)
3468 (Plugin_manager::add_input_file): Make filename arguments const.
3469 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
3472 2010-06-16 Doug Kwan <dougkwan@google.com>
3474 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
3475 .ARM.attributes section if we have not merged any input
3476 attributes sections.
3478 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3480 * arm.cc: Allow combining objects with no EABI version
3483 2010-06-15 Rafael Espindola <espindola@google.com>
3485 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
3487 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3489 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
3490 (struct iovec): Correct !HAVE_READV definition.
3492 2010-06-10 Cary Coutant <ccoutant@google.com>
3494 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
3495 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
3497 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
3500 * symtab.h (Symbol::is_placeholder): New member function.
3501 * target-reloc.h (relocate_section): Check for placeholder symbols.
3503 * testsuite/Makefile.am (plugin_test_8): New test.
3504 (plugin_test_9): New test.
3505 * testsuite/Makefile.in: Regenerate.
3507 2010-06-09 Nick Clifton <nickc@redhat.com>
3509 * yyscript.y (input_list_element): Allow strings prefixed with
3510 the '-' character. Treat these as libraries.
3511 * script.cc (script_add_library): New function. Adds a library
3512 specified by "-l<name>" found in an input script.
3513 * script-c.h: Add prototype for script_add_library.
3515 2010-06-07 Doug Kwan <dougkwan@google.com>
3517 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
3518 Restrict stub-group size to be within long conditional branch
3519 range when working around cortex-A8 erratum.
3521 2010-06-07 Damien Diederen <dd@crosstwine.com>
3523 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
3526 2010-06-03 Sriraman Tallam <tmsriram@google.com>
3530 (Output_section::Input_section_sort_entry::compare_section_ordering):
3531 Change to return non-zero correctly.
3532 (Output_section::Input_section_sort_section_order_index_compare
3533 ::operator()): Change to fix ambiguity in comparisons.
3535 2010-06-01 Sriraman Tallam <tmsriram@google.com>
3537 * gold.h (is_wildcard_string): New function.
3538 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
3539 (Layout::layout_eh_frame): Ditto.
3540 (Layout::find_section_order_index): New method.
3541 (Layout::read_layout_from_file): New method.
3542 * layout.h (Layout::find_section_order_index): New method.
3543 (Layout::read_layout_from_file): New method.
3544 (Layout::input_section_position_): New private member.
3545 (Layout::input_section_glob_): New private member.
3546 * main.cc (main): Call read_layout_from_file here.
3547 * options.h (--section-ordering-file): New option.
3548 * output.cc (Output_section::input_section_order_specified_): New
3550 (Output_section::Output_section): Initialize new member.
3551 (Output_section::add_input_section): Add new parameter.
3552 Keep input sections when --section-ordering-file is used.
3553 (Output_section::set_final_data_size): Sort input sections when
3554 section ordering file is specified.
3555 (Output_section::Input_section_sort_entry): Add new parameter.
3557 (Output_section::Input_section_sort_entry::compare_section_ordering):
3559 (Output_section::Input_section_sort_compare::operator()): Change to
3560 consider section_order_index.
3561 (Output_section::Input_section_sort_init_fini_compare::operator()):
3562 Change to consider section_order_index.
3563 (Output_section::Input_section_sort_section_order_index_compare
3564 ::operator()): New method.
3565 (Output_section::sort_attached_input_sections): Change to sort
3566 according to section order when specified.
3567 (Output_section::add_input_section<32, true>): Add new parameter.
3568 (Output_section::add_input_section<64, true>): Add new parameter.
3569 (Output_section::add_input_section<32, false>): Add new parameter.
3570 (Output_section::add_input_section<64, false>): Add new parameter.
3571 * output.h (Output_section::add_input_section): Add new parameter.
3572 (Output_section::input_section_order_specified): New
3574 (Output_section::set_input_section_order_specified): New method.
3575 (Input_section::Input_section): Initialize section_order_index_.
3576 (Input_section::section_order_index): New method.
3577 (Input_section::set_section_order_index): New method.
3578 (Input_section::section_order_index_): New member.
3579 (Input_section::Input_section_sort_section_order_index_compare): New
3581 (Output_section::input_section_order_specified_): New member.
3582 * script-sections.cc (is_wildcard_string): Delete and move modified
3584 (Output_section_element_input::Output_section_element_input): Modify
3585 call to is_wildcard_string.
3586 (Output_section_element_input::Input_section_pattern
3587 ::Input_section_pattern): Ditto.
3588 (Output_section_element_input::Output_section_element_input): Ditto.
3589 * testsuite/Makefile.am (final_layout): New test case.
3590 * testsuite/Makefile.in: Regenerate.
3591 * testsuite/final_layout.cc: New file.
3592 * testsuite/final_layout.sh: New file.
3594 2010-06-01 Rafael Espindola <espindola@google.com>
3596 * plugin.cc (Plugin::load): Pass the output name to the plugin.
3598 2010-06-01 Rafael Espindola <espindola@google.com>
3600 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
3601 visibility of symbols.
3603 2010-05-27 Doug Kwan <dougkwan@google.com>
3605 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
3606 from start of output section instead of address for a local symbol
3607 in a merged or relaxed section when doing a relocatable link.
3609 2010-05-26 Rafael Espindola <espindola@google.com>
3612 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
3613 adding sections the garbage collector removed.
3614 * gold/testsuite/Makefile.am: Add test.
3615 * gold/testsuite/Makefile.in: Regenerate.
3616 * gold/testsuite/plugin_test_7.sh: New.
3617 * gold/testsuite/plugin_test_7_1.c: New.
3618 * gold/testsuite/plugin_test_7_2.c: New.
3620 2010-05-26 Rafael Espindola <espindola@google.com>
3622 * script-sections.cc (Output_section_definition::set_section_addresses):
3623 Check for --section-start.
3625 2010-05-26 Doug Kwan <dougkwan@google.com>
3627 * arm.cc (Arm_scan_relocatable_relocs): New class.
3628 (Target_arm::relocate_special_relocatable): New method.
3629 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
3630 (Arm_relocate_functions::thumb_branch_common): Same.
3631 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
3632 instead of Default_scan_relocatable_relocs.
3633 * target-reloc.h (relocate_for_relocatable): Let target handle
3634 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
3635 * target.h (Sized_target::relocate_special_relocatable): New method.
3637 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3639 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
3641 2010-05-23 Doug Kwan <dougkwan@google.com>
3643 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
3645 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
3646 with a direct branch, not a conditional branch, to a stub.
3647 * merge.cc (Output_merge_base::record_input_section): New method
3649 (Output_merge_data::do_add_input_section): Record input section if
3650 keeps-input-sections flag is set.
3651 (Output_merge_string::do_add_input_section): Ditto.
3652 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
3653 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
3655 (Output_merge_base::keeps_input_sections,
3656 Output_merge_base::set_keeps_input_sections,
3657 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
3659 (Output_merge_base::Input_sections): New type declaration.
3660 (Output_merge_base::input_sections_begin,
3661 Output_merge_base::input_sections_end,
3662 Output_merge_base::do_set_keeps_input_sections): New method definitions.
3663 (Output_merge_base::bool keeps_input_sections_,
3664 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
3665 Output_merge_base::input_sections_): New data members.
3666 (Output_merge_data::do_set_keeps_input_sections): New method
3668 (Output_merge_string::do_set_keeps_input_sections): Ditto.
3669 * output.cc (Output_section::Input_section::relobj): Move method
3670 defintion from class declaration to here and handle merge sections.
3671 (Output_section::Input_section::shndx): Ditto.
3672 (Output_section::Output_section): Remove initializations of removed
3673 data members and initialize new data member LOOKUP_MAPS_.
3674 (Output_section::add_input_section): Set keeps-input-sections flag
3675 for a newly created merge output section as appropriate. Adjust code
3676 to use Output_section_lookup_maps class.
3677 (Output_section::add_relaxed_input_section): Adjst code for lookup
3678 maps code refactoring.
3679 (Output_section::add_merge_input_section): Add a new parameter
3680 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
3681 class. If adding input section to a newly created merge output
3682 section fails, remove the new merge section.
3683 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
3684 Adjust code for use of the Output_section_lookup_maps class.
3685 (Output_section::find_merge_section): Ditto.
3686 (Output_section::build_lookup_maps): New method defintion.
3687 (Output_section::find_relaxed_input_section): Adjust code to use
3688 Output_section_lookup_maps class.
3689 (Output_section::get_input_sections): Export merge sections. Adjust
3690 code to use Output_section_lookup_maps class.
3691 (Output_section:::add_script_input_section): Adjust code to use
3692 Output_section_lookup_maps class. Update lookup maps for merge
3694 (Output_section::discard_states): Use Output_section_lookup_maps.
3695 (Output_section::restore_states): Same.
3696 * output.h (Merge_section_properties): Move class defintion out of
3698 (Output_section_lookup_maps): New class.
3699 (Output_section::Input_section::is_merge_section): New method
3701 (Output_section::Input_section::relobj): Move defintion out of class
3702 defintion. Declare method only.
3703 (Output_section::Input_section::shndx): Ditto.
3704 (Output_section::Input_section::output_merge_base): New method defintion.
3705 (Output_section::Input_section::u2_.pomb): New union field.
3706 (Output_section::Merge_section_by_properties_map,
3707 Output_section::Output_section_data_by_input_section_map,
3708 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
3710 (Output_section::add_merge_input_section): Add new parameter
3711 KEEPS_INPUT_SECTIONS.
3712 (Output_section::build_lookup_maps): New method declaration.
3713 (Output_section::merge_section_map_,
3714 Output_section::merge_section_by_properties_map_,
3715 Output_section::relaxed_input_section_map_,
3716 Output_section::is_relaxed_input_section_map_valid_): Remove data
3718 (Output_section::lookup_maps_): New data member.
3720 2010-05-21 Doug Kwan <dougkwan@google.com>
3723 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
3724 avoid a compilation error.
3726 2010-05-19 Rafael Espindola <espindola@google.com>
3728 * script-sections.cc (Output_section_definition::allocate_to_segment):
3729 Update the phdrs_list even when the output section is NULL.
3730 * testsuite/Makefile.am: Add test.
3731 * testsuite/Makefile.in: Regenerate.
3732 * testsuite/script_test_9.cc: New.
3733 * testsuite/script_test_9.sh: New.
3734 * testsuite/script_test_9.t: New.
3736 2010-05-19 Doug Kwan <dougkwan@google.com>
3738 * arm.cc (Arm_input_section::original_size): New method.
3739 (Arm_input_section::do_addralign): Add a cast.
3740 (Arm_input_section::do_output_offset): Remove static cast.
3741 (Arm_input_section::original_addralign,
3742 Arm_input_section::original_size_): Change type to uint32_t.
3743 (Arm_input_section::init): Add safe casts for section alignment
3745 (Arm_input_section::set_final_data_size): Do not set address and
3746 offset of stub table.
3747 (Arm_output_section::fix_exidx_coverage): Change use of of
3748 Output_section::Simple_input_section to that of
3749 Output_section::Input_section.
3750 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
3751 except for the first pass.
3752 * output.cc (Output_section::get_input_sections): Change type of
3753 input_sections to std::list<Input_section>.
3754 (Output_section::add_script_input_section): Rename from
3755 Output_section::add_simple_input_section. Change type of SIS
3756 parameter from Simple_input_section to Input_section.
3757 * output.h (Output_section::Simple_input_section): Remove class.
3758 (Output_section::Input_section): Change class visibility to public.
3759 (Output_section::Input_section::addralign): Use stored alignments
3760 for special input sections if set.
3761 (Output_section::Input_section::set_addralign): New method.
3762 (Output_section::get_input_sections): Change parameter type from
3763 list of Simple_input_section to list of Input_section.
3764 (Output_section::add_script_input_section): Rename from
3765 Output_section::add_simple_input_section. Change first parameter's
3766 type from Simple_input_section to Input_section and remove the
3767 second and third parameters.
3768 * script-sections.cc (Input_section::Input_section_list): Change
3769 type to list of Output_section::Input_section/
3770 (Input_section_info::Input_section_info): Change parameter type of
3771 INPUT_SECTION to Output_section::Input_section.
3772 (Input_section_info::input_section): Change return type.
3773 (Input_section_info::input_section_): Change type to
3774 Output_section::Input_section.
3775 (Output_section_element_input::set_section_addresses): Adjust code
3776 to use Output_section::Input_section instead of
3777 Output_section::Simple_input_section. Adjust code for renaming
3778 of Output_section::add_simple_input_section.
3779 (Orphan_output_section::set_section_addresses): Ditto.
3781 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3783 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
3784 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
3786 2010-05-18 Rafael Espindola <espindola@google.com>
3788 * options.cc (General_options::finalize): Handle -nostdlib.
3789 * options.h (nostdlib): New option.
3790 * script.cc (script_add_search_dir): Handle -nostdlib.
3792 2010-05-12 Doug Kwan <dougkwan@google.com>
3794 * arm.cc (Target_arm::do_finalize_sections): Create an empty
3795 attributes section only if there no attributes section after merging.
3796 (Target_arm::merge_object_attributes): Move value of
3797 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
3798 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
3799 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
3800 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
3801 and arm_attr_merge_7.stdout.
3802 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
3803 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
3804 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
3805 arm_attr_merge_7b.o): New rules.
3806 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
3808 * testsuite/Makefile.in: Regenerate.
3809 * testsuite/arm_attr_merge.sh: New file.
3810 * testsuite/arm_attr_merge_[67][ab].s: Same.
3812 2010-05-05 Nick Clifton <nickc@redhat.com>
3814 * po/es.po: Updated Spanish translation.
3816 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
3818 * Makefile.am (install-exec-local): Properly install gold as
3819 default cross linker.
3820 * Makefile.in: Regenerated.
3822 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
3823 Nick Clifton <nickc@redhat.com>
3825 * configure.ac (install_as_default): Define and set to false
3826 unless --enable-gold or --enable-gold=both/gold has been
3828 * configure: Regenerate.
3830 * Makefile.am (install-exec-local): Install the executable as
3831 'ld.gold'. If install_as_default is true then also install it as
3833 * Makefile.in: Regenerated.
3835 2010-04-24 Ian Lance Taylor <iant@google.com>
3837 * layout.cc (Layout::layout_reloc): In relocatable link don't
3838 combine reloc sections for grouped sections.
3840 2010-04-23 Sriraman Tallam <tmsriram@google.com>
3842 * gc.h (gc_process_relocs): Pass information on relocs pointing to
3843 sections that are not ordinary to icf.
3844 * icf.cc (get_section_contents): Handle relocation pointing to section
3845 with no object or shndx information.
3846 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
3847 * testsuite/Makefile.in: Regenerate.
3848 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
3849 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
3851 2010-04-22 Ian Lance Taylor <iant@google.com>
3853 * expression.cc (Expression::Expression_eval_info): Add
3854 result_alignment_pointer field.
3855 (Expression::eval_with_dot): Add result_alignment_pointer
3856 parameter. Change all callers.
3857 (Expression::eval_maybe_dot): Likewise.
3858 (class Binary_expression): Add alignment_pointer parameter to
3859 left_value and right_value. Change all callers.
3860 (BINARY_EXPRESSION): Set result alignment.
3861 (class Trinary_expression): Add alignment_pointer parameter to
3862 arg2_value and arg3_value. Change all callers.
3863 (Trinary_cond::value): Set result alignment.
3864 (Max_expression::value, Min_expression::value): Likewise.
3865 (Align_expression::value): Likewise.
3866 * script-sections.cc (class Sections_element): Add dot_alignment
3867 parameter to set_section_addresses virtual function. Update
3869 (class Output_section_element): Likewise.
3870 (Script_sections::create_segments): Add dot_alignment parameter.
3872 (Script_sections::create_segments_from_phdrs_clause): Likewise.
3873 (Script_sections::set_phdrs_clause_addresses): Likewise.
3874 * script-sections.h: Update declarations.
3875 * script.h: Update declarations.
3876 * output.h (Output_segment::set_minimum_p_align): Don't decrease
3878 * testsuite/script_test_3.t: Set large alignment.
3879 * testsuite/script_test_3.sh: Make sure that at least one LOAD
3880 segment has expected alignment.
3882 2010-04-22 Nick Clifton <nickc@redhat.com>
3884 * po/gold.pot: Updated by the Translation project.
3885 * po/vi.po: Updated Vietnamese translation.
3887 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
3889 * testsuite/Makefile.am (check_PROGRAMS): Add
3890 icf_virtual_function_folding_test.
3891 * testsuite/Makefile.in: Regenerated.
3893 2010-04-15 Andrew Haley <aph@redhat.com>
3895 * options.h (merge_exidx_entries): New option.
3896 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
3897 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
3898 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
3899 (Target_arm::merge_exidx_entries): New function.
3900 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
3901 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
3902 to Arm_exidx_fixup constructor.
3903 Add new arg, merge_exidx_entries.
3904 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
3905 Arm_output_section::fix_exidx_coverage.
3907 2010-04-18 Sriraman Tallam <tmsriram@google.com>
3909 * icf.cc (get_section_contents): Check for preemptible functions.
3910 Ignore addend when appropriate.
3911 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
3913 (add_from_relobj): Check for section folded.
3914 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
3915 * symtab.h (should_add_dynsym_entry): Add new parameter.
3916 * target-reloc.h (scan_relocs): Check for section folded.
3917 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
3918 Check reloc types for function pointers in shared objects.
3919 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
3921 (icf_preemptible_functions_test): New test case.
3922 (icf_string_merge_test): New test case.
3923 * testsuite.Makefile.in: Regenerate.
3924 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
3925 bar_glob. Refactor code.
3926 * testsuite/icf_preemptible_functions_test.cc: New file.
3927 * testsuite/icf_preemptible_functions_test.sh: New file.
3928 * testsuite/icf_string_merge_test.cc: New file.
3929 * testsuite/icf_string_merge_test.sh: New file.
3930 * testsuite/icf_virtual_function_folding_test.cc: New file.
3931 * testsuite/icf_virtual_function_folding_test.sh: New file.
3933 2010-04-14 Doug Kwan <dougkwan@google.com>
3935 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
3936 for local symbol recounting if we remove a section due to ICF.
3937 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
3938 there are no regular objects in input.
3940 2010-04-13 Doug Kwan <dougkwan@google.com>
3942 * arm.cc (Arm_input_section::set_final_data_size): Compute
3943 accurate final data size instead of using current data size.
3945 2010-04-09 Doug Kwan <dougkwan@google.com>
3947 * layout.cc (Layout::choose_output_section): Handle script section
3949 (Layout::make_output_section_for_script): Add section type parameter.
3950 Handle script section types.
3951 * layout.h (Layout::make_output_section_for_script): Add section
3953 * output.cc (Output_section::Output_section): Initialize data member
3955 (Output_section::do_reset_address_and_file_offset): Do not set address
3956 to 0 if section is a NOLOAD section.
3957 * output.h (Output_section::is_noload): New method.
3958 (Output_section::set_is_noload): Ditto.
3959 (Output_section::is_noload_): New data member.
3960 * script-c.h (Script_section_type): New enum type.
3961 (struct Parser_output_section_header): Add new file section_type.
3962 * script-sections.cc (Sections_element::output_section_name): Add
3963 parameter for returning script section type.
3964 (Output_section_definition::output_section_name): Ditto.
3965 (Output_section_definition::section_type)P; New method.
3966 (Output_section_definiton::script_section_type_name): Ditto.
3967 (Output_section_definition::script_section_type_): New data member.
3968 (Output_section_definition::Output_section_definition): Initialize
3969 data member Output_section_definition::script_section_type_.
3970 (Output_section_definition::create_sections): Pass script section type
3971 to Layout::make_output_section_for_script.
3972 (Output_section_definition::output_section_name): Return script
3973 section type to caller.
3974 (Output_section_definition::set_section_address): Do not advance
3975 dot value and load address if section type is NOLOAD. Set address
3976 of NOLOAD sections regardless of section flags.
3977 (Output_section_definition::print): Print section type if it is
3978 not SCRIPT_SECTION_TYPE_NONE.
3979 (Output_section_definition::section_type): New method.
3980 (Output_section_definition::script_section_type_name): Ditto.
3981 (Script_sections::output_section_name): Add new parameter
3982 PSECTION_TYPE for returning script section type. Pass it to
3983 section elements. Handle discard sections.
3984 (Sort_output_sections::operator()): Handle NOLOAD sections.
3985 * script-sections.h (Script_sections::Section_type): New enum type.
3986 (Script_sections::output_section_name): Add a new parameter for
3987 returning script section type.
3988 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
3990 * yyscript.y (union): Add new field SECTION_TYPE.
3991 (COPY, DSECT, INFO, NOLOAD): New tokens.
3992 (opt_address_and_section_type): Change type to output_section_header.
3993 (section_type): New non-terminal
3994 (section_header): Handle section type.
3995 (opt_address_and_section_type): Return section type value.
3997 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
3999 * testsuite/plugin_common_test_1.c (foo): Add prototype.
4000 * testsuite/plugin_common_test_2.c (foo): Likewise.
4002 2010-04-08 Doug Kwan <dougkwan@google.com>
4004 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
4006 * output.cc (Output_section::add_merge_input_section): Simplify
4007 code and return status of Output_merge_base::add_input_section.
4008 Update merge section map only if Output_merge_base::add_input_section
4011 2010-04-07 Doug Kwan <dougkwan@google.com>
4013 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
4014 if section is marked as containing instructions but has no mapping
4016 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
4017 correct section index.
4018 (Arm_relobj::find_linked_text_section): Ditto.
4020 2010-04-07 Cary Coutant <ccoutant@google.com>
4022 * archive.cc (include_member): Destroy Read_symbols_data object before
4024 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
4025 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
4026 (Read_symbols_data::~Read_symbols_data) New destructor.
4027 (Section_relocs::Section_relocs) New constructor.
4028 (Section_relocs::~Section_relocs) New destructor.
4029 (Read_relocs_data::Read_relocs_data) New constructor.
4030 (Read_relocs_data::~Read_relocs_data) New destructor.
4031 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
4032 pointers to NULL after deleting.
4034 2010-04-07 Doug Kwan <dougkwan@google.com>
4036 * arm.cc: Replace "endianity" with "endianness" in comments.
4037 (Arm_exidx_cantunwind): Ditto.
4038 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
4039 (Arm_relobj::merge_flags_and_attributes): New method.
4040 (Arm_relobj::merge_flags_and_attributes_): New data member.
4041 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
4042 (Arm_relobj::scan_sections_for_stubs): Ditto.
4043 (Arm_relobj::do_read_symbols): Check to see if we really want to
4044 merge processor-specific flags and attributes. Exit early if
4045 an object is empty except for section names and the undefined symbol.
4046 (Target_arm::do_finalize_sections): Move check for ELF format to
4047 Arm_relobj::do_read_symbols. Merge processor specific flags and
4048 attributes from a regular object only when we have determined that
4049 it is aapropriate. Do not create an .ARM.attributes section in
4050 output if there is no regular input object.
4051 (Target_arm::merge_processor_specific_flags): Check
4052 --warn-mismatch before printing any error.
4053 (Target_arm::merge_object_attributes): Ditto.
4054 * gold.cc (queue_middle_tasks): Handle the case in which there is
4055 no regular object in input.
4056 * options.cc (General_options::parse_EB): New method.
4057 (General_options::parse_EL): Same.
4058 (General_options::General_options): Initialize endianness_.
4059 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
4061 (General_options::Endianness): New enum.
4062 (General_options::endianness): New method.
4063 (General_options::endianness_): New data member.
4064 * parameters.cc (Parameters::set_options): Check target endianness.
4065 (Parameters::set_target_once): Ditto.
4066 (Parameters::check_target_endianness): New method.
4067 (parameters_force_valid_target): If either -EL or -EB is specified,
4068 use it to define endianness of default target.
4069 * parameters.h (Parameters::check_target_endianness): New method
4071 * target.h (class Target): Change "endianity" to "endianness"
4074 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4076 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
4077 * configure: Regenerate.
4078 * Makefile.in: Regenerate.
4079 * testsuite/Makefile.in: Regenerate.
4081 2010-04-06 Cary Coutant <ccoutant@google.com>
4084 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
4085 prevailing definitions of common symbols.
4086 * testsuite/plugin_test_6.sh: New test case.
4087 * testsuite/plugin_common_test_1.c: New test case.
4088 * testsuite/plugin_common_test_2.c: New test case.
4089 * testsuite/Makefile.am (plugin_test_6): New test case.
4090 * testsuite/Makefile.in: Regenerate.
4092 2010-04-06 Nick Clifton <nickc@redhat.com>
4094 * po/vi.po: New Vietnamese translation.
4096 2010-03-30 Doug Kwan <dougkwan@google.com>
4098 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
4100 2010-03-25 Doug Kwan <dougkwan@google.com>
4102 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
4103 to avoid a conversion warning on a 32-bit host.
4105 2010-03-24 Ian Lance Taylor <iant@google.com>
4107 * testsuite/script_test_3.t: Add a TLS segment.
4108 * testsuite/Makefile.am (check_PROGRAMS): Add
4109 tls_phdrs_script_test.
4110 (tls_phdrs_script_test_SOURCES): Define.
4111 (tls_phdrs_script_test_DEPENDENCIES): Define.
4112 (tls_phdrs_script_test_LDFLAGS): Define.
4113 (tls_phdrs_script_test_LDADD): Define.
4114 * testsuite/Makefile.in: Rebuild.
4116 2010-03-23 Cary Coutant <ccoutant@google.com>
4118 * fileread.cc (find_or_make_view): Fix comment.
4120 2010-03-23 Ian Lance Taylor <iant@google.com>
4122 * script-sections.cc (class Orphan_section_placement): Define
4123 PLACE_TLS and PLACE_TLS_BSS.
4124 (Orphan_section_placement::Orphan_section_placement): Initialize
4126 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
4127 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
4128 (tls_script_test_SOURCES): Define.
4129 (tls_script_test_DEPENDENCIES): Define.
4130 (tls_script_test_LDFLAGS): Define.
4131 (tls_script_test_LDADD): Define.
4132 * testsuite/Makefile.in: Rebuild.
4134 2010-03-22 Doug Kwan <dougkwan@google.com>
4136 * arm.cc (Arm_relocate_functions::abs8,
4137 Arm_relocate_functions::abs16): Use correct check for overflow
4138 specified in the ARM ELF specs.
4139 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
4140 target of a BLX instruction specially.
4141 (Reloc_stub::stub_type_for_reloc): Ditto.
4142 (Relocate::relocate): Use symbolic names instead of numeric relocation
4143 codes to report error.
4144 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
4146 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
4147 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
4148 thumb2_blx_out_of_range.stdout
4149 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
4150 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
4151 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
4152 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
4153 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
4154 thumb2_blx_in_range, thumb2_blx_in_range.o,
4155 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
4156 thumb2_blx_out_of_range.o): New rules.
4157 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
4158 thumb2_blx_in_range and thumb2_blx_out_of_range.
4159 * testsuite/Makefile.in: Regenerate.
4160 * arm_branch_in_range.sh: Add tests for THUMB BLX.
4161 * testsuite/thumb_blx_in_range.s: New file.
4162 * testsuite/thumb_blx_out_of_range.s: New file.
4164 2010-03-22 Rafael Espindola <espindola@google.com>
4166 * archive.cc (Should_include): Move to archive.h.
4167 (should_include_member): Make it a member of Archive.
4169 (Add_lib_group_symbols): New.
4170 * archive.h: Include options.h.
4171 (Archive_member): Moved from Archive.
4172 (Should_include): Moved from archive.cc.
4174 (Add_lib_group_symbols): New.
4175 * dynobj.cc (do_should_include_member): New.
4176 * dynobj.h (do_should_include_member): New.
4177 * gold.cc (queue_initial_tasks): Update call to queue.
4178 * main.cc (main): Print lib group stats.
4179 * object.cc (do_should_include_member): New.
4180 * object.h: Include archive.h.
4181 (Object::should_include_member): New.
4182 (Object::do_should_include_member): New.
4183 (Sized_relobj::do_should_include_member): New.
4184 * options.cc (General_options::parse_start_lib): New.
4185 (General_options::parse_end_lib): New.
4186 (Input_arguments::add_file): Handle lib groups.
4187 (Input_arguments::start_group): Check we are not in a lib.
4188 (Input_arguments::start_lib): New.
4189 (Input_arguments::end_lib): New.
4190 * options.h (General_options): Add start_lib and end_lib.
4191 (Input_argument::lib_): New.
4192 (Input_argument::lib): New.
4193 (Input_argument::is_lib): New.
4194 (Input_file_lib): New.
4195 (Input_arguments::in_lib_): New.
4196 (Input_arguments::in_lib): New.
4197 (Input_arguments::start_lib): New.
4198 (Input_arguments::end_lib_): New.
4199 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
4200 in unused members as preempted.
4201 (Sized_pluginobj::do_should_include_member): New.
4202 * plugin.h (Sized_pluginobj::do_should_include_member): New.
4203 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
4205 (Read_symbols::do_whole_lib_group): New.
4206 (Read_symbols::do_lib_group): New.
4207 (Read_symbols::do_read_symbols): Handle lib groups.
4208 (Read_symbols::get_name): Handle lib groups.
4209 * readsyms.h (Read_symbols): Add an archive member pointer.
4210 (Read_symbols::do_whole_lib_group): New.
4211 (Read_symbols::do_lib_group): New.
4212 (Read_symbols::member_): New.
4213 * script.cc (read_input_script): Update call to queue_soon.
4215 2010-03-19 Doug Kwan <dougkwan@google.com>
4217 * arm.cc (Stub_table::Stub_table): Initialize new data members
4218 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
4219 (Stub_table::add_reloc_stub): Assign stub offset and update
4220 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
4221 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
4223 (Stub_table::update_data_size_and_addralign): Use
4224 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
4225 instead of going over all reloc stubs.
4226 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
4227 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
4228 Stringpool_template::offset_ to size of Stringpool_char.
4229 (Stringpool_template::new_key_offset): Remove code to initialize
4230 Stringpool_template::offset_.
4231 * stringpool.h (Stringpool_template::set_no_zero_null): Set
4232 Stringpool_template::offset_ to zero.
4234 2010-03-15 Doug Kwan <dougkwan@google.com>
4236 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
4238 (Stringpool_template::new_key_offset): New method.
4239 (Stringpool_template::add_string): Assign offsets when adding new
4241 (Stringpool_template::set_string_offsets): Do not set string offsets
4242 when not optimizing.
4243 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
4245 (Chunked_vector::clear): Clear size_.
4246 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
4247 (Chunked_vector::size): Return size_.
4248 (Chunked_vector::push_back): Use size_ to find insert position.
4249 (Chunked_vector::size_): New data member.
4250 (Stringpool_template::set_no_zero_null): Assert string set is empty.
4251 (Stringpool_template::new_key_offset): New method declaration.
4252 (Stringpool_template::offset_): New data member.
4254 2010-03-15 Rafael Espindola <espindola@google.com>
4256 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
4257 Add_symbols' constructor.
4258 * readsyms.h (Add_symbols): Remove the input_group member.
4260 2010-03-10 Ian Lance Taylor <iant@google.com>
4262 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
4263 target to ask whether a reference to a symbol requires a stack
4265 * target.h (Target::is_call_to_non_split): New function.
4266 (Target::do_is_call_to_non_split): Declare virtual function.
4267 * target.cc: Include "symtab.h".
4268 (Target::do_is_call_to_non_split): New function.
4269 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
4271 2010-03-10 Cary Coutant <ccoutant@google.com>
4273 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
4274 (File_read::open[1]): Remove initial mapping of whole_file_view_.
4275 (File_read::open[2]): Add whole_file_view_ to list of views.
4276 (File_read::make_view): Remove test of whole_file_view_.
4277 (File_read::find_or_make_view): Create whole_file_view_ if
4279 (File_read::clear_views): Replace bool parameter with enum;
4280 adjust all callers. Don't delete views with permanent data;
4281 do delete cached views and views from archives if
4282 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
4283 if clearing the corresponding view.
4284 * fileread.h (File_read::Clear_views_mode): New enum.
4285 (File_read::View::is_permanent_view): New method.
4286 (File_read::clear_views): Replace bool parameter
4287 with enum; adjust all callers.
4288 * options.h (General_options): Change keep_files_mapped option;
4289 add map_whole_files.
4290 * readsyms.cc (Add_symbols::run): Delete sd_ object before
4292 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
4295 2010-03-10 David S. Miller <davem@davemloft.net>
4297 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
4299 2010-03-09 Sriraman Tallam <tmsriram@google.com>
4301 * icf.cc (get_section_contents): Add '@' marker after processing the
4304 2010-03-08 Doug Kwan <dougkwan@google.com>
4306 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
4307 due to a conversion warning.
4308 (Arm_relobj::update_output_local_symbol_count): Check for local
4309 symbol with unset output index.
4311 2010-03-05 Ian Lance Taylor <iant@google.com>
4313 * options.h (class General_options): Add --spare-dynamic-tags.
4314 * output.cc (Output_data_dynamic::set_final_data_size): Implement
4315 --spare-dynamic-tags.
4317 2010-03-05 Ian Lance Taylor <iant@google.com>
4319 * incremental.cc: Include "libiberty.h".
4321 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
4323 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
4324 function, is_info_ member.
4325 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
4326 (Versions::Versions): Update caller.
4327 (Versions::define_base_version): Likewise.
4328 (Versions::add_def): Likewise.
4330 2010-03-03 Sriraman Tallam <tmsriram@google.com>
4332 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
4333 (Scan::possible_function_pointer_reloc): New function.
4334 (Scan::local_reloc_may_be_function_pointer): Change to call
4335 possible_function_pointer_reloc.
4336 (Scan::global_reloc_may_be_function_pointer): Ditto.
4337 * icf.h (Icf::check_section_for_function_pointers): Change to reject
4338 relocations in ".data.rel.ro._ZTV" section.
4339 * testsuite/icf_safe_so_test.sh: Change to pass i386.
4340 * testsuite/icf_safe_so_test.cc: Ditto.
4341 * testsuite/icf_safe_test.cc: Ditto.
4342 * testsuite/icf_safe_test.sh: Ditto.
4344 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4345 Ian Lance Taylor <iant@google.com>
4347 * target-reloc.h (relocate_section): Check the symbol table index
4348 for -1U before setting the local symbol index.
4349 (scan_relocatable_relocs): If copying the relocation, record that
4350 the local symbol is required.
4351 * object.h (Symbol_value::is_output_symtab_index_set): New
4353 (Symbol_value::may_be_discarded_from_output_symtab): New
4355 (Symbol_value::has_output_symtab_entry): New function.
4356 (Symbol_value::needs_output_symtab_entry): Remove.
4357 (Symbol_value::output_symtab_index): Make sure the symbol index is
4359 (Symbol_value::set_output_symtab_index): Make sure the symbol
4360 index is not set. Make sure the new index is valid.
4361 (Symbol_value::set_must_have_output_symtab_entry): New function.
4362 (Symbol_value::has_output_dynsym_entry): New function.
4363 (Symbol_value::set_output_dynsym_index): Make sure the new index
4365 (Sized_relobj::set_must_have_output_symtab_entry): New function.
4366 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
4367 local symbol if permitted.
4368 (Sized_relobj::do_finalize_local_symbols): Call
4369 is_output_symtab_index_set rather than needs_output_symtab_entry.
4370 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
4371 rather than needs_output_symtab_entry. Call
4372 has_output_dynsym_entry rather than needs_output_dynsym_entry.
4373 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
4374 is_output_symtab_index_set rather than needs_output_symtab_entry.
4375 * testsuite/discard_locals_relocatable_test.c: New file.
4376 * testsuite/discard_locals_test.sh: Test -r.
4377 * testsuite/Makefile.am (check_DATA): Add
4378 discard_locals_relocatable_test1.syms,
4379 discard_local_relocatable_test2.syms.
4380 (MOSTLYCLEANFILES): Likewise. Also add
4381 discard_locals_relocatable_test1.lout and
4382 discard_locals_relocatable_test2.out.
4383 (discard_locals_relocatable_test1.syms): New target.
4384 (discard_locals_relocatable_test.o): New target.
4385 (discard_locals_relocatable_test1.out): New target.
4386 (discard_locals_relocatable_test2.syms): New target.
4387 (discard_locals_relocatable_test2.out): New target.
4388 (various): Add missing ../ld-new dependencies.
4389 * testsuite/Makefile.in: Rebuild.
4391 2010-03-03 Nick Clifton <nickc@redhat.com>
4393 * po/fi.po: New Finnish translation.
4395 2010-03-01 Doug Kwan <dougkwan@google.com>
4397 * layout.cc (Layout::Layout): Force section types of .init_array*,
4398 .preinit_array* and .fini_array* sections.
4399 * output.cc (Output_section::Input_section_sort_entry::has_priority):
4400 Fix check of return value of std::string::find.().
4401 (Output_section::Input_section_sort_compare::operator()): Remove
4402 comment about .init_array.
4403 (Output_section::Input_section_sort_init_fini_compare::operator()):
4405 (Output_section::sort_attached_input_sections): Handle .init_array
4406 and .fini_array specially.
4407 * output.h (Output_section::Inut_section_sort_compare): Update
4409 (Output_section::Input_section_sort_init_fini_compare): New struct.
4411 2010-02-26 Doug Kwan <dougkwan@google.com>
4413 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
4414 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
4415 * testsuite/debug_msg.sh: Avoid matching source line number for
4416 use of global variable undef_int.
4418 2010-02-26 Doug Kwan <dougkwan@google.com>
4420 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
4421 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
4422 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
4423 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
4424 * options.cc (General_options::General_options): Initialize member
4426 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
4427 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
4428 and rm_no_fix_v4bx.stdout
4429 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
4430 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
4431 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
4432 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
4433 and arm_no_fix_v4bx.
4434 * Makefile.in: Regenerate.
4435 * testsuite/arm_fix_v4bx.s: New file.
4436 * testsuite/arm_fix_v4bx.sh: Ditto.
4438 2010-02-24 Doug Kwan <dougkwan@google.com>
4440 * arm.cc (Target_arm::got_section): Make the .got section the first
4441 non RELRO section in the data segment.
4442 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
4443 suffixes of section names.
4445 2010-02-24 Doug Kwan <dougkwan@google.com>
4447 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
4448 flags and attributes merging if an input file is a binary file.
4449 * fileread.cc (Input_file::open): Record format of original file.
4450 * fileread.h (Input_file::Format): New enum type.
4451 (Input_file::Input_file): Initialize data member format_.
4452 (Input_file::format): New method definition.
4453 (Input_file::format_):: New data member.
4455 2010-02-24 Doug Kwan <dougkwan@google.com>
4457 * arm.cc (Arm_output_data_got): New class.
4458 (ARM_TCB_SIZE): New constant
4459 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
4460 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
4461 If user uses a script with a SECTIONS clause, issue only a warning
4462 for a misplaced EXIDX input section. Otherwise, issue an error.
4463 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
4465 (Target_arm::got_mode_index_entry): Handle static linking.
4466 (Target_arm::Scan::local): Ditto.
4467 (Target_arm::Scan::global): Ditto.
4468 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
4469 all incorrectly implemented relocations.
4470 (Target_arm::fix_exidx_coverage): Pass layout to
4471 Arm_output_section::fix_exidx_coverage.
4472 * layout.cc (Layout::section_name_mapping): Remove trailing dots
4473 from ".ARM.exidx." and ".ARM.extab.".
4475 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4477 * arm.cc (Target_arm::do_finalize_sections): Create attribute
4478 section if it does not already exist.
4479 * attributes.cc (Attributes_section_data::Attributes_section_data):
4480 Don't crash if size is zero.
4482 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4483 Ian Lance Taylor <iant@google.com>
4485 * gold.cc (queue_middle_tasks): If no input files were opened,
4487 * workqueue.h (Task_function::Task_function): Assert that there is
4490 2010-02-22 Doug Kwan <dougkwan@google.com>
4492 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
4493 * icf.cc (get_section_contents): Cast snprintf arguments to long long
4494 types to avoid warnings due to different uint64_t implementations
4497 2010-02-21 Doug Kwan <dougkwan@google.com>
4499 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
4500 handling of the maximum backward branch offset.
4501 (Arm_relocate_functions::thumb_branch_common): Ditto.
4502 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
4503 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
4504 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
4505 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
4506 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
4507 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
4508 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
4509 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
4510 thumb_bl_out_of_range thumb_bl_out_of_range.o,
4511 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
4512 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
4513 thumb2_bl_out_of_range.o): New rules.
4514 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
4515 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
4516 thumb2_bl_out_of_range
4517 * testsuite/Makefile.in: Regenerate.
4518 * testsuite/arm_bl_in_range.s: New file.
4519 * testsuite/arm_bl_out_of_range.s: Ditto.
4520 * testsuite/arm_branch_in_range.sh: Ditto.
4521 * testsuite/arm_branch_range.t: Ditto.
4522 * testsuite/thumb2_branch_range.t: Ditto.
4523 * testsuite/thumb_bl_in_range.s: Ditto.
4524 * testsuite/thumb_bl_out_of_range.s: Ditto.
4525 * testsuite/thumb_branch_range.t: Ditto.
4527 2010-02-20 Sriraman Tallam <tmsriram@google.com>
4529 * gc.h (gc_process_relocs): Change vectors to point to the new list.
4530 Add reloc offset information.
4531 * icf.cc (get_section_contents): Change iterators to point to the new
4532 vectors. Add reloc offset information to the contents.
4533 * icf.h (Icf::Sections_reachable_info): New typedef.
4534 (Icf::Sections_reachable_list): New typedef.
4535 (Icf::Offset_info): New typedef.
4536 (Icf::Reloc_info): New struct typedef.
4537 (Icf::Reloc_info_list): New typedef.
4538 (Icf::symbol_reloc_list): Delete method.
4539 (Icf::addend_reloc_list): Delete method.
4540 (Icf::section_reloc_list): Delete method.
4541 (Icf::reloc_info_list): New method.
4542 (Icf::reloc_info_list_): New member.
4544 2010-02-19 Doug Kwan <dougkwan@google.com>
4546 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
4547 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
4548 * arm.cc (Arm_relocation_functions): New forward declaration.
4549 (Target_arm::Target_arm): Initialize new data members
4550 got_mod_index_offset_ and tls_base_symbol_defined_.
4551 (Target_arm::Relocate::relocate_tls): New method.
4552 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
4553 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
4555 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
4556 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
4557 (Target_arm::got_mod_index_offset_,
4558 Target_arm::tls_base_symbol_defined_): New data members.
4559 (Target_arm::Scan::local, Target::Scan::global,
4560 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
4563 2010-02-18 Doug Kwan <dougkwan@google.com>
4565 * arm.cc (Arm_relobj::find_linked_text_section): New method.
4566 (Arm_relobj::make_exidx_input_section): Pass section index of linked
4567 text section as a parameter becuase some broken tools may not set
4568 the link in section header.
4569 (Target_arm::has_got_section): New method.
4570 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
4571 without any mapping symbol as data only. Remove warning.
4572 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
4573 link in its section header, try to discover the link by inspecting the
4574 REL31 relocation at the beginning of the section.
4575 (Target_arm::Scan::check_non_pic): Report name of offending relocation
4577 (Target_arm::Scan::global): Treat any reference to the symbol
4578 _GLOBAL_OFFSET_TABLE_ as a GOT access.
4580 2010-02-12 Sriraman Tallam <tmsriram@google.com>
4582 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
4583 (Scan::global_reloc_may_be_function_pointer): New function.
4584 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
4585 (Scan::global_reloc_may_be_function_pointer): New function.
4586 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
4587 (Scan::global_reloc_may_be_function_pointer): New function.
4588 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
4589 (Scan::global_reloc_may_be_function_pointer): New function.
4590 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
4591 (Scan::global_reloc_may_be_function_pointer): New function.
4592 (Scan::possible_function_pointer_reloc): New function.
4593 (Target_x86_64::can_check_for_function_pointers): New function.
4594 * gc.h (gc_process_relocs): Scan relocation types to determine if
4595 function pointers were taken for targets that support it.
4596 * icf.cc (Icf::find_identical_sections): Include functions for
4597 folding in safe ICF whose pointer is not taken.
4598 * icf.h (Secn_fptr_taken_set): New typedef.
4599 (fptr_section_id_): New member.
4600 (section_has_function_pointers): New function.
4601 (set_section_has_function_pointers): New function.
4602 (check_section_for_function_pointers): New function.
4603 * options.h: Fix comment for safe ICF option.
4604 * target.h (can_check_for_function_pointers): New function.
4605 * testsuite/Makefile.am: Add icf_safe_so_test test case.
4606 Modify icf_safe_test for X86-64.
4607 * testsuite/Makefile.in: Regenerate.
4608 * testsuite/icf_safe_so_test.cc: New file.
4609 * testsuite/icf_safe_so_test.sh: New file.
4610 * testsuite/icf_safe_test.cc (kept_func_3): New function.
4611 (main): Change to take pointer to function kept_func_3.
4612 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
4613 folding is done correctly for X86-64.
4615 2010-02-12 David S. Miller <davem@davemloft.net>
4617 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
4618 is_symbolless parameter.
4619 (Output_reloc<SHT_REL>::is_symbolless): New.
4620 (Output_reloc<SHT_REL>::is_symbolless_): New.
4621 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
4622 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
4623 (Output_reloc<SHT_RELA>::is_symbolless): New.
4624 (Output_data_reloc::add_global): Handle is_symbolless.
4625 (Output_data_reloc::add_global_relative): Likewise.
4626 (Output_data_reloc::add_local): Likewise.
4627 (Output_data_reloc::add_local_relative): Likewise.
4628 (Output_data_reloc::add_symbolless_global_addend): New.
4629 (Output_data_reloc::add_symbolless_local_addend): New.
4630 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
4632 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
4633 instead of ->is_relative_
4634 (Output_reloc::write): Likewise.
4635 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
4636 (Output_reloc::write_rel): Simplify.
4638 * sparc.cc (Target_sparc::Scan::local): Use
4639 ->add_symbolless_local_addend as needed.
4640 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
4641 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
4642 based upon relocation offset.
4644 2010-02-11 Doug Kwan <dougkwan@google.com>
4646 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
4647 (Target_arm::Scan::global): Ditto. Also remove a comment before the
4648 beginning of function.
4649 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
4650 and MOVT_ABS relocations. Those are non issued in scanning. Fix
4651 parameter is_32bit in calls to should_apply_static_reloc.
4652 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
4653 (check_DATA): Add arm_abs_global.stdout.
4654 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
4655 arm_abs_global.stdout): New rules.
4656 (MOSTLLYCLEANFILES): Add arm_abs_global
4657 * Makefile.in: Regenerate.
4658 * testsuite/arm_abs_global.s: New file.
4659 * testsuite/arm_abs_global.sh: Ditto.
4660 * testsuite/arm_abs_lib.s: Ditto.
4662 2010-02-11 Ian Lance Taylor <iant@google.com>
4664 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
4666 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
4667 Allocate_commons_task first.
4668 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
4669 task, rather than symtab_lock_.
4670 (Gc_process_relocs::~Gc_process_relocs): New function.
4671 (Gc_process_relocs::is_runnable): Check this_blocker_.
4672 (Gc_process_relocs::locks): Use next_blocker_ rather than
4674 (Scan_relocs::~Scan_relocs): New function.
4675 (Scan_relocs::is_runnable): Check this_blocker_ rather than
4677 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
4679 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
4680 fields. Add this_blocker_ and next_blocker_ fields. Adjust
4681 constructor accordingly.
4682 (class Gc_process_relocs): Likewise.
4683 (class Scan_relocs): Likewise.
4684 * common.h (class Allocate_commons_task): Remove symtab_lock_
4685 field, and corresponding constructor parameter.
4686 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
4688 (Allocate_commons_task::locks): Likewise.
4690 2010-02-11 Ian Lance Taylor <iant@google.com>
4692 * gold-threads.h (class Once): Define.
4693 (class Initialize_lock): Rewrite as child of Once.
4694 * gold-threads.cc (class Once_initialize): Define.
4695 (once_pointer_control): New static variable.
4696 (once_pointer, once_arg): New static variables.
4697 (c_run_once): New static function.
4698 (Once::Once, Once::run_once, Once::internal_run): New functions.
4699 (class Initialize_lock_once): Remove.
4700 (initialize_lock_control): Remove.
4701 (initialize_lock_pointer): Remove.
4702 (initialize_lock_once): Remove.
4703 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
4704 (Initialize_lock::initialize): Rewrite.
4705 (Initialize_lock::do_run_once): New function.
4706 * archive.cc (Archive::interpret_header): Only clear name if it is
4708 * fileread.cc: Include "gold-threads.h"
4709 (file_counts_lock): New static variable.
4710 (file_counts_initialize_lock): Likewise.
4711 (File_read::release): Only increment counts when using --stats.
4712 Use a lock around the increment.
4713 * parameters.cc (class Set_parameters_target_once): Define.
4714 (set_parameters_target_once): New static variable.
4715 (Parameters::Parameters): Move here from parameters.h.
4716 (Parameters::set_target): Rewrite.
4717 (Parameters::set_target_once): New function.
4718 (Parameters::clear_target): Move here and rewrite.
4719 * parameters.h (class Parameters): Update declarations. Add
4720 set_parameters_target_once_ field.
4721 (Parameters::Parameters): Move to parameters.cc.
4722 (Parameters::clear_target): Likewise.
4723 * readsyms.cc (Read_symbols::do_group): Create a Start_group
4725 (Start_group::~Start_group): New function.
4726 (Start_group::is_runnable): New function.
4727 (Start_group::locks, Start_group::run): New functions.
4728 (Finish_group::run): Change saw_undefined to size_t.
4729 * readsyms.h (class Start_group): Define.
4730 (class Finish_group): Change saw_undefined_ field to size_t.
4731 (Finish_group::Finish_group): Remove saw_undefined and
4732 this_blocker parameters. Change all callers.
4733 (Finish_group::set_saw_undefined): New function.
4734 (Finish_group::set_blocker): New function.
4735 * symtab.h (class Symbol_table): Change saw_undefined to return
4736 size_t. Change saw_undefined_ field to size_t.
4737 * target-select.cc (Set_target_once::do_run_once): New function.
4738 (Target_selector::Target_selector): Initialize set_target_once_
4739 field. Don't initialize lock_ and initialize_lock_ fields.
4740 (Target_selector::instantiate_target): Rewrite.
4741 (Target_selector::set_target): New function.
4742 * target-select.h (class Set_target_once): Define.
4743 (class Target_selector): Update declarations. Make
4744 Set_target_once a friend. Remove lock_ and initialize_lock_
4745 fields. Add set_target_once_ field.
4747 2010-02-10 Ian Lance Taylor <iant@google.com>
4749 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
4751 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
4752 (queue_middle_tasks): Add all blockers before queueing any tasks.
4753 (queue_final_tasks): Likewise.
4754 * token.h (Task_token::add_blockers): New function.
4755 * object.h (Input_objects::number_of_relobjs): New function.
4757 2010-02-10 Ian Lance Taylor <iant@google.com>
4759 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
4760 shared, not if not position independent.
4761 * x86_64.cc (Relocate::relocate_tls): Likewise.
4762 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
4763 (tls_pie_pic_test): New target.
4764 * testsuite/Makefile.in: Rebuild.
4766 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
4767 (tls_test_main_pie.o, tls_test_pie.o): New targets.
4768 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
4769 * testsuite/Makefile.in: Rebuild.
4771 2010-02-09 David S. Miller <davem@davemloft.net>
4773 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
4774 R_SPARC_RELATIVE using ->add_local_relative().
4775 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
4777 * output.h (Output_data_dynamic::add_section_size): New method
4778 that takes two Output_data objects.
4779 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
4780 entry param. Handle it in initializers.
4781 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
4782 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
4783 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
4785 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
4786 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
4787 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
4788 for dynrel_includes_plt.
4789 * i386.cc (Target_i386::do_finalize_sections): Likewise.
4790 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4791 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
4793 (Target_sparc::do_finalize_sections): Update to pass true for
4794 dynrel_includes_plt.
4795 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
4796 output before .rela.plt
4797 (Target_powerpc::do_finalize_sections): Update to pass true for
4798 dynrel_includes_plt when 32-bit.
4800 2010-02-08 Doug Kwan <dougkwan@google.com>
4802 * arm.cc (Arm_relobj::simple_input_section_output_address): New
4804 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
4805 Arm_relobj::scan_section_for_cortex_a8_stubs,
4806 Arm_relobj::do_relocation_section): Instead of calling
4807 Output_section::output_address, use faster
4808 Arm_relobj::simple_input_section_output_address.
4810 2010-02-08 David S. Miller <davem@davemloft.net>
4812 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
4813 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
4814 relocation helper function.
4816 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
4817 just like R_SPARC_GOT{10,13,22}.
4818 (Target_sparc::Scan::local): Likewise.
4819 (Target_sparc::Relocate:relocate): Likewise.
4821 2010-02-06 Ian Lance Taylor <iant@google.com>
4823 * configure.ac: Rewrite targetobjs duplicate removal code to use
4824 only shell constructs.
4825 * configure: Rebuild.
4827 2010-02-05 Doug Kwan <dougkwan@google.com>
4830 * arm.cc (Arm_relobj::section_is_scannable): New method.
4831 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
4832 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
4834 2010-02-04 Doug Kwan <dougkwan@google.com>
4837 * arm-reloc-property.cc (cstdio): Include.
4838 * configure.ac (targetobjs): Remove duplicates.
4839 * configure: Regenerate.
4840 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
4841 big and little endian version for a given address size.
4843 2010-02-03 Doug Kwan <dougkwan@google.com>
4845 * arm-reloc-property.cc
4846 (Arm_reloc_property_table::reloc_name_in_error_message): New method
4848 * arm-reloc-property.h
4849 (Arm_reloc_property_table::get_implemented_static_reloc_property):
4850 New method definition.
4851 (Arm_reloc_property_table::reloc_name_in_error_message): New method
4853 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
4855 (GOT_PREL): Change implemented to Y.
4856 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
4857 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
4858 (Arm_relocate_functions::movw_abs_nc): Remove method.
4859 (Arm_relocate_functions::movt_abs): Ditto.
4860 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
4861 (Arm_relocate_functions::thm_movt_abs): Ditto.
4862 (Arm_relocate_functions::movw_rel_nc): Ditto.
4863 (Arm_relocate_functions::movw_rel): Ditto.
4864 (Arm_relocate_functions::movt_rel): Ditto.
4865 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
4866 (Arm_relocate_functions:thm_movw_rel): Ditto.
4867 (Arm_relocate_functions:thm_movt_rel): Ditto.
4868 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
4869 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
4870 New method definitions.
4871 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
4872 (Arm_relocation_functions::arm_grp_ldr): Ditto.
4873 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
4874 (Arm_relocation_functions::arm_grp_ldc): Ditto.
4875 (Target_arm::Relocate::relocate): Check for non-static or
4876 unimplemented relocation code and exit early. Change calls to
4877 Target_arm::reloc_uses_thumb_bit and
4878 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
4879 instead. Refactor code to handle similar relocations to increase
4880 code sharing. Remove check for unsupported relocation code in switch
4882 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
4883 relocation property table to find out size. Change error message to
4884 print out the name of a relocation code instead of the numeric value.
4885 (Target_arm::scan_reloc_for_stub): Use relocation property table
4886 instead of calling Target_arm::reloc_uses_thumb_bit().
4888 2010-02-02 Doug Kwan <dougkwan@google.com>
4890 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
4891 types of relaxed input section.
4893 2010-02-02 Doug Kwan <dougkwan@google.com>
4895 * Makefile.am (HFILES): Add arm-reloc-property.h.
4897 (TARGETSOURCES): Add arm-reloc-property.cc
4898 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
4899 (libgold_a_SOURCES): $(DEFFILES)
4900 * Makefile.in: Regenerate.
4901 * arm-reloc-property.cc: New file.
4902 * arm-reloc-property.h: New file.
4903 * arm-reloc.def: New file.
4904 * arm.cc: Update comments.
4905 (arm-reloc-property.h): New included header.
4906 (arm_reloc_property_table): New global variable.
4907 (Target_arm::do_select_as_default_target): New method definition.
4908 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
4909 arm-reloc-property to targ_extra_obj.
4910 * parameters.cc (set_parameters_target): Call
4911 Target::select_as_default_target().
4912 * target.h (Target::select_as_default_target): New method definition.
4913 (Target::do_select_as_default_target): Same.
4915 2010-02-01 Doug Kwan <dougkwan@google.com>
4917 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
4918 first_output_text_section_.
4919 (Arm_exidx_fixup::first_output_text_section): New method definition.
4920 (Arm_exidx_fixup::first_output_text_section_): New data member.
4921 (Arm_exidx_fixup::process_exidx_section): Record the first text
4922 output section seen.
4923 (Arm_output_section::fix_exidx_coverage): Set correct linked section
4924 and entsize in output section header.
4926 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4928 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
4929 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
4930 (Arm_relocate_functions::thm_alu11): New Method.
4931 (Arm_relocate_functions::thm_pc8): New Method.
4932 (Arm_relocate_functions::thm_pc12): New Method.
4933 (Target_arm::Scan::local): Handle the relocations.
4934 (Target_arm::Scan::global): Likewise.
4935 (Target_arm::Relocate::relocate): Likewise.
4936 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
4938 2010-01-29 Doug Kwan <dougkwan@google.com>
4940 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
4941 of relocation types as ld.
4943 2010-01-29 Doug Kwan <dougkwan@google.com>
4945 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
4947 (Arm_relocate_functions::thumb_branch_common): Ditto.
4948 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
4949 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
4950 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
4951 Arm_relocate_functions::jump24): Remove.
4952 (Target_arm::Relocate::relocate): Adjust code to call
4953 Arm_relocation_functions::arm_branch_common and
4954 Arm_relocation_functions::thumb_branch_common instead of their removed
4955 wrappers. Merge switch-cases together to reduce source code size.
4957 2010-01-29 Doug Kwan <dougkwan@google.com>
4959 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
4960 output_local_symbol_count_needs_update_.
4961 (Arm_relobj::output_local_symbol_count_needs_update,
4962 Arm_relobj::set_output_local_symbol_count_needs_update,
4963 Arm_relobj::update_output_local_symbol_count): New methods.
4964 (Arm_relobj::output_local_symbol_count_needs_update_): New data
4966 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
4967 of pointed function as in a R_ARM_PREL31 relocation.
4968 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
4969 for output local symbol count updating.
4970 (Target_arm::do_relax): Update output local symbol counts in objects
4972 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
4974 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4976 * arm.cc: Added support for the ARM relocations:
4977 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
4978 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
4979 (Arm_relocate_functions::movw_rel_nc): Renamed (was
4981 (Arm_relocate_functions::movw_rel): New method.
4982 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
4983 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
4985 (Arm_relocate_functions::thm_movw_rel): New method.
4986 (Arm_relocate_functions::thm_movt_rel): Renamed (was
4988 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
4990 (Target_arm::Scan::global): Likewise.
4991 (Target_arm::Relocate::relocate): Likewise.
4992 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4995 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4997 * arm.cc: Added support for ARM group relocations.
4998 (Target_arm::reloc_needs_sym_origin): New method.
4999 (Arm_relocate_functions::calc_grp_kn): New method.
5000 (Arm_relocate_functions::calc_grp_residual): New method.
5001 (Arm_relocate_functions::calc_grp_gn): New method.
5002 (Arm_relocate_functions::arm_grp_alu): New Method.
5003 (Arm_relocate_functions::arm_grp_ldr): New Method.
5004 (Arm_relocate_functions::arm_grp_ldrs): New Method.
5005 (Arm_relocate_functions::arm_grp_ldc): New Method.
5006 (Target_arm::Scan::local): Handle the ARM group relocations.
5007 (Target_arm::Scan::global): Likewise.
5008 (Target_arm::Relocate::relocate): Likewise.
5009 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5012 2010-01-26 Doug Kwan <dougkwan@google.com>
5014 * arm.cc (set): Include.
5015 (class Arm_exidx_fixup): Change type of last_input_section_ to const
5017 (Arm_output_section::Text_section_list): New type.
5018 (Arm_output_section::append_text_sections_to_list): New method.
5019 (Arm_output_section::fix_exidx_coverage): Ditto.
5020 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
5021 (Arm_relobj::convert_input_section_to_relaxed_section): Use
5022 Relobj::set_section_offset() instead of
5023 Sized_relobj::invalidate_section_offset().
5024 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
5025 parameter for section headers. Ignore relocation sections for
5026 unallocated sections and EXIDX sections.
5027 (Target_arm::fix_exidx_coverage): New method.
5028 (Target_arm::output_section_address_less_than): New type.
5029 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
5030 linked text section instead of the EXIDX section.
5031 (Arm_output_section::create_stub_group): Add an assertion to check
5032 that this is not an EXIDX output section.
5033 (Arm_output_section::append_text_sections_to_list): New method.
5034 (Arm_output_section::fix_exidx_coverage): Ditto.
5035 (Arm_relobj::scan_sections_for_stubs): Adjust call to
5036 Arm_relobj::section_needs_reloc_stub_scanning.
5037 (Target_arm::do_relax): Fix EXIDX output section coverage in the
5039 (Target_arm::fix_exidx_coverage): New method.
5040 * object.h (Relobj::set_output_section): New method.
5041 (Sized_relobj::invalidate_section_offset): Remove method.
5042 (Sized_relobj::do_invalidate_section_offset): Remove method.
5043 (Sized_relobj::do_set_section_offset): Handle offset value -1.
5045 2010-01-25 Doug Kwan <dougkwan@google.com>
5047 * arm.cc (Arm_exidx_merged_section::do_output_offset):
5048 Fix warning due to signed and unsigned comparison on a 32-bit host.
5050 2010-01-22 Doug Kwan <dougkwan@google.com>
5052 * arm.cc (Target_arm::do_relax): Record an output section for section
5053 offset adjustment it contains any stub table that has changed.
5054 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
5055 offsets in an output section if necessary.
5056 * output.cc (Output_section::Output_section): Initialize
5057 section_offsets_need_adjustments_.
5058 (Output_section::add_input_section_for_script): Renamed to
5059 Output_section::add_simple_input_section.
5060 (Output_section::save_states): Add a comment.
5061 (Output_section::discard_states): New method defintion.
5062 (Output_section::adjust_section_offsets): Same.
5063 * output.h (Output_section::add_input_section_for_script): Renamed to
5064 Output_section::add_simple_input_section.
5065 (Output_section::discard_states): New method declaration.
5066 (Output_section::adjust_section_offsets): Same.
5067 (Output_section::section_offsets_need_adjustment,
5068 Output_section::set_section_offsets_need_adjustment): New method
5070 (Output_section::section_offsets_need_adjustment_): New data member.
5071 * script-sections.cc
5072 (Output_section_element_input::set_section_address): Adjust code for
5073 renaming of Output_section::add_input_section_for_script.
5074 (Orphan_output_section::set_section_address): Same.
5076 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5078 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
5079 Fix_v4bx enum values .
5080 * gold/options.h (General_options): New option definitions.
5081 (General_options::fix_v4bx): New method.
5082 (General_options::Fix_v4bx): New enum.
5083 * gold/options.cc (General_options::parse_fix_v4bx): New method.
5084 (General_options::parse_fix_v4bx_interworking): New method.
5086 2010-01-22 Doug Kwan <dougkwan@google.com>
5088 * arm.cc (Arm_exidx_fixup): New class.
5090 2010-01-21 Doug Kwan <dougkwan@google.com>
5092 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
5094 (Arm_exidx_section_offset_map): New type.
5096 2010-01-21 Doug Kwan <dougkwan@google.com>
5098 * arm.cc (Arm_exidx_input_section): New class.
5099 (Arm_relobj::exidx_input_section_by_link,
5100 Arm_relobj::exidx_input_section_by_shndx,
5101 Arm_relobj::make_exidx_input_section): New methods.
5102 (read_arm_attributes_section): Remove.
5103 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
5104 information about them.
5105 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
5108 2010-01-20 Doug Kwan <dougkwan@google.com>
5110 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
5111 Input_section_specifier to Section_id.
5112 (Target_arm::new_arm_input_section: Adjust code for change of key
5114 (Target_arm::find_arm_input_section): Ditto.
5115 * gc.h (object.h): Include for Section_id nand Section_id_hash.
5116 (Section_id): Remove.
5117 (Garbage_collection::Section_id_hash): Remove.
5118 * icf.h (object.h): Include for Section_id nand Section_id_hash.
5119 (Section_id): Remove.
5120 (Icf::Section_id_hash): Remove.
5121 * object.h (Section_id, Const_section_id, Section_id_hash,
5122 Const_section_id_hash): New type definitions.
5123 * output.cc (Output_section::add_relaxed_input_section): Change to
5124 use Const_section_id instead of Input_section_specifier as key type.
5125 (Output_section::add_merge_input_section): Ditto.
5126 (Output_section::build_relaxation_map): Change to use Section_id
5127 instead of Input_section_specifier as key type.
5128 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5130 (Output_section::convert_input_sections_to_relaxed_sections): Change
5131 to use Const_section_id instead of Input_section_specifier as key type.
5132 (Output_section::find_merge_section): Ditto.
5133 (Output_section::find_relaxed_input_section): Ditto.
5134 * output.h (Input_section_specifier): Remove class.
5135 (Output_section::Output_section_data_by_input_section_map): Change
5136 key type to Const_section_id.
5137 (Output_section::Output_relaxed_input_section_by_input_section_map):
5139 (Output_section::Relaxation_map): Change key type to Section_id.
5141 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5143 * gold/arm.cc: Added support for R_ARM_V4BX relocation
5144 (class Arm_v4bx_stub): New class.
5145 (DEF_STUBS): Updated definition to support v4_veneer_bx.
5146 (Stub_factory::make_arm_v4bx_stub): New method.
5147 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
5148 (Stub_table::empty): Handle v4bx stubs.
5149 (Stub_table::add_arm_v4bx_stub): New method.
5150 (Stub_table::find_arm_v4bx_stub): New method.
5151 (Arm_relocate_functions::v4bx): New method.
5152 (Target_arm::fix_v4bx): New method.
5153 (Target_arm::Target_arm): Handle R_ARM_V4BX.
5154 (Stub_table::relocate_stubs): Likewise.
5155 (Stub_table::do_write): Likewise.
5156 (Stub_table::update_data_size_and_addralign): Likewise.
5157 (Stub_table::finalize_stubs): Likewise.
5158 (Target_arm::Scan::local): Likewise.
5159 (Target_arm::Scan::global): Likewise.
5160 (Target_arm::do_finalize_sections): Likewise.
5161 (Target_arm::Relocate::relocate): Likewise.
5162 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5164 (Target_arm::scan_reloc_for_stub): Likewise.
5165 (Target_arm::scan_reloc_section_for_stubs): Likewise.
5167 2010-01-19 Ian Lance Taylor <iant@google.com>
5169 * output.cc (Output_section_headers::do_sized_write): Write large
5170 segment count to sh_info field.
5171 (Output_file_header::do_sized_write): For large segment count,
5172 write PN_XNUM to e_phnum field.
5174 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5176 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
5177 (Arm_relocate_functions::thm_jump8): New function.
5178 (Arm_relocate_functions::thm_jump11): New function.
5179 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
5181 (Target_arm::Scan::global): Likewise.
5182 (Target_arm::Relocate::relocate): Likewise.
5183 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5186 2010-01-14 Doug Kwan <dougkwan@google.com>
5188 * arm.cc (map, utility): Include headers.
5189 (Target_arm::apply_cortex_a8_workaround): New method.
5190 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
5191 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
5192 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
5193 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
5194 the --[no-]fix-cortex-a8 command line options.
5195 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
5196 (Target_arm::relocate_stub): Use addend in instruction template.
5197 * options.h (DEFINE_bool): Set the user-set flag.
5198 (General_options): Add --[no-]-fix-cortex options.
5199 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
5200 : Update fast look-up map after conversion.
5202 2010-01-14 Sriraman Tallam <tmsriram@google.com>
5204 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
5205 in the first pass of do_layout.
5207 2010-01-13 Doug Kwan <dougkwan@google.com>
5209 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
5210 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
5211 apparent compiler problem of not folding static constant integral
5212 data members of elfcpp::Elf_sizes<32>.
5214 2010-01-13 Doug Kwan <dougkwan@google.com>
5216 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
5217 Arm_relobj::section_needs_cortex_a8_stub_scanning,
5218 Arm_relobj::scan_section_for_cortex_a8_erratum,
5219 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
5220 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
5221 sections to scan for relocation stubs into a new method
5222 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
5223 relocation and Cortex-A8 stub scanning.
5224 (Target_arm::do_relax): Force stubs to be after stubbed sections
5225 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
5226 the beginning of a new relaxation pass. Update a comment.
5227 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
5229 2010-01-12 Ian Lance Taylor <iant@google.com>
5231 * target-reloc.h (visibility_error): New inline function.
5232 (relocate_section): Call visibility_error.
5233 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
5234 (MOSTLYCLEANFILES): Likewise.
5235 (protected_4_pic.o, protected_3.err): New targets.
5236 * testsuite/protected_4.cc: New file.
5238 2010-01-12 Doug Kwan <dougkwan@google.com>
5240 * arm.cc (Cortex_a8_reloc): New class.
5241 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
5242 and cortex_a8_relocs_info_.
5243 (Target_arm::fix_cortex_a8): New method definition.
5244 (Target_arm::Cortex_a8_relocs_info): New type.
5245 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
5246 New data member declarations.
5247 (Target_arm::scan_reloc_for_stub): Record information about
5248 relocations for THUMB branches that might be exempted from the
5249 Cortex-A8 workaround.
5250 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
5251 at the beginning of a relaxation pass.
5253 2010-01-12 Doug Kwan <dougkwan@google.com>
5255 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
5256 (Arm_relobj::Mapping_symbol_position,
5257 Arm_reloj::Mapping_symbol_position_less,
5258 Arm_relobj::Mapping_symbols_info): New types.
5259 (Target_arm::is_mapping_symbol_name): New method definition.
5260 (Arm_relobj::do_count_local_symbols): Save information about mapping
5263 2010-01-11 Doug Kwan <dougkwan@google.com>
5265 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
5266 Arm_relocate_functions::thumb32_branch_upper,
5267 Arm_relocate_functions::thumb32_branch_lower,
5268 Arm_relocate_functions::thumb32_cond_branch_offset,
5269 Arm_relocate_functions::thumb32_cond_branch_upper,
5270 Arm_relocate_functions::thumb32_cond_branch_lower,
5271 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
5272 branch offset encoding.
5273 (Arm_relocate_functions::thumb_branch_common): Use new branch
5274 offset encoding methods to avoid code duplication.
5275 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
5276 (Stub_addend_reader::operator()): Use new branch encoding method
5277 to avoid code duplication.
5279 2010-01-11 Doug Kwan <dougkwan@google.com>
5281 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
5282 (Target_arm::do_finalize_sections): Define special EXIDX section
5283 symbols only if referenced.
5284 * gc.h (Garbage_collection::add_reference): New method.
5285 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
5288 2010-01-11 Ian Lance Taylor <iant@google.com>
5290 * script.cc (Version_script_info::build_expression_list_lookup):
5291 Change complaing about duplicate wildcard match from error to
5294 * script.cc (class Lazy_demangler): Recreate--revert part of patch
5296 (Version_script_info::Version_script_info): Initialize globs_,
5297 default_version_, default_is_global_, and exact_. Don't
5298 initialize globals_ or locals_.
5299 (Version_script_info::build_lookup_tables): Build local symbols
5301 (Version_script_info::unquote): New function.
5302 (Version_script_info::add_exact_match): New function.
5303 (Version_script_info::build_expression_list_lookup): Remove lookup
5304 parameter. Add is_global parameter. Change all callers. Handle
5305 wildcard pattern specially. Unquote pattern. Call
5307 (Version_script_info::get_name_to_match): New function.
5308 (Version_script_info::get_symbol_version): New function.
5309 (Version_script_info::get_symbol_version_helper): Remove.
5310 (Version_script_info::check_unmatched_names): Call unquote.
5311 * script.h (class Version_script_info): Change get_symbol_version
5312 to be non-inline and add is_global parameter; change all callers.
5313 Rewrite symbol_is_local. Update declarations. Define struct
5314 Version_tree_match, Exact, Globs. Don't define struct Lookup.
5315 Remove globals_ and locals_ members. Add exact_, globs_,
5316 default_version_, is_global_.
5317 (Version_script_info::Glob): Remove pattern, add expression and
5318 is_global. Update constructor. Change all callers.
5319 * dynobj.cc (Versions::finalize): Mark the version symbol as the
5321 (Versions::symbol_section_contents): If a symbol is undefined, or
5322 defined in a dynamic object, set the version index to
5324 * symtab.cc (Symbol_table::add_from_relobj): Don't call
5326 (Symbol_table::add_from_pluginobj): Likewise.
5327 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
5329 2010-01-11 Doug Kwan <dougkwan@google.com>
5331 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
5332 (incremental_dump_LDADD): Add linking option for libintl.
5333 * Makefile.in: Regenerate.
5335 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
5338 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
5340 * testsuite/Makefile.in: Regenerated.
5342 2010-01-10 Doug Kwan <dougkwan@google.com>
5344 * options.h (DEFINE_var): Use parentheses around argument varname__
5345 in macro body to avoid any unintended subsequent substitutions.
5347 2010-01-10 Ian Lance Taylor <iant@google.com>
5349 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
5350 candidates before doing symbol resolution.
5352 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
5353 ODR candidates if only one is weak.
5355 2010-01-08 Ian Lance Taylor <iant@google.com>
5357 * script.cc (Version_script_info::build_expression_list_lookup):
5358 Don't warn about ambiguous version, just record the ambiguity.
5359 (Version_script_info::get_symbol_version_helper): Give error if
5360 version is ambiguous.
5362 2010-01-08 Doug Kwan <dougkwan@google.com>
5364 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
5365 prev_data_size_ and prev_addralign_. Remove initializer for
5366 deleted data member has_been_changed_.
5367 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
5368 to determine if the table is empty.
5369 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
5371 (Stub_table::add_reloc_stub): Define method in class definition
5372 instead of just declaring it there.
5373 (Stub_table::add_cortex_a8_stub): New method definition.
5374 (Stub_table::update_data_size_and_addralign): Ditto.
5375 (Stub_table::finalize_stubs): Ditto.
5376 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
5377 (Stub_table::do_addralign_): Return address alignment in the
5378 (Stub_table::do_reset_address_and_file_offset): Define method in
5379 class definition instead of declaring it there. Set current data
5380 size to be the data size of the previous pass.
5381 (Stub_table::set_final_data_size): Use current data size as the
5383 (Stub_table::relocate_stub): Change parameter type of stub from
5384 Reloc_stub pointer to Stub pointer.
5385 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
5386 (Stub_table::Cortex_a8_stub_list): New typedef.
5387 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
5388 Stub_table::prev_addralign_): New data member.
5389 (Arm_relobj::Arm_relobj): Initialize data member
5390 section_has_cortex_a8_workaround_.
5391 (Arm_relobj::section_has_cortex_a8_workaround,
5392 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
5394 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
5396 (Target_arm::relocate_stub): Change parameter type of stub from
5397 Reloc_stub pointer to Stub pointer.
5398 (Insn_template::size, Insn_template::alignment): Handle
5399 THUMB16_SPECIAL_TYPE.
5400 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
5401 Stub_table::update_data_size_and_addralign,
5402 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
5404 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
5405 (Stub_table::do_write): Ditto.
5406 (Target_arm::do_relax): Adjust code for changes in Stub_table.
5408 2010-01-08 Ian Lance Taylor <iant@google.com>
5411 * symtab.h (class Symbol): Remove fields is_target_special_ and
5412 has_plt_offset_. Add field is_defined_in_discarded_section_.
5413 (Symbol::is_defined_in_discarded_section): New function.
5414 (Symbol::set_is_defined_in_discarded_section): New function.
5415 (Symbol::has_plt_offset): Rewrite.
5416 (Symbol::set_plt_offset): Verify that new offset is not -1U.
5417 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
5418 Don't initialize is_target_special_ or has_plt_offset_.
5419 Initialize is_defined_in_discarded_section_.
5420 (Symbol_table::add_from_relobj): If appropriate, set
5421 is_defined_in_discarded_section.
5422 * resolve.cc (Symbol::override_base_with_special): Don't test
5423 is_target_special_. Change has_plt_offset_ to has_plt_offset().
5424 * target-reloc.h (relocate_section): Do special handling for
5425 symbols defined in discarded sections for global symbols as well
5428 2010-01-08 Ian Lance Taylor <iant@google.com>
5430 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
5431 the SHT_SYMTAB case.
5433 2010-01-08 Ian Lance Taylor <iant@google.com>
5435 * object.cc (Sized_relobj::do_layout): Don't get confused if
5436 layout_eh_frame returns NULL.
5438 2010-01-08 Ian Lance Taylor <iant@google.com>
5441 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
5442 dynamic symbol table, use the normal symbol table.
5443 (Sized_dynobj::do_read_symbols): Remove assertion about type of
5446 2010-01-08 Ian Lance Taylor <iant@google.com>
5449 * layout.cc (Layout::include_section): Remove .gnu_debuglink
5452 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
5454 * version.cc (print_version): Change to "Copyright 2010".
5456 2010-01-08 Ian Lance Taylor <iant@google.com>
5460 * i386.cc (class Target_i386): Change return type of plt_section
5462 (class Output_data_plt_i386): Add tls_desc_rel_ field.
5463 (Output_data_plt_i386::Output_data_plt_i386): Initialize
5464 tls_desc_rel_ field.
5465 (Output_data_plt_i386::rel_tls_desc): New function.
5466 (Target_i386::rel_tls_desc_section): New function.
5467 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
5468 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
5469 R_386_TLS_DESC reloc in rel_tls_desc_section.
5470 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
5471 Define struct Tlsdesc_info.
5472 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
5473 (Target_x86_64::do_reloc_symbol_index): New function.
5474 (Target_x86_64::add_tlsdesc_info): New function.
5475 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
5476 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
5478 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
5480 (Output_data_plt_x86_64::rela_tlsdesc): New function.
5481 (Target_x86_64::rela_tlsdesc_section): New function.
5482 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
5484 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
5485 (Target_x86_64::do_reloc_addend): New function.
5486 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
5487 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
5488 declarations. Define TARGET_CODE. Add arg field to u1_ union.
5489 (Output_reloc::type): New function.
5490 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
5491 (Output_reloc::is_target_specific): New function.
5492 (Output_reloc::target_arg): New function.
5493 (class Output_reloc) [SHT_RELA]: Add four new constructors for
5494 absolute relocs and target specific relocs.
5495 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
5496 add_target_specific.
5497 (class Output_data_reloc) [SHT_RELA]: Likewise.
5498 * output.cc (Output_reloc::Output_reloc): Add four new versions
5499 for absolute relocs and target specific relocs.
5500 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
5501 (Output_reloc::get_symbol_index): Likewise.
5502 (Output_reloc::local_section_offset): Check that local_sym_index_
5503 is not TARGET_CODE or 0.
5504 (Output_reloc::symbol_value): Likewise.
5505 (Output_reloc::write) [SHT_RELA]: Call target for target specific
5507 * target.h (class Target): Add reloc_symbol_index and reloc_addend
5508 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
5510 * layout.cc (add_target_dynamic_tags): Use output section for
5511 DT_PLTRELSZ and DT_JMPREL.
5513 2010-01-07 Ian Lance Taylor <iant@google.com>
5516 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
5518 (class Output_data_reloc_generic): Define.
5519 (class Output_data_reloc_base): Change base class to
5520 Output_data_reloc_generic. Change add() method to call
5521 bump_relative_reloc_count for a relative reloc. Remove
5523 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
5525 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
5526 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
5528 * layout.h (class Layout): Update declaration.
5530 2010-01-07 Ian Lance Taylor <iant@google.com>
5532 * output.h (class Output_data): Add const version of
5533 output_section and do_output_section.
5534 (class Output_section_data): Add const version of
5536 (class Output_section): Likewise.
5537 * layout.cc (Layout::add_target_dynamic_tags): New function.
5538 * layout.h (class Layout): Update declarations.
5539 * arm.cc (Target_arm::do_finalize_sections): Use
5540 add_target_dynamic_tags.
5541 * i386.cc (Target_i386::do_finalize_sections): Likewise.
5542 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
5543 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
5544 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5546 2010-01-07 Ian Lance Taylor <iant@google.com>
5549 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
5552 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
5553 Ian Lance Taylor <iant@google.com>
5556 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
5557 Xindex::read_symtab_xindex.
5559 2010-01-07 Doug Kwan <dougkwan@google.com>
5561 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
5562 (Insn_template::thumb16_bcond_insn): New method declaration.
5563 (Insn_template): Fix spelling.
5564 (Stub::thumb16_special): New method declaration.
5565 (Stub::do_write): Define virtual method which was previously pure
5567 (Stub::do_thumb16_special): New method declaration.
5568 (Stub::do_fixed_endian_write): New template member.
5569 (Reloc_stub::do_write): Remove.
5570 (Reloc_stub::do_fixed_endian_write): Remove.
5571 (Cortex_a8_stub): New class definition.
5572 (Stub_factory::make_cortex_a8_stub): New method definition.
5573 (Stub_factory::Stub_factory): Add missing static storage class
5574 qualifier for elf32_arm_stub_a8_veneer_blx.
5576 2010-01-07 Ian Lance Taylor <iant@google.com>
5579 * options.h (class General_options): Add --warn-unresolved-symbols
5580 and --error-unresolved-symbols.
5581 * errors.cc (Errors::undefined_symbol): Implement
5582 --warn-unresolved-symbols.
5584 * options.h (class General_options): Add -z text and -z textoff.
5585 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
5587 2010-01-06 Sriraman Tallam <tmsriram@google.com>
5589 * gc.h (Garbage_collection::Cident_section_map): New typedef.
5590 (Garbage_collection::cident_sections): New function.
5591 (Garbage_collection::add_cident_section): New function.
5592 (Garbage_collection::cident_sections_): New member.
5593 (gc_process_relocs): Add references to sections whose names are C
5595 * gold.h (cident_section_start_prefix): New constant.
5596 (cident_section_stop_prefix): New constant.
5597 (is_cident): New function.
5598 * layout.cc (Layout::define_section_symbols): Replace string constants
5599 with the newly defined constants.
5600 * object.cc (Sized_relobj::do_layout): Track sections whose names are
5602 * testsuite/Makefile.am: Add gc_orphan_section_test.
5603 * testsuite/Makefile.in: Regenerate.
5604 * testsuite/gc_orphan_section_test.cc: New file.
5605 * testsuite/gc_orphan_section_test.sh: New file.
5607 2010-01-06 Ian Lance Taylor <iant@google.com>
5610 * options.h (class General_options): Add --warn-shared-textrel.
5611 * layout.cc (Layout::finish_dynamic_section): Implement
5612 --warn-shared-textrel.
5615 * options.h (class General_options): Add --warn-multiple-gp.
5617 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5619 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
5620 $(THREADSLIB) and $(LIBDL).
5621 * Makefile.in: Rebuild.
5623 2010-01-06 Ian Lance Taylor <iant@google.com>
5626 * options.cc (General_options::parse_section_start): New function.
5627 (General_options::section_start): New function.
5628 (General_options::General_options): Initialize all members.
5629 * options.h: Include <map>
5630 (class General_options): Add --section-start. Add section_starts_
5632 * layout.cc (Layout::attach_allocated_section_to_segment): If
5633 --section-start was used, set the address of the segment. Remove
5634 local sort_sections.
5635 (Layout::relaxation_loop_body): If the address of the load segment
5636 has been set by --section-start, don't use it.
5637 * output.h (Output_segment::update_flags_for_output_section): New
5639 * output.cc (Output_segment::add_output_section): Call
5640 update_flags_for_output_section.
5642 2010-01-05 Ian Lance Taylor <iant@google.com>
5645 * options.h (class General_options): Add --undefined-version.
5646 * script.cc (struct Version_expression): Add was_matched_by_symbol
5648 (Version_script_info::matched_symbol): New function.
5649 (Version_script_info::get_symbol_version_helper): Call
5651 (Version_script_info::check_unmatched_names): New function.
5652 * script.h (class Version_script_info): Update declarations.
5653 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
5655 * options.h (class General_options): Use DEFINE_bool_alias for
5656 allow_multiple_definition.
5657 * resolve.cc (Symbol_table::should_override): Don't test
5658 allow_multiple_definition.
5661 * options.h (class General_options): Add --cref.
5662 * main.cc (main): Print cref table if --cref. Don't close mapfile
5663 until after printing cref table.
5664 * cref.cc: Include "symtab.h".
5665 (class Cref_inputs): Define Cref_table_compare and Cref_table.
5666 (Cref_table_compare::operator()): New function.
5667 (Cref_inputs::gather_cref): New function.
5668 (filecol): New static const.
5669 (Cref_inputs::print_cref): New function.
5670 (Cref::print_cref): New function.
5671 * cref.h: Include <cstdio>.
5672 (class Cref): Update declarations.
5673 * mapfile.h (Mapfile::file): New function.
5674 * object.h (class Object): Define Symbols. Declare virtual
5675 do_get_global_symbols.
5676 (Object::get_global_symbols): New function.
5677 * object.cc (Input_objects::add_object): Pass object to cref_ if
5679 (Input_objects::archive_start): Likewise.
5680 (Input_objects::archive_stop): Likewise.
5681 (Input_objects::print_cref): New function.
5682 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
5683 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
5685 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
5687 * plugin.h (class Sized_pluginobj): Update declarations.
5689 2010-01-05 Ian Lance Taylor <iant@google.com>
5691 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
5692 to is_default_version. Rename insdef to insdefault.
5693 (Symbol_table::add_from_relobj): Rename def to is_default_version
5694 and local to is_forced_local.
5695 (Symbol_table::add_from_pluginobj): Likewise.
5696 (Symbol_table::add_from_dynobj): Likewise.
5697 (Symbol_table::define_special_symbol): Rename insdef to
5700 2010-01-04 Ian Lance Taylor <iant@google.com>
5703 * options.h (class General_options): Add
5704 --allow-multiple-definition and -z muldefs.
5705 * resolve.cc (Symbol_table::should_override): Don't warn about a
5706 multiple symbol definition if --allow-multiple-definition or -z
5710 * options.h (class General_options): Add --add-needed and
5711 --copy-dt-needed-entries. Tweak --as-needed help entry.
5712 * object.cc (Input_objects::check_dynamic_dependencies): Give an
5713 error if --copy-dt-needed-entries aka --add-needed is used and
5714 would cause a change in behaviour.
5717 * options.h (class General_options): Add -G as a short version of
5718 --shared. Add no-op options -assert, -g, and -i.
5720 2010-01-04 Sriraman Tallam <tmsriram@google.com>
5722 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
5723 check for .text or .gnu.linkonce.t sections.
5724 * icf.cc (Icf::find_identical_sections): Ditto.
5725 Change the detection for mangled function name within the section
5727 * icf.h (is_section_foldable_candidate): New function.
5729 2009-12-30 Ian Lance Taylor <iant@google.com>
5732 * options.h (class General_options): Permit two dashes with
5733 --retain-symbols-file.
5735 2009-12-30 Ian Lance Taylor <iant@google.com>
5738 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
5739 don't put the file header and segment headers in the text
5743 * common.cc (Sort_commons::operator()): Stabilize sort when both
5745 (Symbol_table::do_allocate_commons_list): When allocating common
5746 symbols, skip a symbol which is no longer common.
5747 * symtab.h (Symbol::is_common): Test whether the symbol comes from
5748 an object before checking its type.
5749 * testsuite/common_test_2.c: New file.
5750 * testsuite/common_test_3.c: New file.
5751 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
5752 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
5753 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
5754 (common_test_2_pic.o, common_test_2.so): New targets.
5755 (common_test_3_pic.o, common_test_3.so): New targets.
5756 * testsuite/Makefile.in: Rebuild.
5759 * script.cc (read_input_script): If we see a new SECTIONS clause,
5760 and we have added an input section, give an error.
5761 * layout.h (class Layout): Add have_added_input_section function.
5762 Add have_added_input_section_ field.
5763 * layout.cc (Layout::Layout): Initialize
5764 have_added_input_section_.
5765 (Layout::layout): Set have_added_input_section_.
5766 (Layout::layout_eh_frame): Likewise.
5768 2009-12-30 Ian Lance Taylor <iant@google.com>
5771 * options.h (class General_options): Add --sort-common option.
5772 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
5773 * common.cc (Sort_common): Add sort_order parameter to
5774 constructor. Add sort_order_ field.
5775 (Sort_commons::operator): Check sort_order_.
5776 (Symbol_table::allocate_commons): Determine the sort order.
5777 (Symbol_table::do_allocate_commons): Add sort_order parameter.
5779 (Symbol_table::do_allocate_commons_list): Likewise.
5781 2009-12-30 Ian Lance Taylor <iant@google.com>
5784 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
5785 symbols from this object, don't change the visibility of an
5787 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
5789 2009-12-30 Ian Lance Taylor <iant@google.com>
5792 * script.h (class Version_script_info): Define Language enum.
5793 Update declarations. Define Glob, Exact, and Lookup types. Add
5794 new fields globals_, locals_, and is_finalized_.
5795 * script.cc: Various formatting fixes.
5796 (class Parser_closure): Change language_stack_ from a vector of
5797 std::string to one of Version_script_info::Language. Adjust all
5799 (class Lazy_demangler): Remove.
5800 (struct Version_expression): Change language from std::string to
5801 Version_script_info::Language.
5802 (Version_script_info::Version_script_info): New function.
5803 (Version_script_info::~Version_script_info): Don't call clear.
5804 (Version_script_info::finalize): New function.
5805 (Version_script_info::build_lookup_tables): New function.
5806 (Version_script_info::build_expression_list_lookup): New
5808 (Version_script_info::get_symbol_version_helper): Rewrite to use
5810 (Version_script_info::print_expression_list): Adjust to use
5811 Version_script_info::Language.
5812 (script_push_lex_into_version_mode): Check that the version script
5813 has not been finalized.
5814 (version_script_push_lang): Change language string to
5815 Version_script_info::Language.
5816 * options.cc (Command_line::version_script): New function.
5817 * options.h (class General_options): Add finalize_dynamic_list
5818 function. Change version_script from declaration to definition.
5819 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
5820 * testsuite/version_script.map: Remove duplicate def of foo.
5821 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
5823 * testsuite/Makefile.in: Rebuild.
5825 2009-12-30 Ian Lance Taylor <iant@google.com>
5828 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
5829 if the input symbol index is 0, make the output symbol index 0.
5831 2009-12-30 Ian Lance Taylor <iant@google.com>
5834 * options.h (class General_options): Add -x/--discard-all.
5835 * object.cc (Sized_relobj::do_count_local_symbols): Handle
5836 --discard-all. If the local symbol needs a dynamic entry, check
5837 that before handling --discard-locals.
5839 2009-12-30 Ian Lance Taylor <iant@google.com>
5842 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
5844 (Output_segment::add_output_section): Don't change the flags if
5848 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
5849 GNU hash table if they need a dynamic value. Otherwise, don't add
5850 them if they are defined in a dynamic object or are forced local.
5852 2009-12-29 Ian Lance Taylor <iant@google.com>
5855 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
5856 .gnu.hash table for a 32-bit target.
5859 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
5860 regular and a dynamic object only needs a dynamic symbol table
5861 entry if it is externally visible.
5864 * i386.cc (class Target_i386): Initialize global_offset_table_ in
5865 constructor. Add global_offset_table_ field.
5866 (Target_i386::got_section): Set global_offset_table_.
5867 (Target_i386::do_finalize_sections): Set global_offset_table_
5869 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
5870 in constructor. Add global_offset_table_ field.
5871 (Target_x86_64::got_section): Set global_offset_table_.
5872 (Target_x86_64::do_finalize_sections): Set global_offset_table_
5875 * layout.cc (Layout::Layout): Initialize increase_relro_.
5876 (Layout::get_output_section): Add is_relro, is_last_relro, and
5877 is_first_non_relro parameters. Change all callers.
5878 (Layout::choose_output_section): Likewise.
5879 (Layout::add_output_section_data): Likewise.
5880 (Layout::make_output_section): Likewise.
5881 (Layout::set_segment_offsets): Clear increase_relro when using a
5883 * layout.h (class Layout): Add increase_relro method. Add
5884 increase_relro_ field. Update declarations.
5885 * output.cc (Output_section::Output_section): Initialize
5886 is_last_relro_ and is_first_non_relro_.
5887 (Output_segment::add_output_section): Group relro sections is
5888 do_sort is true. Handle is_last_relro and is_first_non_relro.
5889 (Output_segment::maximum_alignment): Remove relro handling.
5890 (Output_segment::set_section_addresses): Add increase_relro
5891 parameter. Change all callers. Add initial alignment to align
5892 relro sections on separate page. Remove old relro handling.
5893 (Output_segment::set_section_list_addresses): Remove in_relro
5894 parameter. Change all callers.
5895 (Output_segment::set_offset): Add increase parameter. Change all
5896 callers. Remove old relro handling.
5897 * output.h (class Output_section): Add new methods: is_last_relro,
5898 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
5899 Add is_last_relro_ and is_first_non_relro_ fields.
5900 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
5901 Create separate .got.plt section. Call increase_relro.
5902 * x86_64.cc (Target_x86_64::got_section): Likewise.
5903 * testsuite/relro_script_test.t: Add .got.plt.
5906 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
5907 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
5908 (Layout::finalize): Call set_dynamic_symbol_size.
5909 (Layout::set_dynamic_symbol_size): New function.
5910 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
5911 set_dynamic_symbol_size.
5914 * output.h (class Output_section): Add is_entsize_zero_ field.
5915 * output.cc (Output_section::Output_section): Initialize
5917 (Output_section::set_entsize): If two different entsizes are
5918 requested, force it to zero.
5919 (Output_section::add_input_section): Set flags for .debug_str
5920 before updating section flags. Set entsize.
5921 (Output_section::update_flags_for_input_section): Set SHF_MERGE
5922 and SHF_STRING if all input sections have those flags.
5924 2009-12-29 Rafael Espindola <espindola@google.com>
5926 * main.cc (main): Fix the sys time reporting.
5927 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
5930 2009-12-29 Sriraman Tallam <tmsriram@google.com>
5932 * options.cc (General_options::parse_version): Allow -v to exit
5933 without an error if there is nothing to link.
5935 2009-12-29 Ian Lance Taylor <iant@google.com>
5937 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
5938 using a version of gcc before 4.1.
5939 * configure: Rebuild.
5941 2009-12-28 Chris Demetriou <cgd@google.com>
5943 * attributes.cc (Output_attributes_section_data::do_write): Use
5944 std::vector::front rather than std::vector::data.
5946 2009-12-28 Ian Lance Taylor <iant@google.com>
5948 * symtab.h (class Symbol_table): Add enum Defined.
5949 * resolve.cc (Symbol_table::should_override): Add defined
5950 parameter. Change all callers. Test whether object is NULL
5951 before calling a method on it.
5952 (Symbol_table::report_resolve_problem): Add defined parameter.
5954 (Symbol_table::should_override_with_special): Likewise.
5955 * symtab.cc (Symbol_table::define_in_output_data): Add defined
5956 parameter. Change all callers.
5957 (Symbol_table::do_define_in_output_data): Likewise.
5958 (Symbol_table::define_in_output_segment): Likewise.
5959 (Symbol_table::do_define_in_output_segment): Likewise.
5960 (Symbol_table::define_as_constant): Likewise.
5961 (Symbol_table::do_define_as_constant): Likewise.
5962 * script.h (class Symbol_assignment): Add is_defsym parameter to
5963 constructor; change all callers.
5964 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
5965 parameter. Change all callers. Add is_defsym_ field.
5966 (class Parser_closure): Add parsing_defsym parameter to
5967 constructor; change all callers. Add parsing_defsym accessor
5968 function. Add parsing_defsym_ field.
5970 2009-12-28 Ian Lance Taylor <iant@google.com>
5972 * gold.cc (queue_middle_tasks): Fix formatting.
5973 * object.cc (Relobj::is_section_name_included): Likewise.
5975 2009-12-23 Ian Lance Taylor <iant@google.com>
5977 * i386.cc (Target_i386::do_calls_non_split): Recognize
5978 -fsplit-stack prologue for a function with a static chain.
5979 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
5980 -fsplit-stack prologue when using %r11.
5982 2009-12-21 Sriraman Tallam <tmsriram@google.com>
5984 * options.cc (General_options::parse_version): Make -v continue and do
5985 the link like GNU ld does.
5987 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
5989 * Makefile.am (CCFILES): Add timer.cc.
5990 (HFILES): Add timer.h.
5991 * configure.ac: Check for sysconf and times.
5992 * main.cc: include timer.h.
5993 (main): Use Timer instead of get_run_time.
5996 * workqueue.cc: include timer.h.
5997 (Workqueue::find_and_run_task):
5998 Report user, sys and wall time.
5999 * Makefile.in: Regenerate.
6000 * config.in: Regenerate.
6001 * configure: Regenerate.
6003 2009-12-16 Doug Kwan <dougkwan@google.com>
6005 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
6007 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
6008 relaxed input sections.
6009 * output.cc (Output_section::find_relaxed_input_section): Change
6010 return type to Output_relaxed_input_section pointer. Adjust code
6011 for new type of relaxed_input_section_map_.
6012 * output.h (Output_section::find_relaxed_input_section): Change
6013 return type to Output_relaxed_input_section pointer.
6014 (Output_section::Output_relaxed_input_section_by_input_section_map):
6016 (Output_section::relaxed_input_section_map_): Change type to
6017 Output_section::Output_relaxed_input_section_by_input_section_map.
6018 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
6021 2009-12-15 Ian Lance Taylor <iant@google.com>
6023 * layout.cc (Layout::create_shstrtab): Only write out after input
6024 sections if we are compressing debug sections.
6026 2009-12-15 Ian Lance Taylor <iant@google.com>
6028 * archive.cc (Archive::add_symbols): Only look up a symbol without
6029 a version if there is, in fact, a version.
6031 2009-12-14 Ian Lance Taylor <iant@google.com>
6033 Revert -Wshadow changes, all changes from:
6034 2009-12-11 Doug Kwan <dougkwan@google.com>
6035 2009-12-11 Nick Clifton <nickc@redhat.com>
6036 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
6038 2009-12-11 Doug Kwan <dougkwan@google.com>
6040 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
6042 * attributes.cc (Object_attribute::size): Ditto.
6043 (Attributes_section_data::size): Ditto.
6044 (Attributes_section_data::Attributes_section_data): Ditto.
6045 (Output_attributes_section_data::do_write): Ditto.
6046 * attributes.h (Object_attribute::set_type): Ditto.
6047 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
6049 2009-12-11 Nick Clifton <nickc@redhat.com>
6051 * archive.cc: Fix shadowed variable warnings.
6053 * compressed_output.cc: Likewise.
6054 * compressed_output.h: Likewise.
6055 * configure: Likewise.
6056 * dwarf_reader.cc: Likewise.
6057 * dynobj.cc: Likewise.
6058 * dynobj.h: Likewise.
6059 * ehframe.cc: Likewise.
6060 * ehframe.h: Likewise.
6061 * errors.cc: Likewise.
6062 * expression.cc: Likewise.
6063 * fileread.cc: Likewise.
6064 * fileread.h: Likewise.
6065 * freebsd.h: Likewise.
6066 * i386.cc: Likewise.
6068 * incremental.h: Likewise.
6069 * layout.cc: Likewise.
6070 * layout.h: Likewise.
6071 * mapfile.cc: Likewise.
6072 * merge.cc: Likewise.
6073 * merge.h: Likewise.
6074 * object.cc: Likewise.
6075 * object.h: Likewise.
6076 * options.h: Likewise.
6077 * output.cc: Likewise.
6078 * output.h: Likewise.
6079 * parameters.cc: Likewise.
6080 * plugin.cc: Likewise.
6081 * powerpc.cc: Likewise.
6082 * reduced_debug_output.cc: Likewise.
6083 * reduced_debug_output.h: Likewise.
6084 * reloc.cc: Likewise.
6085 * reloc.h: Likewise.
6086 * resolve.cc: Likewise.
6087 * script-sections.cc: Likewise.
6088 * script.cc: Likewise.
6089 * script.h: Likewise.
6090 * sparc.cc: Likewise.
6091 * symtab.cc: Likewise.
6092 * symtab.h: Likewise.
6093 * target-select.cc: Likewise.
6094 * target-select.h: Likewise.
6095 * token.h: Likewise.
6096 * workqueue.cc: Likewise.
6097 * workqueue.h: Likewise.
6098 * x86_64.cc: Likewise.
6100 2009-12-10 Doug Kwan <dougkwan@google.com>
6102 * arm.cc (attributes.h): New include.
6103 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
6104 (Arm_relobj::~Arm_relobj): Delete object pointed by
6105 attributes_section_data_.
6106 (Arm_relobj::attributes_section_data): New method definition.
6107 (Arm_relobj::attributes_section_data_): New data member declaration.
6108 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
6109 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
6110 attributes_section_data_.
6111 (Arm_dynobj::attributes_section_data): New method definition.
6112 (Arm_dynobj::attributes_section_data_): New data member declaration.
6113 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
6114 initialization value of may_use_blx_ to false.
6115 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
6116 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
6117 object attributes to compute results instead of hard-coding.
6118 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
6119 Target_arm::get_secondary_compatible_arch,
6120 Target_arm::set_secondary_compatible_arch
6121 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
6122 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
6123 New method declarations.
6124 (Target_arm::get_aeabi_object_attribute): New method definition.
6125 (Target_arm::attributes_section_data_): New data member declaration.
6126 (read_arm_attributes_section): New template definition.
6127 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
6128 (Arm_dynobj::do_read_symbols): Ditto.
6129 (Target_arm::do_finalize_sections): Merge attributes sections from
6130 input. Check for BLX use after attributes section merging.
6131 Fix __exidx_start and __exidx_end visibility. Create an
6132 .ARM.attributes section if necessary.
6133 (Target_arm::get_secondary_compatible_arch,
6134 Target_arm::set_secondary_compatible_arch,
6135 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
6136 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
6137 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
6138 New method definitions.
6140 2009-12-09 Ian Lance Taylor <iant@google.com>
6142 * plugin.cc (Plugin::load): Don't cast from void* to a function
6145 2009-12-09 Ian Lance Taylor <iant@google.com>
6147 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
6150 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
6152 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
6153 Replace two_file_shared_1.so with two_file_shared_2.so.
6154 * testsuite/Makefile.in: Regenerated.
6156 2009-12-08 Doug Kwan <dougkwan@google.com>
6158 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
6159 (HFILES): Add attributes.h and int_encoding.h.
6160 * Makefile.in: Regenerate.
6161 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
6162 function definitions to int_encoding.cc
6163 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
6164 prototypes to int_encoding.h
6165 * reduced_debug_output.cc (int_encoding.h): New include.
6166 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
6167 function definitions to int_encoding.cc
6168 (insert_into_vector, read_from_pointer): Move template definitions to
6170 * attributes.cc: New file.
6171 * attributes.h: New file.
6172 * int_encoding.cc: New file.
6173 * int_encoding.h: New file.
6175 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
6178 * incremental-dump.cc (dump_incremental_inputs): New.
6179 (main): Use dump_incremental_inputs.
6181 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
6184 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
6185 checking elfcpp::STT_FUNC.
6186 (Target_i386::Relocate::relocate): Likewise.
6187 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
6189 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
6190 symbols from shared libraries into normal FUNC symbols.
6192 * symtab.h (Symbol): Add is_func and use it.
6194 2009-12-05 Doug Kwan <dougkwan@google.com>
6196 * arm.cc (Target_arm::arm_info): Initialize new fields
6197 attributes_section and attributes_vendor.
6198 * i386.cc (Target_i386::i386_info): Same.
6199 * object.cc (Sized_relobj::do_layout): Skip attribute section.
6200 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
6201 fields attributes_section and attributes_vendor.
6202 * sparc.cc (Target_sparc::sparc_info): Same.
6203 * target.h (Target::attributes_section, Target::attributes_vendor,
6204 Target::is_attributes_section, Target::attribute_arg_type,
6205 Target::attributes_order): New method definitions.
6206 (Target::Target_info::attributes_section,
6207 Target::Target_info::attributes_vendor): New fields.
6208 (Target::do_attribute_arg_type, Target::do_attributes_order): New
6209 virtual method definitions.
6210 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
6211 attributes_section and attributes_vendor.
6212 * testsuite/testfile.cc (Target_test::test_target_info): Same.
6214 2009-12-05 Doug Kwan <dougkwan@google.com>
6216 * arm.cc: Update comments about interworking and stub generation.
6217 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
6218 considered as non-PIC.
6219 (Arm_relocate_functions::base_abs): Fix formatting.
6220 (Arm_relocate_functions::got_prel): Fix comment. Change interface
6221 of function to use GOT entry address instead of offset.
6222 (Target_arm::Scan::global): Issue an error if a symbol would need a
6223 PLT does not get one because it is untyped. Remove code to create
6224 dynamic symbols for relative branches.
6225 (Target_arm::Relocate::relocate: Use 0 instead of false since function
6226 takes unsigned integer instead of boolean.
6228 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
6230 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
6231 (two_file_test_LDADD): Likewise.
6232 (common_test_1_LDADD): Likewise.
6233 (exception_test_LDADD) Likewise.
6234 (weak_test_LDADD): Likewise.
6235 (many_sections_test_LDADD): Likewise.
6236 (initpri1_LDADD): Likewise.
6237 (script_test_1_LDADD): Likewise.
6238 (script_test_2_LDADD): Likewise.
6239 (justsyms_LDADD): Likewise.
6240 (binary_test_LDADD): Likewise.
6241 (large_LDADD): Likewise.
6242 * testsuite/Makefile.in: Regenerated.
6244 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
6246 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
6247 (Symbol_table::override_with_special): Likewise.
6248 (Symbol_table::add_from_object): Likewise.
6250 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
6252 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
6253 Don't set the data_offset twice.
6255 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
6257 * testsuite/Makefile.in: Regenerate.
6259 2009-12-03 Doug Kwan <dougkwan@google.com>
6261 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
6262 (Target_arm::do_finalize_sections): Add parameter for symbol table
6263 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
6264 * i386.cc (Target_i386::do_finalize_sections): Add an additional
6265 parameter for symbol table pointer.
6266 * layout.cc (Layout::finalize): Call Target::finalize_sections with
6267 an additional parameter for a pointer to symbol table.
6268 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
6269 parameter for a symbol table pointer.
6270 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
6271 * target.h (Target::finalize_sections, Target::do_finalize_sections):
6273 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
6274 parameter for a symbol table pointer.
6276 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
6278 * incremental.cc (Incremental_inputs_header)
6279 (Incremental_inputs_header_write, Incremental_inputs_entry)
6280 (Incremental_inputs_entry_write): Move ...
6281 * incremental.h (Incremental_inputs_header)
6282 (Incremental_inputs_header_write, Incremental_inputs_entry)
6283 (Incremental_inputs_entry_write): here.
6285 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
6287 * incremental.cc (make_sized_incremental_binary): Set the target.
6288 Error if it is incompatible.
6289 * output.h (Output_file): Add filename method.
6291 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
6293 * incremental.cc (Incremental_inputs_entry): Remove unused argument
6294 from the get_* methods.
6296 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
6298 * incremental-dump.cc (main): Check that the offeset of a script is 0.
6299 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
6300 Write 0 for the data_offset of scripts.
6302 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
6304 * testsuite/Makefile.am: Add the incremental_test.sh test.
6305 * testsuite/incremental_test.sh: New.
6306 * testsuite/incremental_test_1.c: New.
6307 * testsuite/incremental_test_2.c: New.
6309 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
6311 * incremental-dump.cc (main): Fix typos.
6313 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
6316 * incremental-dump.cc (main): Use llu to print 64 bit values.
6318 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
6319 H.J. Lu <hongjiu.lu@intel.com>
6321 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
6323 (incremental_dump_LDADD): Likewise.
6324 * Makefile.in: Regenerated.
6326 2009-11-25 Doug Kwan <dougkwan@google.com>
6330 2009-11-25 Doug Kwan <dougkwan@google.com>
6332 * arm.cc (Target_arm::Target_arm): Move method definition
6333 outside of class definition. Add code to handle
6334 --target1-rel, --target1-abs and --target2= options.
6335 (Target_arm::get_reloc_reloc_type): Change method to be
6336 non-static and const.
6337 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
6338 New data member declaration.
6339 (Target_arm::Scan::local, Target_arm::Scan::global,
6340 Target_arm::Relocate::relocate,
6341 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6342 Adjust call to Target_arm::get_real_reloc_type.
6343 (Target_arm::get_real_reloc_type): Use command line options
6344 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
6345 * options.h (--target1-rel, --target1-abs, --target2): New
6348 2009-11-25 Doug Kwan <dougkwan@google.com>
6350 * arm.cc (Target_arm::Target_arm): Move method definition outside of
6351 class definition. Add code to handle --target1-rel, --target1-abs
6352 and --target2= options.
6353 (Target_arm::get_reloc_reloc_type): Change method to be non-static
6355 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
6357 (Target_arm::Scan::local, Target_arm::Scan::global,
6358 Target_arm::Relocate::relocate,
6359 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
6360 call to Target_arm::get_real_reloc_type.
6361 (Target_arm::get_real_reloc_type): Use command line options to
6362 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
6363 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
6366 2009-11-25 Doug Kwan <dougkwan@google.com>
6368 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
6369 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
6370 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
6372 (Arm_relocate_functions::thm_call): Replace body with a call to
6373 Arm_relocate_functions::thumb_branch_common.
6374 (Arm_relocate_functions::thm_jump24,
6375 Arm_relocate_functions::thm_xpc22): New method definitions.
6376 (Arm_relocate_functions::thumb_branch_common): New method definition.
6377 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
6379 (Target_arm::Relocate::relocate): Adjust call to thm_call.
6380 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
6382 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
6384 * Makefile.am: Build incremental-dump
6385 * Makefile.in: Regenerate.
6386 * incremental-dump.cc: New.
6387 * incremental.cc (Incremental_inputs_header_data,
6388 Incremental_inputs_entry_data): Move to incremental.h
6389 * incremental.h: (Incremental_inputs_header_data,
6390 Incremental_inputs_entry_data): Move from incremental.cc
6392 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
6394 * incremental.cc (Incremental_inputs_header,
6395 Incremental_inputs_header_write, Incremental_inputs_entry,
6396 Incremental_inputs_entry_write): Add a typedef with the data type.
6398 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
6400 * incremental.cc (Incremental_inputs_header,
6401 Incremental_inputs_header_write, Incremental_inputs_entry,
6402 Incremental_inputs_entry_write): Update comment about which
6403 type has the filed descriptions.
6405 2009-11-15 Doug Kwan <dougkwan@google.com>
6407 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
6408 (Arm_relocate_functions::arm_branch_common): Change method defintion
6409 in class definition to a method declaration and update list of formal
6411 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
6412 Arm_relocation_functions::jump24): Adjust call to
6413 Arm_relocate_functions::arm_branch_common. Update list of formal
6415 (Arm_relocate_functions::xpc25): New method definition.
6416 (Arm_relocate_functions::arm_branch_common): Move method defintion
6417 out from class definition. Use stubs for mode-switching and extending
6419 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
6420 specially. Change code to enable use of stubs in ARM branches.
6422 2009-11-10 Doug Kwan <dougkwan@google.com>
6424 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
6425 in method declaration.
6426 (Target_arm::relocate_stub): New method declaration.
6427 (Target_arm::default_target): Change to return a pointer instead of
6429 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
6430 Target_arm::default_target.
6431 (Arm_Relobj::do_relocate_sections): Remove options paramater in
6433 (Target_arm::relocate_section): Adjust view.
6434 (Target_arm::relocate_stub): New method definition.
6436 2009-11-10 Doug Kwan <dougkwan@google.com>
6438 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
6440 * incremental.cc (open_incremental_binary): Initialized local
6441 variables to avoid warnings.
6442 * object.cc (make_elf_object): Ditto.
6443 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
6446 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
6449 * testsuite/plugin_test.c: Include "config.h".
6451 2009-11-09 Doug Kwan <dougkwan@google.com>
6453 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
6454 (arm_symbol_value): Remove.
6455 (Arm_relocate_functions::arm_branch_common,
6456 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
6457 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
6458 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
6459 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
6460 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
6461 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
6462 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
6463 Arm_relocate_functions::thm_mobw_abs_nc,
6464 Arm_relocate_functions::thm_mov_abs,
6465 Arm_relocate_functions::movw_prel_nc,
6466 Arm_relocate_functions::thm_movt_abs,
6467 Arm_relocate_functions::movt_prel,
6468 Arm_relocate_functions::thm_movw_prel_nc,
6469 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
6470 (Target_arm::Relocate::relocate): Only decompose address into two
6471 parts if relocation type uses the thumb-bit and pass the actual
6472 bit instead of a flag indicating that the thumb-bit is used. Adjust
6473 calls to methods in Arm_relocate_functions for this change.
6475 2009-11-08 Ian Lance Taylor <iant@google.com>
6478 * reloc.cc: Instantiate
6479 Sized_relobj::initialize_input_to_output_maps and
6480 Sized_relobj:free_input_to_output_maps.
6482 2009-11-06 Ian Lance Taylor <iant@google.com>
6485 * defstd.cc (in_segment): Set only_if_ref true for "end".
6487 2009-11-06 Doug Kwan <dougkwan@google.com>
6489 * arm.cc (class Reloc_stub): Correct a comment.
6490 (Target_arm::Target_arm): Initialize arm_input_section_map_.
6491 (Target_arm::scan_section_for_stubs): New method declaration.
6492 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
6493 Change methods from private to protected.
6494 (Target_arm::do_may_relax): New method definition.
6495 (Target_arm::do_relax, Target_arm::group_sections,
6496 Target_arm::scan_reloc_for_stub,
6497 Target_arm::scan_reloc_section_for_stubs): New method declarations.
6498 (Target_arm::arm_input_section_map_): New data member declaration.
6499 (Target_arm::scan_reloc_for_stub,
6500 Target_arm::scan_reloc_section_for_stubs,
6501 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
6502 Target_arm::do_relax): New method definitions.
6504 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
6506 * configure.ac: Check for (struct stat)::st_mtim
6507 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
6508 * config.in: Regenerate.
6509 * configure: Regenerate.
6511 2009-11-05 Ian Lance Taylor <iant@google.com>
6514 * output.cc (Output_segment::add_output_section): Add missing
6517 2009-11-04 Ian Lance Taylor <iant@google.com>
6520 * object.h (class Object): Add is_needed and set_is_needed
6521 methods. Add is_needed_ field. Make bool fields into bitfields.
6522 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
6523 defined in a dynamic object and referenced by a regular object,
6524 set is_needed for the dynamic object.
6525 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
6526 if the file is marked with as_needed and it is not needed.
6528 2009-11-04 Ian Lance Taylor <iant@google.com>
6531 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
6532 tags if data is discarded by linker script.
6533 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6534 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6535 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6536 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6538 2009-11-04 Ian Lance Taylor <iant@google.com>
6540 * layout.cc (Layout::get_output_section): Add is_interp and
6541 is_dynamic_linker_section parameters. Change all callers.
6542 (Layout::choose_output_section): Likewise.
6543 (Layout::make_output_section): Likewise.
6544 (Layout::add_output_section_data): Add is_dynamic_linker_section
6545 parameter. Change all callers.
6546 * layout.h (class Layout): Update declarations.
6547 * output.h (class Output_section): Add is_interp, set_is_interp,
6548 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
6549 Add is_interp_, is_dynamic_linker_section_ fields. Change
6550 generate_code_fills_at_write_ to a bitfield.
6551 * output.cc (Output_section::Output_sections): Initialize new
6553 (Output_segment::add_output_section): Add do_sort parameter.
6556 2009-11-03 Ian Lance Taylor <iant@google.com>
6559 * options.h (class General_options): Add --warn-common.
6560 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
6561 merging two common symbols.
6562 (Symbol_table::should_override): Handle --warn-common when merging
6563 a common symbol with a defined symbol. Use report_resolve_problem
6564 for multiple definitions.
6565 (Symbol_table::report_resolve_problem): New function.
6566 * symtab.h (class Symbol_table): Declare report_resolve_problem.
6568 2009-11-03 Doug Kwan <dougkwan@google.com>
6570 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
6572 (Target_arm::stub_factory): New method definition.
6573 (Target_arm::new_arm_input_section,
6574 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
6575 Target_arm::reloc_uses_thumb_bit): New method declarations.
6576 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
6577 New type definitions.
6578 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
6579 member declarations.
6580 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
6581 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
6582 New method definitions.
6584 2009-11-03 Ian Lance Taylor <iant@google.com>
6586 * options.h (class General_options): Add --warn_constructors.
6588 2009-11-03 Ian Lance Taylor <iant@google.com>
6591 * defstd.cc (in_section): Add entries for __rel_iplt_start,
6592 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
6594 2009-11-03 Ian Lance Taylor <iant@google.com>
6597 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
6598 --msgid-bugs-address.
6599 (install-pdf): New target.
6600 (install-data_yes): Look up one directory to find mkinstalldirs.
6602 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
6604 * po/Make-in (.po.gmo): Don't generate .gmo files in source
6607 2009-10-30 Doug Kwan <dougkwan@google.com>
6609 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
6611 2009-10-30 Doug Kwan <dougkwan@google.com>
6613 * arm.cc (Stub_addend_reader): New struct template definition
6614 and partial specializations.
6615 (Stub_addend_reader::operator()): New method definition for a
6616 partially specialized template.
6618 2009-10-30 Doug Kwan <dougkwan@google.com>
6620 * arm.cc (Arm_relobj::processor_specific_flags): New method
6622 (Arm_relobj::do_read_symbols): New method declaration.
6623 (Arm_relobj::processor_specific_flags_): New data member declaration.
6624 (Arm_dynobj): New class definition.
6625 (Target_arm::do_finalize_sections): Add input_objects parameter.
6626 (Target_arm::do_adjust_elf_header): New method declaration.
6627 (Target_arm::are_eabi_versions_compatible,
6628 (Target_arm::merge_processor_specific_flags): New method declaration.
6629 (Target_arm::do_make_elf_object): New overloaded method definitions
6631 (Arm_relobj::do_read_symbols): New method definition.
6632 (Arm_dynobj::do_read_symbols): Ditto.
6633 (Target_arm::do_finalize_sections): Add input_objects parameters.
6634 Merge processor-specific flags from all input objects.
6635 (Target_arm::are_eabi_versions_compatible,
6636 Target_arm::merge_processor_specific_flags,
6637 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
6638 New method definitions.
6639 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
6640 Input_objects pointer type parameter.
6641 * layout.cc (Layout::finalize): Pass input objects to target's.
6642 finalize_sections function.
6643 * output.cc (Output_file_header::do_sized_write): Set ELF file
6644 header's processor-specific flags.
6645 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
6646 Input_objects pointer type parameter.
6647 * sparc.cc (Target_sparc::do_finalize_sections): Same.
6648 * target.h (Input_objects): New forward class declaration.
6649 (Target::processor_specific_flags,
6650 Target::are_processor_specific_flags_sect): New method definitions.
6651 (Target::finalize_sections): Add input_objects parameter.
6652 (Target::Target): Initialize processor_specific_flags_ and
6653 are_processor_specific_flags_set_.
6654 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
6656 (Target::set_processor_specific_flags): New method definition.
6657 (Target::processor_specific_flags_,
6658 Target::are_processor_specific_flags_set_): New data member
6660 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
6661 Input_objects pointer type parameter.
6663 2009-10-30 Doug Kwan <dougkwan@google.com>
6665 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
6667 2009-10-28 Ian Lance Taylor <iant@google.com>
6669 * object.h (class Relobj): Drop options parameter from
6670 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
6671 do_scan_relocs, do_relocate. Change all callers.
6672 (class Sized_relobj): Drop options parameters from
6673 do_gc_process_relocs, do_scan_relocs, do_relocate,
6674 do_relocate_sections, relocate_sections, emit_relocs_scan,
6675 emit_relocs_scan_reltype. Change all callers.
6676 (struct Relocate_info): Remove options field and all references to
6678 * reloc.h (class Read_relocs): Remove options constructor
6679 parameter and options_ field. Change all callers.
6680 (class Gc_process_relocs, class Scan_relocs): Likewise.
6681 (class Relocate_task): Likewise.
6682 * target-reloc.h (scan_relocs): Remove options parameter. Change
6684 (scan_relocatable_relocs): Likewise.
6685 * target.h (class Sized_target): Remove options parameter from
6686 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
6688 * gc.h (gc_process_relocs): Remove options parameter. Change all
6690 * arm.cc: Update functions to remove options parameters.
6691 * i386.cc: Likewise.
6692 * powerpc.cc: Likewise.
6693 * sparc.cc: Likewise.
6694 * x86_64.cc: Likewise.
6695 * testsuite/testfile.cc: Likewise.
6697 2009-10-28 Doug Kwan <dougkwan@google.com>
6699 * arm.cc (Arm_relobj): New class definition.
6700 (Arm_relobj::scan_sections_for_stubs,
6701 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
6702 New method definitions.
6704 2009-10-28 Cary Coutant <ccoutant@google.com>
6706 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
6707 (Plugin::cleanup_done_): New member.
6708 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
6709 (Plugin_manager::cleanup_done_): Remove.
6710 (Plugin_manager::add_input_file): Edit error message.
6711 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
6712 (Plugin_manager::cleanup): Remove use of cleanup_done_.
6714 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
6716 * fileread.cc: (File_read::View::~View): Use the new
6717 data_ownership_ filed.
6718 (File_read::~File_read): Dispose the new whole_file_view_.
6719 (File_read::open): Mmap the whole file if needed.
6720 (File_read::open): Use whole_file_view_ instead of contents_.
6721 (File_read::find_view): Use whole_file_view_ if applicable.
6722 (File_read::do_read): Use whole_file_view_ instead of contents_.
6723 (File_read::make_view): Use whole_file_view_ instead of contents_,
6724 update File_read::View::View call.
6725 (File_read::find_or_make_view): Update File_read::View::View
6727 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
6729 (File_read::View::Data_ownership): New enum.
6730 (File_read::View::View): Replace bool mapped_ with Data_ownership
6732 (File_read::View::mapped_): Remove (replaced by data_ownership_).
6733 (File_read::View::data_ownership_): New field.
6734 (File_read::contents_): Remove (replaced by whole_file_view_).
6735 (File_read::whole_file_view_): New field.
6736 * options.h (class General_options): Add --keep-files-mapped.
6738 2009-10-27 Cary Coutant <ccoutant@google.com>
6740 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
6741 * testsuite/Makefile.am (plugin_test_5): New test case.
6742 * testsuite/Makefile.in: Regenerate.
6744 2009-10-25 Doug Kwan <dougkwan@google.com>
6746 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
6747 from private to protected to allow access by child class.
6748 (Sized_relobj::do_relocate_sections): New method declaration.
6749 (Sized_relobj::relocate_sections): Virtualize.
6750 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
6751 Sized_relobj::relocate_sections. Instantiate template explicitly
6752 for different target sizes and endianity.
6754 2009-10-24 Doug Kwan <dougkwan@google.com>
6756 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
6757 (Arm_input_section::as_arm_input_section): New method.
6758 (Arm_output_section): New class definition.
6759 (Arm_output_section::create_stub_group,
6760 Arm_output_section::group_sections): New method definitions.
6762 2009-10-22 Doug Kwan <dougkwan@google.com>
6764 * arm.cc (Arm_input_section): New class definition.
6765 (Arm_input_section::init, Arm_input_section:do_write,
6766 Arm_input_section::set_final_data_size,
6767 Arm_input_section::do_reset_address_and_file_offset): New method
6770 2009-10-21 Doug Kwan <dougkwan@google.com>
6772 * arm.cc (Stub_table, Arm_input_section): New forward class
6774 (Stub_table): New class defintion.
6775 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
6776 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
6777 New method definition.
6779 2009-10-21 Doug Kwan <dougkwan@google.com>
6781 * arm.cc: Update copyright comments.
6782 (Target_arm): New forward class template declaration.
6783 (Arm_address): New type.
6784 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
6785 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
6786 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
6788 (Insn_template): Same.
6789 (DEF_STUBS): New macro.
6790 (Stub_type): New enum type.
6791 (Stub_template): New class definition.
6794 (Stub_factory): Same.
6795 (Target_arm::Target_arm): Initialize may_use_blx_ and
6796 should_force_pic_veneer_.
6797 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
6798 Target_arm::should_force_pic_veneer,
6799 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
6800 Target_arm::using_thumb_only, Target_arm:;default_target): New
6802 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
6803 New data member declarations.
6804 (Insn_template::size, Insn_template::alignment): New method defintions.
6805 (Stub_template::Stub_template): New method definition.
6806 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
6807 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
6808 (Stub_factory::Stub_factory): New method definition.
6809 * gold.h (string_hash): New template.
6810 * output.h (Input_section_specifier::hash_value): Use
6812 (Input_section_specifier::string_hash): Remove.
6813 * stringpool.cc (Stringpool_template::string_hash): Use
6816 2009-10-20 Doug Kwan <dougkwan@google.com>
6818 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
6819 symbols of relaxed input sections.
6820 * output.h (Output_section::find_relaxed_input_section): Make
6823 2009-10-16 Doug Kwan <dougkwan@google.com>
6825 * dynobj.cc (Versions::Versions): Initialize version_script_.
6826 Only insert base version symbol definition for a shared object
6827 if version script defines any version versions.
6828 (Versions::define_base_version): New method definition.
6829 (Versions::add_def): Check that base version is not needed.
6830 (Versions::add_need): Define base version lazily.
6831 * dynobj.h (Versions::define_base_version): New method declaration.
6832 (Versions::needs_base_version_): New data member declaration.
6833 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
6834 (check_DATA): Add no_version_test.stdout.
6835 (libno_version_test.so, no_version_test.o no_version_test.stdout):
6837 * testsuite/Makefile.in: Regenerate.
6838 * testsuite/no_version_test.c: New file.
6839 * testsuite/no_version_test.sh: Ditto.
6841 2009-10-16 Doug Kwan <dougkwan@google.com>
6843 * expression.cc (class Segment_start_expression): New class definition.
6844 (Segment_start_expression::value): New method definition.
6845 (script_exp_function_segment_start): Return a new
6846 Segment_start_expression.
6847 * gold/script-c.h (script_saw_segment_start_expression): New function
6849 * script-sections.cc (Script_sections::Script_sections): Initialize
6850 SAW_SEGMENT_START_EXPRESSION_ to false.
6851 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
6852 and -Tbbs options to specify section addresses if given in
6853 command line and no SEGMENT_START expression is seen in a script.
6854 * script-sections.h (Script_sections::saw_segment_start_expression,
6855 Script_sections::set_saw_segment_start_expression): New method
6857 (Script_sections::saw_segment_start_expression_): New data member
6859 * script.cc (script_saw_segment_start_expression): New function.
6860 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
6861 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
6862 script_test_7.sh and script_test_8.sh.
6863 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
6864 script_test_8.stdout.
6865 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
6866 (script_test_6, script_test_6.stdout, script_test_7,
6867 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
6868 * Makefile.in: Regenerate.
6869 * testsuite/script_test_6.sh: New file.
6870 * testsuite/script_test_6.t: Same.
6871 * testsuite/script_test_7.sh: Same.
6872 * testsuite/script_test_7.t: Same.
6873 * testsuite/script_test_8.sh: Same.
6875 2009-10-16 Doug Kwan <dougkwan@google.com>
6877 * output.cc (Output_segment::set_section_list_address): Cast
6878 expressions to unsigned long long type to avoid format warnings.
6880 2009-10-15 Ian Lance Taylor <iant@google.com>
6882 * script.cc (Script_options::add_symbol_assignment): Always add a
6883 dot assignment to script_sections_.
6884 * script-sections.cc (Script_sections::add_dot_assignment):
6885 Initialize if necessary.
6887 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
6888 program headers with no load segment if there is a linker script.
6890 * layout.cc (Layout::set_segment_offsets): Align the file offset
6891 to the segment aligment for -N or -n with no load segment.
6892 * output.cc (Output_segment::add_output_section): Don't crash if
6893 the first section is a TLS section.
6894 (Output_segment::set_section_list_addresses): Print an error
6895 message if the address moves backward in a linker script.
6896 * script-sections.cc
6897 (Output_section_element_input::set_section_addresses): Don't
6898 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
6899 (Orphan_output_section::set_section_addresses): Likewise.
6901 2009-10-15 Doug Kwan <dougkwan@google.com>
6903 * layout.cc (Layout::finish_dynamic_section): Generate tags
6904 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
6905 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
6906 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
6908 2009-10-14 Ian Lance Taylor <iant@google.com>
6910 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
6912 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
6913 data_shdr fields of relinfo.
6914 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
6915 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
6916 R_386_TLS_LDO_32, adjust based on section flags.
6917 (Target_i386::Relocate::fix_up_ldo): Remove.
6919 2009-10-13 Ian Lance Taylor <iant@google.com>
6921 Add support for -pie.
6922 * options.h (class General_options): Add -pie and
6924 (General_options::output_is_position_independent): Test -pie.
6925 (General_options::output_is_executable): Return true if not shared
6926 and not relocatable.
6927 (General_options::output_is_pie): Remove.
6928 * options.cc (General_options::finalize): Reject incompatible uses
6930 * gold.cc (queue_middle_tasks): A -pie link is not static.
6931 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
6932 * symtab.cc (Symbol::final_value_is_known): Return false if
6933 output_is_position_independent.
6934 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
6935 output_is_position_independent.
6936 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
6937 output_is_position_independent.
6938 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
6939 output_is_position_independent.
6940 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
6942 (basic_pie_test.o, basic_pie_test): New targets.
6943 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
6944 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
6945 (two_file_pie_test): New target.
6946 * testsuite/Makefile.in: Rebuild.
6947 * README: Remove note saying that -pie is not supported.
6949 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
6951 * options.h (class General_options): Add -init and -fini.
6952 * layout.cc (Layout::finish_dynamic_section): Emit
6953 given init and fini functions.
6955 2009-10-13 Sriraman Tallam <tmsriram@google.com>
6957 * gc.h (gc_process_relocs): Check if icf is enabled using new
6959 * gold.cc (queue_initial_tasks): Likewise.
6960 (queue_middle_tasks): Likewise.
6961 * object.cc (do_layout): Likewise.
6962 * symtab.cc (is_section_folded): Likewise.
6963 * main.cc (main): Likewise.
6964 * reloc.cc (Read_relocs::run): Likewise.
6965 (Sized_relobj::do_scan_relocs): Likewise.
6966 * icf.cc (is_function_ctor_or_dtor): New function.
6967 (Icf::find_identical_sections): Check if function is ctor or dtor when
6969 * options.h (General_options::icf): Change option to be an enum.
6970 (Icf_status): New enum.
6971 (icf_enabled): New method.
6972 (icf_safe_folding): New method.
6973 (set_icf_status): New method.
6974 (icf_status_): New variable.
6975 * (options.cc) (General_options::finalize): Set icf_status_.
6976 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
6977 icf_test and icf_keep_unique_test to use the --icf enum flag.
6978 * testsuite/icf_safe_test.sh: New file.
6979 * testsuite/icf_safe_test.cc: New file.
6981 2009-10-12 Sriraman Tallam <tmsriram@google.com>
6983 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
6984 includes to gc.h and icf.h.
6985 * arm.cc: Include gc.h.
6986 * gold.cc: Likewise.
6987 * i386.cc: Likewise.
6988 * powerpc.cc: Likewise.
6989 * sparc.cc: Likewise.
6990 * x86_64.cc: Likewise.
6991 * gc.h: Include icf.h.
6993 2009-10-11 Ian Lance Taylor <iant@google.com>
6995 * plugin.cc: Include "gold.h" before other header files.
6997 2009-10-10 Chris Demetriou <cgd@google.com>
6999 * options.h (Input_file_argument::Input_file_type): New enum.
7000 (Input_file_argument::is_lib_): Replace with...
7001 (Input_file_argument::type_): New member.
7002 (Input_file_argument::Input_file_argument): Take Input_file_type
7003 'type' rather than boolean 'is_lib' as second argument.
7004 (Input_file_argument::is_lib): Use type_.
7005 (Input_file_argument::is_searched_file): New function.
7006 (Input_file_argument::may_need_search): Handle is_searched_file.
7007 * options.cc (General_options::parse_library): Support -l:filename.
7008 (General_options::parse_just_symbols): Update for Input_file_argument
7010 (Command_line::process): Likewise.
7011 * archive.cc (Archive::get_file_and_offset): Likewise.
7012 * plugin.cc (Plugin_manager::release_input_file): Likewise.
7013 * script.cc (read_script_file, script_add_file): Likewise.
7014 * fileread.cc (Input_file::Input_file): Likewise.
7015 (Input_file::will_search_for): Handle is_searched_file.
7016 (Input_file::open): Likewise.
7017 * readsyms.cc (Read_symbols::get_name): Likewise.
7018 * testsuite/Makefile.am (searched_file_test): New test.
7019 * testsuite/Makefile.in: Regenerate.
7020 * testsuite/searched_file_test.cc: New file.
7021 * testsuite/searched_file_test_lib.cc: New file.
7023 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7024 Ian Lance Taylor <iant@google.com>
7026 * descriptor.cc: Include <cstdio> and "binary-io.h".
7027 (Descriptors::open): Open the files in binary mode always.
7028 * script.cc (Lex::get_token): Treat \r as whitespace.
7030 2009-10-09 Ian Lance Taylor <iant@google.com>
7032 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
7034 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7035 Ian Lance Taylor <iant@google.com>
7037 * configure.ac: Check for readv function also.
7038 * fileread.cc (readv): Define if not HAVE_READV.
7039 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
7041 * config.in: Regenerate.
7042 * configure: Regenerate.
7044 2009-10-09 Doug Kwan <dougkwan@google.com>
7046 * layout.cc (Layout::make_output_section): Call target hook to make
7047 ordinary output section.
7048 (Layout::finalize): Adjust parameter list of call the
7049 Target::may_relax().
7050 * layout.h (class Layout::section_list): New method.
7051 * merge.h (Output_merge_base::entsize): Change visibility to public.
7052 (Output_merge_base::is_string, Output_merge_base::do_is_string):
7054 (Output_merge_string::do_is_string): New method.
7055 * object.cc (Sized_relobj::do_setup): renamed from
7056 Sized_relobj::set_up.
7057 * object.h (Sized_relobj::adjust_shndx,
7058 Sized_relobj::initializ_input_to_output_maps,
7059 Sized_relobj::free_input_to_output_maps): Change visibilities to
7061 (Sized_relobj::setup): Virtualize.
7062 (Sized_relobj::do_setup): New method declaration.
7063 (Sized_relobj::invalidate_section_offset,
7064 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
7065 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
7066 * options.cc (parse_int): New function.
7067 * options.h (parse_int): New declaration.
7068 (DEFINE_int): New macro.
7069 (stub_group_size): New option.
7070 * output.cc (Output_section::Output_section): Initialize memebers
7071 merge_section_map_, merge_section_by_properties_map_,
7072 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
7073 (Output_section::add_input_section): Handled deferred code-fill
7074 generation and remove an old comment.
7075 (Output_section::add_relaxed_input_section): New method definition.
7076 (Output_section::add_merge_input_section): Use merge section by
7077 properties map to speed to search. Update merge section maps
7079 (Output_section::build_relaxation_map): New method definition.
7080 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7082 (Output_section::relax_input_section): Renamed to
7083 Output_section::convert_input_sections_to_relaxed_sections and change
7084 interface to take a vector of pointers to relaxed sections.
7085 (Output_section::find_merge_section,
7086 Output_section::find_relaxed_input_section): New method definitions.
7087 (Output_section::is_input_address_mapped,
7088 Output_section::output_offset, Output_section::output_address):
7089 Use output section data maps to speed up searching.
7090 (Output_section::find_starting_output_address): Add comments.
7091 (Output_section::do_write,
7092 Output_section::write_to_postprocessing_buffer): Do code-fill
7093 generation as appropriate.
7094 (Output_section::get_input_sections): Invalidate relaxed input section
7096 (Output_section::restore_states): Adjust type of checkpoint .
7097 Invalidate relaxed input section map.
7098 * output.h (Output_merge_base): New class declaration.
7099 (Input_section_specifier): New class defintion.
7100 (class Output_relaxed_input_section) Change base class to
7101 Output_section_data_build.
7102 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
7103 base class initializer.
7104 (Output_section::add_relaxed_input_section): New method declaration.
7105 (Output_section::Input_section): Change visibility to protected.
7106 (Output_section::Input_section::relobj,
7107 Output_section::Input_section::shndx): Handle relaxed input sections.
7108 Output_section::input_sections) Change visibility to protected. Also
7109 define overload to return a non-const pointer.
7110 (Output_section::Merge_section_properties): New class defintion.
7111 (Output_section::Merge_section_by_properties_map,
7112 Output_section::Output_section_data_by_input_section_map,
7113 Output_section::Relaxation_map): New types.
7114 (Output_section::relax_input_section): Rename method to
7115 Output_section::convert_input_sections_to_relaxed_sections and change
7116 interface to take a vector of relaxed section pointers.
7117 (Output_section::find_merge_section,
7118 Output_section::find_relaxed_input_section,
7119 Output_section::build_relaxation_map,
7120 Output_section::convert_input_sections_in_list_to_relaxed_sections):
7121 New method declarations.
7122 (Output_section::merge_section_map_
7123 Output_section::merge_section_by_properties_map_,
7124 Output_section::relaxed_input_section_map_,
7125 Output_section::is_relaxed_input_section_map_valid_,
7126 Output_section::generate_code_fills_at_write_): New data members.
7127 * script-sections.cc
7128 (Output_section_element_input::set_section_addresses): Call
7129 current_data_size and addralign methods of relaxed input sections.
7130 (Orphan_output_section::set_section_addresses): Call current_data_size
7131 and addralign methods of relaxed input sections.
7132 * symtab.cc (Symbol_table::compute_final_value): Extract template
7133 from the body of Symbol_table::sized_finalize_symbol.
7134 (Symbol_table::sized_finalized_symbol): Call
7135 Symbol_table::compute_final_value.
7136 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
7137 (Symbol_table::compute_final_value): New templated method declaration.
7138 * target.cc (Target::do_make_output_section): New method defintion.
7139 * target.h (Target::make_output_section): New method declaration.
7140 (Target::relax): Add more parameters for input objects, symbol table
7141 and layout. Adjust call to do_relax.
7142 (Target::do_make_output_section): New method declaration.
7143 (Target::do_relax): Add parameters for input objects, symbol table
7146 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7148 * pread.c: Include stdio.h.
7150 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7152 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
7155 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7157 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7158 Change read_shndx type to unsigned int.
7159 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
7161 (Sized_dwarf_line_info::read_line_mappings): Likewise.
7162 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
7163 Change read_shndx type to unsigned int.
7164 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
7166 (Sized_dwarf_line_info::read_line_mappings): Likewise.
7167 * layout.cc (Layout::create_symtab_sections): Cast the result of
7168 local_symcount * symsize to off_t in the gold_assert.
7170 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7172 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
7173 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
7175 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
7176 (Arm_relocate_functions::thm_abs5): New function.
7177 (Arm_relocate_functions::abs12): New function.
7178 (Arm_relocate_functions::abs16): New function.
7179 (Arm_relocate_functions::base_abs): New function.
7180 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
7181 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
7182 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
7184 (Scan::global): Likewise.
7185 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
7186 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
7187 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
7188 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
7191 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7193 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
7194 (Arm_relocate_functions::movt_prel): New function.
7195 (Arm_relocate_functions::thm_movw_prel_nc): New function.
7196 (Arm_relocate_functions::thm_movt_prel): New function.
7197 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
7198 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
7199 (Scan::global, Relocate::relocate): Likewise.
7200 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7202 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
7204 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
7205 Incremental_checker.
7206 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
7208 (class Incremental_inputs_header): New class.
7209 (Incremental_inputs_header_writer): Edit comment.
7210 (Incremental_inputs_entry): New class.
7211 (Incremental_inputs_entry_writer): Edit comment.
7212 (Sized_incremental_binary::do_find_incremental_inputs_section):
7213 Add *strtab_shndx parameter, fill it.
7214 (Sized_incremental_binary::do_check_inputs): New method.
7215 (Incremental_checker::can_incrementally_link_output_file): Use
7216 Sized_incremental_binary::check_inputs.
7217 (Incremental_inputs::report_command_line): Save command line in
7220 (Incremental_binary::find_incremental_inputs_section): New
7222 (Incremental_binary::do_find_incremental_inputs_section): Add
7223 strtab_shndx parameter.
7224 (Incremental_binary::do_check_inputs): New pure virtual method.
7225 (Sized_incremental_binary::do_check_inputs): Declare.
7226 (Incremental_checker::Incremental_checker): Add incremental_inputs
7227 parameter, use it to initialize incremental_inputs_.
7228 (Incremental_checker::incremental_inputs_): New field.
7229 (Incremental_checker::command_line): New method.
7230 (Incremental_checker::inputs): New method.
7231 (Incremental_checker::command_line_): New field.
7233 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
7235 * incremental.cc: Include <cstdarg> and "target-select.h".
7236 (vexplain_no_incremental): New function.
7237 (explain_no_incremental): New function.
7238 (Incremental_binary::error): New method.
7239 (Sized_incremental_binary::do_find_incremental_inputs_section): New
7241 (make_sized_incremental_binary): New function.
7242 (open_incremental_binary): New function.
7243 (can_incrementally_link_file): Add checks if output is ELF and has
7245 * incremental.h: Include "elfcpp_file.h" and "output.h".
7246 (Incremental_binary): New class.
7247 (Sized_incremental_binary): New class.
7248 (open_incremental_binary): Declare.
7249 * object.cc (is_elf_object): Use
7250 elfcpp::Elf_recognizer::is_elf_file.
7251 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
7252 * output.h (Output_file::filesize): New method.
7254 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7256 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
7258 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
7259 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
7261 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
7263 (Arm_relocate_functions::movw_abs_nc): New function.
7264 (Arm_relocate_functions::movt_abs): New function.
7265 (Arm_relocate_functions::thm_movw_abs_nc): New function.
7266 (Arm_relocate_functions::thm_movt_abs): New function.
7267 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
7268 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
7269 (Scan::global): Likewise.
7270 (Relocate::relocate): Likewise.
7271 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7273 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7275 * arm.cc (Arm_relocate_functions::got_prel) New function.
7276 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
7277 (Relocate::relocate): Likewise.
7278 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7280 2009-10-06 Ian Lance Taylor <iant@google.com>
7282 * options.h (class General_options): Define
7283 split_stack_adjust_size parameter.
7284 * object.h (class Object): Add uses_split_stack_ and
7285 has_no_split_stack_ fields. Add uses_split_stack and
7286 has_no_split_stack accessor functions. Declare
7287 handle_split_stack_section.
7288 (class Reloc_symbol_changes): Define.
7289 (class Sized_relobj): Define Function_offsets. Declare
7290 split_stack_adjust, split_stack_adjust_reltype, and
7292 * object.cc (Object::handle_split_stack_section): New function.
7293 (Sized_relobj::do_layout): Call handle_split_stack_section.
7294 * dynobj.cc (Sized_dynobj::do_layout): Call
7295 handle_split_stack_section.
7296 * reloc.cc (Sized_relobj::relocate_sections): Call
7297 split_stack_adjust for executable sections in split_stack
7298 objects. Pass reloc_map to relocate_section.
7299 (Sized_relobj::split_stack_adjust): New function.
7300 (Sized_relobj::split_stack_adjust_reltype): New function.
7301 (Sized_relobj::find_functions): New function.
7302 * target-reloc.h: Include "object.h".
7303 (relocate_section): Add reloc_symbol_changes parameter. Change
7305 * target.h (class Target): Add calls_non_split method. Declare
7306 do_calls_non_split virtual method. Declare match_view and
7308 * target.cc: Include "elfcpp.h".
7309 (Target::do_calls_non_split): New function.
7310 (Target::match_view): New function.
7311 (Target::set_view_to_nop): New function.
7312 * gold.cc (queue_middle_tasks): Give an error if mixing
7313 split-stack and non-split-stack objects with -r.
7314 * i386.cc (Target_i386::relocate_section): Add
7315 reloc_symbol_changes parameter.
7316 (Target_i386::do_calls_non_split): New function.
7317 * x86_64.cc (Target_x86_64::relocate_section): Add
7318 reloc_symbol_changes parameter.
7319 (Target_x86_64::do_calls_non_split): New function.
7320 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
7322 * powerpc.cc (Target_powerpc::relocate_section): Add
7323 reloc_symbol_changes parameter.
7324 * sparc.cc (Target_sparc::relocate_section): Add
7325 reloc_symbol_changes parameter.
7326 * configure.ac: Call AM_CONDITIONAL for the default target.
7327 * configure: Rebuild.
7328 * testsuite/Makefile.am (TEST_AS): New variable.
7329 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
7330 (check_DATA): Add split_i386 and split_x86_64 files.
7331 (SPLIT_DEFSYMS): Define.
7332 (split_i386_[1234n].o): New targets.
7333 (split_i386_[124]): New targets.
7334 (split_i386_[1234r].stdout): New targets.
7335 (split_x86_64_[1234n].o): New targets.
7336 (split_x86_64_[124]): New targets.
7337 (split_x86_64_[1234r].stdout): New targets.
7338 (MOSTLYCLEANFILES): Add new executables.
7339 * testsuite/split_i386.sh: New file.
7340 * testsuite/split_x86_64.sh: New file.
7341 * testsuite/split_i386_1.s: New file.
7342 * testsuite/split_i386_2.s: New file.
7343 * testsuite/split_i386_3.s: New file.
7344 * testsuite/split_i386_4.s: New file.
7345 * testsuite/split_i386_n.s: New file.
7346 * testsuite/split_x86_64_1.s: New file.
7347 * testsuite/split_x86_64_2.s: New file.
7348 * testsuite/split_x86_64_3.s: New file.
7349 * testsuite/split_x86_64_4.s: New file.
7350 * testsuite/split_x86_64_n.s: New file.
7351 * testsuite/testfile.cc (Target_test): Update relocation_section
7353 * testsuite/Makefile.in: Rebuild.
7355 2009-10-06 Ian Lance Taylor <iant@google.com>
7357 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
7358 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
7359 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
7360 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
7361 the address on ldo_addrs_.
7362 (Target_i386::Relocate::fix_up_ldo): New function.
7364 2009-10-06 Rafael Espindola <espindola@google.com>
7366 * plugin.cc (add_input_library): New.
7367 (Plugin::load): Add add_input_library to tv.
7368 (Plugin_manager::add_input_file): Add the is_lib argument.
7369 (add_input_file): Update call to Plugin_manager::add_input_file.
7370 (add_input_library): New.
7371 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
7373 2009-09-30 Doug Kwan <dougkwan@google.com>
7375 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
7376 symbol and call Symbol::may_need_copy_reloc to determine if
7377 a copy reloc is needed.
7378 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
7379 nocopyreloc is given in command line.
7380 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
7381 given in command line.
7382 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
7383 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
7384 of the removed Target_i386::may_need_copy_reloc.
7385 * options.h (copyreloc): New option with default value false.
7386 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
7387 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
7388 instead of the removed Target_powerpc::may_need_copy_reloc.
7389 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
7390 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
7391 instead of the removed Target_sparc::may_need_copy_reloc.
7392 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
7393 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
7394 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
7395 instead of the removed Target_x86_64::may_need_copy_reloc.
7397 2009-09-30 Ian Lance Taylor <iant@google.com>
7399 * object.h (class Object): Remove target_ field, and target,
7400 sized_target, and set_target methods.
7401 (Object::sized_target): Remove.
7402 (class Sized_relobj): Update declarations. Remove sized_target.
7403 * object.cc (Sized_relobj::setup): Remove target parameter.
7405 (Input_objects::add_object): Don't do anything with the target.
7406 (make_elf_sized_object): Add punconfigured parameter. Change all
7407 callers. Set or test parameter target.
7408 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
7410 * parameters.cc (Parameters::set_target): Change parameter type to
7412 (Parameters::default_target): Remove.
7413 (set_parameters_target): Change parameter type to be non-const.
7414 (parameters_force_valid_target): New function.
7415 (parameters_clear_target): New function.
7416 * parameters.h (class Parameters): Update declarations. Remove
7417 default_target method. Add sized_target and clear_target
7418 methods. Change target_ to be non-const.
7419 (set_parameters_target): Update declaration.
7420 (parameters_force_valid_target): Declare.
7421 (parameters_clear_target): Declare.
7422 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
7423 as NULL if we aren't searching.
7424 (Add_symbols::run): Don't check for compatible target.
7425 * fileread.cc (Input_file::open_binary): Call
7426 parameters_force_valid_target.
7427 * gold.cc (queue_middle_tasks): Likewise.
7428 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
7429 set_target on object.
7430 * dynobj.h (class Sized_dynobj): Update declarations.
7431 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
7432 make_elf_object returns NULL.
7433 (Archive::include_member): Don't check whether object target is
7435 * output.cc (Output_section::add_input_section): Get target from
7437 (Output_section::relax_input_section): Likewise.
7438 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
7440 (Sized_relobj::do_scan_relocs): Likewise.
7441 (Sized_relobj::relocate_sections): Likewise.
7442 * resolve.cc (Symbol_table::resolve): Likewise.
7443 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
7444 parameter. Change all callers.
7445 (Symbol_table::add_from_object): Get target from parameters.
7446 (Symbol_table::add_from_relobj): Don't check object target.
7447 (Symbol_table::add_from_dynobj): Likewise.
7448 (Symbol_table::define_special_symbol): Get target from
7450 * symtab.h (class Symbol_table): Update declaration.
7451 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
7452 parameter. Change all callers. Clear parameter target.
7453 (Binary_test): Test target here.
7454 * testsuite/object_unittest.cc (gold_testsuite): Remove
7455 target_test_pointer parameter. Change all callers.
7456 (Object_test): Test target here.
7458 2009-09-26 Ian Lance Taylor <iant@google.com>
7460 * testsuite/initpri1.c: Don't try to use constructor priorities if
7461 compiling with gcc before 4.3.
7463 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
7465 * testsuite/retain_symbols_file_test.sh (check_present): Change
7466 output file name to retain_symbols_file_test.stdout.
7467 (check_absent): Likewise.
7469 2009-09-18 Craig Silverstein <csilvers@google.com>
7471 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
7472 * options.cc: Include <cerrno> and <fstream>.
7473 (General_options::finalize): Parse -retain-symbols-file tag.
7474 * options.h: New flag.
7475 (General_options): New method should_retain_symbol, new
7476 variable symbols_to_retain.
7477 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
7478 should_retain_symbol map.
7479 * testsuite/Makefile.am (retain_symbols_file_test): New test.
7480 * testsuite/Makefile.in: Regenerate.
7481 * testsuite/retain_symbols_file_test.sh: New file.
7483 2009-09-18 Nick Clifton <nickc@redhat.com>
7485 * po/es.po: Updated Spanish translation.
7487 2009-09-17 Doug Kwan <dougkwan@google.com>
7489 * debug.h (DEBUG_RELAXATION): New constant.
7490 (DEBUG_ALL): Add DEBUG_RELAXATION.
7491 (debug_string_to_enum): Add relaxation debug option.
7493 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
7494 Layout::Relaxation_debug_check::read_sections,
7495 Layout::Relaxation_debug_check::read_sections): New method definitions.
7496 (Layout::Layout): Initialize data members
7497 record_output_section_data_from_scrips_,
7498 script_output_section_data_list_ and relaxation_debug_check_.
7499 (Layout::save_segments, Layout::restore_segments,
7500 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7501 Layout::relaxation_loop_body): New method definitions.
7502 (Layout::finalize): Support relaxation. Move section layout code to
7503 Layout::relaxation_loop_body.
7504 (Layout::set_asection_address_from_script): Move code for orphan
7505 section placement out.
7506 (Layout::place_orphan_sections_in_script): New method definition.
7507 * layout.h (Output_segment_headers, Output_file_header):
7508 New forward class declarations.
7509 (Layout::~Layout): Define.
7510 (Layout::new_output_section_data_from_script): New method definition.
7511 (Layout::place_orphan_sections_in_script): New method declaration.
7512 (Layout::Segment_states): New type declaration.
7513 (Layout::save_segments, Layout::restore_segments,
7514 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7515 Layout::relaxation_loop_body): New method declarations.
7516 (Layout::Output_section_data_list): New type declaration.
7517 (Layout::Relaxation_debug_check): New class definition.
7518 (Layout::record_output_section_data_from_script_,
7519 Layout::script_output_section_data_list_, Layout::segment_states_,
7520 Layout::relaxation_debug_check_): New data members.
7521 * output.cc: (Output_section_headers::do_size): New method definition.
7522 (Output_section_headers::Output_section_headers): Move size
7523 computation to Output_section_headers::do_size.
7524 (Output_segment_headers::do_size): New method definition.
7525 (Output_file_header::Output_file_header): Move size computation to
7526 Output_file_header::do_size and call it.
7527 (Output_file_header::do_size): New method definition.
7528 (Output_data_group::Output_data_group): Adjust call to
7529 Output_section_data.
7530 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
7531 (Output_symtab_xindex::do_write): Add array bound check.
7532 (Output_section::Input_section::print_to_mapfile): Handle
7533 RELAXED_INPUT_SECTION_CODE.
7534 (Output_section::Output_section): Initialize data member checkpoint_.
7535 (Output_section::~Output_section): Delete checkpoint object pointed
7537 (Output_section::add_input_section): Always add an Input_section if
7539 (Output_section::add_merge_input_section): Add assert.
7540 (Output_section::relax_input_section): New method definition.
7541 (Output_section::set_final_data_size): Set load address to zero for
7542 an unallocated section.
7543 (Output_section::do_address_and_file_offset_have_reset_values):
7544 New method definition.
7545 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
7546 Handle relaxed input section.
7547 (Output_section::sort_attached_input_sections): Checkpoint input
7548 section list lazily.
7549 (Output_section::get_input_sections): Change type of input_sections to
7550 list of Simple_input_section pointers. Checkpoint input section list
7551 lazily. Also handle relaxed input sections.
7552 (Output_section::add_input_section_for_script): Take a reference to
7553 a Simple_input_section object instead of Relobj pointer and section
7554 index as parameter. Handle relaxed input sections.
7555 (Output_section::save_states, Output_section::restore_states): New
7557 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
7558 (Output_data::is_data_size_fixed): New method definition.
7559 (Output_data::reset_addresss_and_file_offset): Do not reset data size
7561 (Output_data::address_and_file_offset_have_reset_values): New method
7563 (Output_data::do_address_and_file_offset_have_reset_values): New method
7565 (Output_data::set_data_size): Check that data size is not fixed.
7566 (Output_data::fix_data_size): New method definition.
7567 (Output_data::is_data_size_fixed_): New data member.
7568 (Output_section_headers::set_final_data_size): New method definition.
7569 (Output_section_headers::do_size): New method declaration.
7570 (Output_segment_headers::set_final_data_size): New method definition.
7571 (Output_segment_headers::do_size): New method declaration.
7572 (Output_file_header::set_final_data_size)::New method definition.
7573 (Output_file_header::do_size)::New method declaration.
7574 (Output_section_data::Output_section_data): Add new parameter
7575 is_data_size_fixed and use it to fix data size.
7576 (Output_data_const::Output_data_const): Adjust call to base class
7577 constructor and fix data size.
7578 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
7579 base class constructor and fix data size.
7580 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
7581 base class constructor and fix data size.
7582 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
7583 class constructor and fix data size.
7584 (Output_data_group::set_final_data_size): New method definition.
7585 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
7586 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
7587 class constructor and fix data size.
7588 (Output_relaxed_input_section): New class definition.
7589 (Output_section::Simple_input_section): New class definition.
7590 (Output_section::get_input_sections): Adjust parameter list.
7591 (Output_section::add_input_section_for_script): Same.
7592 (Output_section::save_states, Output_section::restore_states,
7593 Output_section::do_address_and_file_offset_have_reset_values,
7594 (Output_section::Input_section::Input_section): Handle
7595 RELAXED_INPUT_SECTION_CODE. Add new overload for
7596 Output_relaxed_input_section.
7597 (Output_section::Input_section::is_input_section,
7598 Output_section::Input_section::set_output_section): Handle relaxed
7600 (Output_section::Input_section::is_relaxed_input_section,
7601 Output_section::Input_section::output_section_data,
7602 Output_section::Input_section::relaxed_input_section): New method
7604 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
7606 (Output_section::Input_section::u1_): Update comments.
7607 (Output_section::Input_section::u2_): Add new union member poris.
7608 (Output_section::Checkpoint_output_section): New classs definition.
7609 (Output_section::relax_input_section): New method declaration.
7610 (Output_section::checkpoint_): New data member.
7611 (Output_segment): Update comments.
7612 (Output_segment::Output_segment): Un-privatize copy constructor.
7613 (Output_segment::operator=): Un-privatize.
7614 * script-sections.cc (Output_section_element::Input_section_list):
7615 Change element type to Output_section::Simple_input_section.
7616 (Output_section_element_dot_assignment::set_section_addresses):
7617 Register output section data for relaxation clean up.
7618 (Output_data_exression::Output_data_expression): Adjust call to base
7619 constructor to fix data size.
7620 (Output_section_element_data::set_section_addresses): Register
7621 Output_data_expression object for relaxation clean up.
7622 (struct Input_section_info): Replace Relobj pointer and section index
7623 pair with Output_section::Simple_input_section and Convert struct to a
7625 (Input_section_sorter::operator()): Adjust access to
7626 Input_section_info data member to use accessors.
7627 (Output_section_element_input::set_section_addresses): Use layout
7628 parameter. Adjust code to use Output_section::Simple_input_section
7629 and Input_secction_info classes. Register filler for relaxation
7631 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
7632 and section index pair with Output_section::Simple_input_section
7633 class. Adjust code accordingly.
7634 (Phdrs_element::release_segment): New method definition.
7635 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
7637 (Script_sections::release_segments): New method definition.
7638 * gold/script-sections.h (Script_sections::release_segments): New
7640 * gold/target.h (Target::may_relax, Target::relax,
7641 Target::do_may_relax, Target::do_relax): New method definitions.
7643 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7645 * arm.cc (has_signed_unsigned_overflow): New function.
7646 (Arm_relocate_functions::abs8): New function.
7647 (Target_arm::Scan::local): Handle R_ARM_ABS8.
7648 (Target_arm::Scan::global): Likewise.
7649 (Target_arm::relocate::relocate): Likewise.
7650 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7653 2009-09-16 Cary Coutant <ccoutant@google.com>
7655 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
7656 * testsuite/Makefile.in: Regenerate.
7658 2009-09-11 Nick Clifton <nickc@redhat.com>
7660 * po/gold.pot: Updated by the Translation project.
7662 2009-09-08 Cary Coutant <ccoutant@google.com>
7664 * output.cc (Output_file::open): Add execute permission to empty file.
7665 * testsuite/Makefile.am (permission_test): New test.
7666 * testsuite/Makefile.in: Regenerate.
7668 2009-09-02 Ian Lance Taylor <iant@google.com>
7670 * output.cc (Output_file::resize): Call map_no_anonymous rather
7673 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
7675 * gold.cc: Include "incremental.h".
7676 (queue_initial_tasks): Call Incremental_checker methods.
7677 * incremental.cc: Include "output.h".
7678 (Incremental_checker::can_incrementally_link_output_file): New
7680 * incremental.h (Incremental_checker): New class.
7682 * output.cc (Output_file::open_for_modification): New method.
7683 (Output_file::map_anonymous): Changed return type to bool. Record
7685 (Output_file::map_no_anonymous): New method, broken out of map.
7686 (Output_file::map): Use map_no_anonymous and map_anonymous.
7687 * output.h (class Output_file): Update declarations.
7689 2009-08-24 Cary Coutant <ccoutant@google.com>
7691 * options.h (Command_line::Pre_options): New class.
7692 (Command_line::pre_options): New member.
7693 * options.cc (gold::options::ready_to_register): New variable.
7694 (One_option::register_option): Do nothing if not registering options.
7695 Assert if same short option registered twice.
7696 (General_options::General_options): Turn off option registration when
7698 (Command_line::Pre_options::Pre_options): New constructor.
7700 2009-08-24 Cary Coutant <ccoutant@google.com>
7702 * options.h (General_options::no_keep_memory): Remove incorrect
7705 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7707 * Makefile.am (am__skiplex, am__skipyacc): New.
7708 * Makefile.in: Regenerate.
7710 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7712 * Makefile.am (AM_CPPFLAGS): Renamed from ...
7713 (INCLUDES): ... this.
7714 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
7715 (AM_CPPFLAGS): Renamed from ...
7716 (INCLUDE): ... this.
7717 * Makefile.in, testsuite/Makefile.in: Regenerate.
7719 * Makefile.in: Regenerate.
7720 * aclocal.m4: Likewise.
7721 * config.in: Likewise.
7722 * configure: Likewise.
7723 * testsuite/Makefile.in: Likewise.
7725 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7726 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7727 * Makefile.in: Regenerate.
7728 * testsuite/Makefile.in: Regenerate.
7730 2009-08-19 Cary Coutant <ccoutant@google.com>
7732 * resolve.cc (Symbol_table::resolve): Don't complain about defined
7733 symbols in shared libraries overridden by hidden or internal symbols
7734 in the main program.
7736 2009-08-19 Chris Demetriou <cgd@google.com>
7738 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
7739 checking source file names in error messages.
7741 2009-08-18 Doug Kwan <dougkwan@google.com>
7743 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
7744 an elcpp::Ehdr as parameter. Adjust call to set_target.
7745 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
7746 an elfcpp::Ehdr as parameter.
7747 * object.cc (Object::set_target): Remove the version that looks up
7748 a target and sets it.
7749 (Sized_relobj::setup): Take a Target object instead of
7750 an elfcpp::Ehdr as parameter. Adjust call to set_target.
7751 (make_elf_sized_object): Find target and ask target to
7753 * object.h: (Object::set_target): Remove the version that looks up
7754 a target and sets it.
7755 (Sized_relobj::setup): Take a Target object instead of
7756 an elfcpp:Ehdr as parameter.
7757 * target.cc: Include dynobj.h.
7758 (Target::do_make_elf_object_implementation): New.
7759 (Target::do_make_elf_object): New.
7760 * target.h (Target::make_elf_object): New template declaration.
7761 (Target::do_make_elf_object): New method declarations.
7762 (Target::do_make_elf_object_implementation): New template declaration.
7764 2009-08-14 Ian Lance Taylor <iant@google.com>
7766 * gold.h (FUNCTION_NAME): Define.
7767 (gold_unreachable): Use FUNCTION_NAME.
7769 2009-08-12 Sriraman Tallam <tmsriram@google.com>
7771 * icf.cc (Icf::find_identical_sections): Issue a warning when a
7772 symbol in the --keep-unique list is not found.
7774 2009-08-12 Sriraman Tallam <tmsriram@google.com>
7776 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
7777 been maked as --keep-unique.
7778 (Icf::unfold_section): New function.
7779 * icf.h (Icf::unfold_section): New function.
7780 * options.h (General_options::keep_unique): New option.
7781 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
7782 * testsuite/Makefile.in: Regenerate.
7783 * testsuite/icf_keep_unique_test.sh: New file.
7784 * testsuite/icf_keep_unique_test.cc: New file.
7786 2009-08-12 Cary Coutant <ccoutant@google.com>
7789 * resolve.cc (Symbol_table::resolve): Check for references from
7790 dynamic objects to hidden and internal symbols.
7791 * testsuite/Makefile.am (hidden_test.sh): New test.
7792 * testsuite/Makefile.in: Regenerate.
7793 * testsuite/hidden_test.sh: New script.
7794 * testsuite/hidden_test_1.c: New test source.
7795 * testsuite/hidden_test_main.c: New test source.
7797 2009-08-11 Doug Kwan <dougkwan@google.com>
7799 * arm.cc: Update comments.
7800 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
7801 segment to locate the .ARM.exidx section if present.
7803 2009-08-09 Doug Kwan <dougkwan@google.com>
7805 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
7808 2009-08-07 Sriraman Tallam <tmsriram@google.com>
7809 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
7812 2009-08-06 Sriraman Tallam <tmsriram@google.com>
7814 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
7815 valid tls_segment only for non-debug-section relocations.
7816 * testsuite/Makefile.am: Add gc_tls_test.
7817 * testsuite/Makefile.in: Regenerate.
7818 * testsuite/gc_tls_test.cc: New file.
7819 * testsuite/gc_tls_test.sh: New file.
7821 2009-08-05 Sriraman Tallam <tmsriram@google.com>
7825 * Makefile.am (CCFILES): Add icf.cc.
7827 * Makefile.in: Regenerate.
7828 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
7829 * gc.h (gc_process_relocs): Populate lists used by icf to contain
7830 section, symbol and addend information for the relocs.
7831 * gold.cc (queue_middle_tasks): Call identical code folding.
7832 * gold.h: Add defines for multimap.
7833 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
7834 to the call of finalize_local_symbols.
7835 * main.cc (main): Create object of class Icf.
7836 * object.cc (Sized_relobj::do_layout): Allow this function to be
7837 called twice during icf.
7838 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
7839 to sections marked as identical by icf.
7840 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
7842 (Sized_relobj::do_section_entsize): New function.
7843 * object.h (Object::section_entsize): New function.
7844 (Object::do_section_entsize): New pure virtual function.
7845 (Relobj::finalize_local_symbols): Add new parameter.
7846 (Relobj::do_section_entsize): New function.
7847 * options.h (General_options::icf): New option.
7848 (General_options::icf_iterations): New option.
7849 (General_options::print_icf_sections): New option.
7850 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
7851 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
7852 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
7854 * symtab.cc (Symbol_table::is_section_folded): New function.
7855 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
7856 to sections marked as identical by icf.
7857 * symtab.h (Symbol_table::set_icf): New function.
7858 (Symbol_table::icf): New function.
7859 (Symbol_table::is_section_folded): New function.
7860 (Symbol_table::icf_): New data member.
7861 * target-reloc.h (relocate_section): Ignore sections folded by icf.
7862 * testsuite/Makefile.am: Add commands to build icf_test.
7863 * testsuite/Makefile.in: Regenerate.
7864 * testsuite/icf_test.sh: New file.
7865 * testsuite/icf_test.cc: New file.
7867 2009-07-24 Chris Demetriou <cgd@google.com>
7869 * layout.cc (is_compressible_debug_section): Fix incorrect
7870 comment about compressed section names.
7872 2009-07-20 Ian Lance Taylor <ian@airs.com>
7875 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
7877 2009-07-16 Ian Lance Taylor <iant@google.com>
7880 * layout.h: #include <map>.
7881 (class Kept_section): Change from struct to class. Add accessors
7882 and setters. Add section size to Comdat_group mapping. Change
7883 Comdat_group to std::map. Add is_comdat_ field. Add
7884 linkonce_size field in union.
7885 (class Layout): Update declaration of find_or_add_kept_section.
7886 Don't declare find_kept_object.
7887 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
7888 parameter. Add object, shndx, is_comdat, and is_group_name
7889 parameters. Change all callers. Adjust for new Kept_section.
7890 (Layout::find_kept_object): Remove.
7891 * object.cc (Sized_relobj::include_section_group): Update use of
7892 Kept_section. Rename secnum to shndx. Only record
7893 Kept_comdat_section if sections are the same size.
7894 (Sized_relobj::include_linkonce_section): Update use of
7895 Kept_section. Only record Kept_comdat_section if sections are the
7896 same size. Set size of linkonce section.
7897 (Sized_relobj::map_to_kept_section): Update call to
7898 get_kept_comdat_section.
7899 * object.h (class Sized_relobj): Rename fields in
7900 Kept_comdat_section to drop trailing underscores; change object
7901 field to Relobj*. Change Kept_comdat_section_table to store
7902 struct rather than pointer.
7903 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
7904 Add kept_object and kept_shndx parameters. Change all callers.
7905 (Sized_relobj::get_kept_comdat_section): Change return type to
7906 bool. Add kept_object and kept_shndx parameters. Change all
7908 * plugin.cc (Pluginobj::include_comdat_group): Update call to
7909 Layout::find_or_add_kept_section.
7911 2009-07-09 Ian Lance Taylor <iant@google.com>
7913 * merge.cc (Object_merge_map::initialize_input_to_output_map):
7914 Reserve space in the hash table.
7916 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
7918 * fileread.cc (File_read::get_mtime): New method.
7919 * fileread.h (Timespec): New structure.
7920 (File_read::get_mtime): New method.
7921 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
7922 Renamed from timestamp_nsec.
7923 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
7925 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
7927 (Incremental_inputs::report_archive): Save mtime; style fix.
7928 (Incremental_inputs::report_obejct): Save mtime; style fix.
7929 (Incremental_inputs::report_script): Save mtime; style fix.
7930 (Incremental_inputs::finalize_inputs): Style fix.
7931 (Incremental_inputs::finalize): Style fix.
7932 (Incremental_inputs::create_input_section_data): Store inputs
7934 * incremental.h (Incremental_inputs::report_script): Add mtime
7936 (Incremental_inputs::Input_info::Input_info): Intialize only one
7938 (Incremental_inputs::Input_info::archive): Move to nameless
7940 (Incremental_inputs::Input_info::obejct): Move to nameless union.
7941 (Incremental_inputs::Input_info::script): Move to nameless union.
7942 (Incremental_inputs::mtime): New field.
7943 * script.cc (read_input_script): Pass file mtime to
7945 * script.h (Script_info::inputs): Style fix.
7947 2009-07-01 Ian Lance Taylor <ian@airs.com>
7949 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
7952 2009-06-24 Ian Lance Taylor <iant@google.com>
7955 * layout.cc (Layout::choose_output_section): If we find an
7956 existing section, update the flags.
7957 (Layout::create_notes): New function, broken out of
7959 (Layout::finalize): Don't create note sections.
7960 (Layout::create_note): Don't crash if linker script discards
7962 (Layout::create_gold_note): Likewise.
7963 (Layout::create_build_id): Likewise. Don't set
7964 after_input_sections on the section.
7965 (Layout::create_executable_stack_info): Remove target parameter.
7967 * layout.h (class Layout): Declare create_notes. Update
7968 declaration of create_executable_stack_info.
7969 * gold.cc (queue_middle_tasks): Call create_notes.
7970 * output.cc (Output_section::update_flags_for_input_section): Move
7971 here from output.h. If SHF_ALLOC flag is newly set, mark address
7973 * output.h (Output_data::mark_address_invalid): New function.
7974 (class Output_section): Only declare, not define,
7975 update_flags_for_input_section. Remove set_flags.
7977 2009-06-24 Ian Lance Taylor <iant@google.com>
7979 * script-sections.cc (Output_section_definition::
7980 set_section_addresses): Rename shadowing local load_address to
7983 2009-06-24 Ian Lance Taylor <iant@google.com>
7986 * reloc.cc (relocate_sections): Skip empty relocation sections.
7988 2009-06-23 Ian Lance Taylor <iant@google.com>
7991 * layout.cc (Layout::create_note): Use choose_output_section
7992 rather than make_output_section.
7994 2009-06-23 Ian Lance Taylor <iant@google.com>
7997 * options.cc (General_options::parse_V): Set printed_version_.
7998 (General_options::General_options): Initialize printed_version_.
7999 * options.h (class General_options): Add printed_version_ field.
8000 * gold.cc (queue_initial_tasks): If there are no input files,
8001 don't give a fatal error if we printed the version information.
8002 (queue_middle_tasks): If using -r with a shared object, give a
8003 fatal error rather than an ordinary error.
8005 2009-06-23 Ian Lance Taylor <iant@google.com>
8008 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
8009 (Layout::make_output_section): Set have_stabstr_section_ if we see
8010 a .stab*str section.
8011 (Layout::finalize): Call link_stabs_sections.
8012 (Layout::link_stabs_sections): New file.
8013 * layout.h (class Layout): Add have_stabstr_section_ field.
8014 Declare link_stabs_sections.
8016 2009-06-23 Doug Kwan <dougkwan@google.com>
8018 * Makefile.am (libgold_a_LIBADD): New.
8019 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
8020 * Makefile.in: Regenerate.
8021 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
8022 * configure: Regenerate.
8023 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
8024 * fileread.cc: Include sys/state.h
8025 * gold.h: Declare memmem and strndup if found missing.
8026 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
8028 2009-06-23 Ian Lance Taylor <iant@google.com>
8030 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
8031 * configure: Rebuild.
8033 2009-06-23 Ian Lance Taylor <iant@google.com>
8036 * object.cc (Object::section_contents): Don't try to get a view if
8037 the section has length zero.
8038 (Object::handle_gnu_warning_section): If the section is empty, use
8039 the name of the section as the warning.
8041 2009-06-23 Ian Lance Taylor <iant@google.com>
8044 * stringpool.h (class Stringpool_template): Add optimize_ field.
8045 (Stringpool_template::set_optimize): New function.
8046 * stringpool.cc (Stringpool_template::Stringpool_template):
8047 Initialize optimize_ field.
8048 (Stringpool_template::set_string_offsets): Test local optimize
8049 fild rather than parameter.
8050 * layout.cc (Layout::Layout): Call set_optimize on the section
8053 2009-06-22 Ian Lance Taylor <iant@google.com>
8056 * yyscript.y: Parse TARGET.
8057 * script.cc (script_set_target): New function.
8058 * script-c.h (script_set_target): Declare.
8059 * options.cc (General_options::string_to_object_format): Rename
8060 from string_to_object_format in anonymous namespace. Change
8062 * options.h (class General_options): Declare
8063 string_to_object_format.
8065 2009-06-22 Ian Lance Taylor <iant@google.com>
8067 * script-sections.cc (Script_sections::create_segments): Don't put
8068 program headers in a PT_LOAD segment if -n or -N.
8070 2009-06-22 Ian Lance Taylor <iant@google.com>
8073 * options.h (class General_options): Add -z lazy and -z now. Sort
8074 -z options into alphabetical order.
8075 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
8077 2009-06-21 Ian Lance Taylor <iant@google.com>
8079 * layout.cc (Layout::make_output_section): Call
8080 Target::new_output_section.
8081 (Layout::attach_allocated_section_to_segment): Put large section
8082 sections in a separate load segment with the large segment flag
8084 (Layout::segment_precedes): Sort large data segments after other
8086 (align_file_offset): New static function.
8087 (Layout::set_segment_offsets): Use align_file_offset.
8088 * output.h (class Output_section): Add is_small_section_ and
8089 is_large_section_ fields.
8090 (Output_section::is_small_section): New function.
8091 (Output_section::set_is_small_section): New function.
8092 (Output_section::is_large_section): New function.
8093 (Output_section::set_is_large_section): New function.
8094 (Output_section::is_large_data_section): New function.
8095 (class Output_segment): Add is_large_data_segment_ field.
8096 (Output_segment::is_large_data_segment): New function.
8097 (Output_segment::set_is_large_data_segment): New function.
8098 * output.cc (Output_section::Output_section): Initialize new
8100 (Output_segment::Output_segment): Likewise.
8101 (Output_segment::add_output_section): Add assertion that large
8102 data sections always go in large data segments. Force small data
8103 sections to the end of the list of data sections. Force small BSS
8104 sections to the start of the list of BSS sections. For large BSS
8105 sections to the end of the list of BSS sections.
8106 * symtab.h (class Symbol): Declare is_common_shndx.
8107 (Symbol::is_defined): Check Symbol::is_common_shndx.
8108 (Symbol::is_common): Likewise.
8109 (class Symbol_table): Define enum Commons_section_type. Update
8110 declarations. Add small_commons_ and large_commons_ fields.
8111 * symtab.cc (Symbol::is_common_shndx): New function.
8112 (Symbol_table::Symbol_table): Initialize new fields.
8113 (Symbol_table::add_from_object): Put small and large common
8114 symbols in the right list.
8115 (Symbol_table::sized_finalized_symbol): Check
8116 Symbol::is_common_shndx.
8117 (Symbol_table::sized_write_globals): Likewise.
8118 * common.cc (Symbol_table::do_allocate_commons): Allocate new
8119 common symbol lists. Don't call do_allocate_commons_list if the
8121 (Symbol_table::do_allocate_commons_list): Remove is_tls
8122 parameter. Add comons_section_type parameter. Change all
8123 callers. Handle small and large common symbols.
8124 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
8125 Symbol::is_common_shndx.
8126 * resolve.cc (symbol_to_bits): Likewise.
8127 * target.h (Target::small_common_shndx): New function.
8128 (Target::small_common_section_flags): New function.
8129 (Target::large_common_shndx): New function.
8130 (Target::large_common_section_flags): New function.
8131 (Target::new_output_section): New function.
8132 (Target::Target_info): Add small_common_shndx, large_common_shndx,
8133 small_common_section_flags, and large_common_section_flags
8135 (Target::do_new_output_section): New virtual function.
8136 * arm.cc (Target_arm::arm_info): Initialize new fields.
8137 * i386.cc (Target_i386::i386_info): Likewise.
8138 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
8140 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
8141 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
8142 (Target_x86_64::do_new_output_section): New function.
8143 * configure.ac: Define conditional MCMODEL_MEDIUM.
8144 * testsuite/Makefile.am (check_PROGRAMS): Add large.
8145 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
8146 (large_LDFLAGS): Define.
8147 * testsuite/large.c: New file.
8148 * testsuite/testfile.cc (Target_test::test_target_info):
8149 Initialize new fields.
8150 * configure, testsuite/Makefile.in: Rebuild.
8152 2009-06-05 Doug Kwan <dougkwan@google.com>
8154 * Makefile.am (CCFILES): Add target.cc.
8155 * Makefile.in: Regenerate.
8156 * i386.cc (class Target_i386): Define new virtual method to
8157 override do_is_local_label_name in parent.
8158 * object.cc (Sized_relobj::do_count_local_symbols): Discard
8159 local symbols if --discard-locals or -X is given.
8160 * options.h (class General_options): Declare new options
8161 '--discard-locals' and '-X' for discarding locals.
8162 * target.h (class Target): Define new methods is_local_label_name.
8163 Declare new virtual method do_is_local_label_name.
8164 * target.cc: New file.
8165 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
8166 (check_SCRIPTS): Add discard_locals_test.sh.
8167 (check_DATA): Add discard_local_tests.syms.
8168 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
8169 (discard_local_tests.syms, discard_locals_test.o): New make rules.
8170 * testsuite/Makefile.in: Regenerate.
8171 * testsuite/discard_locals_test.c: New file.
8172 * testsuite/discard_locals_test.sh: Same.
8174 2009-06-05 Doug Kwan <dougkwan@google.com>
8176 * object.cc (Sized_relobj::Sized_relobj): Initialize
8177 discarded_eh_frame_shndx_ to -1U.
8178 (Sized_relobj::do_layout): Record index of a discard .eh_frame
8180 (Sized_relobj::do_count_local_symbols): Skip local symbols in
8181 a discarded .eh_frame section.
8182 (Sized_relobj::do_finalize_local_symbols): Ditto.
8183 * object.h (class Sized_relobj): Declare new member
8184 discarded_eh_frame_shndx_.
8185 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
8186 (local_labels_test.o, local_labels_test): New rules.
8187 * testsuite/Makefile.in: Regenerate.
8189 2009-06-04 Doug Kwan <dougkwan@google.com>
8191 * layout.cc (Layout::section_name_mapping): Add mapping for
8192 special ARM sections.
8194 2009-06-03 Doug Kwan <dougkwan@google.com>
8196 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
8197 (utils::has_overflow): Same.
8199 2009-06-03 Ian Lance Taylor <iant@google.com>
8201 * layout.cc (Layout::section_name_mapping): New array, replacing
8202 Layout::linkonce_mapping.
8203 (Layout::section_name_mapping_count): New variable, replacing
8204 Layout::linkonce_mapping_count.
8205 (Layout::linkonce_output_name): Remove.
8206 (Layout::output_section_name): Rewrite.
8207 * layout.h (class Layout): Rename Linkonce_mapping to
8208 Section_name_mapping, linkonce_mapping to section_name_mapping,
8209 linkonce_mapping_count to section_name_mapping_count. Don't
8210 declare linkonce_output_name.
8212 2009-06-03 Doug Kwan <dougkwan@google.com>
8214 * gold/arm.cc (namespace utils): New.
8215 (Target_arm::reloc_is_non_pic): Define new method.
8216 (class Arm_relocate_functions): New.
8217 (Target_arm::Relocate::relocate): Handle relocation types used by
8220 2009-06-03 Ian Lance Taylor <iant@google.com>
8222 * arm.cc (Target_arm::scan::global): Use || instead of |.
8224 2009-06-02 Doug Kwan <dougkwan@google.com>
8226 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
8227 issued_non_pic_error_.
8228 (class Target_arm::Scan): Declare new method check_non_pic.
8229 Define new method symbol_needs_plt_entry.
8230 Declare new data member issued_non_pic_error_.
8231 (class Target_arm::Relocate): Declare new method
8232 should_apply_static_reloc.
8233 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
8234 (Target_arm::Scan::check_non_pic): Define new method.
8235 (Target_arm::Scan::local): Handle a small subset of reloc types used
8237 (Target_arm::Scan::local): Same.
8238 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
8240 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
8242 * incremental.cc (Incremental_inputs::report_command_line): Filter
8243 out --incremental-* options.
8245 2009-05-29 Doug Kwan <dougkwan@google.com>
8247 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
8249 (class Target_arm): Update comment.
8250 (Target_arm::Target_arm): Initialize new data members GOT_,
8251 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
8252 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
8253 and Target_arm::rel_dyn_section.
8254 Declare new_enum Target_arm::Got_type.
8255 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
8257 Update commments for member do_dynsym_value.
8258 (Target_arm::got_size, Target_arm::plt_section,
8259 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
8260 new methods inside class defintion.
8261 (Target_arm::got_section): Define new method.
8262 (Target_arm::rel_dyn_section): Same.
8263 (Output_data_plt_arm): New template class.
8264 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
8265 (Output_data_plt_arm:do_adjust_output_section): Define new method.
8266 (Output_data_plt_arm::add_entry): Same.
8267 (Output_data_plt_arm::first_plt_entry): Define new
8268 static data member for PLT instruction template.
8269 (Output_data_plt_arm::plt_entry): Same.
8270 (Output_data_plt_arm::do_write): Define new method.
8271 (Target_arm::make_plt_entry): Same.
8272 (Target_arm::do_finalize_sections): Same.
8273 (Target_arm::do_dynsym_value): Same.
8275 2009-05-28 Doug Kwan <dougkwan@google.com>
8277 * Makefile.am (TARGETSOURCES): Add arm.cc.
8278 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
8279 * Makefile.in: Regenerate.
8281 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
8283 2009-05-26 Doug Kwan <dougkwan@google.com>
8285 * options.cc (General_options::parse_exclude_libs). Fix a comment.
8286 (General_options::check_excluded_libs): Strip off directories in
8287 archive name before matching like GNU ld does.
8288 * testsuite/Makefile.am (MOSTLYCLEANFILES,
8289 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
8290 (exclude_libs_test_LDFLAGS): Add linker option
8291 -Wl,--exclude-libs,libexclude_libs_test_3
8292 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
8293 an explicit archive without using -l.
8294 (alt/libexclude_libs_test_3.a): New make rule.
8295 * testsuite/Makefile.in: Regenerate.
8296 * testsuite/exclude_libs_test.c : Declare lib3_default().
8298 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
8299 * exclude_libs_test_3.c: New file.
8301 2009-05-26 Nick Clifton <nickc@redhat.com>
8303 * po/id.po: New Indonesian translation.
8304 * po/gold.pot: Updated template file.
8306 2009-05-22 Sriraman Tallam <tmsriram@google.com>
8308 * testsuite/Makefile.am: Add -ffunction-sections to compile
8309 gc_comdat_test files. Add -Wl,--gc-sections to build
8311 * testsuite/Makefile.in: Regenerate.
8312 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
8314 2009-05-21 Sriraman Tallam <tmsriram@google.com>
8316 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
8317 kept comdat section was garbage collected.
8318 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
8319 * testsuite/Makefile.in: Regenerate.
8320 * testsuite/gc_comdat_test.sh: New file.
8321 * testsuite/gc_comdat_test_1.cc: New file.
8322 * testsuite/gc_comdat_test_2.cc: New file.
8324 2009-05-19 Doug Kwan <dougkwan@google.com>
8326 * archive.cc (Archive::Archive): Move constructor from archive.h
8327 to here. Initialize no_export_.
8328 (Archive::get_elf_object_for_member): Set no_export flag of object.
8329 * archive.h (Archive::Archive): Move constructor body to
8331 (Archive::no_export): New method.
8332 (Archive::no_export_): New field.
8333 * object.h (Object::Object): Initialize no_export_ to false.
8334 (Object::no_export, Object::set_no_export): New methods.
8335 (Object::no_export_): New field.
8336 * options.cc (General_options::parse_exclude_libs): New method.
8337 (General_options::check_excluded_libs) Same.
8338 * options.h (exclude_libs): New option.
8339 (General_options::check_excluded_libs): New method declaration.
8340 (General_options::excluded_libs_): New field.
8341 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
8342 default or protected visibility if an object has no-export flag set.
8343 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
8344 (check_SCRIPTS): Add exclude_libs_test.sh.
8345 (check_DATA): Add exclude_libs_test.syms.
8346 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
8347 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
8348 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
8349 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
8350 (exclude_libs_test.syms, libexclude_libs_test_1.a,
8351 libexclude_libs_test_2.a): New rules.
8352 * testsuite/Makefile.in: Regenerate.
8353 * testsuite/exclude_libs_test.c: New file.
8354 * testsuite/exclude_libs_test.sh: Ditto.
8355 * testsuite/exclude_libs_test_1.c: Ditto.
8356 * testsuite/exclude_libs_test_2.c: Ditto.
8358 2009-05-15 Ian Lance Taylor <iant@google.com>
8360 * configure.ac: Check for declarations for cases where libiberty.h
8361 checks HAVE_DECL_xxx.
8362 * configure, config.in: Rebuild.
8364 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
8366 * gold.h (Incremental_argument_list): Remove (invalid) forward
8368 * incremental.cc (Incremental_inputs::report_achive): New method.
8369 (Incremental_inputs::report_object): New method.
8370 (Incremental_inputs::report_script): New method.
8371 (Incremental_inputs::finalize_inputs): New method.
8372 (Incremental_inputs::finalize): Call finalize_inputs().
8373 (Incremental_inputs::sized_create_incremental_inputs_section_data):
8374 Create inputs entries.
8375 * incremental.h (Incremental_input_type): New enum.
8376 (Incremental_inputs::Incremental_input): Initialize new fields.
8377 (Incremental_inputs::report_inputs): New method.
8378 (Incremental_inputs::report_achive): New method.
8379 (Incremental_inputs::report_object): New method.
8380 (Incremental_inputs::report_script): New method.
8381 (Incremental_inputs::finalize_inputs): New method.
8382 (Incremental_inputs::Input_info): New struct.
8383 (Incremental_inputs::Input_info_map): New typedef.
8384 (Incremental_inputs::lock_): New field.
8385 (Incremental_inputs::Inputs_): New field.
8386 (Incremental_inputs::Inputs_map): New field.
8387 * main.cc (main): Call Incremental_input::report_inputs.
8388 * options.h (Input_argument_list): Typedef moved from
8390 (Input_file_group::Files): Remove, use ::Input_argument_list.
8391 (Input_file_group::Input_argument_list): Remove, use
8392 ::Input_argument_list.
8393 * plugin.cc (Plugin_manager::add_input_file): Add error in
8395 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
8397 * script.cc (read_input_script): Call
8398 Incremental_input::report_script.
8399 * script.h (Script_info): New class.
8401 2009-04-27 Ian Lance Taylor <iant@google.com>
8403 * x86_64.cc (do_adjust_output_section): Set entsize to
8406 2009-04-23 Elliott Hughes <enh@google.com>
8408 * output.cc (Output_file::close): After short writes, continue
8409 writing from the correct offset in the buffer being written.
8411 2009-04-23 Chris Demetriou <cgd@google.com>
8413 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
8414 * configure: Regenerate.
8415 * config.in: Regenerate.
8416 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
8417 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
8419 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
8421 * incremental.cc (Incremental_inputs_header_data): Renamed from
8422 Incremental_input_header_data.
8423 (Incremental_inputs_header_data::data_size): New field.
8424 (Incremental_inputs_header_data::put_input_file_count): Renamed
8425 from input_file_count.
8426 (Incremental_inputs_header_data::put_command_line_offset): Renamed
8427 from command_line_offset.
8428 (Incremental_inputs_header_data::put_reserved): Renamed from
8430 (Incremental_inputs_entry_data): Renamed from
8431 Incremental_input_entry_data.
8432 (Incremental_inputs_entry_data::data_size): New field.
8433 (Incremental_inputs::report_command_line): New method.
8434 (Incremental_inputs::finalize): New method.
8435 (Incremental_inputs::create_incremental_inputs_data): New method.
8436 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
8437 * incremental.h: New file.
8438 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
8439 (Layout::finalize): Create incremental inputs section in
8441 (Layout::create_incremental_info_sections): New method.
8442 * layout.h (Layout::incremental_inputs): New method.
8443 (Layout::create_incremental_info_sections): New method.
8444 (Layout::incremental_inputs_): New field.
8445 * main.cc (main): Notify Incremental_input of the command line.
8447 2009-04-01 Ian Lance Taylor <iant@google.com>
8448 Mikolaj Zalewski <mikolajz@google.com>
8450 * gold.h (reserve_unordered_map): Define, three versions, one for
8451 each version of Unordered_map.
8452 * layout.cc (Layout::Layout): Remove options parameter. Add
8453 number_of_input_files parameter. Don't initialize options_.
8454 Initialize number_of_input_files_ and resized_signatures_. Move
8455 sections_are_attached_.
8456 (Layout::layout_group): Reserve space for group_signatures_.
8457 (Layout::find_or_add_kept_section): Change name parameter to be a
8458 reference. Resize signatures_ map when it gets large enough.
8459 (Layout::layout_eh_frame): Use parameters->options() instead of
8461 (Layout::make_output_section): Likewise.
8462 (Layout::attach_allocated_section_to_segment): Likewise.
8463 (Layout::finalize, Layout::create_executable_stack): Likewise.
8464 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
8465 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
8466 * layout.h (class Layout): Update declarations. Remove options_
8467 field. Add number_of_input_files_ and resized_signatures_
8468 fields. Move sections_are_attached_ field.
8469 * main.cc (main): Pass number of input files to Layout
8470 constructor. Don't pass options.
8472 2009-03-30 Ian Lance Taylor <iant@google.com>
8474 * ffsll.c (ffsll): Correct implementation.
8476 2009-03-27 Ian Lance Taylor <iant@google.com>
8478 * ffsll.c: New file.
8479 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
8480 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
8481 * ftruncate.c (ftruncate): Declare before definition.
8482 * mremap.c (mremap): Likewise.
8483 * pread.c (pread): Likewise.
8484 * configure, Makefile.in, config.in: Rebuild.
8486 * mremap.c: New file.
8487 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
8488 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
8489 (mremap): Declare if HAVE_MREMAP is not defined.
8490 * configure, Makefile.in, config.in: Rebuild.
8492 2009-03-27 Cary Coutant <ccoutant@google.com>
8494 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
8495 position independent.
8496 * sparc.cc (Target_sparc::check_non_pic): Likewise.
8497 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
8499 2009-03-24 Cary Coutant <ccoutant@google.com>
8501 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
8503 (needs_dynamic_reloc): Likewise.
8505 2009-03-24 Ian Lance Taylor <iant@google.com>
8507 * yyscript.y (file_cmd): Recognize EXTERN.
8508 (extern_name_list, extern_name_list_body): New nonterminals.
8509 * script.cc (script_add_extern): Define.
8510 * script-c.h (script_add_extern): Declare.
8512 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
8514 * object.cc (is_elf_object): Define.
8515 * object.h (is_elf_object): Declare.
8516 * archive.cc (Archive::get_elf_object_for_member): Call
8518 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
8520 2009-03-24 Elliott Hughes <enh@google.com>
8522 * output.cc (Output_file::map_anonymous): Define.
8523 (Output_file::map): Use map_anonymous. If the regular mmap fails,
8524 try an anonymous one. Report the size if the mmap fails.
8525 * output.h (class Output_file): Declare map_anonymous.
8527 2009-03-24 Ian Lance Taylor <iant@google.com>
8529 * target-select.cc (instantiate_target): Don't acquire the lock if
8530 the instantiated_target_ field has already been set.
8532 2009-03-23 Ian Lance Taylor <iant@google.com>
8534 * gold-threads.h (class Initialize_lock): Define.
8535 * gold-threads.cc (class Initialize_lock_once): Define.
8536 (initialize_lock_control): New static variable.
8537 (initialize_lock_pointer): New static variable.
8538 (initialize_lock_once): New static function.
8539 (Initialize_lock::Initialize_lock): Define.
8540 (Initialize_lock::initialize): Define.
8541 * target-select.h: Include "gold-threads.h".
8542 (class Target_selector): Add lock_ and initialize_lock_ fields.
8543 Don't define instantiate_target, just declare it.
8544 * target-select.cc (Target_selector::Target_selector): Initialize
8546 (Target_selector::instantiate_target): Define.
8547 * descriptors.h: Include "gold-threads.h".
8548 (class Descriptors): Add initialize_lock_ field.
8549 * descriptors.cc (Descriptors::Descriptors): Initialize new
8551 (Descriptors::open): Use initialize_lock_ field
8552 * errors.h (class Errors): Add initialize_lock_ field.
8553 * errors.cc (Errors::Errors): Initialize new field.
8554 (Errors::initialize_lock): Use initialize_lock_ field.
8555 * powerpc.cc (class Target_selector_powerpc): Remove
8556 instantiated_target_ field. In do_recognize call
8557 instantiate_target rather than do_instantiate_target. In
8558 do_instantiate_target just allocate a new target.
8559 * sparc.cc (class Target_selector_sparc): Likewise.
8561 * freebsd.h: New file.
8562 * i386.cc: Include "freebsd.h".
8563 (Target_i386): Derive from Target_freebsd rather than
8565 (Target_selector_i386): Derive from Target_selector_freebsd rather
8566 than Target_selector.
8567 * x86_64.cc: Include "freebsd.h".
8568 (Target_x86_64): Derive from Target_freebsd rather than
8570 (Target_selector_x86_64): Derive from Target_selector_freebsd
8571 rather than Target_selector.
8572 * target.h (class Target): Add adjust_elf_header and
8573 do_adjust_elf_header.
8574 * output.cc (Output_file_header:: do_sized_write): Call target
8575 adjust_elf_header routine.
8576 * configure.tgt: Set targ_osabi.
8577 * configure.ac: Define GOLD_DEFAULT_OSABI.
8578 * parameters.cc (Parameters::default_target): Pass
8579 GOLD_DEFAULT_OSABI to select_target.
8580 * target-select.h (class Target_selector): Make instantiate_target
8581 protected rather than private.
8582 * Makefile.am (HFILES): Add freebsd.h.
8583 * configure, Makefile.in, config.in: Rebuild.
8585 * merge.cc (do_add_input_section): Correct pend value. Change
8586 message about last entry not being null terminated from error to
8589 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
8591 * incremental.cc: New file.
8592 * Makefile.am (CCFILES): Add incremental.cc.
8593 * Makefile.in: Rebuild.
8595 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
8597 * layout.cc (Layout::output_section_name): Preserve names
8598 of '.note.' sections.
8600 2009-03-19 Ian Lance Taylor <iant@google.com>
8602 * descriptors.cc (Descriptors::open): Check that the options are
8603 valid before using them.
8605 2009-03-18 Ian Lance Taylor <iant@google.com>
8607 * script-sections.h: Include <list>.
8608 (class Script_sections): Change Sections_elements from std::vector
8609 to std::list. Typedef public Elements_iterator. Add
8610 orphan_section_placement_, data_segment_align_start_, and
8611 saw_data_segment_align_ fields. Remove data_segment_align_index_
8613 * script-sections.cc (class Orphan_section_placement): New class.
8614 (class Sections_element): Add virtual functions is_relro and
8615 orphan_section_init. Remove virtual function place_orphan_here.
8616 (class Output_section_definition): Add is_relro and
8617 orphan_section_init. Remove place_orphan_here.
8618 (class Orphan_output_section): Likewise.
8619 (Script_sections::Script_sections): Update for field changes.
8620 (Script_sections::data_segment_align): Set saw_data_segment_align_
8621 and data_segment_align_start_, not data_segment_align_index.
8622 (Script_sections::data_segment_relro_end): Check
8623 saw_data_segment_align_. Use data_segment_align_start_ rather
8624 than data_segment_align_index_.
8625 (Script_sections::place_orphan): Rewrite to use
8626 Orphan_section_placement.
8628 2009-03-17 Ian Lance Taylor <iant@google.com>
8630 * archive.cc (Archive::add_symbols): Check for a version attached
8631 to the symbol name in the archive map.
8632 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
8633 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
8634 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
8635 (ver_test_11.a): New target.
8636 * testsuite/Makefile.in: Rebuild.
8638 * configure.ac: Check for chsize and posix_fallocate. Replace
8640 * ftruncate.c: New file, from gnulib.
8641 * output.cc (posix_fallocate): Define dummy version if not
8642 HAVE_POSIX_FALLOCATE.
8643 (Output_file::map): Call posix_fallocate rather than lseek and
8645 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
8646 * configure, Makefile.in, config.in: Rebuild.
8648 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
8650 * layout.h (Layout::create_note): Add section_name parameter.
8651 * layout.cc (Layout::create_note): Likewise.
8652 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
8654 2009-03-17 Ian Lance Taylor <iant@google.com>
8656 * descriptors.cc: Include "options.h".
8657 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
8658 (Descriptors::open): Always use O_CLOEXEC when opening a new
8659 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
8660 then set FD_CLOEXEC.
8662 * sparc.cc (class Target_sparc): Add has_got_section.
8663 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
8664 make sure we have a GOT section.
8666 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
8667 (Target_sparc::Scan::local): Likewise.
8668 (Target_sparc::Scan::global): Likewise.
8669 (Target_sparc::Relocate::relocate): Likewise.
8670 (Target_sparc::Relocate::relocate_tls): Likewise.
8672 * symtab.cc (Symbol_table::define_default_version): New function,
8673 broken out of add_from_object.
8674 (Symbol_table::add_from_object): Call define_default_version.
8675 (Symbol_table::define_special_symbol): Add resolve_oldsym
8676 parameter. Change all callers. If the version for a symbol comes
8677 from a version script, resolve it with the symbol with the same
8678 name with no version. Also add the symbol without a version if
8680 (do_define_in_output_data): If resolving with oldsym, don't delete
8682 (do_define_in_output_segment): Likewise.
8683 (do_define_as_constant): Likewise.
8684 * symtab.h (class Symbol_table): Update declarations.
8686 2009-03-13 Ian Lance Taylor <iant@google.com>
8688 * readsyms.cc (Read_symbols::incompatible_warning): New function.
8689 (Read_symbols::requeue): New function.
8690 (Read_symbols::do_read_symbols): If make_elf_object fails because
8691 the target type is not configured, and the file was searched for,
8692 issue a warning and retry with the next directory.
8693 (Add_symbols::run): If the file has an incompatible format, and
8694 it was searched for, requeue the Read_symbols task. On error,
8696 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
8697 dirindex parameter to constructor. Change all callers. Declare
8698 incompatible_warning and requeue.
8699 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
8700 input_argument_ and input_group_ fields. Add them to
8701 constructor. Change all callers.
8702 (class Read_script): Add dirindex_ field. Add it to constructor.
8704 * archive.cc (Archive::setup): Remove input_objects parameter.
8706 (Archive::get_file_and_offset): Likewise.
8707 (Archive::read_all_symbols): Likewise.
8708 (Archive::read_symbols): Likewise.
8709 (Archive::get_elf_object_for_member): Remove input_objects
8710 parameter. Add punconfigured parameter. Change all callers.
8711 (Archive::add_symbols): Change return type to bool. Check return
8712 value of include_member.
8713 (Archive::include_all_members): Likewise.
8714 (Archive::include_member): Change return type to bool. Return
8715 false if first included object has incompatible target. Set
8716 included_member_ field.
8717 (Add_archive_symbols::run): If add_symbols returns false, requeue
8719 * archive.h (class Archive): Add included_member_ field.
8720 Initialize it in constructor. Add input_file and searched_for
8721 methods. Update declarations.
8722 (class Add_archive_symbols): Add dirpath_, dirindex_, and
8723 input_argument_ fields. Add them to constructor. Change all
8725 * script.cc: Include "target-select.h".
8726 (class Parser_closure): Add skip_on_incompatible_target_ and
8727 found_incompatible_target_ fields. Add
8728 skip_on_incompatible_target parameter to constructor. Change all
8729 callers. Add methods skip_on_incompatible_target,
8730 clear_skip_on_incompatible_target, found_incompatible_target, and
8731 set_found_incompatible_target.
8732 (read_input_script): Add dirindex parameter. Change all callers.
8733 If parser finds an incompatible target, requeue Read_symbols
8735 (script_set_symbol): Clear skip_on_incompatible_target in
8737 (script_add_assertion, script_parse_option): Likewise.
8738 (script_start_sections, script_add_phdr): Likewise.
8739 (script_check_output_format): New function.
8740 * script.h (read_input_script): Update declaration.
8741 * script-c.h (script_check_output_format): Declare.
8742 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
8743 (ignore_cmd): Remove OUTPUT_FORMAT.
8744 * fileread.cc (Input_file::Input_file): Add explicit this.
8745 (Input_file::will_search_for): New function.
8746 (Input_file::open): Add pindex parameter. Change all callers.
8747 * fileread.h (class Input_file): Add input_file_argument method.
8748 Declare will_search_for. Update declarations.
8749 * object.cc (make_elf_object): Add punconfigured parameter.
8751 * object.h (class Object): Make input_file public. Add
8752 searched_for method.
8753 (make_elf_object): Update declaration.
8754 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
8756 * dirsearch.h (class Dirsearch): Update declaration.
8757 * options.h (class General_options): Add --warn-search-mismatch.
8758 * parameters.cc (Parameters::is_compatible_target): New function.
8759 * parameters.h (class Parameters): Declare is_compatible_target.
8760 * workqueue.cc (Workqueue::add_blocker): New function.
8761 * workqueue.h (class Workqueue): Declare add_blocker.
8763 * fileread.cc (Input_file::open): Remove options parameter.
8765 (Input_file::open_binary): Likewise.
8766 * script.cc (read_input_script): Likewise.
8767 * readsyms.h (class Read_symbols): Remove options_ field. Remove
8768 options parameter from constructor. Change all callers.
8769 (class Read_script): Likewise.
8770 * fileread.h (class Input_file): Update declarations.
8771 * script.h (read_input_script): Update declaration.
8773 2009-03-10 Nick Clifton <nickc@redhat.com>
8775 * po/es.po: New Spanish translation.
8777 2009-03-06 Cary Coutant <ccoutant@google.com>
8779 * options.cc (parse_short_option): Keep dash_z from registering itself.
8781 2009-03-03 Ian Lance Taylor <iant@google.com>
8784 * target-reloc.h (relocate_section): Pass output_section to
8786 * i386.cc (Target_i386::should_apply_static_reloc): Add
8787 output_section parameter. Change all callers.
8788 (Target_i386::Relocate::relocate): Add output_section parameter.
8789 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8790 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
8791 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
8792 * testsuite/two_file_shared.sh: New script.
8793 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
8794 (check_DATA): Add two_file_shared.dbg.
8795 (two_file_shared.dbg): New target.
8796 * testsuite/Makefile.in: Rebuild.
8798 2009-03-01 Ian Lance Taylor <iant@google.com>
8800 * configure.ac: Check for byteswap.h.
8801 * configure: Rebuild.
8802 * config.in: Rebuild.
8804 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
8806 * layout.cc (Layout::find_or_add_kept_section): New function.
8807 (Layout::add_comdat): Removed.
8808 * layout.h (struct Kept_section): Move out of class Layout.
8809 Remove trailing underscores from field names. Add group_sections
8810 field. Rename group_ field to is_group. Change all uses.
8811 (class Layout): Declare find_or_add_kept_section, not add_comdat.
8812 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
8813 comdat_groups_ field.
8814 (Sized_relobj::include_section_group): Use
8815 find_or_add_kept_section and Kept_section::group_sections.
8816 (Sized_relobj::include_linkonce_section): Likewise.
8817 * object.cc (class Sized_relobj): Don't define Comdat_group or
8818 Comdat_group_table. Remove find_comdat_group and
8819 add_comdat_group. Remove comdat_groups_ field.
8820 * plugin.cc (include_comdat_group): Use
8821 Layout::find_or_add_kept_section.
8823 2009-02-28 Ian Lance Taylor <iant@google.com>
8825 * README: --gc-sections and map files are now supported. Document
8826 some build requirements.
8829 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
8830 relocatable link set the value of the section symbol to zero.
8831 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
8832 relocatable link don't include the section address in the local
8835 2009-02-27 Ian Lance Taylor <iant@google.com>
8838 * options.h (class Search_directory): Add is_system_directory.
8839 (class General_options): Declare is_in_system_directory.
8840 * options.cc (get_relative_sysroot): Make static.
8841 (get_default_sysroot): Make static.
8842 (General_optoins::is_in_system_directory): New function.
8843 * fileread.cc (Input_file::is_in_system_directory): New function.
8844 * fileread.h (class Input_file): Declare is_in_system_directory.
8845 * object.h (class Object): Add is_in_system_directory.
8846 (class Input_objects): Remove system_library_directory_ field.
8847 * object.cc (Input_objects::add_object): Don't set
8848 system_library_directory_.
8849 (input_objects::found_in_system_library_directory): Remove.
8850 * symtab.cc (Symbol_table::write_globals): Remove input_objects
8851 parameter. Change all callers.
8852 (Symbol_table::sized_write_globals): Likewise.
8853 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
8854 Call Object::is_in_system_directory.
8855 * symtab.h (class Symbol_table): Update declarations.
8858 * descriptors.h (Open_descriptor): Add is_on_stack field.
8859 * descriptors.cc (Descriptors::open): If the descriptor is on the
8860 top of the stack, remove it. Initialize is_on_stack field.
8861 (Descriptors::release): Only add pod to stack if it is not on the
8863 (Descriptors::close_some_descriptor): Clear stack_next and
8867 * output.cc (Output_section::find_starting_output_address): Rename
8868 from starting_output_address; add PADDR parameter; change return
8870 * output.h (class Output_section): Declare
8871 find_starting_output_address instead of starting_output_address.
8872 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
8873 section symbol for which we can't find a merge section.
8876 * symtab.cc (Symbol_table::add_from_object): If the visibility is
8877 hidden or internal, force the symbol to be local.
8878 * resolve.cc (Symbol::override_visibility): Define.
8879 (Symbol::override_base): Use override_visibility.
8880 (Symbol_table::resolve): Likewise.
8881 (Symbol::override_base_with_special): Likewise.
8882 (Symbol_table::override_with_special): If the visibility is hidden
8883 or internal, force the symbol to be local.
8884 * symtab.h (class Symbol): Add set_visibility and
8885 override_visibility.
8886 * testsuite/ver_test_1.sh: New file.
8887 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
8888 (check_DATA): Add ver_test_1.syms.
8889 (ver_test_1.syms): New target.
8890 * testsuite/Makefile.in: Rebuild.
8892 2009-02-25 Cary Coutant <ccoutant@google.com>
8894 * layout.cc (Layout::choose_output_section): Don't rename sections
8895 when using a linker script that has a SECTIONS clause.
8896 * Makefile.in: Regenerate.
8898 * testsuite/Makefile.am (script_test_5.sh): New test case.
8899 * testsuite/Makefile.in: Regenerate.
8900 * testsuite/script_test_5.cc: New file.
8901 * testsuite/script_test_5.sh: New file.
8902 * testsuite/script_test_5.t: New file.
8904 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
8906 * archive.cc (Archive::include_member): Update calls to add_symbols.
8907 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
8908 the Layout argument.
8909 * dynobj.h (do_add_symbols): Add the Layout argument.
8910 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
8912 * object.h (Object::add_symbols): Add the Layout argument.
8913 (Object::do_add_symbols): Add the Layout argument.
8914 (Sized_relobj::do_add_symbols): Add the Layout argument.
8915 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
8916 Unify the two versions.
8917 (Add_plugin_symbols): Remove.
8918 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
8919 (Sized_pluginobj::do_add_symbols): Unify the two versions.
8920 (Add_plugin_symbols): Remove.
8921 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
8922 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
8923 (Add_symbols::run): Make it work with Pulginobj.
8925 2009-02-06 Ian Lance Taylor <iant@google.com>
8927 * object.cc (Sized_relobj::do_layout): Make info message start
8928 with lower case letter.
8930 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
8932 * binary.cc: Fix file comment.
8934 * options.h (enum Incremental_disposition): Define.
8935 (class General_options): Add new options: --incremental,
8936 --incremental_changed, --incremental_unchanged,
8937 --incremental_unknown. Add incremental_disposition_ and
8938 implicit_incremental_ fields.
8939 (General_options::incremental_disposition): New function.
8940 (class Position_dependent_options): Add incremental_disposition
8942 (Position_dependent_options::copy_from_options): Set incremental
8944 * options.cc (General_options::parse_incremental_changed): New
8946 (General_options::parse_incremental_unchanged): New function.
8947 (General_options::parse_incremental_unknown): New function.
8948 (General_options::General_options): Initialize new fields
8949 incremental_disposition_ and implicit_incremental_.
8950 (General_options::finalize): Check for uasge of --incremental-*
8951 without --incremental.
8953 2009-02-06 Chris Demetriou <cgd@google.com>
8955 * gold.h (gold_undefined_symbol): Change to take only a Symbol
8956 pointer and to report location as the file name associated with
8958 (gold_undefined_symbol_at_location): New function to replace the
8959 old gold_undefined_symbol functionality.
8960 * target-reloc.h (relocate_section): Update to use
8961 gold_undefined_symbol_at_location.
8962 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
8963 Call gold_undefined_symbol function rather than gold_error.
8964 * errors.h (Errors::undefined_symbol): Take location as a
8965 string, rather than calculating it from a relocation.
8966 * errors.cc (Errors::fatal): Print "fatal error:" before the
8968 (Errors::error, Errors::error_at_location): Print "error: "
8969 before the formatted message.
8970 (Errors::undefined_symbol): Take location as a string, rather
8971 than calculating it from a relocation.
8972 (gold_undefined_symbol_at_location): New function akin to
8973 old gold_undefined_symbol, calculates location from relocation.
8974 (gold_undefined_symbol): Change to take only a Symbol pointer
8975 and to report location as the file name associated with the symbol.
8976 * testsuite/debug_msg.sh: Update for changed error messages.
8977 * testsuite/undef_symbol.sh: Likewise.
8979 2009-02-04 Duncan Sands <baldrick@free.fr>
8982 * reduced_debug_output.h
8983 (Output_reduced_debug_abbrev_section::failed): Use format for
8985 (Output_reduced_debug_info_section::faild): Likewise.
8987 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
8989 * script.cc (Lazy_demangler): New class.
8990 (Version_script_info::get_symbol_version_helper): Demangle a
8993 2009-01-29 Cary Coutant <ccoutant@google.com>
8995 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
8997 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8999 2009-01-28 Ian Lance Taylor <iant@google.com>
9001 * version.cc (version_string): Bump to 1.9.
9003 * gold.h: Include <cstring> and <stdint.h>.
9004 * version.cc: Include <cstdio>.
9005 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
9007 * reduced_debug_output.cc (insert_into_vector): Rename from
9008 Insert_into_vector; change all callers. Use Swap_unaligned to
9009 avoid aliasing issue; remove union since it is unnecessary.
9011 2009-01-27 Sriraman Tallam <tmsriram@google.com>
9013 * Makefile.am (CCFILES): Add gc.cc.
9015 * Makefile.in: Regenerate.
9016 * gold.cc (Gc_runner): New class.
9017 (queue_initial_tasks): Call garbage collection related tasks
9018 when corresponding options are invoked.
9019 (queue_middle_gc_tasks): New function.
9020 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
9021 processed early before laying out sections during garbage collection.
9022 * gold.h (queue_middle_gc_tasks): New function.
9023 (is_prefix_of): Move from "layout.cc".
9024 * i386.cc (Target_i386::gc_process_relocs): New function.
9025 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
9026 * main.cc (main): Create object of class "Garbage_collection".
9027 * object.cc (Relobj::copy_symbols_data): New function.
9028 (Relobj::is_section_name_included): New function.
9029 (Sized_relobj::do_layout): Allow this function to be called twice
9030 during garbage collection and defer layout of section during the
9032 * object.h (Relobj::get_symbols_data): New function.
9033 (Relobj::is_section_name_included): New function.
9034 (Relobj::copy_symbols_data): New function.
9035 (Relobj::set_symbols_data): New function.
9036 (Relobj::get_relocs_data): New function.
9037 (Relobj::set_relocs_data): New function.
9038 (Relobj::is_output_section_offset_invalid): New pure virtual function.
9039 (Relobj::gc_process_relocs): New function.
9040 (Relobj::do_gc_process_relocs): New pure virtual function.
9041 (Relobj::sd_): New data member.
9042 (Sized_relobj::is_output_section_offset_invalid): New function.
9043 (Sized_relobj::do_gc_process_relocs): New function.
9044 * options.h (General_options::gc_sections): Modify to not be a no-op.
9045 (General_options::print_gc_sections): New option.
9046 * plugin.cc (Plugin_finish::run): Remove function call to
9047 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
9048 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
9049 * reloc.cc (Read_relocs::run): Add task to process relocs and
9050 determine unreferenced sections when doing garbage collection.
9051 (Gc_process_relocs): New class.
9052 (Sized_relobj::do_gc_process_relocs): New function.
9053 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
9054 sections that are garbage collected.
9055 * reloc.h (Gc_process_relocs): New class.
9056 * sparc.cc (Target_sparc::gc_process_relocs): New function.
9057 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
9058 symbols whose corresponding sections are garbage collected.
9059 (Symbol_table::Symbol_table): Add new parameter for the garbage
9061 (Symbol_table::gc_mark_undef_symbols): New function.
9062 (Symbol_table::gc_mark_symbol_for_shlib): New function.
9063 (Symbol_table::gc_mark_dyn_syms): New function.
9064 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
9066 (Symbol_table::add_from_object): Likewise.
9067 (Symbol_table::add_from_relobj): When building shared objects, do not
9068 treat externally visible symbols as garbage.
9069 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
9070 table information for static and relocatable links.
9071 * symtab.h (Symbol_table::set_gc): New function.
9072 (Symbol_table::gc): New function.
9073 (Symbol_table::gc_mark_undef_symbols): New function.
9074 (Symbol_table::gc_mark_symbol_for_shlib): New function.
9075 (Symbol_table::gc_mark_dyn_syms): New function.
9076 (Symbol_table::gc_): New data member.
9077 * target.h (Sized_target::gc_process_relocs): New pure virtual
9079 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
9080 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
9082 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
9084 * options.h (General_options::gc_sections): Define as a no-op for now.
9085 (General_options::no_keep_memory): Ditto.
9086 (General_options::Bshareable): Define.
9087 * options.cc (General_options::finalize): Honor -Bshareable.
9089 2009-01-20 Andreas Schwab <schwab@suse.de>
9091 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
9092 read the value in the contents, since we don't use it. Use the
9093 template endianness when writing.
9094 (Relocate::relocate): Use it for R_PPC_REL16_HA.
9096 2009-01-19 Andreas Schwab <schwab@suse.de>
9098 * configure.tgt (powerpc64-*): Fix targ_obj.
9100 2009-01-15 Ian Lance Taylor <iant@google.com>
9102 * object.cc (Sized_relobj::write_local_symbols): Don't write out
9103 local symbols when stripping all symbols.
9105 2009-01-14 Cary Coutant <ccoutant@google.com>
9107 * output.cc (Output_reloc): Add explicit instantiations.
9109 2009-01-14 Cary Coutant <ccoutant@google.com>
9111 * archive.cc (Archive::get_elf_object_for_member): Remove call
9112 to File_read::claim_for_plugin.
9113 * descriptors.cc (Descriptors::open): Remove reference to
9115 (Descriptors::claim_for_plugin): Remove.
9116 * descriptors.h (Descriptors::claim_for_plugin): Remove.
9117 (Descriptors::is_claimed): Remove.
9118 (claim_descriptor_for_plugin): Remove.
9119 * fileread.cc (File_read::claim_for_plugin): Remove.
9120 * fileread.h (File_read::claim_for_plugin): Remove.
9121 (File_read::descriptor): Reopen descriptor if necessary.
9122 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
9123 (Plugin_manager::all_symbols_read): Add task parameter. Change
9125 (Plugin_manager::get_input_file): New function.
9126 (Plugin_manager::release_input_file): New function.
9127 (Pluginobj::Pluginobj): Add filesize parameter and initialize
9128 corresponding data member.
9129 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
9130 and pass to base constructor. Change all callers.
9131 (get_input_file, release_input_file): New functions.
9132 (make_sized_plugin_object): Add filesize parameter. Change all callers.
9133 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
9134 (Plugin_manager::all_symbols_read): Add task parameter.
9135 (Plugin_manager::get_input_file): New function.
9136 (Plugin_manager::release_input_file): New function.
9137 (Plugin_manager::task_): New data member.
9138 (Pluginobj::Pluginobj): Add filesize parameter.
9139 (Pluginobj::filename): New function.
9140 (Pluginobj::descriptor): New function.
9141 (Pluginobj::filesize): New function.
9142 (Pluginobj::filesize_): New data member.
9143 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
9144 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
9145 File_read::claim_for_plugin; use Object::unlock to unlock the file.
9147 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
9148 with archive libraries.
9149 * testsuite/Makefile.in: Regenerate.
9150 * testsuite/plugin_test.c (struct sym_info): New type.
9151 (get_input_file, release_input_file): New static variables.
9152 (onload): Capture new transfer vector entries.
9153 (claim_file_hook): Stop reading at end of file according to filesize.
9154 Factor out parsing of readelf output into separate function.
9155 (all_symbols_read_hook): Exercise get_input_file and release_input_file
9156 APIs and get the source file name from the symbol table. Convert
9157 source file name to corresponding object file name. Print info
9158 message when adding new input files.
9159 (parse_readelf_line): New function.
9160 * testsuite/plugin_test_1.sh: Add checks for new info messages.
9161 * testsuite/plugin_test_2.sh: Likewise.
9162 * testsuite/plugin_test_3.sh: Likewise.
9163 * testsuite/plugin_test_4.sh: New test case.
9165 2009-01-07 Ian Lance Taylor <iant@google.com>
9167 * version.cc (version_string): Bump to 1.8.
9169 2008-12-23 Cary Coutant <ccoutant@google.com>
9171 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
9172 * plugin.cc (Plugin_manager::finish): Rename as
9173 layout_deferred_objects. Move cleanup to separate function.
9174 (Plugin_manager::cleanup): New function.
9175 (Plugin_finish::run): Call layout_deferred_objects and cleanup
9177 * plugin.h (Plugin_manager::finish): Rename as
9178 layout_deferred_objects.
9179 (Plugin_manager::cleanup): New function.
9180 (Plugin_manager::cleanup_done): New field.
9182 2008-12-23 Cary Coutant <ccoutant@google.com>
9184 * plugin.cc (is_visible_from_outside): New function.
9185 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
9186 so we don't return "IR only" status for exported symbols or -r links.
9188 * testsuite/Makefile.am (plugin_test_3): New test case.
9189 * testsuite/Makefile.in: Regenerate.
9190 * testsuite/plugin_test_3.sh: New file.
9192 2008-12-22 Cary Coutant <ccoutant@google.com>
9194 * object.cc (Sized_relobj::layout_section): New function.
9195 (Sized_relobj::do_layout): Defer layout of input sections until after
9196 plugin has provided replacement files.
9197 (Sized_relobj::do_layout_deferred_sections): New function.
9198 * object.h (Relobj::set_section_offset): Remove virtual keyword.
9199 (Relobj::layout_deferred_sections): New function.
9200 (Relobj::do_layout_deferred_sections): New function.
9201 (Sized_relobj::do_layout_deferred_sections): New function.
9202 (Sized_relobj::layout_section): New function.
9203 (Sized_relobj::Deferred_layout): New structure.
9204 (Sized_relobj::deferred_layout_): New field.
9205 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
9206 Change all callers. Layout deferred sections.
9207 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
9209 (Plugin_hook::run): Move code from do_plugin_hook inline.
9210 (Plugin_hook::do_plugin_hook): Remove.
9211 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
9212 (Plugin_manager::finish): Renamed, was cleanup.
9213 (Plugin_manager::should_defer_layout): New function.
9214 (Plugin_manager::add_deferred_layout_object): New function.
9215 (Plugin_manager::Deferred_layout_list): New type.
9216 (Plugin_manager::deferred_layout_objects_): New field.
9217 (Plugin_hook::do_plugin_hook): Remove.
9219 2008-12-17 Ian Lance Taylor <iant@google.com>
9221 * options.h (class General_options): Add --no case for
9224 2008-12-16 Cary Coutant <ccoutant@google.com>
9226 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
9228 (Plugin_manager::claim_file): Create plugin object even if
9229 plugin did not call the add_symbols callback.
9230 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
9231 asking for more symbols than were added.
9232 * testsuite/Makefile.am (plugin_test_1): Add test case with
9234 (empty.syms): New target.
9235 * testsuite/Makefile.in: Regenerate.
9236 * testsuite/plugin_test.c (claim_file_hook): Add new debug
9237 message. Don't call add_symbols if no globals.
9238 (all_symbols_read_hook): Don't provide replacement for empty
9241 2008-12-12 Ian Lance Taylor <iant@google.com>
9243 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
9244 r_type == 0 for a local symbol with r_sym == 0.
9245 (scan_relocatable_relocs): Pass r_sym to
9246 local_non_section_strategy.
9247 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
9250 * configure.ac: Update test for TLS descriptors: they are
9251 supported as of glibc 2.9.
9252 * configure: Rebuild.
9254 2008-12-11 Ian Lance Taylor <iant@google.com>
9257 * target-reloc.h (Default_scan_relocatable_relocs): For each
9258 function, map r_type == 0 to RELOC_DISCARD.
9260 2008-12-10 Cary Coutant <ccoutant@google.com>
9262 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
9263 object to override a kept COMDAT group from a plugin object.
9265 2008-12-09 Ian Lance Taylor <iant@google.com>
9268 * yyscript.y (file_cmd): Handle INPUT.
9270 * testsuite/initpri1.c: Change all declarations to be full
9271 prototypes by adding void, to avoid compiler warnings.
9273 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
9275 * options.cc (General_options::parse_plugin_opt): New.
9276 (General_options::add_plugin): The argument now is just the filename.
9277 (General_options::add_plugin_option): New.
9278 * options.h (plugin_opt): New.
9279 (add_plugin): Change argument name.
9280 (add_plugin_option): New.
9281 * plugin.cc (Plugin::load): Don't parse the plugin option.
9282 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
9283 (Plugin::add_option): New.
9284 (Plugin::args_): Change type.
9285 (Plugin::filename_): New.
9286 (Plugin_manager::add_plugin_option): New.
9287 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
9288 * testsuite/Makefile.in: Regenerate.
9290 2008-12-05 Cary Coutant <ccoutant@google.com>
9292 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
9293 Handle --strip-lto-sections option.
9294 * options.h (strip_lto_sections): New option.
9296 2008-12-01 Cary Coutant <ccoutant@google.com>
9298 * plugin.cc (ld_plugin_message): Change format parameter to const.
9299 Fix mismatch between new[] and delete.
9301 2008-11-14 Cary Coutant <ccoutant@google.com>
9303 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
9306 2008-11-05 Craig Silverstein <csilvers@google.com>
9308 * options.cc (General_options::parse_dynamic_list): New function.
9309 * options.h (General_options): New flags dynamic_list,
9310 dynamic_list_data, dynamic_list_cpp_new, and
9311 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
9312 (General_options::in_dynamic_list): New function.
9313 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
9314 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
9315 (Lex::can_continue_name): Likewise.
9317 (read_script_file): New parameter script_options.
9318 (read_dynamic_list): New function.
9319 (Script_options::define_dynamic_list): New function.
9320 (dynamic_list_keyword_parsecodes): New variable.
9321 (dynamic_list_keywords): New variable.
9322 * script.h (Script_options::define_dynamic_list): New function
9324 (read_dynamic_list): New function prototype.
9325 * symtab.cc (strprefix): New macro.
9326 (Symbol::should_add_dynsym_entry): Support dynamic_list,
9327 dynamic_list_data, dynamic_list_cpp_new, and
9328 dynamic_list_cpp_typeinfo.
9329 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
9330 (dynamic_list_expr): New rule.
9331 (dynamic_list_nodes): Likewise.
9332 (dynamic_list_node): Likewise.
9333 * testsuite/Makefile.am (dynamic_list): New test.
9334 * testsuite/Makefile.in: Regenerated.
9335 * testsuite/dynamic_list.t: New file.
9336 * testsuite/dynamic_list.sh: New file.
9338 2008-11-05 Craig Silverstein <csilvers@google.com>
9340 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
9341 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
9342 (t11_last): Likewise.
9343 * testsuite/ver_test_6.c (main): Likewise.
9345 2008-10-07 Cary Coutant <ccoutant@google.com>
9347 * options.c (General_options::finalize): Add check for -static and
9349 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
9352 2008-10-02 Cary Coutant <ccoutant@google.com>
9354 * plugin.cc (make_sized_plugin_object): Fix conditional
9355 compilation to work when not all targets are enabled.
9357 2008-09-29 Cary Coutant <ccoutant@google.com>
9359 * archive.cc (Archive::get_file_and_offset): Use filename instead
9360 of name to get library path.
9361 (Archive::include_member): Unlock external member of a thin archive.
9363 * testsuite/Makefile.am (TEST_AR): New variable.
9364 (thin_archive_test_1): New test.
9365 (thin_archive_test_2): New test.
9366 * testsuite/Makefile.in: Regenerate.
9367 * testsuite/thin_archive_main.cc: New file.
9368 * testsuite/thin_archive_test_1.cc: New file.
9369 * testsuite/thin_archive_test_2.cc: New file.
9370 * testsuite/thin_archive_test_3.cc: New file.
9371 * testsuite/thin_archive_test_4.cc: New file.
9373 2008-09-29 Cary Coutant <ccoutant@google.com>
9375 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
9376 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
9378 (Sized_relobj::do_finalize_local_symbols): Likewise.
9379 (Sized_relobj::map_to_kept_section): Likewise.
9380 * object.h (Sized_relobj::invalid_address): New constant.
9381 (Sized_relobj::do_output_section_offset): Check for invalid_address
9383 * output.cc (Output_reloc::local_section_offset): Use constant
9384 invalid_address instead of -1U.
9385 (Output_reloc::get_address): Likewise.
9386 (Output_section::output_address): Change -1U to -1ULL.
9387 * output.h (Output_reloc::invalid_address): New constant.
9388 * reloc.cc (Sized_relobj::write_sections): Use constant
9389 invalid_address instead of -1U.
9390 (Sized_relobj::relocate_sections): Likewise.
9391 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
9392 values for merge sections.
9393 * target-reloc.h (relocate_for_relocatable): Use constant
9394 invalid_address instead of -1U.
9396 2008-09-19 Cary Coutant <ccoutant@google.com>
9398 Add plugin functionality for link-time optimization (LTO).
9399 * configure.ac (plugins): Add --enable-plugins option.
9400 * configure: Regenerate.
9401 * config.in: Regenerate.
9402 * Makefile.am (LIBDL): New variable.
9403 (CCFILES): Add plugin.cc.
9404 (HFILES): Add plugin.h.
9405 (ldadd_var): Add LIBDL.
9406 * Makefile.in: Regenerate.
9408 * archive.cc: Include "plugin.h".
9409 (Archive::setup): Don't preread archive symbols when using a plugin.
9410 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
9411 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
9413 (Archive::include_member): Add symbols from plugin objects.
9414 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
9415 * descriptors.cc (Descriptors::open): Check for file descriptors
9416 abandoned by plugins.
9417 (Descriptors::claim_for_plugin): New function.
9418 * descriptors.h (Descriptors::claim_for_plugin): New function.
9419 (Open_descriptor::is_claimed): New field.
9420 (claim_descriptor_for_plugin): New function.
9421 * fileread.cc (File_read::claim_for_plugin): New function.
9422 * fileread.h (File_read::claim_for_plugin): New function.
9423 (File_read::descriptor): New function.
9424 * gold.cc: Include "plugin.h".
9425 (queue_initial_tasks): Add task to call plugin hooks for generating
9427 * main.cc: Include "plugin.h".
9428 (main): Load plugin libraries.
9429 * object.h (Pluginobj): Declare.
9430 (Object::pluginobj): New function.
9431 (Object::do_pluginobj): New function.
9432 (Object::set_target): New function.
9433 * options.cc: Include "plugin.h".
9434 (General_options::parse_plugin): New function.
9435 (General_options::General_options): Initialize plugins_ field.
9436 (General_options::add_plugin): New function.
9437 * options.h (Plugin_manager): Declare.
9438 (General_options): Add --plugin option.
9439 (General_options::has_plugins): New function.
9440 (General_options::plugins): New function.
9441 (General_options::add_plugin): New function.
9442 (General_options::plugins_): New field.
9443 * plugin.cc: New file.
9444 * plugin.h: New file.
9445 * readsyms.cc: Include "plugin.h".
9446 (Read_symbols::do_read_symbols): Check for archive before checking
9447 for ELF file. Call plugin hooks to claim files.
9448 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
9449 from a real object file; force override when processing replacement
9451 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
9452 (Symbol::init_base_object): Likewise.
9453 (Symbol::init_base_output_data): Likewise.
9454 (Symbol::init_base_output_segment): Likewise.
9455 (Symbol::init_base_constant): Likewise.
9456 (Symbol::init_base_undefined): Likewise.
9457 (Symbol::output_section): Assert that object is not a plugin.
9458 (Symbol_table::add_from_pluginobj): New function.
9459 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
9461 (Symbol_table::sized_write_globals): Likewise.
9462 (Symbol_table::add_from_pluginobj): Instantiate template.
9463 * symtab.h (Sized_pluginobj): Declare.
9464 (Symbol::in_real_elf): New function.
9465 (Symbol::set_in_real_elf): New function.
9466 (Symbol::in_real_elf_): New field.
9467 (Symbol_table::add_from_pluginobj): New function.
9469 * testsuite/Makefile.am (AM_CFLAGS): New variable.
9470 (LIBDL): New variable.
9472 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
9473 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
9474 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
9475 (MOSTLYCLEANFILES): Likewise.
9476 * testsuite/Makefile.in: Regenerate.
9477 * testsuite/plugin_test.c: New file.
9478 * testsuite/plugin_test_1.sh: New file.
9479 * testsuite/plugin_test_2.sh: New file.
9481 2008-09-16 Ian Lance Taylor <iant@google.com>
9483 * target-reloc.h (relocate_section): Check whether a symbol is
9484 defined by the ABI before reporting an undefined symbol error.
9485 * target.h (Target::is_defined_by_abi): Make parameter const.
9486 (Target::do_is_defined_by_abi): Likewise.
9487 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
9488 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
9489 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
9490 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
9491 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
9492 * testsuite/Makefile.in: Rebuild.
9494 * fileread.cc (make_view): Add casts to avoid warning.
9496 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
9498 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
9499 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
9501 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
9503 * options.h (General_options::output_is_executable): New.
9504 (General_options::output_is_pie): New.
9505 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
9506 for shared libraries.
9507 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
9509 2008-09-11 Chris Demetriou <cgd@google.com>
9511 * options.h (origin): New -z option.
9512 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
9513 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
9516 2008-09-05 Cary Coutant <ccoutant@google.com>
9518 * fileread.cc (File_read::make_view): Add check for attempt to map
9521 2008-09-05 Cary Coutant <ccoutant@google.com>
9523 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
9524 explicit instantiations.
9526 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
9529 * options.cc (General_options::finalize): Allow undefined symbols
9530 in shlibs if linking -shared.
9533 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
9534 symbols as not needing a dynsym entry.
9536 2008-08-20 Craig Silverstein <csilvers@google.com>
9538 * fileread.cc (File_read::open): Do not lock the file unless it
9539 was successfully opened.
9541 2008-08-14 Cary Coutant <ccoutant@google.com>
9543 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
9544 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
9545 * testsuite/tls_test.cc (struct int128): 128-bit struct
9546 for testing TLS relocs with non-zero addend.
9547 (v12): New TLS variable.
9549 (t_last): Add check for v12.
9550 * testsuite/tls_test.h (t12): New function.
9551 * testsuite/tls_test_main.cc (thread_routine): Call new test.
9553 2008-08-13 Ian Lance Taylor <iant@google.com>
9555 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
9556 set tls_segment_ or relro_segment_.
9557 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
9559 * output.h (Output_section::clear_is_relro): New function.
9560 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
9561 sections specially even when output_data_ is empty.
9562 (Output_segment::maximum_alignment): When first section is relro,
9563 only force alignment for PT_LOAD segments.
9564 * script.cc (script_data_segment_align): New function.
9565 (script_data_segment_relro_end): New function.
9566 * script-c.h (script_data_segment_align): Declare.
9567 (script_data_segment_relro_end): Declare.
9568 * script-sections.h (class Script_sections): Declare
9569 data_segment_align and data_segment_relro_end. Add fields
9570 segment_align_index_ and saw_relro_end_.
9571 * script-sections.cc (class Sections_element): Add set_is_relro
9572 virtual function. Add new bool* parameter to place_orphan_here.
9573 Add get_output_section virtual function.
9574 (class Output_section_definition): Add set_is_relro. Add new
9575 bool* parameter to place_orphan_here. Add get_output_section.
9576 Add is_relro_ field.
9577 (Output_section_definition::Output_section_definition): Initialize
9578 evaluated_address_, evaluated_load_address, evaluated_addralign_,
9579 and is_relro_ fields.
9580 (Output_section_definition::place_orphan_here): Add is_relro
9582 (Output_section_definition::set_section_addresses): Set relro for
9584 (Output_section_definition::alternate_constraint): Likewise.
9585 (class Orphan_output_section): Add new bool* parameter to
9586 place_orphan_here. Add get_output_section.
9587 (Orphan_output_section::place_orphan_here): Add is_relro
9589 (Script_sections::Script_sections): Initialize
9590 data_segment_align_index_ and saw_relro_end_.
9591 (Script_sections::data_segment_align): New function.
9592 (Script_sections::data_segment_relro_end): New function.
9593 (Script_sections::place_orphan): Set or clear is_relro.
9594 (Script_sections::set_section_addresses): Force alignment of first
9596 * yyscript.y (exp): Call script_data_segment_align and
9597 script_data_segment_relro_end.
9598 * testsuite/relro_script_test.t: New file.
9599 * testsuite/relro_test.cc (using_script): Declare.
9600 (t1, t2): Test using_script.
9601 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
9602 (relro_script_test_SOURCES): Define.
9603 (relro_script_test_DEPENDENCIES): Define.
9604 (relro_script_test_LDFLAGS): Define.
9605 (relro_script_test_LDADD): Define.
9606 (relro_script_test.so): New target.
9607 * testsuite/Makefile.in: Rebuild.
9609 2008-08-06 Cary Coutant <ccoutant@google.com>
9611 * archive.cc (Archive::total_archives, Archive::total_members)
9612 (Archive::total_members_loaded): New variables.
9613 (Archive::setup): Add parameter. Add option to preread
9615 (Archive::read_armap): Add counter.
9616 (Archive::get_file_and_offset): New function.
9617 (Archive::get_elf_object_for_member): New function.
9618 (Archive::read_all_symbols): New function.
9619 (Archive::read_symbols): New function.
9620 (Archive::add_symbols): Add counters.
9621 (Archive::include_all_members): Use armap to find members if it's
9623 (Archive::include_member): Skip reading symbols if already read.
9624 Factored code into Archive::get_file_and_offset and
9625 Archive::get_elf_object_for_member. Changed call to
9626 Mapfile::report_include_archive_member.
9627 (Archive::print_stats): New function.
9628 * archive.h: Declare Object and Read_symbols_data classes.
9629 (Archive::Archive): Add initializers for new members.
9630 (Archive::setup): Add parameter.
9631 (Archive::print_stats): New function.
9632 (Archive::total_archives, Archive::total_members)
9633 (Archive::total_members_loaded): New variables.
9634 (Archive::get_file_and_offset): New function.
9635 (Archive::get_elf_object_for_member): New function.
9636 (Archive::read_all_symbols): New function.
9637 (Archive::read_symbols): New function.
9638 (Archive::Archive_member): New class.
9639 (Archive::members_): New member.
9640 (Archive::num_members_): New member.
9641 * main.cc: Include archive.h.
9642 (main): Call Archive::print_stats.
9643 * mapfile.cc (Mapfile::report_include_archive_member): Delete
9644 archive parameter; member_name is now the fully-decorated name.
9645 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
9646 * options.h: (General_options): Add --preread-archive-symbols option.
9647 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
9650 2008-08-04 Ian Lance Taylor <iant@google.com>
9652 * symtab.h (Symbol::use_plt_offset): New function.
9653 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
9654 * powerpc.cc (Relocate::relocate): Likewise.
9655 * sparc.cc (Relocate::relocate): Likewise.
9656 * x86_64.cc (Relocate::relocate): Likewise.
9657 * testsuite/weak_plt.sh: New test.
9658 * testsuite/weak_plt_main.cc: New test.
9659 * testsuite/weak_plt_shared.cc: New test.
9660 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
9661 (check_PROGRAMS): Add weak_plt.
9662 (check_DATA): Add weak_plt_shared.so.
9663 (weak_plt_main_pic.o, weak_plt): New targets.
9664 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
9665 * testsuite/Makefile.in: Rebuild.
9667 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
9669 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
9670 * testsuite/Makefile.in: Rebuild.
9672 2008-08-04 Alan Modra <amodra@bigpond.net.au>
9674 * Makefile.am (POTFILES.in): Set LC_ALL=C.
9675 * Makefile.in: Regenerate.
9676 * po/POTFILES.in: Regenerate.
9678 2008-07-29 Ian Lance Taylor <iant@google.com>
9680 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
9681 symbols before other symbols.
9682 * testsuite/script_test_2.cc (test_addr): Declare.
9683 (test_addr_alias): Declare.
9684 (main): Check that test_addr and test_addr_alias have the right
9686 * testsuite/script_test_2.t: Define test_addr_alias and
9689 2008-07-24 Ian Lance Taylor <iant@google.com>
9692 * descriptors.cc: New file.
9693 * descriptors.h: New file.
9694 * gold-threads.h (class Hold_optional_lock): New class.
9695 * fileread.cc: Include "descriptors.h".
9696 (File_read::~File_read): Release descriptor rather than closing
9698 (File_read::open) [file]: Call open_descriptor rather than open.
9699 Set is_descriptor_opened_.
9700 (File_read::open) [memory]: Assert that descriptor is not open.
9701 (File_read::reopen_descriptor): New function.
9702 (File_read::release): Release descriptor.
9703 (File_read::do_read): Make non-const. Reopen descriptor.
9704 (File_read::read): Make non-const.
9705 (File_read::make_view): Reopen descriptor.
9706 (File_read::do_readv): Likewise.
9707 * fileread.h (class File_read): Add is_descriptor_opened_ field.
9708 Update declarations.
9709 * layout.cc: Include "descriptors.h".
9710 (Layout::create_build_id): Use open_descriptor rather than open.
9711 * output.cc: Include "descriptors.h".
9712 (Output_file::open): Use open_descriptor rather than open.
9713 * archive.cc (Archive::const_iterator): Change Archive to be
9715 (Archive::begin, Archive::end): Make non-const.
9716 (Archive::count_members): Likewise.
9717 * archive.h (class Archive): Update declarations.
9718 * object.h (Object::read): Make non-const.
9719 * Makefile.am (CCFILES): Add descriptors.cc.
9720 (HFILES): Add descriptors.h.
9721 * Makefile.in: Rebuild.
9724 * gold.h: Always include <clocale>. Add Solaris workarounds
9725 following code in binutils/sysdep.h.
9728 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
9729 this->eh_frame_hdr_ is NULL before using it.
9731 * dynobj.cc (Versions::Versions): Update comment.
9733 * dynobj.cc (Versions::Versions): If there is an soname, use it as
9734 the base version name.
9736 * stringpool.cc (Stringpool_template::add_with_length): Set key to
9737 array size plus one.
9738 (Stringpool_template::set_string_offsets): Subtract one from key
9739 before using it as an array index.
9740 (Stringpool_template::get_offset_with_length): Likewise.
9741 (Stringpool_template::write_to_buffer): Likewise.
9742 * stringpool.h (Stringpool_template::get_offset_from_key):
9745 2008-07-23 Ian Lance Taylor <iant@google.com>
9748 * object.h (Merged_symbol_value::value): Do our best to handle a
9752 * script.cc (Version_script_info::get_versions): Don't add empty
9753 version tag to return value.
9754 (Version_script_info::get_symbol_version_helper): Change return
9755 type to bool. Add pversion parameter. Change all callers.
9756 (script_register_vers_node): Don't require a non-NULL tag.
9757 * script.h (class Version_script_info): Update declarations.
9758 (Version_script_info::get_symbol_version): Change return type to
9759 bool. Add version parameter. Change all callers.
9760 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
9761 handling. Handle an empty version from a version script.
9762 (Symbol_table::define_special_symbol): Likewise.
9763 * testsuite/ver_test_10.script: New file.
9764 * testsuite/ver_test_10.sh: New file.
9765 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
9766 (check_DATA): Add ver_test_10.syms.
9767 (ver_test_10.syms, ver_test_10.so): New target.
9768 * testsuite/Makefile.in: Rebuild.
9770 2008-07-23 Simon Baldwin <simonb@google.com>
9772 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
9773 to zero for undefined symbols from dynamic libraries.
9775 2008-07-23 Ian Lance Taylor <iant@google.com>
9777 * symtab.cc (Symbol_table::resolve): Remove version parameter.
9779 * symtab.h (class Symbol_table): Update declaration.
9780 * testsuite/ver_test_9.cc: New file.
9781 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
9782 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
9783 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
9784 (ver_test_9.so, ver_test_9.o): New targets.
9785 * testsuite/Makefile.in: Rebuild.
9787 2008-07-22 Ian Lance Taylor <iant@google.com>
9789 * options.h (class General_options): Define --check-sections.
9790 * layout.cc (Layout::set_segment_offsets): Handle
9793 * options.h (class General_options): Define -n/--nmagic and
9795 * options.cc (General_options::finalize): For -n/--nmagic or
9796 -N/--omagic, set -static.
9797 * layout.cc (Layout::attach_allocated_section_to_segment): If
9798 -N/--omagic, don't put read-only and read-write sections in
9800 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
9801 finding a read-only segment.
9802 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
9803 don't set the minimum segment alignment to the common page size,
9804 and don't set the file offset to the address modulo the page size.
9805 * script-sections.cc (Script_sections::create_segments): If
9806 -n/--omagic, don't put read-only and read-write sections in
9809 * cref.cc: New file.
9811 * options.h (class General_options): Add --print-symbol-counts.
9812 * main.cc (main): Issue defined symbol report if requested.
9813 * archive.cc (Archive::interpret_header): Make into a const member
9815 (Archive::add_symbols): Call Input_objects::archive_start and
9817 (Archive::const_iterator): Define new class.
9818 (Archive::begin, Archive::end): New functions.
9819 (Archive::include_all_members): Rewrite to use iterator.
9820 (Archive::count_members): New function.
9821 * archive.h (class Archive): Update declarations.
9822 (Archive::filename): New function.
9823 * object.cc: Include "cref.h".
9824 (Sized_relobj::Sized_relobj): Initialize defined_count_.
9825 (Sized_relobj::do_get_global_symbol_counts): New function.
9826 (Input_objects::add_object): Add object to cross-referencer.
9827 (Input_objects::archive_start): New function.
9828 (Input_objects::archive_stop): New function.
9829 (Input_objects::print_symbol_counts): New function.
9830 * object.h: Declare Cref and Archive.
9831 (Object::get_global_symbol_counts): New function.
9832 (Object::do_get_global_symbol_counts): New pure virtual function.
9833 (class Sized_relobj): Add defined_count_ field. Update
9835 (class Input_objects): Add cref_ field. Update constructor.
9836 Update declarations.
9837 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
9839 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
9841 (Sized_dynobj::do_get_global_symbol_counts): New function.
9842 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
9843 defined_count_. Update declarations. Define Symbols typedef.
9844 * symtab.cc (Symbol_table::add_from_relobj): Add defined
9845 parameter. Change all callers.
9846 (Symbol_table::add_from_dynobj): Add sympointers and defined
9847 parameters. Change all callers.
9848 * symtab.h (class Symbol_table): Update declarations.
9849 * Makefile.am (CCFILES): Add cref.cc.
9850 (HFILES): Add cref.h.
9851 * Makefile.in: Rebuild.
9853 2008-07-22 Simon Baldwin <simonb@google.com>
9855 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
9856 to zero when writing undefined symbols.
9858 2008-07-22 Ian Lance Taylor <iant@google.com>
9860 * output.cc (Output_section::add_input_section): Don't try to
9861 merge empty merge sections.
9863 2008-07-21 Craig Silverstein <csilvers@google.com>
9865 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9866 Include symbol version in error message.
9868 2008-07-20 Chris Demetriou <cgd@google.com>
9870 * configure.ac (gold_cv_c_random_seed): New configured variable.
9871 (RANDOM_SEED_CFLAGS): New substituted variable.
9872 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
9873 * configure: Rebuild.
9874 * Makefile.in: Likewise.
9875 * testsuite/Makefile.in: Likewise.
9877 2008-07-18 Ian Lance Taylor <iant@google.com>
9879 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
9880 where we see NAME/NULL and NAME/VERSION as separate symbols.
9881 * testsuite/ver_test_main.cc (main): Call t4.
9882 (t4, t4_2a): Define.
9883 * testsuite/ver_test_2.cc (t4_2): Define.
9884 * testsuite/ver_test_2.script: Put t4_2a in VER2.
9885 * testsuite/ver_test_4.cc (t4_2a): Define.
9886 * testsuite/ver_test_4.script: Put t4_2a in VER2.
9887 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
9889 2008-07-17 Ian Lance Taylor <iant@google.com>
9891 * dynobj.cc (Versions::add_def): If we give an error about a
9892 missing version, go ahead and create the version anyhow.
9894 2008-07-10 Ian Lance Taylor <iant@google.com>
9896 Handle output sections with more than 0x7fffffff bytes.
9897 * object.h (class Relobj): Change map_to_output_ to
9898 output_sections_, and just keep a section pointer. Change all
9899 uses. Move comdat group support to Sized_relobj.
9900 (Relobj::is_section_specially_mapped): Remove.
9901 (Relobj::output_section): Remove poff parameter. Change all
9903 (Relobj::output_section_offset): New function.
9904 (Relobj::set_section_offset): Rewrite.
9905 (Relobj::map_to_output): Remove.
9906 (Relobj::output_sections): New function.
9907 (Relobj::do_output_section_offset): New pure virtual function.
9908 (Relobj::do_set_section_offset): Likewise.
9909 (class Sized_relobj): Add section_offsets_ field. Add comdat
9910 group support from Relobj. Update declarations.
9911 (Sized_relobj::get_output_section_offset): New function.
9912 (Sized_relobj::do_output_section_offset): New function.
9913 (Sized_relobj::do_set_section_offset): New function.
9914 * object.cc (Relobj::output_section_address): Remove.
9915 (Sized_relobj::Sized_relobj): Initialize new fields.
9916 (Sized_relobj::include_section_group): Cast find_kept_object to
9918 (Sized_relobj::include_linkonce_section): Likewise.
9919 (Sized_relobj::do_layout): Use separate arrays for output section
9921 (Sized_relobj::do_count_local_symbols): Change map_to_output to
9923 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
9924 output_sections and section_offsets.
9925 (Sized_relobj::write_local_symbols): Likewise.
9926 (map_to_kept_section): Compute output address directly.
9927 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
9928 output_sections and section_offsets.
9929 (Sized_relobj::write_sections): Likewise.
9930 (Sized_relobj::relocate_sections): Likewise.
9931 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
9932 * output.h (class Output_reloc): Update declarations. Change
9933 u2_.relobj to Sized_relobj*.
9934 (class Output_data_reloc): Change add functions to use
9936 * output.cc (Output_reloc::Output_reloc): Change relobj to
9938 (Output_reloc::local_section_offset): Change return type to
9939 Elf_Addr. Use get_output_section_offset.
9940 (Output_reloc::get_address): Likewise.
9941 (Output_section::is_input_address_mapped): Don't call
9942 is_section_specially_mapped.
9943 (Output_section::output_offset): Likewise.
9944 (Output_section::output_address): Likewise.
9945 (Output_section::starting_output_address): Likewise.
9946 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
9947 parameter to Sized_relobj*.
9948 (Copy_relocs::need_copy_reloc): Likewise.
9949 (Copy_relocs::save): Likewise.
9950 * copy-relocs.h (class Copy_relocs): Update declarations.
9951 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
9952 Sized_relobj*. Change relobj_ field to Sized_relobj*.
9953 * target-reloc.h (relocate_for_relocatable): Change
9954 offset_in_output_section type to Elf_Addr. Change code that uses
9956 * layout.cc (Layout::layout): Always set *off.
9957 * mapfile.cc (Mapfile::print_input_section): Use
9958 output_section_offset.
9959 * i386.cc (Target_i386::copy_reloc): Change object parameter to
9961 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
9962 * sparc.cc (Target_sparc::copy_reloc): Likewise.
9963 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
9965 2008-07-03 Ian Lance Taylor <iant@google.com>
9967 * layout.cc (Layout::include_section): Do not discard unrecognized
9968 SHT_STRTAB sections.
9970 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
9972 * script.cc (Lex::can_continue_name): Make '?' allowable in
9973 version-script names.
9974 * testsuite/version_script.map: Change glob pattern to use '?'
9976 2008-06-30 Manish Singh <yosh@gimp.org>
9979 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
9982 2008-06-30 Ian Lance Taylor <iant@google.com>
9986 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
9987 versions]: Don't try to read the value in the contents, since we
9988 don't use it. Use the template endianness when writing.
9990 2008-06-25 Cary Coutant <ccoutant@google.com>
9992 * fileread.cc (File_read::make_view): Assert on zero-length view.
9993 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
9994 symbol table when there are no symbols to read.
9996 2008-06-23 Craig Silverstein <csilvers@google.com>
9998 * version.cc (version_string): Bump to 1.7
10000 2008-06-18 Craig Silverstein <csilvers@google.com>
10002 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
10003 constant 0xFFFF to type Valtype.
10004 (Powerpc_relocate_functions::rel16_ha): Likewise.
10006 2008-06-17 Ian Lance Taylor <iant@google.com>
10008 * output.h (Output_section::Input_section): Initialize p2align_ to
10009 zero for Output_section_data constructors.
10010 (Output_section::Input_section::addralign): If not an input
10011 section, return the alignment of the Output_section_data.
10012 * testsuite/copy_test.cc: New file.
10013 * testsuite/copy_test_1.cc: New file.
10014 * testsuite/copy_test_2.cc: New file.
10015 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
10016 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
10017 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
10018 (copy_test_1_pic.o, copy_test_1.so): New targets.
10019 (copy_test_2_pic.o, copy_test_2.so): New targets.
10020 * testsuite/Makefile.in: Rebuild.
10022 * script-sections.cc (Script_sections::place_orphan): Initialize
10023 local variable exact.
10025 2008-06-13 David Edelsohn <edelsohn@gnu.org>
10027 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
10029 2008-06-12 David Edelsohn <edelsohn@gnu.org>
10030 David S. Miller <davem@davemloft.net>
10032 * powerpc.cc: New file.
10033 * Makefile.am (TARGETSOURCES): Add powerpc.cc
10034 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
10035 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
10036 * Makefile.in: Rebuild.
10038 2008-06-09 Ian Lance Taylor <iant@google.com>
10040 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
10042 (throwing, orig_terminate): New static variables.
10043 (terminate_handler): New static function.
10044 (t2): Set terminate handler.
10046 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
10049 * binary.cc (Binary_to_elf::sized_convert): Fix .data
10052 2008-05-30 Cary Coutant <ccoutant@google.com>
10054 * archive.cc (Archive::include_all_members) Correct to step
10055 over symbol table and extended name table in thin archives.
10057 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
10060 * target-reloc.h (relocate_for_relocatable): Fix new_offset
10063 2008-05-28 Caleb Howe <cshowe@google.com>
10065 * reduced_debug_output.cc: New file.
10066 * reduced_debug_output.h: New file.
10067 * options.h (class General_options): Add --strip-debug-non-line.
10068 * options.cc (General_options::finalize): Add strip_debug_non_line
10069 to the strip heirarchy.
10070 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
10072 * layout.cc: Include "reduced_debug_output.h".
10073 (Layout::Layout): Initialize new fields.
10074 (line_only_debug_sections): New static array.
10075 (is_lines_only_debug_sections): New static inline function.
10076 (Layout::include_section): Handle --strip-debug-non-line.
10077 (Layout::make_output_section): If --strip-debug-non-line, build
10078 new output sections for .debug_abbrev and .debug_info.
10079 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
10080 gold. Warn about possible overflow.
10081 (read_signed_LEB_128): Likewise.
10082 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
10083 (read_signed_LEB_128): Declare.
10084 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
10085 (HFILES): Add reduced_debug_output.h.
10086 * Makefile.in: Rebuild.
10088 2008-05-21 Ian Lance Taylor <iant@google.com>
10090 * mapfile.cc: New file.
10091 * mapfile.h: New file.
10092 * options.h (class General_options): Add -M/--print-map and -Map.
10093 * options.cc (General_options::finalize): Make -M equivalent to
10095 * main.cc: Include <cstdio> and "mapfile.h".
10096 (main): Open mapfile if requested.
10097 * gold.cc (class Middle_runner): Add mapfile_ field. Update
10098 constructor. Change caller.
10099 (queue_initial_tasks): Add mapfile parameter. Change caller.
10100 (queue_middle_tasks): Likewise.
10101 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
10103 * archive.cc: Include "mapfile.h".
10104 (Archive::add_symbols): Add mapfile parameter. Change all
10105 callers. Pass mapfile, symbol, and reason to include_member.
10106 (Archive::include_all_members): Add mapfile parameter. Change all
10108 (Archive::include_member): Add mapfile, sym, and why parameters.
10109 Change all callers. Report inclusion to map file.
10110 * archive.h: Include "fileread.h".
10111 (class Archive): Update declarations.
10112 (Archive::file): New const method.
10113 (class Add_archive_symbols): Add mapfile_ field. Update
10114 constructor. Change all callers.
10115 * readsyms.h (class Read_symbols): Likewise.
10116 (class Finish_group): Likewise.
10117 (class Read_script): Likewise.
10118 * common.cc: Include "mapfile.h".
10119 (Symbol_table::allocate_commons): Add mapfile parameter. Change
10121 (Symbol_table::do_allocate_commons): Likewise.
10122 (Symbol_table::do_allocate_commons_list): Likewise. Report common
10123 symbol allocation to mapfile.
10124 * common.h (class Allocate_commons_task): Add mapfile_ field.
10125 Update constructor. Change all callers.
10126 * symtab.h (class Symbol_table): Update declarations.
10127 * layout.cc: Include "mapfile.h".
10128 (Layout_task_runner::run): Print information to mapfile.
10129 (Layout::create_gold_note): Change Output_data_fixed_space to
10130 Output_data_zero_fill.
10131 (Layout::create_build_id): Likewise.
10132 (Layout::print_to_mapfile): New function.
10133 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
10134 constructor. Change caller.
10135 (class Layout): Declare print_to_mapfile.
10136 * output.cc (Output_section::Input_section::print_to_mapfile): New
10138 (Output_section::add_input_section): If producing a map, always
10139 add to input_sections_ list.
10140 (Output_section::do_print_to_mapfile): New function.
10141 (Output_segment::print_sections_to_mapfile): New function.
10142 (Output_segment::print_section_list_to_mapfile): New function.
10143 * output.h: Include "mapfile.h".
10144 (Output_data::print_to_mapfile): New function.
10145 (Output_data::do_print_to_mapfile): New virtual function.
10146 (Output_segment_headers::do_print_to_mapfile): New function.
10147 (Output_file_header::do_print_to_mapfile): New function.
10148 (Output_data_const::do_print_to_mapfile): New function.
10149 (class Output_data_const_buffer): Add map_name_ field. Update
10150 constructor. Change all callers. Add do_print_to_mapfile
10152 (class Output_data_fixed_space): Likewise.
10153 (class Output_data_space): Likewise.
10154 (class Output_data_zero_fill): New class.
10155 (Output_data_strtab::do_print_to_mapfile): New function.
10156 (Output_data_reloc_base::do_print_to_mapfile): New function.
10157 (Output_relocatable_relocs::do_print_to_mapfile): New function.
10158 (Output_data_group::do_print_to_mapfile): New function.
10159 (Output_data_got::do_print_to_mapfile): New function.
10160 (Output_data_dynamic::do_print_to_mapfile): New function.
10161 (Output_symtab_xindex::do_print_to_mapfile): New function.
10162 (class Output_section): Declare do_print_to_mapflie. Declare
10163 print_to_mapfile in Input_section.
10164 (class Output_segment): Declare new functions.
10165 * object.h (Sized_relobj::symbol_count): New function.
10166 * script-sections.cc
10167 (Output_section_element_dot_assignment::set_section_addresses):
10168 Change Output_data_fixed_space to Output_data_zero_fill.
10169 (Output_data_expression::do_print_to_mapfile): New function.
10170 * script.cc (read_input_script): Add mapfile parameter. Change
10172 * script.h (read_input_script): Update declaration.
10173 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
10174 (Eh_frame::do_print_to_mapfile): New function.
10175 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
10176 (Output_merge_string::do_print_to_mapfile): New function.
10177 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
10179 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
10181 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
10183 * Makefile.am (CCFILES): Add mapfile.cc.
10184 (HFILES): Add mapfile.h.
10185 * Makefile.in: Rebuild.
10187 2008-05-19 Ian Lance Taylor <iant@google.com>
10189 * options.h (class General_options): Add -z relro.
10190 * layout.cc (Layout::Layout): Initialize relro_segment_.
10191 (Layout::add_output_section_data): Return the output section.
10192 (Layout::make_output_section): Rcognize relro sections and mark
10193 them appropriately.
10194 (Layout::attach_allocated_section_to_segment): Put relro sections
10195 in a PT_GNU_RELRO segment.
10196 (Layout::create_initial_dynamic_sections): Mark the .dynamic
10198 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
10200 (Layout::linkonce_mapping): Map d.rel.ro.local to
10201 .data.rel.ro.local.
10202 (Layout::output_section_name): Us .data.rel.ro.local for any
10203 section which begins with that.
10204 * layout.h (class Layout): Update add_output_section_data
10205 declaration. Add relro_segment_ field.
10206 * output.cc (Output_section::Output_section): Initialize is_relro_
10207 and is_relro_local_ fields.
10208 (Output_segment::add_output_section): Group relro sections.
10209 (Output_segment::is_first_section_relro): New function.
10210 (Output_segment::maximum_alignment): If there is a relro section,
10211 align the segment to the common page size.
10212 (Output_segment::set_section_addresses): Track whether we are
10213 looking at relro sections. If the last section is a relro
10214 section, align to the common page size.
10215 (Output_segment::set_section_list_addresses): Add in_relro
10216 parameter. Change all callers. Align to the page size when
10217 moving from relro to non-relro section.
10218 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
10220 * output.h (class Output_section): Add is_relro_ and
10221 is_relro_local_ fields.
10222 (Output_section::is_relro): New function.
10223 (Output_section::set_is_relro): New function.
10224 (Output_section::is_relro_local): New function.
10225 (Output_section::set_is_relro_local): New function.
10226 (class Output_segment): Update declarations.
10227 * i386.cc (Target_i386::got_section): Mark .got section as relro.
10228 * sparc.cc (Target_sparc::got_section): Likewise.
10229 * x86_64.cc (Target_x86_64::got_section): Likewise.
10230 * testsuite/relro_test_main.cc: New file.
10231 * testsuite/relro_test.cc: New file.
10232 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
10233 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
10234 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
10235 (relro_test.so, relro_test_pic.o): New targets.
10236 * testsuite/Makefile.in: Rebuild.
10238 2008-05-16 Ian Lance Taylor <iant@google.com>
10240 * output.cc (Output_segment::add_output_section): Remove front
10242 * output.h (class Output_segment): Remove
10243 add_initial_output_section and overloaded add_output_section.
10244 Update declaration of remaining add_output_section.
10245 * layout.cc (Layout::create_interp): Call add_output_section
10246 rather than add_initial_output_section.
10247 (Layout::finish_dynamic_section): Likewise.
10249 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
10250 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
10251 know the dynamic type.
10252 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
10253 field. Initialize it in constructor.
10254 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
10255 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
10256 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
10259 * output.cc (Output_reloc::get_address): Change return type to
10261 * output.h (class Output_reloc): Update get_address declaration.
10262 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
10263 for section addresses.
10265 2008-05-09 Ian Lance Taylor <iant@google.com>
10268 * gold.cc (gold_nomem): Use return value of write.
10270 2008-05-08 Ian Lance Taylor <iant@google.com>
10272 * symtab.c (Symbol::init_base_output_data): Add version
10273 parameter. Change all callers.
10274 (Symbol::init_base_output_segment): Likewise.
10275 (Symbol::init_base_constant): Likewise.
10276 (Symbol::init_base_undefined): Likewise.
10277 (Sized_symbol::init_output_data): Likewise.
10278 (Sized_symbol::init_output_segment): Likewise.
10279 (Sized_symbol::init_constant): Likewise.
10280 (Sized_symbol::init_undefined): Likewise.
10281 (Symbol_table::do_define_in_output_data): If the new symbol has a
10282 version, mark it as the default.
10283 (Symbol_table::do_define_in_output_segment): Likewise.
10284 (Symbol_table::do_define_as_constant): Likewise.
10285 * symtab.h (class Symbol): Update declarations.
10286 (class Sized_symbol): Likewise.
10287 * resolve.cc (Symbol::override_version): New function.
10288 (Symbol::override_base): Call override_version.
10289 (Symbol::override_base_with_special): Likewise.
10290 * testsuite/ver_script_8.script: New file.
10291 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
10292 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
10293 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
10294 (ver_test_8_1.so, ver_test_8_2.so): New targets.
10296 2008-05-06 Ian Lance Taylor <iant@google.com>
10299 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
10301 (class General_options): Remove existing --undefined, and add
10302 --no-undefined instead. Add new --undefined as synonym for -u.
10303 * archive.cc (Archive::add_symbols): Check whether symbol was
10305 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
10306 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
10307 all uses. Add IS_UNDEFINED. Update declarations to split
10308 different versions of init_base. Declare init_base_undefined.
10309 (Symbol::is_defined): Handle IS_UNDEFINED.
10310 (Symbol::is_undefined): Likewise.
10311 (Symbol::is_weak_undefined): Call is_undefined.
10312 (Symbol::is_absolute): Handle IS_CONSTANT.
10313 (class Sized_symbol): Update declarations to split different
10314 versions of init. Declare init_undefined.
10315 (class Symbol_table): Declare new functions.
10316 * symtab.cc (Symbol::init_base_object): Rename from init_base.
10317 Change all callers.
10318 (Symbol::init_base_output_data): Likewise.
10319 (Symbol::init_base_output_segment): Likewise.
10320 (Symbol::init_base_constant): Likewise.
10321 (Symbol::init_base_undefined): New function.
10322 (Sized_symbol::init_object): Rename from init. Change all
10324 (Sized_symbol::init_output_data): Likewise.
10325 (Sized_symbol::init_output_segment): Likewise.
10326 (Sized_symbol::init_constant): Likewise.
10327 (Sized_symbol::init_undefined): New function.
10328 (Symbol_table::add_undefined_symbols_from_command_line): New
10330 (Symbol_table::do_add_undefined_symbols_from_command_line): New
10332 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
10333 (Symbol::output_section): Likewise.
10334 (Symbol::set_output_section): Likewise.
10335 (Symbol_table::sized_finalize_symbol): Likewise.
10336 (Symbol_table::sized_write_globals): Likewise.
10337 * resolve.cc (Symbol_table::should_override): Likewise.
10338 (Symbol::override_base_with_special): Likewise.
10340 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
10341 symbol, change it to have default visibility.
10342 * testsuite/protected_1.cc: New file.
10343 * testsuite/protected_2.cc: New file.
10344 * testsuite/protected_3.cc: New file.
10345 * testsuite/protected_main_1.cc: New file.
10346 * testsuite/protected_main_2.cc: New file.
10347 * testsuite/protected_main_3.cc: New file.
10348 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
10349 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
10350 (protected_1_LDFLAGS, protected_1_LDADD): Define.
10351 (protected_1.so): New target.
10352 (protected_1_pic.o, protected_2_pic.o): New targets.
10353 (protected_3_pic.o): New target.
10354 (check_PROGRAMS): Add protected_2.
10355 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
10356 (protected_2_LDFLAGS, protected_2_LDADD): Define.
10357 * testsuite/Makefile.in: Rebuild.
10359 * options.h (DEFINE_var): Add set_user_set_##varname__.
10360 (DEFINE_bool_alias): New macro.
10361 (class General_options): Define -Bstatic using DEFINE_bool_alias
10362 rather than DEFINE_special. Add --undefined as an alias for -z
10364 * options.cc (General_options::parse_Bstatic): Remove.
10366 * options.h (class General_options): Add --fatal-warnings.
10367 * main.cc (main): Implement --fatal-warnings.
10368 * errors.h (Errors::warning_count): New function.
10370 * options.h (class General_options): Add -Bsymbolic-functions.
10371 * symtab.h (Symbol::is_preemptible): Check for
10372 -Bsymbolic-functions.
10374 2008-05-05 Ian Lance Taylor <iant@google.com>
10376 * options.h (DEFINE_bool): For DASH_Z, create the negative option
10377 as noVARNAME rather than no-VARNAME.
10378 (class General_options): Add option -z combreloc.
10379 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
10381 (Output_reloc::sort_before) [SHT_REL]: New function.
10382 (Output_reloc::sort_before) [SHT_RELA]: New function.
10383 (class Output_data_reloc_base): Add sort_relocs_ field. Define
10384 Sort_relocs_comparison.
10385 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
10386 parameter. Change all callers.
10387 (Output_data_reloc::Output_data_reloc) [both versions]: Add
10388 sort_relocs parameter. Change all callers.
10389 * output.cc (Output_reloc::get_address): New function, broken out
10391 (Output_reloc::write_rel): Call it.
10392 (Output_reloc::compare): New function.
10393 (Output_data_reloc_base::do_write): Optionally sort relocs.
10395 * configure.ac: If targ_extra_obj is set, link it in.
10396 * configure.tgt: Initialize all variables.
10397 (x86_64*): Set targ_extra_obj and targ_extra_size.
10398 * configure: Rebuild.
10400 * object.cc (Sized_relobj::include_section_group): Adjust section
10401 indexes read from group data. Build vector to pass to
10403 * layout.cc (Layout::layout_group): Add flags and shndxes
10404 parameters. Remove contents parameter. Change caller. Update
10405 explicit instantiations.
10406 * layout.h (class Layout): Update layout_group declaration.
10407 * output.cc (Output_data_group::Output_data_group): Add flags and
10408 input_shndxes parameters. Remove contents parameter. Change
10410 (Output_data_group::do_write): Change input_sections_ to
10412 * output.h (class Output_data_group): Update constructor
10413 declaration. Rename input_sections_ to input_shndxes_.
10414 * testsuite/many_sections_test.cc: Add template.
10416 2008-04-30 Cary Coutant <ccoutant@google.com>
10418 * target-reloc.h (relocate_section): Fix dead-pointer bug.
10420 * layout.cc (Layout::include_section): Refactored check for debug
10422 (Layout::add_comdat): Add new parameters. Change type
10423 of signature parameter. Add object and shndx to signatures table.
10424 (Layout::find_kept_object): New function.
10425 * layout.h: Include <cstring>.
10426 (Layout::is_debug_info_section): New function.
10427 (Layout::add_comdat): Add new parameters.
10428 (Layout::find_kept_object): New function.
10429 (Layout::Kept_section): New struct.
10430 (Layout::Signatures): Change type of map range.
10431 * object.cc (Relobj::output_section_address): New function.
10432 (Sized_relobj::include_section_group): Add new parameters. Change
10433 calls to Layout::add_comdat. Change to build table of kept comdat
10434 groups and table mapping discarded sections to kept sections.
10435 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
10436 (Sized_relobj::do_layout): Change calls to include_section_group and
10437 include_linkonce_section.
10438 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
10439 value to zero when section is discarded.
10440 (Sized_relobj::map_to_kept_section): New function.
10441 * object.h (Relobj::output_section_address): New function.
10442 (Relobj::Comdat_group): New type.
10443 (Relobj::find_comdat_group): New function.
10444 (Relobj::Comdat_group_table): New type.
10445 (Relobj::Kept_comdat_section): New type.
10446 (Relobj::Kept_comdat_section_table): New type.
10447 (Relobj::add_comdat_group): New function.
10448 (Relobj::set_kept_comdat_section): New function.
10449 (Relobj::get_kept_comdat_section): New function.
10450 (Relobj::comdat_groups_): New field.
10451 (Relobj::kept_comdat_sections_): New field.
10452 (Symbol_value::input_value): Update comment.
10453 (Sized_relobj::map_to_kept_section) New function.
10454 (Sized_relobj::include_linkonce_section): Add new parameter.
10455 * target-reloc.h (Comdat_behavior): New type.
10456 (get_comdat_behavior): New function.
10457 (relocate_section): Add code to map a discarded section to the
10458 corresponding kept section when applying a relocation.
10460 2008-04-30 Craig Silverstein <csilvers@google.com>
10462 * dwarf_reader.cc (next_generation_count): New static var.
10463 (Addr2line_cache_entry): New struct.
10464 (addr2line_cache): New static var.
10465 (Dwarf_line_info::one_addr2line): Added caching.
10466 (Dwarf_line_info::clear_addr2line_cache): New function.
10467 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
10468 cache-size parameter.
10469 (Dwarf_line_info::one_addr2line_cache): New function.
10470 * symtab.cc (Symbol_table::detect_odr_violations): Pass
10471 new cache-size argument to one_addr2line(), and clear cache.
10473 2008-04-28 Cary Coutant <ccoutant@google.com>
10475 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
10476 R_386_PC8 relocations.
10478 2008-04-23 Ian Lance Taylor <iant@google.com>
10480 * object.cc (Sized_relobj::include_section_group): Check for
10481 invalid section group.
10483 * object.cc (make_elf_object): Correct test for 64-bit ELF file
10486 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
10487 than read for file header.
10488 * archive.cc (Archive::include_member): Likewise.
10490 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
10492 * aclocal.m4: Regenerate.
10493 * configure: Regenerate.
10495 2008-04-19 Ian Lance Taylor <iant@google.com>
10497 * version.cc (version_string): Bump to 1.6.
10499 * testsuite/Makefile.am (many_sections_r_test): New target.
10500 (many_sections_r_test_SOURCES): Remove.
10501 (many_sections_r_test_DEPENDENCIES): Remove.
10502 (many_sections_r_test_LDFLAGS): Remove.
10503 (many_sections_r_test_LDADD): Remove.
10505 * object.cc (Sized_relobj::do_add_symbols): Always pass
10506 local_symbol_count_ to add_from_relobj.
10508 * testsuite/Makefile.am (many_sections_check.h): Only check one in
10509 every thousand variables.
10510 * testsuite/Makefile.in: Rebuild.
10512 * object.cc (Xindex::initialize_symtab_xindex): New function.
10513 (Xindex::read_symtab_xindex): New function.
10514 (Xindex::sym_xindex_to_shndx): New function.
10515 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
10517 (Sized_relobj::do_initialize_xindex): New function.
10518 (Sized_relobj::do_read_symbols): Adjust section links.
10519 (Sized_relobj::symbol_section_and_value): Add is_ordinary
10520 parameter. Change all callers.
10521 (Sized_relobj::include_section_group): Adjust section links and
10522 symbol section indexes.
10523 (Sized_relobj::do_layout): Adjust section links.
10524 (Sized_relobj::do_count_local_symbols): Adjust section links and
10525 symbol section indexes.
10526 (Sized_relobj::do_finalize_local_symbols): Distinguish between
10527 ordinary and special symbols.
10528 (Sized_relobj::write_local_symbols): Add symtab_xindex and
10529 dynsym_xindex parameters. Change all callers. Adjust section
10530 links. Use SHN_XINDEX when needed.
10531 (Sized_relobj::get_symbol_location_info): Adjust section links.
10532 Don't get fooled by special symbols.
10533 * object.h (class Xindex): Define.
10534 (class Object): Add xindex_ parameter. Declare virtual functoin
10535 do_initialize_xindex.
10536 (Object::adjust_sym_shndx): New function.
10537 (Object::set_xindex): New protected function.
10538 (class Symbol_value): Add is_ordinary_shndx_ field.
10539 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
10540 (Symbol_value::value): Assert ordinary section.
10541 (Symbol_value::initialize_input_to_output_map): Likewise.
10542 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
10543 Change all callers.
10544 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
10546 (class Sized_relobj): Update declarations.
10547 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
10548 parameter. Change all callers.
10549 (Sized_relobj::adjust_shndx): New function.
10550 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
10552 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
10553 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
10554 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
10555 (Sized_dynobj::read_dynsym_section): Adjust section links.
10556 (Sized_dynobj::read_dynamic): Likewise.
10557 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
10559 (Sized_dynobj::do_initialize_xindex): New function.
10560 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
10561 do_initialize_xindex.
10562 (Sized_dynobj::adjust_shndx): New function.
10563 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
10564 dynsym_xindex_ fields.
10565 (Layout::finalize): Add a call to set_section_indexes before
10566 creating the symtab sections.
10567 (Layout::set_section_indexes): Don't do anything if the section
10568 already has a section index.
10569 (Layout::create_symtab_sections): Add shnum parameter. Change
10570 caller. Create .symtab_shndx section if needed.
10571 (Layout::create_shdrs): Add shstrtab_section parameter. Change
10573 (Layout::allocated_output_section_count): New function.
10574 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
10576 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
10577 fields. Update declarations.
10578 (Layout::symtab_xindex): New function.
10579 (Layout::dynsym_xindex): New function.
10580 (class Write_symbols_task): Add layout_ field.
10581 (Write_symbols_task::Write_symbols_task): Add layout parameter.
10583 * output.cc (Output_section_headers::Output_section_headers): Add
10584 shstrtab_section parameter. Change all callers.
10585 (Output_section_headers::do_sized_write): Store overflow values
10586 for section count and section string table section index in
10587 section header zero.
10588 (Output_file_header::do_sized_write): Check for overflow of
10589 section count and section string table section index.
10590 (Output_symtab_xindex::do_write): New function.
10591 (Output_symtab_xindex::endian_do_write): New function.
10592 * output.h (class Output_section_headers): Add shstrtab_section_.
10593 Update declarations.
10594 (class Output_symtab_xindex): Define.
10595 (Output_section::has_out_shndx): New function.
10596 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
10598 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
10599 Change all callers.
10600 (Sized_symbol::init): Likewise.
10601 (Symbol::output_section): Check for ordinary symbol.
10602 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
10603 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
10605 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
10606 Change all callers. Simplify handling of symbols from sections
10607 not included in the link.
10608 (Symbol_table::add_from_dynobj): Handle ordinary symbol
10610 (Weak_alias_sorter::operator()): Assert that symbols are
10612 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
10614 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
10615 parameters. Change all callers.
10616 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
10617 symbol distinction. Use SHN_XINDEX when needed.
10618 (Symbol_table::write_section_symbol): Add symtab_xindex
10619 parameter. Change all callers.
10620 (Symbol_table::sized_write_section_symbol): Likewise. Use
10621 SHN_XINDEX when needed.
10622 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
10624 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
10625 (Symbol::is_defined): Check is_ordinary.
10626 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
10627 (Symbol::is_absolute, Symbol::is_common): Likewise.
10628 (class Sized_symbol): Update declarations.
10629 (class Symbol_table): Update declarations.
10630 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
10631 parameters. Change all callers.
10632 (Sized_symbol::override): Likewise.
10633 (Symbol_table::override): Likewise.
10634 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
10635 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
10636 is_ordinary, and orig_st_shndx parameters. Change all callers.
10637 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
10638 to be in an ordinary section.
10639 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
10640 object and is_ordinary parameters. Change all callers.
10641 (Sized_dwarf_line_info::read_relocs): Add object parameter.
10642 Change all callers. Don't add undefined or non-ordinary symbols
10644 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
10645 Change all callers.
10646 * dwarf_reader.h (class Sized_dwarf_line_info): Update
10648 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
10649 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
10650 (Sized_relobj::relocate_sections): Likewise.
10651 * target-reloc.h (scan_relocs): Adjust section symbol index.
10652 (scan_relocatable_relocs): Likewise.
10653 * i386.cc (Scan::local): Check for ordinary symbols.
10654 * sparc.cc (Scan::local): Likewise.
10655 * x86_64.cc (Scan::local): Likewise.
10656 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
10657 to symbol_section_and_value.
10658 * testsuite/many_sections_test.cc: New file.
10659 * testsuite/Makefile.am (BUILT_SOURCES): Define.
10660 (check_PROGRAMS): Add many_sections_test.
10661 (many_sections_test_SOURCES): Define.
10662 (many_sections_test_DEPENDENCIES): Define.
10663 (many_sections_test_LDFLAGS): Define.
10664 (BUILT_SOURCES): Add many_sections_define.h.
10665 (many_sections_define.h): New target.
10666 (BUILT_SOURCES): Add many_sections_check.h.
10667 (many_sections_check.h): New target.
10668 (check_PROGRAMS): Add many_sections_r_test.
10669 (many_sections_r_test_SOURCES): Define.
10670 (many_sections_r_test_DEPENDENCIES): Define.
10671 (many_sections_r_test_LDFLAGS): Define.
10672 (many_sections_r_test_LDADD): Define.
10673 (many_sections_r_test.o): New target.
10674 * testsuite/Makefile.in: Rebuild.
10676 2008-04-17 Cary Coutant <ccoutant@google.com>
10678 * errors.cc (Errors::info): New function.
10679 (gold_info): New function.
10680 * errors.h (Errors::info): New function.
10681 * gold.h (gold_info): New function.
10682 * object.cc (Input_objects::add_object): Print trace output.
10683 * options.cc (options::parse_set): New function.
10684 (General_options::parse_wrap): Deleted.
10685 (General_options::General_options): Deleted initializer.
10686 * options.h (options::String_set): New typedef.
10687 (options::parse_set): New function.
10688 (DEFINE_set): New macro.
10689 (General_options::wrap): Changed to use DEFINE_set. Changed
10690 callers of any_wrap_symbols and is_wrap_symbol.
10691 (General_options::trace, General_options::trace_symbol):
10693 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
10694 (General_options::wrap_symbols_): Deleted.
10695 * symtab.cc (Symbol_table::add_from_object): Print trace output.
10697 2008-04-17 David S. Miller <davem@davemloft.net>
10699 * options.cc (General_options::parse_V): New function.
10700 * options.h: Add entries for -V and -Qy.
10702 2008-04-17 Ian Lance Taylor <iant@google.com>
10704 * common.cc (Symbol_table::allocate_commons): Remove options
10705 parameter. Change caller.
10706 (Symbol_table::do_allocate_commons): Remove options parameter.
10707 Change caller. Just call do_allocate_commons_list twice.
10708 (Symbol_table::do_allocate_commons_list): New function, broken out
10709 of do_allocate_commons.
10710 * common.h (class Allocate_commons_task): Remove options_ field.
10711 Update constructor.
10712 * symtab.cc (Symbol_table::Symbol_table): Initialize
10714 (Symbol_table::add_from_object): Put TLS common symbols on
10716 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
10717 which are IN_OUTPUT_DATA.
10718 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
10719 allocate_commons and do_allocate_commons declarations. Declare
10720 do_allocate_commons_list.
10721 * gold.cc (queue_middle_tasks): Update creation of
10722 Allocate_commons_task to not pass options.
10723 * testsuite/Makefile.am (INCLUDES): Add -I.. .
10724 (TLS_TEST_C_FLAGS): New variable.
10725 (tls_test_c_pic.o): New target.
10726 (tls_test_shared.so): Link in tls_test_c_pic.o.
10727 (tls_test_c_pic_ie.o): New target.
10728 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
10729 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
10730 (tls_test_c.o): New target.
10731 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
10732 (tls_pic_test_LDADD): Likewise.
10733 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
10734 (tls_shared_gd_to_ie_test_LDADD): Likewise.
10735 (tls_test_c_gnu2.o): New target.
10736 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
10738 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
10739 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
10740 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
10741 * testsuite/tls_test.cc: Include "config.h".
10742 (t_last): Call t11_last.
10743 * testsuite/tls_test.h (t11, t11_last): Declare.
10744 * testsuite/tls_test_c.c: New file.
10745 * testsuite/tls_test_main.cc (thread_routine): Call t11.
10746 * configure.ac: Check for OpenMP support.
10747 * configure, config.in, Makefile.in: Rebuild.
10748 * testsuite/Makefile.in: Rebuild.
10750 2008-04-16 Cary Coutant <ccoutant@google.com>
10752 * i386.cc (Target_i386::define_tls_base_symbol): New function.
10753 (Target_i386::tls_base_symbol_defined_): New field.
10754 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10755 (Target_i386::Scan::global): Likewise.
10756 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
10757 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
10758 (Target_x86_64::tls_base_symbol_defined_): New field.
10759 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10760 (Target_x86_64::Scan::global): Likewise.
10762 2008-04-16 Cary Coutant <ccoutant@google.com>
10764 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
10765 (Symbol::needs_plt_entry): Allow weak undefined symbols.
10766 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
10767 building shared libraries.
10768 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
10769 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
10770 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
10771 * testsuite/Makefile.in: Rebuild.
10772 * testsuite/weak_undef.h: New file.
10773 * testsuite/weak_undef_file1.cc: Add extra test cases.
10774 * testsuite/weak_undef_file2.cc: Likewise.
10775 * testsuite/weak_undef_test.cc: Likewise.
10777 2008-04-16 David S. Miller <davem@davemloft.net>
10779 * sparc.cc (Target_sparc::Scan): Change from struct to class.
10780 Add issued_non_pic_error_ field. Declare check_non_pic.
10781 (Target_sparc::Scan::check_non_pic): New function.
10782 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
10783 (Target_sparc::Scan::global): Likewise.
10785 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
10786 * configure: Rebuild.
10788 * options.h (DEFINE_enable): New macro.
10789 (new_dtags): New enable option.
10790 (initfirst, interpose, loadfltr, nodefaultlib,
10791 nodelete, nodlopen, nodump): New -z options.
10792 * layout.cc (Layout:finish_dynamic_section): If new
10793 dtags enabled, emit DT_RUNPATH. Also, emit a
10794 DT_FLAGS_1 containing any specified -z flags.
10796 2008-04-16 Ian Lance Taylor <iant@google.com>
10798 * copy-relocs.cc: New file.
10799 * copy-relocs.h: New file.
10800 * reloc.cc: Remove Copy_relocs code.
10801 * reloc.h: Likewise.
10802 * reloc-types.h (struct Reloc_types) [both versions]: Add
10803 get_reloc_addend_noerror.
10804 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
10805 variants of add_global which take an addend which must be zero.
10806 * i386.cc: Include "copy-relocs.h".
10807 (class Target_i386): Change type of copy_relocs_ to variable,
10808 update initializer.
10809 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
10810 Change all callers.
10811 (Target_i386::do_finalize_sections): Change handling of
10813 * sparc.cc: Include "copy-relocs.h".
10814 (class Target_sparc): Change type of copy_relocs_ to variable,
10815 update initializer.
10816 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
10817 Change all callers.
10818 (Target_sparc::do_finalize_sections): Change handling of
10820 * x86_64.cc: Include "copy-relocs.h".
10821 (class Target_x86_64): Change type of copy_relocs_ to variable,
10822 update initializer.
10823 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
10824 class. Change all callers.
10825 (Target_x86_64::do_finalize_sections): Change handling of
10827 * Makefile.am (CCFILES): Add copy-relocs.cc.
10828 (HFILES): Add copy-relocs.h.
10830 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
10832 * testsuite/script_test_4.sh: Permit leading zeroes.
10834 2008-04-15 Ian Lance Taylor <iant@google.com>
10836 * script-sections.cc (Script_sections::create_segments): Use
10837 header_size_adjustment even when there is enough room for the
10839 * testsuite/script_test_4.sh: New file.
10840 * testsuite/script_test_4.t: New file.
10841 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
10842 (check_DATA): Add script_test_4.stdout.
10843 (MOSTLYCLEANFILES): Likewise.
10844 (script_test_4): New target.
10845 (script_test_4.stdout): New target.
10846 * testsuite/Makefile.in: Rebuild.
10848 * sparc.cc: Add definitions for Output_data_plt_sparc class
10851 2008-04-14 David S. Miller <davem@davemloft.net>
10853 * sparc.cc: New file.
10854 * Makefile.am (TARGETSOURCES): Add sparc.cc
10855 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
10856 * configure.tgt: Document targ_extra_size and
10857 targ_extra_big_endian. Add entries for sparc-* and
10859 * configure.ac: Handle targ_extra_size and
10860 targ_extra_big_endian.
10861 * Makefile.in: Rebuild.
10862 * configure: Likewise.
10863 * po/POTFILES.in: Likewise.
10864 * po/gold.pot: Likewise.
10866 2008-04-14 Ian Lance Taylor <iant@google.com>
10868 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
10869 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
10870 in the name/type/flags to section mapping. Don't call
10871 allocate_output_section.
10872 (Layout::choose_output_section): Change parameter from adjust_name
10873 to is_input_section. Don't permit input sections after sections
10874 are attached to segments. Don't call allocate_output_section.
10875 (Layout::layout_eh_frame): Call update_flags_for_input_section,
10876 not write_enable_output_section.
10877 (Layout::make_output_section): Don't push to
10878 unattached_section_list_ nor call attach_to_segment. Call
10879 attach_section_to_segment if sections are attached.
10880 (Layout::attach_sections_to_segments): New function.
10881 (Layout::attach_section_to_segment): New function.
10882 (Layout::attach_allocated_section_to_segment): Rename from
10883 attach_to_segment. Remove flags parameter.
10884 (Layout::allocate_output_section): Remove function.
10885 (Layout::write_enable_output_section): Remove function.
10886 * layout.h (class Layout): Update for above changes. Add new
10887 field sections_are_attached_.
10888 * output.h (Output_section::update_flags_for_input_section): New
10890 * output.cc (Output_section::add_input_section): Call
10891 update_flags_for_input_section.
10892 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
10894 2008-04-11 Cary Coutant <ccoutant@google.com>
10896 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
10897 thought unnecessary.
10898 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
10900 2008-04-11 Ian Lance Taylor <iant@google.com>
10902 * output.h (class Output_section_data): Remove inline definition
10904 * output.cc (Output_section_data::set_addralign): New function.
10906 2008-04-11 Cary Coutant <ccoutant@google.com>
10908 Add support for TLS descriptors for i386 and x86_64.
10909 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
10910 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
10911 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
10913 (Target_i386::got_mod_index_entry): Remove unnecessary code.
10914 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
10915 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
10917 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
10918 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
10919 Fix problem with initial-exec relocations.
10920 (Target_i386::Relocate::relocate_tls): Likewise.
10921 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
10923 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
10924 support for section-plus-offset dynamic table entries.
10925 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
10926 (Output_data_dynamic::Dynamic_entry): Add support for
10927 section-plus-offset dynamic table entries.
10928 (Output_data_dynamic::Classification): Likewise.
10929 (Output_data_dynamic::classification_): Renamed offset_.
10930 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
10931 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
10932 (Target_x86_64::make_plt_section): New function.
10933 (Target_x86_64::reserve_tlsdesc_entries): New function.
10934 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
10935 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
10936 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
10937 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
10938 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
10939 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
10940 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
10941 add extra PLT entry for TLS descriptors.
10942 (Output_data_plt_x86_64::got_): New field.
10943 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
10944 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
10946 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
10948 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
10949 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
10950 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
10951 R_386_TLS_DESC_CALL relocations.
10952 (Target_x86_64::Scan::global): Likewise.
10953 (Target_x86_64::do_finalize_sections): Add dynamic table entries
10954 for TLS descriptors.
10955 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
10956 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
10957 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
10958 GD-to-IE relaxation.
10959 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
10960 and TLS_DESCRIPTORS.
10961 * Makefile.in: Rebuild.
10962 * configure: Rebuild.
10963 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
10964 (tls_test_shared2.so): New target.
10965 (tls_shared_gd_to_ie_test_SOURCES): New variable.
10966 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
10967 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
10968 (tls_shared_gd_to_ie_test_LDADD): New variable.
10969 (tls_shared_gnu2_gd_to_ie_test): New target.
10970 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
10972 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
10973 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
10974 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
10975 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
10976 (tls_shared_gnu2_test): New target.
10977 (tls_test_gnu2_shared.so): New target.
10978 (tls_shared_gnu2_test_SOURCES): New variable.
10979 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
10980 (tls_shared_gnu2_test_LDFLAGS): New variable.
10981 (tls_shared_gnu2_test_LDADD): New variable.
10982 * testsuite/Makefile.in: Rebuild.
10983 * testsuite/Makefile.
10985 2008-04-11 Ian Lance Taylor <iant@google.com>
10987 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
10989 * testsuite/Makefile.in: Rebuild.
10991 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
10993 * testsuite/script_test_2.cc (main): Adjust test.
10995 2008-04-11 David S. Miller <davem@davemloft.net>
10996 Ian Lance Taylor <iant@google.com>
10998 * options.h (General_options): Add entries for '-Y' and
11000 * options.cc (General_options:finalize): If -Y was used, add those
11001 entries to the library path instead of the default "/lib" and
11004 2008-04-11 David S. Miller <davem@davemloft.net>
11006 * testsuite/justsyms.t: Start at 0x100.
11007 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
11008 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
11010 * testsuite/script_test_2.cc: Adjust string and section length
11013 2008-04-09 Ian Lance Taylor <iant@google.com>
11016 * script-sections.cc (Sections_element::allocate_to_segment): Add
11018 (Output_section_definition::allocate_to_segment): Likewise.
11019 (Orphan_output_section::allocate_to_segment): Likewise.
11020 (Script_sections::attach_sections_using_phdrs_clause): Don't
11021 propagate non-PT_LOAD segments to orphan sections.
11022 * testsuite/Makefile.am (script_test_3.stdout): Generate using
11023 readelf rather than objdump.
11024 * testsuite/script_test_3.sh: Adjust accordingly. Test that
11025 .interp section and PT_INTERP segment are the same size.
11026 * testsuite/Makefile.in: Rebuild.
11028 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
11029 aliases for symbols defined in the same object.
11030 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
11031 (weak_alias_test_SOURCES): New variable.
11032 (weak_alias_test_DEPENDENCIES): New variable.
11033 (weak_alias_test_LDFLAGS): New variable.
11034 (weak_alias_test_LDADD): New variable.
11035 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
11036 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
11037 (weak_alias_test_3.o): New target.
11038 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
11039 * testsuite/weak_alias_test_main.cc: New file.
11040 * testsuite/weak_alias_test_1.cc: New file.
11041 * testsuite/weak_alias_test_2.cc: New file.
11042 * testsuite/weak_alias_test_3.cc: New file.
11044 2008-04-08 Ian Lance Taylor <iant@google.com>
11046 * options.h (class General_options): Add --noinhibit-exec option.
11047 * main.cc (main): Check --noinhibit-exec.
11049 * options.h (class General_options): Define --wrap as a special
11050 option. Add wrap_symbols_ field.
11051 (General_options::any_wrap_symbols): New function.
11052 (General_options::is_wrap_symbol): New function.
11053 * options.cc (General_options::parse_wrap): New function.
11054 (General_options::General_options): Initialize wrap_symbols_.
11055 * symtab.cc (Symbol_table::wrap_symbol): New function.
11056 (Symbol_table::add_from_object): Handle --wrap.
11057 * symtab.h (class Symbol_table): Declare wrap_symbol.
11058 * target.h (Target::wrap_char): New function.
11059 (Target::Target_info): Add wrap_char field.
11060 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
11061 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11062 * testsuite/testfile.cc (Target_test::test_target_info):
11065 * errors.cc (Errors::undefined_symbol): Mention symbol version if
11068 * layout.h (class Layout): Add added_eh_frame_data_ field.
11069 * layout.cc (Layout::Layout): Initialize new field.
11070 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
11071 output section until we find a section we merged successfully.
11072 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
11073 that the size be non-zero.
11075 * merge.cc (Object_merge_map::get_output_offset): Remove inline
11078 2008-04-08 Craig Silverstein <csilvers@google.com>
11080 * configure.ac: Export new conditional variable HAVE_ZLIB.
11081 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
11083 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
11084 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11086 2008-04-07 Ian Lance Taylor <iant@google.com>
11088 * version.cc (version_string): Set to "1.5".
11090 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
11091 Add issued_non_pic_error_ field. Declare check_non_pic.
11092 (Target_x86_64::Scan::check_non_pic): New function.
11093 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
11094 (Target_x86_64::Scan::global): Likewise.
11096 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
11097 addend parameter. Change caller. Handle merge sections.
11098 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
11099 Address to Addend. Don't add in the result of
11100 local_section_offset, pass down the addend and use the returned
11102 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
11103 Update declarations of local_section_offset and symbol_value.
11104 * testsuite/two_file_test_1.cc (t18): New function.
11105 * testsuite/two_file_test_2.cc (f18): New function.
11106 * testsuite/two_file_test_main.cc (main): Call t18.
11107 * testsuite/two_file_test.h (t18, f18): Declare.
11109 * configure.ac: Don't test for objdump, c++filt, or readelf.
11110 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
11112 (TEST_READELF): New variable.
11113 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
11114 (check_PROGRAMS): Add two_file_strip_test.
11115 (two_file_strip_test): New target.
11116 (check_PROGRAMS): Add two_file_same_shared_strip_test.
11117 (two_file_same_shared_strip_test_SOURCES): New variable.
11118 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
11119 (two_file_same_shared_strip_test_LDFLAGS): New variable.
11120 (two_file_same_shared_strip_test_LDADD): New variable.
11121 (two_file_shared_strip.so): New target.
11122 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
11123 (ver_test_5.syms, ver_test_7.syms): Likewise.
11124 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
11125 (strip_test_3.stdout): Use TEST_OBJDUMP.
11126 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11128 2008-04-04 Cary Coutant <ccoutant@google.com>
11130 * symtab.h (Symbol::is_weak_undefined): New function.
11131 (Symbol::is_strong_undefined): New function.
11132 (Symbol::is_absolute): New function.
11133 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
11134 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
11136 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
11137 (weak_undef_test): New target.
11138 * testsuite/Makefile.in: Rebuild.
11139 * testsuite/weak_undef_file1.cc: New file.
11140 * testsuite/weak_undef_file2.cc: New file.
11141 * testsuite/weak_undef_test.cc: New file.
11143 2008-04-03 Craig Silverstein <csilvers@google.com>
11145 * compressed_output.h (class Output_compressed_section): Use
11147 * compressed_output.cc (zlib_compress): Use unsigned buffers,
11149 (zlib_compressed_suffix): Removed.
11150 (Output_compressed_section::set_final_data_size): Use unsigned
11152 * testsuite/Makefile.am (flagstest_compress_debug_sections):
11153 Fix linker invocation.
11154 (flagstest_o_specialfile_and_compress_debug_sections):
11156 * testsuite/Makefile.in: Regenerated.
11158 2008-04-02 David S. Miller <davem@davemloft.net>
11160 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
11161 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
11163 2008-04-02 Craig Silverstein <csilvers@google.com>
11167 2008-04-02 Ian Lance Taylor <iant@google.com>
11169 * fileread.cc (File_read::find_view): Add byteshift and vshifted
11170 parameters. Update for new key type to views_. Change all
11172 (File_read::read): Adjust for byteshift in returned view.
11173 (File_read::add_view): New function, broken out of
11174 find_and_make_view.
11175 (File_read::make_view): New function, broken out of
11176 find_and_make_view.
11177 (File_read::find_or_make_view): Add offset and aligned
11178 parameters. Rewrite accordingly. Change all callers.
11179 (File_read::get_view): Add offset and aligned parameters. Adjust
11180 for byteshift in return value.
11181 (File_read::get_lasting_view): Likewise.
11182 * fileread.h (class File_read): Update declarations.
11183 (class File_read::View): Add byteshift_ field. Add byteshift to
11184 constructor. Add byteshift method.
11185 * archive.h (Archive::clear_uncached_views): New function.
11186 (Archive::get_view): Add aligned parameter. Change all callers.
11187 * object.h (Object::get_view): Add aligned parameter. Change all
11189 (Object::get_lasting_view): Likewise.
11191 * fileread.cc (File_read::release): Don't call clear_views if
11192 there are multiple objects.
11193 * fileread.h (File_read::clear_uncached_views): New function.
11194 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
11197 2008-03-31 Cary Coutant <ccoutant@google.com>
11199 Add thin archive support.
11200 * archive.cc (Archive::armagt): New const.
11201 (Archive::setup): Remove task parameter and calls to unlock.
11202 (Archive::unlock_nested_archives): New function.
11203 (Archive::read_header): Add nested_off parameter. Change
11205 (Archive::interpret_header): Likewise.
11206 (Archive::include_all_members): Change to handle thin
11208 (Archive::include_member): Likewise.
11209 * archive.h (Archive::Archive): Add new parameters and
11211 (Archive::armagt): New const.
11212 (Archive::setup): Remove task parameter.
11213 (Archive::unlock_nested_archives): New function.
11214 (Archive::read_header): Add nested_off parameter.
11215 (Archive::interpret_header): Likewise.
11216 (Archive::Nested_archive_table): New typedef.
11217 (Archive::is_thin_archive_): New field.
11218 (Archive::nested_archives_): New field.
11219 (Archive::options_): New field.
11220 (Archive::dirpath_): New field.
11221 (Archive::task_): New field.
11222 * readsyms.cc (Read_symbols::do_read_symbols): Add check
11223 for thin archives. Pass additional parameters to
11224 Archive::Archive. Unlock the archive file after calling
11227 2008-03-29 Ian Lance Taylor <iant@google.com>
11229 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
11230 version symbol to be local.
11231 * testsuite/ver_test_4.sh: New file.
11232 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
11233 (check_DATA): Add ver_test_4.syms.
11234 (ver_test_4.syms): New target.
11235 * testsuite/Makefile.in: Rebuild.
11238 (Output_section::Input_section_sort_entry::has_priority): New
11240 (Output_section::Input_section_sort_entry::match_file_name): New
11242 (Output_section::Input_section_sort_entry::match_section_name):
11244 (Output_section::Input_section_sort_entry::match_section_name_prefix):
11246 (Output_section::Input_section_sort_entry::match_section_file):
11248 (Output_section::Input_section_sort_compare::operator()): Rewrite
11249 using new Input_section_sort_entry functions. Sort crtbegin and
11250 crtend first. Sort sections with no priority before sections with
11252 * testsuite/initpri1.c (d3): Check j != 4.
11253 (cd5): New constructor/destructor function.
11254 (main): Check j != 2.
11256 * symtab.cc (Symbol_table::add_from_object): If we don't use the
11257 new symbol when resolving, don't call set_is_default.
11258 * testsuite/ver_test_7.cc: New file.
11259 * testsuite/ver_test_7.sh: New file.
11260 * testsuite/Makefile.am (ver_test_7.so): New target.
11261 (ver_test_7.o): New target.
11262 (check_SCRIPTS): Add ver_test_7.sh.
11263 (check_DATA): Add ver_test_7.syms.
11264 (ver_test_7.syms): New target.
11266 2008-03-28 Ian Lance Taylor <iant@google.com>
11268 * layout.cc (Layout::layout): If we see an input section with a
11269 name that needs sorting, set the must_sort flag for the output
11271 (Layout::make_output_section): If the name of the output section
11272 indicates that it might require sorting, set the may_sort flag.
11273 * output.h (Output_section::may_sort_attached_input_sections): New
11275 (Output_section::set_may_sort_attached_input_sections): New
11277 (Output_section::must_sort_attached_input_sections): New
11279 (Output_section::set_must_sort_attached_input_sections): New
11281 (class Output_section): Declare Input_section_sort_entry. Define
11282 Input_section_sort_compare. Declare
11283 sort_attached_input_sections. Add new fields:
11284 may_sort_attached_input_sections_,
11285 must_sort_attached_input_sections_,
11286 attached_input_sections_are_sorted_.
11287 * output.cc (Output_section::Output_section): Initialize new
11289 (Output_section::add_input_section): Add an entry to
11290 input_sections_ if may_sort or must_sort are true.
11291 (Output_section::set_final_data_size): Call
11292 sort_attached_input_sections if necessary.
11293 (Output_section::Input_section_sort_entry): Define new class.
11294 (Output_section::Input_section_sort_compare::operator()): New
11296 (Output_section::sort_attached_input_sections): New function.
11297 * configure.ac: Check whether the compiler supports constructor
11298 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
11299 * testsuite/initpri1.c: New file.
11300 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
11301 CONSTRUCTOR_PRIORITY.
11302 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
11303 (initpri1_LDFLAGS): New variable.
11304 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11306 2008-03-27 Ian Lance Taylor <iant@google.com>
11308 * common.cc (Sort_commons::operator): Correct sorting algorithm.
11309 * testsuite/common_test_1.c: New file.
11310 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
11311 (common_test_1_SOURCES): New variable.
11312 (common_test_1_DEPENDENCIES): New variable.
11313 (common_test_1_LDFLAGS): New variable.
11315 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
11316 and commons_ correctly when NAME/VERSION does not override
11318 * testsuite/ver_test_6.c: New file.
11319 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
11320 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
11321 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
11323 2008-03-26 Ian Lance Taylor <iant@google.com>
11325 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
11326 of an undefined symbol from a version script.
11327 * testsuite/Makefile.am (ver_test_5.so): New target.
11328 (ver_test_5.o): New target.
11329 (check_SCRIPTS): Add ver_test_5.sh.
11330 (check_DATA): Add ver_test_5.syms.
11331 (ver_test_5.syms): New target.
11332 * testsuite/ver_test_5.cc: New file.
11333 * testsuite/ver_test_5.script: New file.
11334 * testsuite/ver_test_5.sh: New file.
11335 * Makefile.in, testsuite/Makefile.in: Rebuild.
11338 Fix problems building gold with gcc 4.3.0.
11339 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
11340 (gold_error_at_location, gold_warning_at_location): Use it.
11341 * configure.ac: Check whether we can compile and use a template
11342 function with a printf attribute.
11343 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
11344 when jumping over bytes.
11345 * object.cc: Instantiate Object::read_section_data.
11346 * debug.h: Include <cstring>
11347 * dwarf_reader.cc: Include <algorithm>
11348 * main.cc: Include <cstring>.
11349 * options.cc: Include <cstring>.
11350 * output.cc: Include <cstring>.
11351 * script.cc: Include <cstring>.
11352 * script.h: Include <string>.
11353 * symtab.cc: Include <cstring> and <algorithm>.
11354 * target-select.cc: Include <cstring>.
11355 * version.cc: Include <string>.
11356 * testsuite/testmain.cc: Include <cstdlib>.
11357 * configure, config.in: Rebuild.
11359 2008-03-25 Ian Lance Taylor <iant@google.com>
11361 * options.cc: Include "../bfd/bfdver.h".
11362 (options::help): Print bug reporting address.
11364 * version.cc (print_version): Adjust output for current value of
11365 BFD_VERSION_STRING.
11369 * options.cc (options::help): Print list of supported targets.
11370 * target-select.h: Include <vector>.
11371 (class Target_selector): Make machine_, size_, and is_big_endian_
11372 fields const. Add bfd_name_ and instantiated_target_ fields.
11373 (Target_selector::Target_selector): Add bfd_name parameter.
11374 (Target_selector::recognize): Make non-virtual, call
11376 (Target_selector::recognize_by_name): Make non-virtual, call
11377 do_recognize_by_name.
11378 (Target_selector::supported_names): New function.
11379 (Target_selector::bfd_name): New function.
11380 (Target_selector::do_instantiate_target): New pure virtual
11382 (Target_selector::do_recognize): New virtual function.
11383 (Target_selector::do_recognize_by_name): New virtual function.
11384 (Target_selector::instantiate_target): New private function.
11385 (supported_target_names): Declare.
11386 * target-select.cc (Target_selector::Target_selector): Update for
11387 new parameter and fields.
11388 (select_target_by_name): Check that the name matches before
11389 calling recognize_by_name.
11390 (supported_target_names): New function.
11391 * i386.cc (class Target_selector_i386): Update Target_selector
11392 constructor call. Remove recognize and recognize_by_name. Add
11393 do_instantiate_target.
11394 * x86_64.cc (class Target_selector_x86_64): Likewise.
11395 * testsuite/testfile.cc (class Target_selector_test): Update for
11396 changes to Target_selector.
11398 * README: Rewrite, with some notes on unsupported features.
11400 2008-03-24 Cary Coutant <ccoutant@google.com>
11402 * i386.cc (Target_i386::Got_type): New enum declaration.
11403 (Target_i386::Scan::local): Updated callers of Output_data_got
11405 (Target_i386::Scan::global): Likewise.
11406 (Target_i386::Relocate::relocate): Likewise.
11407 (Target_i386::Relocate::relocate_tls): Likewise.
11408 * object.h (Got_offset_list): New class.
11409 (Sized_relobj::local_has_got_offset): Added got_type parameter.
11410 (Sized_relobj::local_got_offset): Likewise.
11411 (Sized_relobj::set_local_got_offset): Likewise.
11412 (Sized_relobj::local_has_tls_got_offset): Removed.
11413 (Sized_relobj::local_tls_got_offset): Removed.
11414 (Sized_relobj::set_local_tls_got_offset): Removed.
11415 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
11416 * output.cc (Output_data_got::add_global): Added got_type parameter.
11417 (Output_data_got::add_global_with_rel): Likewise.
11418 (Output_data_got::add_global_with_rela): Likewise.
11419 (Output_data_got::add_global_pair_with_rel): New function.
11420 (Output_data_got::add_global_pair_with_rela): New function.
11421 (Output_data_got::add_local): Added got_type parameter.
11422 (Output_data_got::add_local_with_rel): Likewise.
11423 (Output_data_got::add_local_with_rela): Likewise.
11424 (Output_data_got::add_local_pair_with_rel): New function.
11425 (Output_data_got::add_local_pair_with_rela): New function.
11426 (Output_data_got::add_global_tls): Removed.
11427 (Output_data_got::add_global_tls_with_rel): Removed.
11428 (Output_data_got::add_global_tls_with_rela): Removed.
11429 (Output_data_got::add_local_tls): Removed.
11430 (Output_data_got::add_local_tls_with_rel): Removed.
11431 (Output_data_got::add_local_tls_with_rela): Removed.
11432 * output.h (Output_data_got::add_global): Added got_type parameter.
11433 (Output_data_got::add_global_with_rel): Likewise.
11434 (Output_data_got::add_global_with_rela): Likewise.
11435 (Output_data_got::add_global_pair_with_rel): New function.
11436 (Output_data_got::add_global_pair_with_rela): New function.
11437 (Output_data_got::add_local): Added got_type parameter.
11438 (Output_data_got::add_local_with_rel): Likewise.
11439 (Output_data_got::add_local_with_rela): Likewise.
11440 (Output_data_got::add_local_pair_with_rel): New function.
11441 (Output_data_got::add_local_pair_with_rela): New function.
11442 (Output_data_got::add_global_tls): Removed.
11443 (Output_data_got::add_global_tls_with_rel): Removed.
11444 (Output_data_got::add_global_tls_with_rela): Removed.
11445 (Output_data_got::add_local_tls): Removed.
11446 (Output_data_got::add_local_tls_with_rel): Removed.
11447 (Output_data_got::add_local_tls_with_rela): Removed.
11448 * resolve.cc (Symbol::override_base_with_special): Removed
11449 reference to has_got_offset_ field.
11450 * symtab.cc (Symbol::init_fields): Replaced initialization
11451 of got_offset_ with got_offsets_. Removed initialization
11453 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
11454 (Symbol::got_offset): Likewise.
11455 (Symbol::set_got_offset): Likewise.
11456 (Symbol::has_tls_got_offset): Removed.
11457 (Symbol::tls_got_offset): Removed.
11458 (Symbol::set_tls_got_offset): Removed.
11459 (Symbol::got_offset_): Removed.
11460 (Symbol::tls_mod_got_offset_): Removed.
11461 (Symbol::tls_pair_got_offset_): Removed.
11462 (Symbol::got_offsets_): New field.
11463 (Symbol::has_got_offset): Removed.
11464 (Symbol::has_tls_mod_got_offset): Removed.
11465 (Symbol::has_tls_pair_got_offset): Removed.
11466 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
11467 (Target_x86_64::Scan::local): Updated callers of Output_data_got
11469 (Target_x86_64::Scan::global): Likewise.
11470 (Target_x86_64::Relocate::relocate): Likewise.
11471 (Target_x86_64::Relocate::relocate_tls): Likewise.
11473 2008-03-25 Ben Elliston <bje@au.ibm.com>
11475 * yyscript.y: Fix spelling error in comment.
11477 2008-03-24 Ian Lance Taylor <iant@google.com>
11479 * options.h (class General_options): Define build_id option.
11480 * layout.h (class Layout): Declare write_build_id, create_note,
11481 create_build_id. Add build_id_note_ member.
11482 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
11483 "libiberty.h", "md5.h", "sha1.h".
11484 (Layout::Layout): Initialize eh_frame_data_,
11485 eh_frame_hdr_section_, and build_id_note_.
11486 (Layout::finalize): Call create_build_id.
11487 (Layout::create_note): New function, broken out of
11488 Layout::create_gold_note.
11489 (Layout::create_gold_note): Call create_note.
11490 (Layout::create_build_id): New function.
11491 (Layout::write_build_id): New function.
11492 (Close_task_runner::run): Call write_build_id.
11494 * x86_64.cc: Correct license to GPLv3.
11496 2008-03-23 Ian Lance Taylor <iant@google.com>
11498 * options.cc: Include "demangle.h".
11499 (parse_optional_string): New function.
11500 (parse_long_option): Handle takes_optional_argument.
11501 (parse_short_option): Update dash_z initializer. Handle
11502 takes_optional_argument.
11503 (General_options::General_options): Initialize do_demangle_.
11504 (General_options::finalize): Set do_demangle_. Handle demangling
11506 * options.h (parse_optional_string): Declare.
11507 (struct One_option): Add optional_arg field. Update constructor.
11508 Update call constructor calls. Add takes_optional_argument
11510 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
11511 (DEFINE_optional_string): Define.
11512 (General_options::demangle): Change from DEFINE_bool to
11513 DEFINE_optional_string.
11514 (General_options::no_demangle): New function.
11515 (General_options::do_demangle): New function.
11516 (General_options::set_do_demangle): New function.
11517 (General_options::execstack_status_): Move definition to end of
11519 (General_options::static_): Likewise.
11520 (General_options::do_demangle_): New field.
11521 * object.cc (big_endian>::get_symbol_location_info): Call
11522 Options::do_demangle, not Options::demangle.
11523 * symtab.cc (demangle): Likewise.
11525 2008-03-22 Ian Lance Taylor <iant@google.com>
11527 * gold.h: Include <cstddef> and <sys/types.h>
11528 * options.h: Include <cstring>.
11530 2008-03-21 Ian Lance Taylor <iant@google.com>
11532 * Added source code to GNU binutils.