1 2011-07-01 Ian Lance Taylor <iant@google.com>
4 * options.h (class General_options): Support -z notext.
5 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
7 (two_file_shared_nonpic.so): Likewise.
8 (two_file_shared_mixed.so): Likewise.
9 (two_file_shared_mixed_1.so): Likewise.
10 (weak_undef_lib_nonpic.so): Likewise.
11 (alt/weak_undef_lib_nonpic.so): Likewise.
12 (tls_test_shared_nonpic.so): Likewise.
13 * testsuite/Makefile.in: Rebuild.
15 2011-07-01 Ian Lance Taylor <iant@google.com>
18 * configure.ac: Test whether static linking works, setting
19 the automake conditional HAVE_STATIC.
20 * testsuite/Makefile.am: Disable tests using -static if
21 HAVE_STATIC is not true.
22 * configure, testsuite/Makefile.in: Rebuild.
24 2011-07-01 Ian Lance Taylor <iant@google.com>
27 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
28 Assert if we see DW_EH_PE_indirect.
29 * target.h (Target::ehframe_datarel_base): New function.
30 (Target::do_ehframe_datarel_base): New target function.
31 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
32 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
35 2011-07-01 Ian Lance Taylor <iant@google.com>
38 * options.h (class General_options): Add
39 --ld-generated-unwind-info.
40 * ehframe.cc (Fde::write): Add address parameter. Change all
41 callers. If associated with PLT, fill in address and size.
42 (Cie::set_output_offset): Only add merge mapping if there is an
44 (Cie::write): Add address parameter. Change all callers.
45 (Eh_frame::add_ehframe_for_plt): New function.
46 * ehframe.h (class Fde): Update declarations. Move shndx_ and
47 input_offset_ fields into union u_, with new plt field.
48 (Fde::Fde): Adjust for new union field.
49 (Fde::Fde) [Output_data version]: New constructor.
50 (Fde::add_mapping): Only add merge mapping if there is an object.
51 (class Cie): Update declarations.
52 (class Eh_frame): Declare add_ehframe_for_plt.
53 * layout.cc (Layout::layout_eh_frame): Break out code into
54 make_eh_frame_section, and call it.
55 (Layout::make_eh_frame_section): New function.
56 (Layout::add_eh_frame_for_plt): New function.
57 * layout.h (class Layout): Update declarations.
58 * merge.cc (Merge_map::add_mapping): Add assertion.
59 * i386.cc: Include "dwarf.h".
60 (class Output_data_plt_i386): Make first_plt_entry,
61 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
62 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
64 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
65 boundary. Call add_eh_frame_for_plt if appropriate.
66 * x86_64.cc: Include "dwarf.h".
67 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
68 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
69 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
71 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
74 2011-06-29 Ian Lance Taylor <iant@google.com>
77 * object.cc (Sized_relobj_file::layout_section): Change shdr
78 parameter to be const.
79 (Sized_relobj_file::layout_eh_frame_section): New function, broken
81 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
82 appropriate. Call layout_eh_frame_section.
83 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
85 * object.h (class Sized_relobj_file): Update declarations.
87 2011-06-29 Ian Lance Taylor <iant@google.com>
90 * script.cc (Token::integer_value): Accept trailing M/m/K/k
92 (Lex::gather_token): Accept trailing M/m/K/k for integers.
94 2011-06-29 Ian Lance Taylor <iant@google.com>
97 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
99 * layout.cc (Layout::layout_eh_frame): Likewise.
101 2011-06-29 Ian Lance Taylor <iant@google.com>
104 * layout.cc (Layout::symtab_section_shndx): New function.
105 * layout.h (class Layout): Declare symtab_section_shndx.
106 * output.cc (Output_section::write_header): Call it.
108 2011-06-29 Ian Lance Taylor <iant@google.com>
111 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
112 symbols which are not used in a relocation.
114 2011-06-28 Ian Lance Taylor <iant@google.com>
117 * layout.cc (Layout::segment_precedes): Don't crash if a linker
118 script create indistinguishable segments.
119 (Layout::set_segment_offsets): Use stable_sort when sorting
120 segments. Pass this to Compare_segments constructor.
121 * layout.h (class Layout): Make segment_precedes non-static.
122 (class Compare_segments): Change from struct to class. Add
123 layout_ field. Add constructor.
125 (Script_sections::attach_sections_using_phdrs_clause): Rename
126 local orphan to is_orphan. Don't report failure to put empty
127 section in segment. On attachment failure, report name of
128 section, and attach to first PT_LOAD segment.
130 2011-06-28 Ian Lance Taylor <iant@google.com>
133 * target-select.cc (Target_selector::Target_selector): Add
134 emulation parameter. Change all callers.
135 (select_target_by_bfd_name): Rename from select_target_by_name.
137 (select_target_by_emulation): New function.
138 (supported_emulation_names): New function.
139 * target-select.h (class Target_selector): Add emulation_ field.
141 (Target_selector::recognize_by_bfd_name): Rename from
142 recognize_by_name. Change all callers.
143 (Target_selector::supported_bfd_names): Rename from
144 supported_names. Change all callers.
145 (Target_selector::recognize_by_emulation): New function.
146 (Target_selector::supported_emulations): New function.
147 (Target_selector::emulation): New function.
148 (Target_selector::do_recognize_by_bfd_name): Rename from
149 do_recognize_by_name. Change all callers.
150 (Target_selector::do_supported_bfd_names): Rename from
151 do_supported_names. Change all callers.
152 (Target_selector::do_recognize_by_emulation): New function.
153 (Target_selector::do_supported_emulations): New function.
154 (select_target_by_bfd_name): Change name in declaration.
155 (select_target_by_emulation): Declare.
156 (supported_emulation_names): Declare.
157 * parameters.cc (parameters_force_valid_target): Try to find
158 target based on emulation from -m option.
159 * options.h (class General_options): Change doc string for -m.
160 * options.cc (help): Print emulations.
161 (General_options::parse_V): Likewise.
162 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
163 Add emulation parameter. Change all callers.
165 2011-06-28 Ian Lance Taylor <iant@google.com>
167 * target.h (class Target): Add osabi_ field.
168 (Target::osabi): New function.
169 (Target::set_osabi): New function.
170 (Target::Target): Initialize osabi_.
171 (Target::do_adjust_elf_header): Make pure virtual.
172 (Sized_target::do_adjust_elf_header): Declare.
173 * target.cc (Sized_target::do_adjust_elf_header): New function.
174 (class Sized_target): Instantiate all versions.
175 * freebsd.h (class Target_freebsd): Remove.
176 (Target_selector_freebsd::do_recognize): Call set_osabi on
178 (Target_selector_freebsd::do_recognize_by_name): Likewise.
179 (Target_selector_freebsd::set_osabi): Remove.
180 * i386.cc (class Target_i386): Inherit from Sized_target rather
182 * x86_64.cc (class Target_x86_64): Likewise.
184 2011-06-28 Ian Lance Taylor <iant@google.com>
186 * target.h (Target::can_check_for_function_pointers): Rewrite.
188 (Target::can_icf_inline_merge_sections): Likewise.
189 (Target::section_may_have_icf_unsafe_poineters): Likewise.
190 (Target::Target_info): Add can_icf_inline_merge_sections field.
191 (Target::do_can_check_for_function_pointers): New virtual
193 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
194 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
195 from can_check_for_function_pointers, move in file.
196 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
197 section_may_have_icf_unsafe_poineters, move in file.
198 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
199 * i386.cc (Target_i386::do_can_check_for_function_pointers):
200 Rename from can_check_for_function_pointers, move in file.
201 (Target_i386::can_icf_inline_merge_sections): Remove.
202 (Target_i386::i386_info): Initialize
203 can_icf_inline_merge_sections.
204 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
205 Initialize can_icf_inline_merge_sections.
206 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
207 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
208 Rename from can_check_for_function_pointers, move in file.
209 (Target_x86_64::can_icf_inline_merge_sections): Remove.
210 (Target_x86_64::x86_64_info): Initialize
211 can_icf_inline_merge_sections.
212 * testsuite/testfile.cc (Target_test::test_target_info):
214 * icf.cc (get_section_contents): Correct formatting.
216 2011-06-27 Ian Lance Taylor <iant@google.com>
218 * symtab.cc (Symbol::versioned_name): New function.
219 (Symbol_table::add_to_final_symtab): Use versioned_name when
221 (Symbol_table::sized_write_symbol): Likewise.
222 * symtab.h (class Symbol): Declare versioned_name.
223 * stringpool.h (class Stringpool_template): Add variant of add
224 which takes a std::basic_string.
225 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
226 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
227 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
228 (ver_test_12.o): New target.
229 * testsuite/Makefile.in: Rebuild.
231 2011-06-27 Doug Kwan <dougkwan@google.com>
233 * arm.cc (Arm_relocate_functions::thm_jump8,
234 Arm_relocate_functions::thm_jump11): Use a wider signed
235 type to compute offset.
236 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
238 * testsuite/Makefile.in: Regenerate.
239 * testsuite/arm_branch_in_range.sh: Check test results of
240 arm_thm_jump11 and arm_thm_jump8.
241 * testsuite/arm_thm_jump11.s: New test source file.
242 * testsuite/arm_thm_jump11.t: New linker script.
243 * testsuite/arm_thm_jump8.s: New test source file.
244 * testsuite/arm_thm_jump8.t: New linker script.
246 2011-06-24 Ian Lance Taylor <iant@google.com>
248 * layout.cc: Include "object.h".
249 (ctors_sections_in_init_array): New static variable.
250 (Layout::is_ctors_in_init_array): New function.
251 (Layout::layout): Add entry to ctors_sections_in_init_array if
253 * layout.h (class Layout): Declare is_ctors_in_init_array.
254 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
255 is_ctors_reverse_view is set.
256 (Sized_relobj_file::write_sections): Add layout parameter. Change
257 all callers. Set is_ctors_reverse_view field of View_size.
258 (Sized_relobj_file::reverse_words): New function.
259 * object.h (Sized_relobj_file::View_size): Add
260 is_ctors_reverse_view field.
261 (class Sized_relobj_file): Update declarations.
262 * testsuite/initpri3.c: New test.
263 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
265 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
266 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
267 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
268 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
269 * testsuite/Makefile.in: Rebuild.
271 2011-06-24 Cary Coutant <ccoutant@google.com>
273 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
274 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
275 (debug_msg_cdebug.err): New targets.
276 * testsuite/Makefile.in: Regenerate.
277 * testsuite/debug_msg.sh: Check output of link with compressed debug.
278 Fix checks for link with shared library.
280 2011-06-24 Doug Kwan <dougkwan@google.com>
282 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
283 skip empty text sections.
284 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
286 2011-06-22 Ian Lance Taylor <iant@google.com>
289 * options.h (class General_options): Add --ctors-in-init-array.
290 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
291 friends as SHT_PROGBITS for merging sections.
292 (Layout::layout): Remove special handling of .init_array and
293 friends. Don't sort if doing relocatable link. Sort for .ctors
294 and .dtors if ctors_in_init_array.
295 (Layout::make_output_section): Force correct section types for
296 .init_array and friends. Don't sort if doing relocatable link,
297 Don't sort .ctors and .dtors if ctors_in_init_array.
298 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
299 (Layout::output_section_name): Add relobj parameter. Change all
300 callers. Handle .ctors. and .dtors. in code rather than table.
301 Handle .ctors and .dtors if ctors_in_init_array.
302 (Layout::match_file_name): New function, moved from output.cc.
303 * layout.h (class Layout): Update declarations.
304 * output.cc: Include "layout.h".
305 (Input_section_sort_entry::get_priority): New function.
306 (Input_section_sort_entry::match_file_name): Just call
307 Layout::match_file_name.
308 (Output_section::Input_section_sort_init_fini_compare::operator()):
309 Handle .ctors and .dtors. Sort by explicit priority rather than
311 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
312 * testsuite/initpri2.c: New test.
313 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
314 (check_PROGRAMS): Add initpri2.
315 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
316 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
317 * configure, testsuite/Makefile.in: Rebuild.
319 2011-06-19 Ian Lance Taylor <iant@google.com>
322 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
323 .interp section to a PT_INTERP segment even if we have seen a
324 --dynamic-linker option. Don't do it if we have seen a PHDRS
325 clause in a linker script.
326 (Layout::finalize): Don't create a .interp section if we've
327 already create a PT_INTERP segment.
328 (Layout::create_interp): Always call choose_output_section (revert
329 patch of 2011-06-17). Don't create PT_INTERP segment.
331 (Script_sections::create_note_and_tls_segments): Add a .interp
332 section to a PT_INTERP segment even if we have seen a
333 --dynamic-linker option.
335 2011-06-18 Ian Lance Taylor <iant@google.com>
337 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
338 merely because a non-PT_LOAD segment has a dynamic reloc.
340 2011-06-18 Ian Lance Taylor <iant@google.com>
342 * layout.cc (Layout::finish_dynamic_section): Don't create
343 DT_FLAGS entry if not needed.
345 2011-06-18 Ian Lance Taylor <iant@google.com>
348 * layout.cc (Layout::layout_eh_frame): Correct handling of
349 writable .eh_frame section.
351 2011-06-17 Ian Lance Taylor <iant@google.com>
354 * resolve.cc (Symbol_table::resolve): Don't give an error if a
355 symbol is redefined with the exact same object and value.
357 2011-06-17 Ian Lance Taylor <iant@google.com>
360 * layout.h (class Layout): Add interp_segment_ field.
361 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
362 (Layout::attach_allocated_section_to_segment): If making shared
363 library, put .interp section in PT_INTERP segment.
364 (Layout::finalize): Also call create_interp if -dynamic-linker
366 (Layout::create_interp): Assert that there is no PT_INTERP
367 segment. If not using a SECTIONS clause, use make_output_section.
368 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
370 (Script_sections::create_note_and_tls_segments): If making shared
371 library, put .interp section in PT_INTERP segment.
373 2011-06-17 Ian Lance Taylor <iant@google.com>
375 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
376 when making a shared library.
378 2011-06-17 Ian Lance Taylor <iant@google.com>
380 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
381 parameter. Change all callers. Don't issue warning about PC32
382 against locally defined symbol.
384 2011-06-16 Ian Lance Taylor <iant@google.com>
386 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
387 occurs in same object.
389 2011-06-14 Alan Modra <amodra@gmail.com>
391 * po/POTFILES.in: Regenerate.
393 2011-06-09 Ian Lance Taylor <iant@google.com>
396 (Orphan_output_section::set_section_addresses): For a relocatable
397 link set address to 0.
399 2011-06-09 Cary Coutant <ccoutant@google.com>
402 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
403 used with --compress-debug-sections.
404 * gold/object.cc (Sized_relobj_file::do_layout): Report
405 uncompressed size of compressed input sections.
407 2011-06-08 Cary Coutant <ccoutant@google.com>
410 * testsuite/two_file_test_2_v1.cc: Change initialization of
411 v2 to keep it in .data.
413 2011-06-07 Cary Coutant <ccoutant@google.com>
415 * common.cc (Symbol_table::do_allocate_commons_list): Call
417 * errors.cc (Errors::fatal): Adjust call to gold_exit.
418 (Errors::fallback): New function.
419 (gold_fallback): New function.
420 * errors.h (Errors::fallback): New function.
421 * gold.cc (gold_exit): Change status parameter to enum; adjust
423 (queue_initial_tasks): Call gold_fallback.
424 * gold.h: Include cstdlib.
425 (Exit_status): New enum type.
426 (gold_exit): Change status parameter to enum.
427 (gold_fallback): New function.
428 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
429 (Layout::create_symtab_sections): Likewise.
430 (Layout::create_shdrs): Likewise.
431 * main.cc (main): Adjust call to gold_exit.
432 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
433 (Output_data_got::add_got_entry_pair): Likewise.
434 (Output_section::add_input_section): Likewise.
435 (Output_section::add_output_section_data): Likewise.
436 (Output_segment::set_section_list_addresses): Likewise.
437 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
439 2011-06-07 Cary Coutant <ccoutant@google.com>
441 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
442 for incremental links.
443 * output.cc (Output_segment::set_section_list_addresses): Remove
444 FIXME and test for TLS or BSS.
446 2011-06-07 Cary Coutant <ccoutant@google.com>
448 * testsuite/Makefile.am: Add incremental_copy_test,
449 incremental_common_test_1.
450 * testsuite/Makefile.in: Regenerate.
451 * testsuite/common_test_1_v1.c: New source file.
452 * testsuite/common_test_1_v2.c: New source file.
453 * testsuite/copy_test_v1.cc: New source file.
455 2011-06-07 Cary Coutant <ccoutant@google.com>
457 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
458 update, allocate common from bss section's free list.
459 * incremental-dump.cc (dump_incremental_inputs): Print flag for
460 linker-defined symbols.
461 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
462 Skip GOT and PLT entries that are no longer referenced.
463 (Output_section_incremental_inputs::write_info_blocks): Mark
464 linker-defined symbols.
465 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
466 * output.cc (Output_section::allocate): New function.
467 * output.h (Output_section::allocate): New function.
468 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
469 linker-defined symbols.
470 (Symbol::override_base_with_special): Copy is_predefined_ flag.
471 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
472 (Symbol::init_base_output_data): Likewise.
473 (Symbol::init_base_output_segment): Likewise.
474 (Symbol::init_base_constant): Likewise.
475 (Sized_symbol::init_output_data): Likewise.
476 (Sized_symbol::init_output_segment): Likewise.
477 (Sized_symbol::init_constant): Likewise.
478 (Symbol_table::do_define_in_output_data): Likewise.
479 (Symbol_table::do_define_in_output_segment): Likewise.
480 (Symbol_table::do_define_as_constant): Likewise.
481 * symtab.h (Symbol::is_predefined): New function.
482 (Symbol::init_base_output_data): Add is_predefined parameter.
483 (Symbol::init_base_output_segment): Likewise.
484 (Symbol::init_base_constant): Likewise.
485 (Symbol::is_predefined_): New data member.
486 (Sized_symbol::init_output_data): Add is_predefined parameter.
487 (Sized_symbol::init_output_segment): Likewise.
488 (Sized_symbol::init_constant): Likewise.
489 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
491 2011-06-07 Cary Coutant <ccoutant@google.com>
493 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
494 instead of emit_copy_reloc.
495 (Copy_relocs::emit_copy_reloc): Refactor.
496 (Copy_relocs::make_copy_reloc): New function.
497 (Copy_relocs::add_copy_reloc): Remove.
498 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
500 (Copy_relocs::make_copy_reloc): New function.
501 (Copy_relocs::add_copy_reloc): Remove.
502 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
503 unchanged input files.
504 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
505 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
506 Reserve BSS space for COPY relocations.
507 (Sized_incremental_binary::do_emit_copy_relocs): New function.
508 (Output_section_incremental_inputs::write_info_blocks): Record
509 whether a symbol is copied from a shared object.
510 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
511 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
512 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
513 (Incremental_input_entry_reader::get_output_symbol_index): Add
515 (Incremental_binary::emit_copy_relocs): New function.
516 (Incremental_binary::do_emit_copy_relocs): New function.
517 (Sized_incremental_binary::Sized_incremental_binary): Initialize
519 (Sized_incremental_binary::add_copy_reloc): New function.
520 (Sized_incremental_binary::do_emit_copy_relocs): New function.
521 (Sized_incremental_binary::Copy_reloc): New struct.
522 (Sized_incremental_binary::Copy_relocs): New typedef.
523 (Sized_incremental_binary::copy_relocs_): New data member.
524 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
525 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
526 * target.h (Sized_target::emit_copy_reloc): New function.
527 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
529 2011-06-02 Cary Coutant <ccoutant@google.com>
532 * gold/archive.cc (Archive::Archive): Initialize new data member.
533 (Archive::include_all_members): Return if archive has already been
535 * gold/archive.h (Archive::include_all_members_): New data member.
537 2011-06-02 Nick Clifton <nickc@redhat.com>
539 * dynobj.h: Fix spelling mistake in comment.
540 * output.cc: Likewise.
542 2011-05-31 Doug Kwan <dougkwan@google.com>
546 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
547 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
548 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
549 redundant arm_exidx_test.so.
550 * testsuite/Makefile.in: Regenerate.
551 (check_SCRIPTS): Add pr12826.sh
552 (check_DATA): Add pr12826.stdout
553 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
554 * testsuite/pr12826.sh: New file.
555 * testsuite/pr12826_1.s: Ditto.
556 * testsuite/pr12826_1.s: Ditto.
558 2011-05-30 Ian Lance Taylor <iant@google.com>
560 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
563 2011-05-29 Ian Lance Taylor <iant@google.com>
566 * testsuite/Makefile.am: Use different file name for two_file_test
567 temporary file for each incremental test.
568 * testsuite/Makefile.in: Rebuild.
570 2011-05-29 Ian Lance Taylor <iant@google.com>
572 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
573 binary input file is empty.
575 2011-05-27 Ian Lance Taylor <iant@google.com>
577 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
578 (ver_test_9.so): Likewise.
579 * testsuite/Makefile.in: Rebuild.
581 2011-05-26 Cary Coutant <ccoutant@google.com>
583 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
584 * incremental.cc (Incremental_inputs::report_input_section): Fix
585 comment, indentation.
586 (Incremental_inputs::report_comdat_group): New function.
587 (Output_section_incremental_inputs::set_final_data_size): Adjust size
588 of data for incremental input file entry.
589 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
590 group count, COMDAT group signatures.
591 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
592 an unchanged input file.
593 * incremental.h (Incremental_object_entry::Incremental_object_entry):
594 Initialize new data member.
595 (Incremental_object_entry::add_comdat_group): New function.
596 (Incremental_object_entry::get_comdat_group_count): New function.
597 (Incremental_object_entry::get_comdat_signature_key): New function.
598 (Incremental_object_entry::groups_): New data member.
599 (Incremental_inputs::report_comdat_group): New function.
600 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
601 data for incremental input file entry.
602 (Incremental_input_entry_reader::get_comdat_group_count): New function.
603 (Incremental_input_entry_reader::get_input_section): Adjust size of
604 data for incremental input file entry.
605 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
606 (Incremental_input_entry_reader::get_comdat_group_signature): New
608 * object.cc (Sized_relobj::include_section_group): Report kept
609 COMDAT groups for incremental links.
611 2011-05-24 David Meyer <pdox@google.com>
613 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
614 with name parameter. Add found_name parameter.
615 * fileread.cc (Input_file::find_file): Adjust code accordingly.
616 * dirsearch.h (class Dirsearch): Update declaration.
618 2011-05-24 Ian Lance Taylor <iant@google.com>
620 * archive.cc (Library_base::should_include_member): Pull in object
621 from archive if it defines the entry symbol.
622 * parameters.cc (Parameters::entry): New function.
623 * parameters.h (class Parameters): Declare entry.
624 * output.h (class Output_file_header): Remove entry_ field.
625 * output.cc (Output_file_header::Output_file_header): Remove entry
626 parameter. Change all callers.
627 (Output_file_header::entry): Use parameters->entry.
628 * gold.cc (queue_middle_tasks): Likewise.
629 * plugin.cc (Plugin_hook::run): Likewise.
631 2011-05-24 Cary Coutant <ccoutant@google.com>
633 * gold.cc (queue_initial_tasks): Pass incremental base filename
634 to Output_file::open_base_file; don't print error message.
635 * incremental-dump.cc (main): Adjust call to
636 Output_file::open_for_modification.
637 * incremental-dump.cc (main): Likewise.
638 * incremental.cc (Incremental_inputs::report_command_line):
639 Ignore --incremental-base option when comparing command lines.
640 Ignore parameter when given as separate argument.
641 * options.h (class General_options): Add --incremental-base.
642 * output.cc (Output_file::Output_file):
643 (Output_file::open_base_file): Add base_name and writable parameters;
644 read base file into new file; print error message here.
645 (Output_file::map_no_anonymous): Add writable parameter; adjust all
647 * output.h (Output_file::open_for_modification): Rename to...
648 (Output_file::open_base_file): ...this; add base_name and
649 writable parameters; adjust all callers.
650 (Output_file::map_no_anonymous): Add writable parameter; adjust all
652 * testsuite/Makefile.am (incremental_test_4): Test
654 * testsuite/Makefile.in: Regenerate.
656 2011-05-24 Cary Coutant <ccoutant@google.com>
658 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
660 * testsuite/Makefile.in: Regenerate.
661 * testsuite/two_file_test_1_v1.cc: New test source file.
662 * testsuite/two_file_test_1b_v1.cc: New test source file.
663 * testsuite/two_file_test_2_v1.cc: New test source file.
665 2011-05-24 Cary Coutant <ccoutant@google.com>
667 * dynobj.h (Dynobj::do_dynobj): New function.
668 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
669 flag and soname for shared objects.
670 * incremental.cc (Incremental_inputs::report_object): Make
671 either Incremental_object_entry or Incremental_dynobj_entry; add
672 soname to string table.
673 (Incremental_inputs::report_input_section): Add assertion.
674 (Output_section_incremental_inputs::set_final_data_size): Adjust
675 type of input file entry for shared libraries; adjust size of
676 shared library info entry.
677 (Output_section_incremental_inputs::write_input_files): Write
678 as_needed flag for shared libraries.
679 (Output_section_incremental_inputs::write_info_blocks): Adjust type
680 of input file entry for shared libraries; write soname.
681 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
682 soname from incremental info.
683 * incremental.h (enum Incremental_input_flags): Add
684 INCREMENTAL_INPUT_AS_NEEDED.
685 (Incremental_input_entry::Incremental_input_entry): Initialize new
687 (Incremental_input_entry::set_as_needed): New function.
688 (Incremental_input_entry::as_needed): New function.
689 (Incremental_input_entry::do_dynobj_entry): New function.
690 (Incremental_input_entry::as_needed_): New data member.
691 (Incremental_object_entry::Incremental_object_entry): Don't check
693 (Incremental_object_entry::do_type): Likewise.
694 (class Incremental_dynobj_entry): New class.
695 (Incremental_input_entry_reader::as_needed): New function.
696 (Incremental_input_entry_reader::get_soname): New function.
697 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
698 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
699 size of shared library info entry.
700 * layout.cc (Layout::finish_dynamic_section): Don't test for
701 incremental link when adding DT_NEEDED entries.
702 * object.h (Object::Object): Initialize new data member.
703 (Object::dynobj): New function.
704 (Object::set_as_needed): New function.
705 (Object::as_needed): New function.
706 (Object::do_dynobj): New function.
707 (Object::as_needed_): New data member.
709 2011-05-24 Cary Coutant <ccoutant@google.com>
711 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
712 info; adjust display of GOT entries.
713 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
714 vector of input objects; remove file_status_.
715 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
716 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
717 got_plt reader; call target hooks to reserve GOT entries.
718 (Output_section_incremental_inputs::set_final_data_size): Adjust size
719 of input file info header and GOT info entry.
720 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
722 (Got_plt_view_info::got_descriptor): Remove.
723 (Got_plt_view_info::sym_index): New data member.
724 (Got_plt_view_info::input_index): New data member.
725 (Local_got_offset_visitor::visit): Write input file index.
726 (Global_got_offset_visitor::visit): Write 0 for input file index.
727 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
728 with sym_index and input_index.
729 (Output_section_incremental_inputs::write_got_plt): Adjust size of
730 incremental info GOT entry; replace got_descriptor with input_index.
731 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
732 map from input file index to object.
733 (Sized_relobj_incr::do_layout): Replace direct data member reference
734 with accessor function.
735 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
736 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
737 Adjust size of input file info header.
738 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
739 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
740 (Incremental_input_entry_reader::get_input_section): Adjust size of
741 input file info header.
742 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
743 of incremental info GOT entry.
744 (Incremental_got_plt_reader::get_got_desc): Remove.
745 (Incremental_got_plt_reader::get_got_symndx): New function.
746 (Incremental_got_plt_reader::get_got_input_index): New function.
747 (Sized_incremental_binary::Sized_incremental_binary): Remove
748 file_status_; add input_objects_.
749 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
750 (Sized_incremental_binary::set_file_is_unchanged): Remove.
751 (Sized_incremental_binary::file_is_unchanged): Remove.
752 (Sized_incremental_binary::set_input_object): New function.
753 (Sized_incremental_binary::input_object): New function.
754 (Sized_incremental_binary::file_status_): Remove.
755 (Sized_incremental_binary::input_objects_): New data member.
756 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
758 (Sized_relobj_incr::invalid_address): Move to base class.
759 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
761 (Sized_relobj_incr::do_output_section_offset): Likewise.
762 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
763 (Sized_relobj_incr::section_offsets_): Likewise.
764 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
766 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
767 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
768 with accessor function.
769 (Sized_relobj_file::do_layout): Likewise.
770 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
771 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
772 (Sized_relobj_file::compute_final_local_value): Replace refs to
773 section_offsets_ with accessor function.
774 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
775 * object.h (Relobj::Relobj): Initialize new data members.
776 (Relobj::add_dyn_reloc): New function.
777 (Relobj::first_dyn_reloc): New function.
778 (Relobj::dyn_reloc_count): New function.
779 (Relobj::first_dyn_reloc_): New data member.
780 (Relobj::dyn_reloc_count_): New data member.
781 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
783 (Sized_relobj::Address): New typedef.
784 (Sized_relobj::invalid_address): Move here from child class.
785 (Sized_relobj::Sized_relobj): Initialize new data members.
786 (Sized_relobj::sized_relobj): New function.
787 (Sized_relobj::is_output_section_offset_invalid): Move here from
789 (Sized_relobj::get_output_section_offset): Likewise.
790 (Sized_relobj::local_has_got_offset): Likewise.
791 (Sized_relobj::local_got_offset): Likewise.
792 (Sized_relobj::set_local_got_offset): Likewise.
793 (Sized_relobj::do_for_all_local_got_entries): Likewise.
794 (Sized_relobj::clear_got_offsets): New function.
795 (Sized_relobj::section_offsets): Move here from child class.
796 (Sized_relobj::do_output_section_offset): Likewise.
797 (Sized_relobj::do_set_section_offset): Likewise.
798 (Sized_relobj::Local_got_offsets): Likewise.
799 (Sized_relobj::local_got_offsets_): Likewise.
800 (Sized_relobj::section_offsets_): Likewise.
801 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
803 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
805 (Sized_relobj_file::sized_relobj): New function
806 (Sized_relobj_file::local_has_got_offset): Move to base class.
807 (Sized_relobj_file::local_got_offset): Likewise.
808 (Sized_relobj_file::set_local_got_offset): Likewise.
809 (Sized_relobj_file::get_output_section_offset): Likewise.
810 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
811 (Sized_relobj_file::do_output_section_offset): Likewise.
812 (Sized_relobj_file::do_set_section_offset): Likewise.
813 (Sized_relobj_file::Local_got_offsets): Likewise.
814 (Sized_relobj_file::local_got_offsets_): Likewise.
815 (Sized_relobj_file::section_offsets_): Likewise.
816 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
818 (set_needs_dynsym_index): Convert relobj to derived class pointer.
819 (Output_reloc::get_symbol_index): Likewise.
820 (Output_reloc::local_section_offset): Likewise.
821 (Output_reloc::get_address): Likewise.
822 (Output_reloc::symbol_value): Likewise.
823 (Output_data_got::reserve_slot): Move to class definition.
824 (Output_data_got::reserve_local): New function.
825 (Output_data_got::reserve_slot_for_global): Remove.
826 (Output_data_got::reserve_global): New function.
827 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
828 (all constructors, two instantiations).
829 (Output_reloc::get_relobj): New function (two instantiations).
830 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
831 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
832 (Output_data_reloc::add_global): Adjust type of relobj.
833 (Output_data_reloc::add_global_relative): Likewise.
834 (Output_data_reloc::add_symbolless_global_addend): Likewise.
835 (Output_data_reloc::add_local): Likewise.
836 (Output_data_reloc::add_local_relative): Likewise.
837 (Output_data_reloc::add_symbolless_local_addend): Likewise.
838 (Output_data_reloc::add_local_section): Likewise.
839 (Output_data_reloc::add_output_section): Likewise.
840 (Output_data_reloc::add_absolute): Likewise.
841 (Output_data_reloc::add_target_specific): Likewise.
842 (Output_data_got::reserve_slot): Move definition here.
843 (Output_data_got::reserve_local): New function.
844 (Output_data_got::reserve_global): New function.
845 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
846 section_offsets_ with accessor function.
847 (Sized_relobj_file::write_sections): Likewise.
848 (Sized_relobj_file::do_relocate_sections): Likewise.
849 * target.h (Sized_target::reserve_local_got_entry): New function.
850 (Sized_target::reserve_global_got_entry): New function.
851 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
852 (Target_x86_64::reserve_global_got_entry): New function.
853 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
855 2011-05-23 Cary Coutant <ccoutant@google.com>
857 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
858 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
859 bit when checking got_type.
860 * incremental.cc (Sized_incremental_binary::setup_readers):
861 Store symbol table and string table locations; initialize bit vector
862 of file status flags.
863 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
865 (Sized_incremental_binary::do_process_got_plt): New function.
866 (Sized_incremental_binary::get_symtab_view): Use stored locations.
867 (Output_section_incremental_inputs::set_final_data_size): Record
868 file index for each input file.
869 (Output_section_incremental_inputs::write_got_plt): Store file index
870 instead of input entry offset for each GOT entry.
872 (Incremental_input_entry::Incremental_input_entry): Initialize new
874 (Incremental_input_entry::set_offset): Store file index.
875 (Incremental_input_entry::get_file_index): New function.
876 (Incremental_input_entry::file_index_): New data member.
877 (Incremental_binary::process_got_plt): New function.
878 (Incremental_binary::do_process_got_plt): New function.
879 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
881 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
882 (Sized_incremental_binary::set_file_is_unchanged): New function.
883 (Sized_incremental_binary::file_is_unchanged): New function.
884 (Sized_incremental_binary::do_process_got_plt): New function.
885 (Sized_incremental_binary::file_status_): New data member.
886 (Sized_incremental_binary::main_symtab_loc_): New data member.
887 (Sized_incremental_binary::main_strtab_loc_): New data member.
888 * output.cc (Output_data_got::Got_entry::write): Add case
890 (Output_data_got::add_global): Call add_got_entry.
891 (Output_data_got::add_global_plt): Likewise.
892 (Output_data_got::add_global_with_rel): Likewise.
893 (Output_data_got::add_global_with_rela): Likewise.
894 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
895 (Output_data_got::add_global_pair_with_rela): Likewise.
896 (Output_data_got::add_local): Call add_got_entry.
897 (Output_data_got::add_local_plt): Likewise.
898 (Output_data_got::add_local_with_rel): Likewise.
899 (Output_data_got::add_local_with_rela): Likewise.
900 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
901 (Output_data_got::add_local_pair_with_rela): Likewise.
902 (Output_data_got::reserve_slot): New function.
903 (Output_data_got::reserve_slot_for_global): New function.
904 (Output_data_got::add_got_entry): New function.
905 (Output_data_got::add_got_entry_pair): New function.
906 (Output_section::add_output_section_data): Edit FIXME.
908 (Output_section_data_build::Output_section_data_build): New
909 constructor with size parameter.
910 (Output_data_space::Output_data_space): Likewise.
911 (Output_data_got::Output_data_got): Initialize new data member; new
912 constructor with size parameter.
913 (Output_data_got::add_constant): Call add_got_entry.
914 (Output_data_got::reserve_slot): New function.
915 (Output_data_got::reserve_slot_for_global): New function.
916 (class Output_data_got::Got_entry): Add RESERVED_CODE.
917 (Output_data_got::add_got_entry): New function.
918 (Output_data_got::add_got_entry_pair): New function.
919 (Output_data_got::free_list_): New data member.
920 * target.h (Sized_target::init_got_plt_for_update): New function.
921 (Sized_target::register_global_plt_entry): New function.
922 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
923 Initialize new data member; call init; add constructor with PLT count.
924 (Output_data_plt_x86_64::init): New function.
925 (Output_data_plt_x86_64::add_relocation): New function.
926 (Output_data_plt_x86_64::reserve_slot): New function.
927 (Output_data_plt_x86_64::free_list_): New data member.
928 (Target_x86_64::init_got_plt_for_update): New function.
929 (Target_x86_64::register_global_plt_entry): New function.
930 (Output_data_plt_x86_64::add_entry): Allocate from free list for
932 (Output_data_plt_x86_64::add_relocation): New function.
933 * testsuite/object_unittest.cc (Object_test): Set default options.
935 2011-05-16 Ian Lance Taylor <iant@google.com>
937 * options.h (class General_options): Make -i a synonym for -r.
939 2011-05-16 Ian Lance Taylor <iant@google.com>
941 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
943 2011-05-10 Cary Coutant <ccoutant@google.com>
945 * object.cc (Sized_relobj::do_count_local_symbols): Check for
948 2011-05-06 Ian Lance Taylor <iant@google.com>
950 * layout.cc (Layout::layout): If the output section flags change,
953 2011-04-25 Cary Coutant <ccoutant@google.com>
955 * incremental-dump.cc (dump_incremental_inputs): Print local
956 symbol info for each input file.
958 (Output_section_incremental_inputs::set_final_data_size): Add local
959 symbol info to input file entries in incremental info.
960 (Output_section_incremental_inputs::write_info_blocks): Likewise.
961 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
962 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
963 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
965 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
966 (Sized_incr_relobj::do_relocate): Write the local symbols.
967 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
968 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
969 Adjust size of input file header.
970 (Incremental_inputs_reader::get_local_symbol_offset): New function.
971 (Incremental_inputs_reader::get_local_symbol_count): New function.
972 (Incremental_inputs_reader::get_input_section): Adjust size of input
974 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
975 (Sized_incr_relobj::This): New typedef.
976 (Sized_incr_relobj::sym_size): New const data member.
977 (Sized_incr_relobj::Local_symbol): New struct.
978 (Sized_incr_relobj::do_output_local_symbol_count): New function.
979 (Sized_incr_relobj::do_local_symbol_offset): New function.
980 (Sized_incr_relobj::local_symbol_count_): New data member.
981 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
982 (Sized_incr_relobj::local_symbol_index_): New data member.
983 (Sized_incr_relobj::local_symbol_offset_): New data member.
984 (Sized_incr_relobj::local_dynsym_offset_): New data member.
985 (Sized_incr_relobj::local_symbols_): New data member.
986 * object.h (Relobj::output_local_symbol_count): New function.
987 (Relobj::local_symbol_offset): New function.
988 (Relobj::do_output_local_symbol_count): New function.
989 (Relobj::do_local_symbol_offset): New function.
990 (Sized_relobj::do_output_local_symbol_count): New function.
991 (Sized_relobj::do_local_symbol_offset): New function.
993 2011-04-22 Vladimir Simonov <sv@sw.ru>
995 * descriptors.cc (set_close_on_exec): New function.
996 (Descriptors::open): Use set_close_on_exec.
997 * output.cc (S_ISLNK): Define if not defined.
999 2011-04-22 Cary Coutant <ccoutant@google.com>
1001 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1003 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
1004 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
1005 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
1007 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
1008 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
1009 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
1011 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
1013 (Incremental_binary::apply_incremental_relocs): New function.
1014 (Incremental_binary::do_apply_incremental_relocs): New function.
1015 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
1017 (Sized_incremental_binary::add_global_symbol): New function.
1018 (Sized_incremental_binary::global_symbol): New function.
1019 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
1020 (Sized_incremental_binary::symbol_map_): New data member.
1021 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
1022 * target.h (Sized_target::apply_relocation): New function.
1023 * target-reloc.h (apply_relocation): New function.
1024 * x86_64.cc (Target_x86_64::apply_relocation): New function.
1026 2011-04-22 Doug Kwan <dougkwan@google.com>
1028 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
1029 flag of a SHT_ARM_EXIDX section.
1030 * testsuite/Makefile.am (arm_exidx_test): New test rules.
1031 * testsuite/Makefile.in: Regenerate.
1032 * testsuite/arm_exidx_test.s: New file.
1033 * testsuite/arm_exidx_test.sh: Same.
1035 2011-04-20 Cary Coutant <ccoutant@google.com>
1038 * archive.h (Incremental_archive_entry::Archive_member):
1039 Initialize arg_serial_ (second constructor).
1041 2011-04-17 Ian Lance Taylor <iant@google.com>
1043 * object.cc (Relocate_info::location): Simplify location string.
1044 * errors.cc (Errors::error_at_location): Don't print program
1046 (Errors::warning_at_location): Likewise.
1047 (Errors::undefined_symbol): Likewise.
1048 * testsuite/debug_msg.sh: Update accordingly.
1050 2011-04-14 Cary Coutant <ccoutant@google.com>
1052 * gold/layout.cc (Layout::symtab_section_offset): New function.
1053 * gold/layout.h (Layout::symtab_section_offset): New function.
1054 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
1056 2011-04-12 Ian Lance Taylor <iant@google.com>
1058 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
1059 with MREMAP_MAYMOVE.
1060 * output.h (class Output_file): Add map_is_allocated_ field.
1061 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
1062 not available, provide stubs. If mremap is not available, #define
1064 (MREMAP_MAYMOVE): Define if not defined.
1065 (Output_file::Output_file): Initialize map_is_allocated_.
1066 (Output_file::resize): Check map_is_allocated_.
1067 (Output_file::map_anonymous): If mmap fails, use malloc.
1068 (Output_file::unmap): Don't do anything for an anonymous map.
1069 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
1070 is not available, provide stubs.
1071 (File_read::View::~View): Use free rather than delete[].
1072 (File_read::make_view): Use malloc rather than new[]. If mmap
1074 (File_read::find_or_make_view): Use malloc rather than new[].
1075 * gold.h: Remove HAVE_REMAP code.
1076 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
1077 exists. Rename mremap to gold_mremap. If mmap is not available
1079 * configure, config.in: Rebuild.
1081 2011-04-11 Ian Lance Taylor <iant@google.com>
1083 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
1084 initialize local variable v.
1086 2011-04-11 Cary Coutant <ccoutant@google.com>
1088 * archive.cc (Archive::include_member): Adjust call to
1090 (Add_archive_symbols::run): Track argument serial numbers.
1091 (Lib_group::include_member): Likewise.
1092 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
1093 * archive.h (Incremental_archive_entry::Archive_member):
1094 Initialize arg_serial_.
1095 (Archive_member::arg_serial_): New data member.
1096 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
1097 (Sized_dynobj::do_add_symbols): Track symbols when doing an
1099 (Sized_dynobj::do_for_all_local_got_entries): New function.
1100 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
1102 * fileread.cc (get_mtime): New function.
1103 * fileread.h (get_mtime): New function.
1104 * gold.cc (queue_initial_tasks): Check for incremental update.
1105 (process_incremental_input): New function.
1106 (queue_middle_tasks): Don't force valid target for incremental
1108 * incremental-dump.cc (find_input_containing_global): Adjust
1109 size of symbol info entry.
1110 (dump_incremental_inputs): Dump argument serial number and
1111 in_system_directory flag; bias shndx by 1; print symbol names
1112 when dumping per-file symbol lists; use new symbol info readers.
1114 (Output_section_incremental_inputs:update_data_size): New function.
1115 (Sized_incremental_binary::setup_readers): Setup input readers
1116 for each input file; build maps for files added from libraries
1118 (Sized_incremental_binary::check_input_args): New function.
1119 (Sized_incremental_binary::do_check_inputs): Build map of argument
1120 serial numbers to input arguments.
1121 (Sized_incremental_binary::do_file_has_changed): Rename
1122 do_file_is_unchanged to this; compare file modification times.
1123 (Sized_incremental_binary::do_init_layout): New function.
1124 (Sized_incremental_binary::do_reserve_layout): New function.
1125 (Sized_incremental_binary::do_get_input_reader): Remove.
1126 (Sized_incremental_binary::get_symtab_view): New function.
1127 (Incremental_checker::can_incrementally_link_output_file): Remove.
1128 (Incremental_inputs::report_command_line): Exclude --debug options.
1129 (Incremental_inputs::report_archive_begin): Add parameter; track
1130 argument serial numbers; don't put input file entry for archive
1131 before archive members.
1132 (Incremental_inputs::report_archive_end): Put input file entry
1133 for archive after archive members.
1134 (Incremental_inputs::report_object): Add parameter; track argument
1135 serial numbers and in_system_directory flag.
1136 (Incremental_inputs::report_script): Add parameter; track argument
1138 (Output_section_incremental_inputs::set_final_data_size): Adjust
1139 size of symbol info entry; check for forwarding symbols.
1140 (Output_section_incremental_inputs::write_input_files): Write
1141 in_system_directory flag and argument serial number.
1142 (Output_section_incremental_inputs::write_info_blocks): Map section
1143 indices between incremental info and original input file; store
1144 input section index for each symbol.
1145 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
1146 change operator() to visit().
1147 (class Global_got_offset_visitor): Likewise.
1148 (class Global_symbol_visitor_got_plt):
1149 (Output_section_incremental_inputs::write_got_plt): Use new visitor
1151 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
1152 (Sized_incr_relobj::do_read_symbols): New function.
1153 (Sized_incr_relobj::do_layout): New function.
1154 (Sized_incr_relobj::do_layout_deferred_sections): New function.
1155 (Sized_incr_relobj::do_add_symbols): New function.
1156 (Sized_incr_relobj::do_should_include_member): New function.
1157 (Sized_incr_relobj::do_for_all_global_symbols): New function.
1158 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
1159 (Sized_incr_relobj::do_section_size): New function.
1160 (Sized_incr_relobj::do_section_name): New function.
1161 (Sized_incr_relobj::do_section_contents): New function.
1162 (Sized_incr_relobj::do_section_flags): New function.
1163 (Sized_incr_relobj::do_section_entsize): New function.
1164 (Sized_incr_relobj::do_section_address): New function.
1165 (Sized_incr_relobj::do_section_type): New function.
1166 (Sized_incr_relobj::do_section_link): New function.
1167 (Sized_incr_relobj::do_section_info): New function.
1168 (Sized_incr_relobj::do_section_addralign): New function.
1169 (Sized_incr_relobj::do_initialize_xindex): New function.
1170 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
1171 (Sized_incr_relobj::do_read_relocs): New function.
1172 (Sized_incr_relobj::do_gc_process_relocs): New function.
1173 (Sized_incr_relobj::do_scan_relocs): New function.
1174 (Sized_incr_relobj::do_count_local_symbols): New function.
1175 (Sized_incr_relobj::do_finalize_local_symbols): New function.
1176 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
1177 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
1178 (Sized_incr_relobj::do_relocate): New function.
1179 (Sized_incr_relobj::do_set_section_offset): New function.
1180 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
1181 (Sized_incr_dynobj::do_read_symbols): New function.
1182 (Sized_incr_dynobj::do_layout): New function.
1183 (Sized_incr_dynobj::do_add_symbols): New function.
1184 (Sized_incr_dynobj::do_should_include_member): New function.
1185 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
1186 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
1187 (Sized_incr_dynobj::do_section_size): New function.
1188 (Sized_incr_dynobj::do_section_name): New function.
1189 (Sized_incr_dynobj::do_section_contents): New function.
1190 (Sized_incr_dynobj::do_section_flags): New function.
1191 (Sized_incr_dynobj::do_section_entsize): New function.
1192 (Sized_incr_dynobj::do_section_address): New function.
1193 (Sized_incr_dynobj::do_section_type): New function.
1194 (Sized_incr_dynobj::do_section_link): New function.
1195 (Sized_incr_dynobj::do_section_info): New function.
1196 (Sized_incr_dynobj::do_section_addralign): New function.
1197 (Sized_incr_dynobj::do_initialize_xindex): New function.
1198 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
1199 (make_sized_incremental_object): New function.
1200 (Incremental_library::copy_unused_symbols): New function.
1201 (Incremental_library::do_for_all_unused_symbols): New function.
1202 * incremental.h (enum Incremental_input_flags): New type.
1203 (class Incremental_checker): Remove.
1204 (Incremental_input_entry::Incremental_input_entry): Add argument
1206 (Incremental_input_entry::arg_serial): New function.
1207 (Incremental_input_entry::set_is_in_system_directory): New function.
1208 (Incremental_input_entry::is_in_system_directory): New function.
1209 (Incremental_input_entry::arg_serial_): New data member.
1210 (Incremental_input_entry::is_in_system_directory_): New data member.
1211 (class Script_info): Move here from script.h.
1212 (Script_info::Script_info): Add filename parameter.
1213 (Script_info::filename): New function.
1214 (Script_info::filename_): New data member.
1215 (Incremental_script_entry::Incremental_script_entry): Add argument
1217 (Incremental_object_entry::Incremental_object_entry): Likewise.
1218 (Incremental_object_entry::add_input_section): Build list of input
1219 sections with map to original shndx.
1220 (Incremental_object_entry::get_input_section_index): New function.
1221 (Incremental_object_entry::shndx_): New data member.
1222 (Incremental_object_entry::name_key_): Rename; adjust all refs.
1223 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
1224 (Incremental_archive_entry::Incremental_archive_entry): Add argument
1226 (Incremental_inputs::report_archive_begin): Likewise.
1227 (Incremental_inputs::report_object): Likewise.
1228 (Incremental_inputs::report_script): Likewise.
1229 (class Incremental_global_symbol_reader): New class.
1230 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
1231 and store flags and input file type.
1232 (Incremental_input_entry_reader::arg_serial): New function.
1233 (Incremental_input_entry_reader::type): Extract type from flags.
1234 (Incremental_input_entry_reader::is_in_system_directory): New function.
1235 (Incremental_input_entry_reader::get_input_section_count): Call
1236 accessor function for type.
1237 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
1238 function for type; adjust size of global symbol entry.
1239 (Incremental_input_entry_reader::get_global_symbol_count): Call
1240 accessor function for type.
1241 (Incremental_input_entry_reader::get_object_count): Likewise.
1242 (Incremental_input_entry_reader::get_object_offset): Likewise.
1243 (Incremental_input_entry_reader::get_member_count): Likewise.
1244 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
1245 (Incremental_input_entry_reader::get_member_offset): Likewise.
1246 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
1247 (Incremental_input_entry_reader::Global_symbol_info): Remove.
1248 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
1249 (Incremental_input_entry_reader::get_global_symbol_reader): New
1251 (Incremental_input_entry_reader::get_output_symbol_index): New
1253 (Incremental_input_entry_reader::type_): Remove.
1254 (Incremental_input_entry_reader::flags_): New data member.
1255 (Incremental_inputs_reader::input_file_offset): New function.
1256 (Incremental_inputs_reader::input_file_index): New function.
1257 (Incremental_inputs_reader::input_file): Call input_file_offset.
1258 (Incremental_inputs_reader::input_file_at_offset): New function.
1259 (Incremental_relocs_reader::get_r_type): Reformat.
1260 (Incremental_relocs_reader::get_r_shndx): Reformat.
1261 (Incremental_relocs_reader::get_r_offset): Reformat.
1262 (Incremental_relocs_reader::data): New function.
1263 (Incremental_binary::Incremental_binary): Initialize new data members.
1264 (Incremental_binary::check_inputs): Add cmdline parameter.
1265 (Incremental_binary::file_is_unchanged): Remove.
1266 (Input_reader::arg_serial): New function.
1267 (Input_reader::get_unused_symbol_count): New function.
1268 (Input_reader::get_unused_symbol): New function.
1269 (Input_reader::do_arg_serial): New function.
1270 (Input_reader::do_get_unused_symbol_count): New function.
1271 (Input_reader::do_get_unused_symbol): New function.
1272 (Incremental_binary::input_file_count): New function.
1273 (Incremental_binary::get_input_reader): Change signature to use
1274 index instead of filename.
1275 (Incremental_binary::file_has_changed): New function.
1276 (Incremental_binary::get_input_argument): New function.
1277 (Incremental_binary::get_library): New function.
1278 (Incremental_binary::get_script_info): New function.
1279 (Incremental_binary::init_layout): New function.
1280 (Incremental_binary::reserve_layout): New function.
1281 (Incremental_binary::output_file): New function.
1282 (Incremental_binary::do_check_inputs): New function.
1283 (Incremental_binary::do_file_is_unchanged): Remove.
1284 (Incremental_binary::do_file_has_changed): New function.
1285 (Incremental_binary::do_init_layout): New function.
1286 (Incremental_binary::do_reserve_layout): New function.
1287 (Incremental_binary::do_input_file_count): New function.
1288 (Incremental_binary::do_get_input_reader): Change signature.
1289 (Incremental_binary::input_args_map_): New data member.
1290 (Incremental_binary::library_map_): New data member.
1291 (Incremental_binary::script_map_): New data member.
1292 (Sized_incremental_binary::Sized_incremental_binary): Initialize
1294 (Sized_incremental_binary::output_section): New function.
1295 (Sized_incremental_binary::inputs_reader): Add const.
1296 (Sized_incremental_binary::symtab_reader): Add const.
1297 (Sized_incremental_binary::relocs_reader): Add const.
1298 (Sized_incremental_binary::got_plt_reader): Add const.
1299 (Sized_incremental_binary::get_symtab_view): New function.
1300 (Sized_incremental_binary::Inputs_reader): New typedef.
1301 (Sized_incremental_binary::Input_entry_reader): New typedef.
1302 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
1303 (Sized_incremental_binary::do_file_is_unchanged): Remove.
1304 (Sized_incremental_binary::do_file_has_changed): New function.
1305 (Sized_incremental_binary::do_init_layout): New function.
1306 (Sized_incremental_binary::do_reserve_layout): New function.
1307 (Sized_input_reader::Inputs_reader): Remove.
1308 (Sized_input_reader::Input_entry_reader): Remove.
1309 (Sized_input_reader::do_arg_serial): New function.
1310 (Sized_input_reader::do_get_unused_symbol_count): New function.
1311 (Sized_input_reader::do_get_unused_symbol): New function.
1312 (Sized_incremental_binary::do_input_file_count): New function.
1313 (Sized_incremental_binary::do_get_input_reader): Change signature;
1314 use index instead of filename.
1315 (Sized_incremental_binary::section_map_): New data member.
1316 (Sized_incremental_binary::input_entry_readers_): New data member.
1317 (class Sized_incr_relobj): New class.
1318 (class Sized_incr_dynobj): New class.
1319 (make_sized_incremental_object): New function.
1320 (class Incremental_library): New class.
1321 * layout.cc (Free_list::num_lists): New static data member.
1322 (Free_list::num_nodes): New static data member.
1323 (Free_list::num_removes): New static data member.
1324 (Free_list::num_remove_visits): New static data member.
1325 (Free_list::num_allocates): New static data member.
1326 (Free_list::num_allocate_visits): New static data member.
1327 (Free_list::init): New function.
1328 (Free_list::remove): New function.
1329 (Free_list::allocate): New function.
1330 (Free_list::dump): New function.
1331 (Free_list::print_stats): New function.
1332 (Layout_task_runner::run): Resize output file for incremental updates.
1333 (Layout::Layout): Initialize new data members.
1334 (Layout::set_incremental_base): New function.
1335 (Layout::init_fixed_output_section): New function.
1336 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
1337 incremental updates.
1338 (Layout::create_gold_note): Do not create gold note section for
1339 incremental updates.
1340 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
1341 for incremental updates.
1342 (Layout::set_section_offsets): For incremental updates, allocate space
1344 (Layout::create_symtab_sections): Layout with offsets relative to
1345 start of section; for incremental updates, allocate space from free
1347 (Layout::create_shdrs): For incremental updates, allocate space from
1349 (Layout::finish_dynamic_section): For incremental updates, do not
1350 check --as-needed (fixed in subsequent patch).
1351 * layout.h (class Free_list): New class.
1352 (Layout::set_incremental_base): New function.
1353 (Layout::incremental_base): New function.
1354 (Layout::init_fixed_output_section): New function.
1355 (Layout::allocate): New function.
1356 (Layout::incremental_base_): New data member.
1357 (Layout::free_list_): New data member.
1358 * main.cc (main): Print Free_list statistics.
1359 * object.cc (Relobj::finalize_incremental_relocs): Add
1360 clear_counts parameter; clear counts only when clear_counts is set.
1361 (Sized_relobj::Sized_relobj): Initialize new base class.
1362 (Sized_relobj::do_layout): Don't report special sections.
1363 (Sized_relobj::do_for_all_local_got_entries): New function.
1364 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
1365 symtab_off to all symbol table offsets.
1366 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
1367 * object.h (class Got_offset_list): Move to top of file.
1368 (Object::Object): Allow case where input_file == NULL.
1369 (Object::~Object): Likewise.
1370 (Object::input_file): Assert that input_file != NULL.
1371 (Object::lock): Allow case where input_file == NULL.
1372 (Object::unlock): Likewise.
1373 (Object::is_locked): Likewise.
1374 (Object::token): Likewise.
1375 (Object::release): Likewise.
1376 (Object::is_incremental): New function.
1377 (Object::get_mtime): New function.
1378 (Object::for_all_local_got_entries): New function.
1379 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
1380 (Object::set_is_in_system_directory): New function.
1381 (Object::is_in_system_directory): New function.
1382 (Object::do_is_incremental): New function.
1383 (Object::do_get_mtime): New function.
1384 (Object::do_for_all_local_got_entries): New function.
1385 (Object::is_in_system_directory_): New data member.
1386 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
1387 (class Sized_relobj_base): New class.
1388 (class Sized_relobj): Derive from Sized_relobj_base.
1389 (class Sized_relobj::Symbols): Redeclare from base class.
1390 (class Sized_relobj::local_got_offset_list): Remove.
1391 (class Sized_relobj::Output_sections): Redeclare from base class.
1392 (class Sized_relobj::do_for_all_local_got_entries): New function.
1393 (class Sized_relobj::write_local_symbols): Add offset parameter.
1394 (class Sized_relobj::local_symbol_offset_): Update comment.
1395 (class Sized_relobj::local_dynsym_offset_): Update comment.
1396 * options.cc (Input_arguments::add_file): Remove const.
1397 * options.h (Input_file_argument::Input_file_argument):
1398 Initialize arg_serial_ (all constructors).
1399 (Input_file_argument::set_arg_serial): New function.
1400 (Input_file_argument::arg_serial): New function.
1401 (Input_file_argument::arg_serial_): New data member.
1402 (Input_arguments::Input_arguments): Initialize file_count_.
1403 (Input_arguments::add_file): Remove const.
1404 (Input_arguments::number_of_input_files): New function.
1405 (Input_arguments::file_count_): New data member.
1406 (Command_line::number_of_input_files): Call
1407 Input_arguments::number_of_input_files.
1408 * output.cc (Output_segment_headers::Output_segment_headers):
1410 (Output_section::Input_section::current_data_size): New function.
1411 (Output_section::Output_section): Initialize new data members.
1412 (Output_section::add_input_section): Don't do merge sections for
1413 an incremental link; allocate space from free list for an
1415 (Output_section::add_output_section_data): Allocate space from
1416 free list for an incremental update.
1417 (Output_section::update_data_size): New function.
1418 (Output_section::set_fixed_layout): New function.
1419 (Output_section::reserve): New function.
1420 (Output_segment::set_section_addresses): Remove const.
1421 (Output_segment::set_section_list_addresses): Remove const; allocate
1422 space from free list for an incremental update.
1423 (Output_segment::set_offset): Adjust size of RELRO segment for an
1425 * output.h (Output_data::current_data_size): Move here from
1427 (Output_data::pre_finalize_data_size): New function.
1428 (Output_data::update_data_size): New function.
1429 (Output_section_headers::update_data_size): new function.
1430 (Output_section_data_build::current_data_size): Move to Output_data.
1431 (Output_data_strtab::update_data_size): New function.
1432 (Output_section::current_data_size): Move to Output_data.
1433 (Output_section::set_fixed_layout): New function.
1434 (Output_section::has_fixed_layout): New function.
1435 (Output_section::reserve): New function.
1436 (Output_section::update_data_size): New function.
1437 (Output_section::has_fixed_layout_): New data member.
1438 (Output_section::free_list_): New data member.
1439 (Output_segment::set_section_addresses): Remove const.
1440 (Output_segment::set_section_list_addresses): Remove const.
1441 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
1443 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
1445 * readsyms.cc (Read_symbols::do_read_symbols): Add library
1446 parameter when calling Add_symbols constructor; store argument
1447 serial number for members of a lib group.
1448 (Add_symbols::locks): Allow case where token == NULL.
1449 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
1450 (Read_member::~Read_member): New function.
1451 (Read_member::is_runnable): New function.
1452 (Read_member::locks): New function.
1453 (Read_member::run): New function.
1454 (Check_script::~Check_script): New function.
1455 (Check_script::is_runnable): New function.
1456 (Check_script::locks): New function.
1457 (Check_script::run): New function.
1458 (Check_library::~Check_library): New function.
1459 (Check_library::is_runnable): New function.
1460 (Check_library::locks): New function.
1461 (Check_library::run): New function.
1462 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
1463 (Add_symbols::library_): New data member.
1464 (class Read_member): New class.
1465 (class Check_script): New class.
1466 (class Check_library): New class.
1467 * reloc.cc (Read_relocs::is_runnable): Allow case where
1469 (Read_relocs::locks): Likewise.
1470 (Scan_relocs::locks): Likewise.
1471 (Relocate_task::locks): Likewise.
1472 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
1474 (Sized_relobj::incremental_relocs_scan): Fix comment.
1475 (Sized_relobj::do_relocate): Pass output file offset to
1476 write_local_symbols.
1477 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
1478 from class declaration.
1479 * script.cc (read_input_script): Allocate Script_info; pass
1480 argument serial number to report_script.
1481 * script.h (class Script_info): Move to incremental.h.
1482 * symtab.cc (Symbol_table::add_from_incrobj): New function.
1483 * symtab.h (Symbol_table::add_from_incrobj): New function.
1484 (Symbol_table::set_file_offset): New function.
1486 2011-04-05 Cary Coutant <ccoutant@google.com>
1488 * incremental-dump.cc (dump_incremental_inputs): Change signature
1489 to take a Sized_incremental_binary; change caller. Use readers
1490 in Sized_incremental_binary.
1492 (Sized_incremental_binary::find_incremental_inputs_sections):
1493 Rename do_find_incremental_inputs_sections to this.
1494 (Sized_incremental_binary::setup_readers): New function.
1495 (Sized_incremental_binary::do_check_inputs): Check
1496 has_incremental_info_ flag; move setup code to setup_readers;
1498 (Sized_incremental_binary::do_file_is_unchanged): New function.
1499 (Sized_incremental_binary::do_get_input_reader): New function.
1500 * incremental.h (class Incremental_binary): Move to end of file.
1501 (Incremental_binary::file_is_unchanged): New function.
1502 (Incremental_binary::do_file_is_unchanged): New function.
1503 (Incremental_binary::Input_reader): New class.
1504 (Incremental_binary::get_input_reader): New function.
1505 (class Sized_incremental_binary): Move to end of file.
1506 (Sized_incremental_binary::Sized_incremental_binary): Setup the
1507 input section reader classes.
1508 (Sized_incremental_binary::has_incremental_info): New function.
1509 (Sized_incremental_binary::inputs_reader): New function.
1510 (Sized_incremental_binary::symtab_reader): New function.
1511 (Sized_incremental_binary::relocs_reader): New function.
1512 (Sized_incremental_binary::got_plt_reader): New function.
1513 (Sized_incremental_binary::do_file_is_unchanged): New function.
1514 (Sized_incremental_binary::Sized_input_reader): New class.
1515 (Sized_incremental_binary::get_input_reader): New function.
1516 (Sized_incremental_binary::find_incremental_inputs_sections):
1517 Rename do_find_incremental_inputs_sections to this.
1518 (Sized_incremental_binary::setup_readers): New function.
1519 (Sized_incremental_binary::has_incremental_info_): New data member.
1520 (Sized_incremental_binary::inputs_reader_): New data member.
1521 (Sized_incremental_binary::symtab_reader_): New data member.
1522 (Sized_incremental_binary::relocs_reader_): New data member.
1523 (Sized_incremental_binary::got_plt_reader_): New data member.
1524 (Sized_incremental_binary::current_input_file_): New data member.
1526 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
1529 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
1532 2011-03-30 Cary Coutant <ccoutant@google.com>
1534 * archive.cc (Archive::include_member): Adjust call to report_object.
1535 (Add_archive_symbols::run): Add script_info to call to
1536 report_archive_begin.
1537 (Lib_group::include_member): Adjust call to report_object.
1538 (Add_lib_group_symbols::run): Adjust call to report_object.
1539 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
1540 blocks. Add object count for script input files.
1541 * incremental.cc (Incremental_inputs::report_archive_begin): Add
1542 script_info parameter; change all callers.
1543 (Incremental_inputs::report_object): Add script_info parameter;
1545 (Incremental_inputs::report_script): Store backpointer to
1546 incremental info entry.
1547 (Output_section_incremental_inputs::set_final_data_size): Record
1548 additional information for scripts.
1549 (Output_section_incremental_inputs::write_info_blocks): Likewise.
1550 * incremental.h (Incremental_script_entry::add_object): New function.
1551 (Incremental_script_entry::get_object_count): New function.
1552 (Incremental_script_entry::get_object): New function.
1553 (Incremental_script_entry::objects_): New data member; adjust
1555 (Incremental_inputs::report_archive_begin): Add script_info parameter.
1556 (Incremental_inputs::report_object): Add script_info parameter.
1557 (Incremental_inputs_reader::get_object_count): New function.
1558 (Incremental_inputs_reader::get_object_offset): New function.
1559 * options.cc (Input_arguments::add_file): Return reference to
1561 * options.h (Input_argument::set_script_info): New function.
1562 (Input_argument::script_info): New function.
1563 (Input_argument::script_info_): New data member; adjust all
1565 (Input_file_group::add_file): Return reference to new input argument.
1566 (Input_file_lib::add_file): Likewise.
1567 (Input_arguments::add_file): Likewise.
1568 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
1569 * script.cc (Parser_closure::Parser_closure): Add script_info
1570 parameter; adjust all callers.
1571 (Parser_closure::script_info): New function.
1572 (Parser_closure::script_info_): New data member.
1573 (read_input_script): Report scripts earlier to incremental info.
1574 (script_add_file): Set script_info in Input_argument.
1575 (script_add_library): Likewise.
1576 * script.h (Script_options::Script_info): Rewrite class.
1578 2011-03-29 Cary Coutant <ccoutant@google.com>
1580 * archive.cc (Library_base::should_include_member): Move
1581 method here from class Archive.
1582 (Archive::Archive): Initialize base class.
1583 (Archive::should_include_member): Move to base class.
1584 (Archive::do_for_all_unused_symbols): New function.
1585 (Add_archive_symbols::run): Remove redundant access to
1587 (Lib_group::Lib_group): Initialize base class.
1588 (Lib_group::do_filename): New function.
1589 (Lib_group::include_member): Pass pointer to Lib_group to
1591 (Lib_group::do_for_all_unused_symbols): New function.
1592 (Add_lib_group_symbols::run): Report archive information for
1594 * archive.h (class Library_base): New base class.
1595 (class Archive): Derive from Library_base.
1596 (Archive::filename): Move to base class.
1597 (Archive::set_incremental_info): Likewise.
1598 (Archive::incremental_info): Likewise.
1599 (Archive::Should_include): Likewise.
1600 (Archive::should_include_member): Likewise.
1601 (Archive::Armap_entry): Remove.
1602 (Archive::Unused_symbol_iterator): Remove.
1603 (Archive::unused_symbols_begin): Remove.
1604 (Archive::unused_symbols_end): Remove.
1605 (Archive::do_filename): New function.
1606 (Archive::do_get_mtime): New function.
1607 (Archive::do_for_all_unused_symbols): New function.
1608 (Archive::task_): Move to base class.
1609 (Archive::incremental_info_): Likewise.
1610 (class Lib_group): Derive from Library_base.
1611 (Lib_group::do_filename): New function.
1612 (Lib_group::do_get_mtime): New function.
1613 (Lib_group::do_for_all_unused_symbols): New function.
1614 (Lib_group::task_): Move to base class.
1615 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
1617 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
1619 * incremental.cc (Incremental_inputs::report_archive_begin):
1620 Use Library_base; call library's get_mtime; add incremental inputs
1621 entry before members.
1622 (class Unused_symbol_visitor): New class.
1623 (Incremental_inputs::report_archive_end): Use Library_base; use
1624 visitor class to record unused symbols; don't add incremental inputs
1625 entry after members.
1626 (Incremental_inputs::report_object): Use Library_base.
1628 (Incremental_archive_entry::Incremental_archive_entry): Remove
1629 unused Archive parameter.
1630 (Incremental_inputs::report_archive_begin): Use Library_base.
1631 (Incremental_inputs::report_archive_end): Likewise.
1632 (Incremental_inputs::report_object): Likewise.
1633 * object.cc (Sized_relobj::do_for_all_global_symbols): New
1635 * object.h (Object::for_all_global_symbols): New function.
1636 (Object::do_for_all_global_symbols): New function.
1637 (Sized_relobj::do_for_all_global_symbols): New function.
1638 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
1640 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
1643 2011-03-27 Ian Lance Taylor <iant@google.com>
1645 * archive.cc (Archive::interpret_header): Return -1 if something
1646 goes wrong. Change callers accordingly.
1648 2011-03-25 Cary Coutant <ccoutant@google.com>
1650 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
1651 * testsuite/Makefile.in: Regenerate.
1653 2010-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
1655 * plugin.cc (get_view): New.
1656 (Plugin::load): Pass get_view to the plugin.
1657 (Plugin_manager::get_view): New.
1659 2011-03-21 Ian Lance Taylor <iant@google.com>
1661 * testsuite/final_layout.sh: Rewrite to not use dc.
1662 * testsuite/relro_test.sh: Fail if dc is not present.
1664 2011-03-21 Sriraman Tallam <tmsriram@google.com>
1666 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
1668 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
1669 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
1671 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
1672 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
1674 2011-03-14 Ian Lance Taylor <iant@google.com>
1676 * script-sections.cc (Sort_output_sections::script_compare):
1677 Rename from is_before, change return type.
1678 (Sort_output_sections::operator()): Adjust accordingly.
1680 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
1683 * testsuite/odr_violation2.cc: Add comment to make all error line
1684 numbers double digits.
1685 * testsuite/debug_msg.sh: Adjust expected errors.
1687 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
1689 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
1690 but mark earlier ones as non-canonical
1691 (offset_to_iterator): Update search target and example
1692 (do_addr2line): Return extra lines in a vector*
1693 (format_file_lineno): Extract from do_addr2line
1694 (one_addr2line): Add vector* out-param
1695 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
1696 when a lineno entry appeared last for its instruction
1697 (Dwarf_line_info): Add vector* out-param
1698 * object.cc (Relocate_info): Pass NULL for the vector* out-param
1699 * symtab.cc (Odr_violation_compare): Include the lineno in the
1701 (linenos_from_loc): New. Combine the canonical line for an
1702 address with its other lines.
1703 (True_if_intersect): New. Helper functor to make
1704 std::set_intersection a query.
1705 (detect_odr_violations): Compare sets of lines instead of just
1706 one line for each function. This became less deterministic, but
1707 has fewer false positives.
1708 * symtab.h: Declarations.
1709 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
1710 mix an optimized and non-optimized object in the same binary
1711 (odr_violation2.so): Same.
1712 * testsuite/Makefile.in: Regenerate from Makefile.am.
1713 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
1714 * testsuite/debug_msg.sh: Update line numbers and add
1716 * testsuite/odr_violation1.cc: Use OdrDerived, in a
1717 non-optimized context.
1718 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
1719 isn't inlined, and use OdrDerived in an optimized context.
1720 * testsuite/odr_header1.h: Defines OdrDerived, where
1721 optimization will change the
1722 first-instruction-in-the-destructor's file and line number.
1723 * testsuite/odr_header2.h: Defines OdrBase.
1725 2011-03-09 Ian Lance Taylor <iant@google.com>
1727 * fileread.cc (File_read::clear_views): Don't delete the whole
1730 2011-03-08 Ian Lance Taylor <iant@google.com>
1733 * fileread.cc: #include <climits>.
1734 (GOLD_IOV_MAX): Define.
1735 (File_read::read_multiple): Limit number of entries by iov_max.
1736 * fileread.h (class File_read): Always set max_readv_entries to
1739 2011-03-07 Ian Lance Taylor <iant@google.com>
1742 * options.h (class General_options): Add -dy and -dn.
1744 2011-03-02 Cary Coutant <ccoutant@google.com>
1746 * testsuite/script_test_9.t: Add TLS segment.
1748 2011-03-02 Simon Baldwin <simonb@google.com>
1750 * configure.ac: Add check for gnu_indirect_function support in
1751 the toolchain building binutils.
1752 * configure: Rebuild.
1754 2010-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
1756 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
1757 plugin only symbols.
1758 (Symbol_table::sized_finalize_symbol) Mark symbol only present
1759 in plugin files as not needed in the symbol table.
1761 2011-02-11 Sriraman Tallam <tmsriram@google.com>
1763 * output.cc (Output_section::add_input_section): Delay fill
1764 generation for section ordering.
1766 2011-02-09 Ian Lance Taylor <iant@google.com>
1769 * object.h (class Sized_relobj): Remove clear_local_symbols.
1770 * reloc.cc (Sized_relobj::do_relocate): Don't call
1771 clear_local_symbols.
1773 2010-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
1775 * plugin.cc (is_visible_from_outside): Return true for symbols
1778 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
1780 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
1783 2011-02-02 Sriraman Tallam <tmsriram@google.com>
1785 * icf.h (is_section_foldable_candidate): Change type of parameter
1787 * icf.cc (Icf::find_identical_sections): Change type of local variable
1788 section_name to be std::string.
1789 (is_function_ctor_or_dtor): Change type of parameter to std::string.
1791 2011-01-25 Ian Lance Taylor <iant@google.com>
1793 * script.cc (script_add_extern): Rewrite to use
1794 add_symbol_reference.
1796 2011-01-25 Doug Kwan <dougkwan@google.com>
1798 * icf.cc (get_section_contents): Always lock section's object.
1800 2011-01-24 Ian Lance Taylor <iant@google.com>
1802 * options.h (class General_options): Accept
1803 --no-detect-odr-violations.
1805 2011-01-24 Ian Lance Taylor <iant@google.com>
1807 * version.cc (version_string): Bump to 1.11.
1809 2011-01-24 Ian Lance Taylor <iant@google.com>
1811 * plugin.cc (class Plugin_rescan): Define new class.
1812 (Plugin_manager::claim_file): Set any_claimed_.
1813 (Plugin_manager::save_archive): New function.
1814 (Plugin_manager::save_input_group): New function.
1815 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
1817 (Plugin_manager::new_undefined_symbol): New function.
1818 (Plugin_manager::rescan): New function.
1819 (Plugin_manager::rescannable_defines): New function.
1820 (Plugin_manager::add_input_file): Set any_added_.
1821 * plugin.h (class Plugin_manager): define new fields rescannable_,
1822 undefined_symbols_, any_claimed_, and any_added_. Declare
1823 Plugin_rescan as friend. Declare new functions.
1824 (Plugin_manager::Rescannable): Define type.
1825 (Plugin_manager::Rescannable_list): Define type.
1826 (Plugin_manager::Undefined_symbol_list): Define type.
1827 (Plugin_manager::Plugin_manager): Initialize new fields.
1828 * archive.cc (Archive::defines_symbol): New function.
1829 (Add_archive_symbols::run): Pass archive to plugins if any.
1830 * archive.h (class Archive): Declare defines_symbol.
1831 * readsyms.cc (Input_group::~Input_group): New function.
1832 (Finish_group::run): Pass input_group to plugins if any.
1833 * readsyms.h (class Input_group): Declare destructor.
1834 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
1837 2011-01-10 Ian Lance Taylor <iant@google.com>
1839 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
1841 (Layout::set_segment_offsets): Reset increase_relro before calling
1842 set_section_addresses a second time.
1844 2011-01-04 Cary Coutant <ccoutant@google.com>
1846 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
1847 sections before NOBITS sections.
1849 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
1851 * version.cc (print_version): Update copyright to 2011.
1853 2010-12-23 Cary Coutant <ccoutant@google.com>
1855 * output.h (Output_data_reloc::add_output_section): Pass OD instead
1856 of OS to this->add. Add OD parameter to second form of the function.
1858 2010-12-20 Ian Lance Taylor <iant@google.com>
1860 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
1861 second of two consecutive entries with same offset.
1863 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1865 * testsuite/Makefile.am (ifuncmain2static_LDADD)
1866 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
1867 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
1868 to avoid unneeded links against $(LDADD).
1869 * testsuite/Makefile.in: Regenerate.
1871 2010-12-15 Ian Lance Taylor <iant@google.com>
1874 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
1875 for R_X86_64_32 and R_X86_64_PC32.
1876 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
1877 ver_matching_def_pic.o.
1878 (ver_matching_def_pic.o): New target.
1880 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1882 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
1883 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
1884 Move definition before File_read::View member definitions.
1885 (File_read::View::~View): Initialize and hold lock before
1886 updating current_mapped_bytes.
1888 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1890 * dwarf_reader.cc: Remove outdated comment.
1891 * gold-threads.cc: Fix typo in error message.
1892 * archive.cc: Fix typos in comments.
1893 * archive.h: Likewise.
1894 * arm-reloc-property.cc: Likewise.
1895 * arm-reloc-property.h: Likewise.
1896 * arm-reloc.def: Likewise.
1898 * attributes.h: Likewise.
1899 * cref.cc: Likewise.
1900 * ehframe.cc: Likewise.
1901 * fileread.h: Likewise.
1903 * i386.cc: Likewise.
1905 * incremental.h: Likewise.
1906 * int_encoding.cc: Likewise.
1907 * layout.h: Likewise.
1908 * main.cc: Likewise.
1909 * merge.h: Likewise.
1910 * object.cc: Likewise.
1911 * object.h: Likewise.
1912 * options.cc: Likewise.
1913 * readsyms.cc: Likewise.
1914 * reduced_debug_output.cc: Likewise.
1915 * reloc.cc: Likewise.
1916 * script-sections.cc: Likewise.
1917 * sparc.cc: Likewise.
1918 * symtab.h: Likewise.
1919 * target-reloc.h: Likewise.
1920 * target.cc: Likewise.
1921 * target.h: Likewise.
1922 * timer.cc: Likewise.
1923 * timer.h: Likewise.
1924 * x86_64.cc: Likewise.
1926 2010-12-09 Cary Coutant <ccoutant@google.com>
1928 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
1930 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
1931 parameter; change all callers.
1932 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
1933 * options.h (warn_execstack): New option.
1935 2010-12-07 Doug Kwan <dougkwan@google.com>
1937 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
1938 like function call relocations.
1940 2010-12-07 Ian Lance Taylor <iant@google.com>
1942 * archive.cc (Archive::get_elf_object_for_member): Permit
1943 punconfigured to be NULL.
1944 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
1945 (Archive::include_member): Pass NULL to get_elf_object_for_member
1946 if we searched for the archive and this is the first included
1949 2010-12-01 Ian Lance Taylor <iant@google.com>
1951 * dwarf_reader.h (class Sized_dwarf_line_info): Add
1952 track_relocs_type_ field.
1953 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1954 Set track_relocs_type_.
1955 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
1956 contents when using RELA relocs.
1957 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
1959 * reloc.cc (Track_relocs::next_addend): New function.
1960 * reloc.h (class Track_relocs): Declare next_addend.
1962 2010-12-01 Ian Lance Taylor <iant@google.com>
1964 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
1967 2010-12-01 Ian Lance Taylor <iant@google.com>
1969 * README: Update compilers known to work and fail.
1971 2010-11-23 Matthias Klose <doko@ubuntu.com>
1973 * configure.in: For --enable-gold, handle value `default' instead of
1974 `both*'. Always install ld as ld.bfd, install as ld if gold is
1976 * configure: Regenerate.
1978 2010-11-18 Doug Kwan <dougkwan@google.com>
1980 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
1981 and right_alignment to be zero. Store result alignment only if it is
1982 greater than existing alignment.
1984 2010-11-16 Cary Coutant <ccoutant@google.com>
1987 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1988 Check for ".zdebug_line".
1990 2010-11-16 Doug Kwan <dougkwan@google.com>
1991 Cary Coutant <ccoutant@google.com>
1993 * output.h (Output_segment::set_section_addresses): Pass increase_relro
1994 by reference; adjust all callers.
1995 * output.cc (Output_segment::set_section_addresses): Adjust references
1996 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
1998 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
1999 end at page boundary.
2001 2010-11-16 Cary Coutant <ccoutant@google.com>
2004 * layout.cc (Layout::choose_output_section): Transform names of
2005 compressed sections even when using a script with a SECTIONS clause.
2006 (Layout::output_section_name): Remove code to transform
2007 compressed debug section names.
2008 * output.cc (Output_section::add_input_section): Use uncompressed
2009 section size when tracking input sections.
2011 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
2013 * symtab.h (Symbol::NON_PIC_REF): Remove.
2014 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
2015 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
2016 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
2017 (Symbol::use_plt_offset): Take a flags argument and pass it
2018 directly to needs_dynamic_reloc. Restrict check for undefined
2019 weak symbols to function calls.
2020 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
2021 (Target_arm::Scan::global): Use it.
2022 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
2023 (Target_arm::Relocate::relocate): Likewise.
2024 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
2025 parameter with an r_type parameter. Use get_reference_flags
2027 (Target_arm::Relocate::relocate): Update accordingly.
2028 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
2029 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
2030 (Target_i386::Scan::global): Likewise.
2031 (Target_i386::Relocate::relocate): Likewise.
2032 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
2033 parameter with an r_type parameter. Use get_reference_flags
2035 (Target_i386::Relocate::relocate): Update accordingly.
2036 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
2037 (Target_powerpc::Scan::global): Use it.
2038 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
2039 (Target_powerpc::Relocate::relocate): Likewise.
2040 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
2041 (Target_sparc::Scan::global): Use it.
2042 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
2043 (Target_sparc::Relocate::relocate): Likewise.
2044 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
2045 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
2046 (Target_x86_64::Scan::global): Likewise.
2047 (Target_x86_64::Relocate::relocate): Likewise.
2049 2010-11-08 Doug Kwan <dougkwan@google.com>
2050 Cary Coutant <ccoutant@google.com>
2052 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
2053 (Arm_exidx_merge_section::section_contents_): New data member.
2054 (Arm_input_section::Arm_input_section): Initialize original_contents_.
2055 (Arm_input_section::~Arm_input_section): De-allocate memory.
2056 (Arm_input_section::original_contents_): New data member.
2057 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
2058 in parameters instead of calling Object::section_contents without
2060 (Arm_output_section::group_section): New parameter TASK. Pass it
2061 to callees that need locking objects.
2062 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
2063 to lock EXIDX input sections. Fix a formatting issue. Call
2064 Arm_exidx_merged_section::build_contents to create merged section
2066 (Arm_output_section::create_stub_group): New parameter TASK. Use it
2067 to lock object of stub table owner.
2068 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
2069 TEXT_SIZE to initialize data member TEXT_SIZE_.
2070 (Arm_exidx_input_section::addralign): Fix typo in comment.
2071 (Arm_exidx_input_section::text_size): New method.
2072 (Target_arm::do_relax): New parameter TASK. Pass it to callees
2073 that require locking objects. Lock objects before scanning for stubs
2074 and updating local symbols.
2075 (Arm_input_section<big_endian>::init): Copy contents of original
2077 (Arm_input_section<big_endian>::do_write): Use saved contents of
2078 original input section instead of calling Object::section_contents
2080 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
2081 size without calling Object::section_size().
2082 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
2083 for size. Allocate a buffer for merged EXIDX entries.
2084 (Arm_exidx_merged_section::build_contents): New method.
2085 (Arm_exidx_merged_section::do_write): Move merge section contents
2086 building code to Arm_exidx_merged_section::build_contetns. Write
2087 out contetns in buffer instead of building it on the fly.
2088 (Arm_relobj::make_exidx_input_section): Also pass text section size
2089 to Arm_exidx_input_section constructor.
2090 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
2091 (Arm_dynobj::do_read_symbols): Fix memory leak.
2092 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
2093 * target.h: (class Task): Add forward declaration.
2094 (Target::relax): Add new parameter TASK and pass it to
2096 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
2098 2010-11-05 Cary Coutant <ccoutant@google.com>
2101 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
2102 object when reading from the file.
2103 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
2105 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
2106 when reading section contents.
2107 (get_section_contents): Likewise.
2108 (icf::find_identical_sections): Likewise.
2109 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
2110 object when reading from the file.
2111 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
2112 the object when doing deferred section layout.
2114 2010-11-03 Nick Clifton <nickc@redhat.com>
2117 * script.h (class Symbol_assignment: name): New member. Returns
2118 the name of the symbol.
2119 * scrfipt.cc (Script_options::is_pending_assignment): New member.
2120 Returns true if the given symbol name is on the list of
2121 assignments wating to be processed.
2122 * archive.cc (should_incldue_member): If the symbol is undefined,
2123 check to see if it is on the list of symbols pending assignment.
2125 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
2127 * script-sections.cc (Script_sections::find_memory_region): Check
2128 for a NULL output section pointer.
2130 2010-10-29 Doug Kwan <dougkwan@google.com>
2132 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
2133 Output_section::add_relaxed_input_section.
2134 * output.cc (Output_section::add_relaxed_input_section): Add new
2135 arguments LAYOUT and NAME. Set section order index.
2136 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
2137 Copy section order index.
2138 * output.h (Output_section::add_relaxed_input_section): Add new
2139 arguments LAYOUT and NAME.
2141 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2143 * testsuite/Makefile.am: Move gcctestdir/ld rule to
2144 NATIVE_OR_CROSS_LINKER.
2145 * testsuite/Makefile.in: Regenerate.
2147 2010-10-20 Doug Kwan <dougkwan@google.com>
2149 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
2150 without SHF_LINK_ORDER flags.
2151 * layout.cc (Layout::choose_output_section): Do not filter
2152 SHF_LINK_ORDER flag in a relocatable link.
2154 2010-10-17 Cary Coutant <ccoutant@google.com>
2156 * output.h (Output_segment::set_section_addresses): Change function
2157 signature. Update all callers.
2158 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
2160 (Output_segment::set_section_addresses): Align after last TLS
2161 section. Add padding before last relro section instead of after.
2163 2010-10-17 Doug Kwan <dougkwan@google.com>
2165 * gold/arm.cc (Target_arm::got_section): Use correct order and set
2166 GOT output section to be writable.
2168 2010-10-14 Cary Coutant <ccoutant@google.com>
2170 * debug.h (DEBUG_INCREMENTAL): New flag.
2171 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
2172 * gold.cc (queue_initial_tasks): Check parameters for incremental link
2174 * incremental.cc (report_command_line): Ignore all forms of
2176 * layout.cc (Layout::Layout): Check parameters for incremental link
2178 * options.cc (General_options::parse_incremental): New function.
2179 (General_options::parse_no_incremental): New function.
2180 (General_options::parse_incremental_full): New function.
2181 (General_options::parse_incremental_update): New function.
2182 (General_options::incremental_mode_): New data member.
2183 (General_options::finalize): Check incremental_mode_.
2184 * options.h (General_options): Update help text for --incremental.
2185 Add --no-incremental, --incremental-full, --incremental-update.
2186 (General_options::Incremental_mode): New enum type.
2187 (General_options::incremental_mode): New function.
2188 (General_options::incremental_mode_): New data member.
2189 * parameters.cc (Parameters::incremental_mode_): New data member.
2190 (Parameters::set_options): Set incremental_mode_.
2191 (Parameters::set_incremental_full): New function.
2192 (Parameters::incremental): New function.
2193 (Parameters::incremental_update): New function.
2194 (set_parameters_incremental_full): New function.
2195 * parameters.h (Parameters::set_incremental_full): New function.
2196 (Parameters::incremental): New function.
2197 (Parameters::incremental_update): New function.
2198 (Parameters::incremental_mode_): New data member.
2199 (set_parameters_incremental_full): New function.
2200 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
2201 incremental link mode.
2202 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
2203 (Sized_relobj::do_relocate_sections): Likewise.
2204 * testsuite/Makefile.am (incremental_test): Use --incremental-full
2206 * testsuite/Makefile.in: Regenerate.
2207 * testsuite/incremental_test.sh: Filter all forms of --incremental.
2209 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2211 * script-sections.h (class Script_sections): Make
2212 Sections_elements typedef public.
2213 * script-sections.cc (class Sort_output_sections): Add elements_
2214 field. Add constructor which sets it; change all callers.
2215 (Sort_output_sections::is_before): New function.
2216 (Sort_output_sections::operator()): Call is_before.
2217 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
2219 * testsuite/script_test_10.sh: New test. Test script section
2221 * testsuite/script_test_10.t: Likewise.
2222 * testsuite/script_test_10.s: Likewise.
2223 * testsuite/Makefile.am: Wrap the cross linker tests and the
2224 common tests into NATIVE_OR_CROSS_LINKER.
2225 (check_SCRIPTS): Add script_test_10.sh.
2226 (check_DATA): Add script_test_10.stdout.
2227 (script_test_10.o, script_test_10): New targets.
2228 (script_test_10.stdout): New target.
2229 * configure, testsuite/Makefile.in: Regenerate.
2231 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2233 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
2234 error for the deprecated relocations.
2235 (Target_arm::Scan::global): Likewise.
2236 (Target_arm::Relocate::relocate): Likewise.
2238 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
2240 * fileread.cc (Input_file::find_file): Initialize *found_name
2241 and *namep when using the fallback search for case 4.
2243 2010-10-11 Cary Coutant <ccoutant@google.com>
2245 * options.h (class General_options): Redefine -z lazy as an alias for
2246 the negation of -z now.
2248 2010-10-11 Ian Lance Taylor <iant@google.com>
2250 * resolve.cc (symbol_to_bits): Report the value of the unsupported
2253 2010-10-06 Nick Clifton <nickc@redhat.com>
2255 * script-sections.cc(class Memory_region): Remove
2256 current_lma_offset_ field. Rename current_vma_offset_ to
2257 current_offset_. Add last_section_ field.
2258 (Memory_region::get_current_vma_address): Rename to
2259 get_current_address.
2260 (Memory_region::get_current_lma_address): Delete.
2261 (Memory_region::increment_vma_offset): Rename to
2263 (Memory_region::increment_lma_offset): Delete.
2264 (Memory_region::attributes_compatible): New method. Returns
2265 true if the provided section is compatible with the region.
2266 (Memory_region::get_last_section): New method. Returns the last
2267 section to use the region.
2268 (Memory_region::set_last_section): New method. Stores the last
2269 section to use the region.
2270 (Script_sections::block_in_region): New method. Returns true if
2271 a block of memory is contained within a region.
2272 (Script_sections::find_memory_region): New method. Locates a
2273 memory region to be used to set a VMA or LMA address.
2274 (Output_section_definition::set_section_addresses): Add code to
2275 check for addresses set by memory regions.
2276 (Output_segment::set_section_addresses): Remove memory region
2278 (Script_sections::create_segment): Add a warning if a header
2279 segment is created outside of any region.
2280 * script-sections.h (class Script_sections): Add prototypes for
2281 find_memory_region and block_in_region methods.
2282 * testsuite/memory_test.s: Use .long instead of .word.
2283 * testsuite/memory_test.t: Add some more output sections.
2284 * testsuite/memory_test.sh: Update expected output.
2286 2010-10-02 Doug Kwan <dougkwan@google.com>
2288 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
2289 defintion to symtab.h
2290 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
2291 declaration to defintion.
2293 2010-10-01 Nick Clifton <nickc@redhat.com>
2295 * expression.cc (eval): Replace dummy argument with NULL.
2296 (eval_maybe_dot): Check for a NULL result section pointer.
2297 (Symbol_expression::value): Likewise.
2298 (Dot_expression::value): Likewise.
2299 (BINARY_EXPRESSION): Likewise.
2300 (Max_expression::value): Likewise.
2301 (Min_expression::value): Likewise.
2302 (Absolute_expression::value): Likewise.
2303 (Addr_expression::value_from_output_section): Likewise.
2304 (Loaddddr_expression::value_from_output_section): Likewise.
2305 (Segment_start_expression::value): Likewise.
2306 * script-sections.cc
2307 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
2309 (Sections_elememt_dot_assignment::set_section_addresses):
2311 (Output_data_expression::do_write_to_buffer): Likewise.
2312 (Output_section_definition::finalize_symbols): Likewise.
2313 (Output_section_definition::set_section_addresses): Likewise.
2315 2010-09-30 Doug Kwan <dougkwan@google.com>
2317 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
2319 2010-09-28 Sriraman Tallam <tmsriram@google.com>
2321 * target.h (Target::can_icf_inline_merge_sections): New virtual
2323 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
2325 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
2327 * icf.cc (get_section_contents): Inline merge sections only when
2330 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2332 * configure: Regenerate.
2334 2010-09-17 Ian Lance Taylor <iant@google.com>
2336 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
2337 * testsuite/Makefile.am (memory_test.o): New target.
2338 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
2340 * testsuite/Makefile.in: Rebuild.
2342 2010-09-17 Doug Kwan <dougkwan@google.com>
2344 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
2345 defintion if relocation uses GOT entries of the symbol.
2346 * testsuite/icf_safe_test.sh: Fix test.
2347 * testsuite/icf_safe_so_test.sh: Fix test.
2349 2010-09-16 Cary Coutant <ccoutant@google.com>
2351 * script_sections.cc (class Memory_region): Remove "NULL" from
2352 vector initializations.
2354 2010-09-15 Cary Coutant <ccoutant@google.com>
2356 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
2357 Resolve forwarding symbols.
2359 2010-09-15 Doug Kwan <dougkwan@google.com>
2361 * gold/testsuite/script_test_3.t: Add ARM special sections.
2362 * gold/testsuite/script_test_4.t: Same.
2363 * gold/testsuite/script_test_5.t: Same.
2364 * gold/testsuite/script_test_6.t: Same.
2365 * gold/testsuite/script_test_7.t: Same.
2366 * gold/testsuite/script_test_7.t: Same.
2367 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
2369 2010-09-14 Cary Coutant <ccoutant@google.com>
2371 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
2372 (Target_x86_64::Relocate::relocate_tls): Replace check for
2373 saw_tls_block_reloc_ with test for executable section.
2375 2010-09-12 Cary Coutant <ccoutant@google.com>
2377 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
2378 position-independent executables to shared libraries need dynamic
2380 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
2381 position-independent executables.
2382 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
2383 * testsuite/Makefile.in: Regenerate.
2385 2010-09-10 Nick Clifton <nickc@redhat.com>
2388 * testsuite/memory_test.t: Discard any sections that are not
2391 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
2394 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
2395 "This::" to work around a bug in gcc 4.2.
2397 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
2399 2010-09-09 Rafael Espindola <espindola@google.com>
2401 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
2402 sections with different PF_X flags in the same segment.
2403 (Layout::find_first_load_seg): Search all segments to find the first
2405 * options.h (rosegment): New.
2407 2010-09-08 Rafael Espindola <espindola@google.com>
2409 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
2411 2010-09-08 Doug Kwan <dougkwan@google.com>
2413 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
2414 (Arm_relobj::do_relocate_sections): Add new parameter for output
2415 file to match the parent.
2416 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
2417 of local symbols instead of input values. Update code to track
2418 changes in gold::relocate_section.
2419 * object.cc (Sized_relobj::compute_final_local_value): New methods.
2420 (Sized_relobj::compute_final_local_value_internal): New methods.
2421 (Sized_relobj::do_finalize_local_symbols): Move code from loop
2422 body into private version of Sized_relobj::compute_final_local_value.
2423 Call the inline method.
2424 * object.h (Symbol_value::Symbol_value): Define destructor. Free
2425 merged symbol value if there is one.
2426 (Symbol_value::has_output_value): New method defintiion.
2427 (Sized_relobj::Compute_final_local_value_status): New enum type.
2428 (Sized_relobj::compute_final_local_value): New methods.
2429 (Sized_relobj::compute_final_local_value_internal): New methods.
2430 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
2431 and arm_cortex_a8.sh.
2432 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
2433 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
2435 * Makefile.in: Regenerate.
2436 * testsuite/arm_bl_out_of_range.s: Update test.
2437 * testsuite/thumb_bl_out_of_range.s: Ditto.
2438 * testsuite/thumb_blx_out_of_range.s: Ditto.
2439 * testsuite/arm_branch_out_of_range.sh: New file.
2440 * testsuite/arm_cortex_a8.sh: Ditto.
2441 * testsuite/arm_cortex_a8_b.s: Ditto.
2442 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
2443 * testsuite/arm_cortex_a8_b_local.s: Ditto.
2444 * testsuite/arm_cortex_a8_bl.s: Ditto.
2445 * testsuite/arm_cortex_a8_blx.s: Ditto.
2446 * testsuite/arm_cortex_a8_local.s: Ditto.
2447 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
2448 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
2450 2010-09-08 Rafael Espindola <espindola@google.com>
2452 * Makefile.am (memory_test.stdout): Run readelf with -W.
2453 * Makefile.in: Regenerate.
2454 * testsuite/memory_test.sh: Make the regexps accept both 32 and
2457 2010-09-08 Rafael Espindola <espindola@google.com>
2459 * script-sections.cc (Script_sections::add_memory_region): Convert
2460 field precision to int.
2461 * script.cc (script_set_section_region, script_set_section_region):
2462 Convert field precision to int.
2464 2010-09-08 Rafael Espindola <espindola@google.com>
2466 * arm.cc (do_finalize_sections): Create the __exidx_start and
2467 __exdix_end symbols even when the section is missing.
2469 2010-09-08 Nick Clifton <nickc@redhat.com>
2471 * README: Remove claim that MEMORY is not supported.
2472 * expression.cc (script_exp_function_origin)
2473 (script_exp_function_length): Move from here to ...
2474 * script.cc: ... here.
2475 (script_set_section_region, script_add_memory)
2476 (script_parse_memory_attr, script_include_directive): New
2478 * script-sections.cc
2479 (class Memory_region): New class.
2480 (class Output_section_definition): Add set_memory_region,
2481 set_section_vma, set_section_lma and get_section_name methods.
2482 (class Script_Sections): Add add_memory_region,
2483 find_memory_region, find_memory_region_origin,
2484 find_memory_region_length and set_memory_region methods.
2485 Have set_section_addresses method walk the list of set memory
2487 Extend the print methos to display memory regions.
2488 * script-sections.h: Add prototypes for new methods.
2489 Add enum for MEMORY region attributes.
2490 * yyscript.y: Add support for parsing MEMORY regions.
2491 * script-c.h: Add prototypes for new functions.
2492 * testsuite/Makefile.am: Add test of MEMORY region functionality.
2493 * testsuite/Makefile.in: Regenerate.
2494 * testsuite/memory_test.sh: New script.
2495 * testsuite/memory_test.s: New assembler source file.
2496 * testsuite/memory_test.t: New linker script.
2498 2010-08-27 Doug Kwan <dougkwan@google.com>
2500 * gold/resolve.cc (Symbol_table::should_override): Let a weak
2501 reference override an existing dynamic weak reference.
2502 * testsuite/Makefile.am: Add new test dyn_weak_ref.
2503 * testsuite/Makefile.in: Regenerate.
2504 * testsuite/dyn_weak_ref.sh: New file.
2505 * testsuite/dyn_weak_ref_1.c: Ditto.
2506 * testsuite/dyn_weak_ref_2.c: Ditto.
2508 2010-08-27 Ian Lance Taylor <iant@google.com>
2510 * incremental.h (class Incremental_input_entry): Add virtual
2513 2010-08-27 Ian Lance Taylor <iant@google.com>
2515 * testsuite/start_lib_test_3.c: Mark t3 as used.
2517 2010-08-27 Nick Clifton <nickc@redhat.com>
2519 * options.cc (version_script): Fix small typo in previous
2522 2010-08-25 Nick Clifton <nickc@redhat.com>
2524 * archive.cc: Formatting fixes: Remove whitespace between
2525 typename and following asterisk. Remove whitespace between
2526 function name and opening parenthesis.
2527 * archive.h: Likewise.
2529 * attributes.cc: Likewise.
2530 * attributes.h: Likewise.
2531 * common.cc: Likewise.
2532 * copy-relocs.cc: Likewise.
2533 * dirsearch.h: Likewise.
2534 * dynobj.cc: Likewise.
2535 * ehframe.cc: Likewise.
2536 * ehframe.h: Likewise.
2537 * expression.cc: Likewise.
2538 * fileread.cc: Likewise.
2539 * fileread.h: Likewise.
2541 * gold-threads.cc: Likewise.
2542 * gold.cc: Likewise.
2543 * i386.cc: Likewise.
2545 * incremental-dump.cc: Likewise.
2546 * incremental.cc: Likewise.
2547 * layout.cc: Likewise.
2548 * layout.h: Likewise.
2549 * main.cc: Likewise.
2550 * merge.cc: Likewise.
2551 * merge.h: Likewise.
2552 * object.cc: Likewise.
2553 * object.h: Likewise.
2554 * options.cc: Likewise.
2555 * options.h: Likewise.
2556 * output.cc: Likewise.
2557 * output.h: Likewise.
2558 * plugin.cc: Likewise.
2559 * plugin.h: Likewise.
2560 * powerpc.cc: Likewise.
2561 * reloc.cc: Likewise.
2562 * script-c.h: Likewise.
2563 * script-sections.cc: Likewise.
2564 * script.cc: Likewise.
2565 * stringpool.cc: Likewise.
2566 * symtab.cc: Likewise.
2567 * symtab.h: Likewise.
2568 * target.cc: Likewise.
2569 * timer.cc: Likewise.
2570 * timer.h: Likewise.
2571 * version.cc: Likewise.
2572 * x86_64.cc: Likewise.
2574 2010-08-24 Nick Clifton <nickc@redhat.com>
2577 * layout.cc (segment_precedes): Sort segments by their physical
2578 addresses, if they have been set.
2580 2010-08-23 Cary Coutant <ccoutant@google.com>
2582 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
2584 (Lib_group::include_member): Unlock object after deleting its
2586 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
2589 2010-08-19 Neil Vachharajani <nvachhar@google.com>
2590 Cary Coutant <ccoutant@google.com>
2592 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
2593 constructor, and set_blocker.
2594 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
2596 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
2597 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
2598 * testsuite/Makefile.am (start_lib_test): New test case.
2599 * testsuite/Makefile.in: Regenerate.
2600 * testsuite/start_lib_test_main.c: New file.
2601 * testsuite/start_lib_test_1.c: New file.
2602 * testsuite/start_lib_test_2.c: New file.
2603 * testsuite/start_lib_test_3.c: New file.
2605 2010-08-19 Ian Lance Taylor <iant@google.com>
2607 * Makefile.in: Rebuild with automake 1.11.1.
2608 * aclocal.m4: Likewise.
2609 * testsuite/Makefile.in: Likewise.
2611 2010-08-19 Ian Lance Taylor <iant@google.com>
2614 * i386.cc (class Output_data_plt_i386): Update declarations.
2615 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
2616 local_ifuncs_ fields.
2617 (Target_i386::do_plt_section_for_global): New function.
2618 (Target_i386::do_plt_section_for_local): New function.
2619 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
2620 parameter; change all callers. Initialize global_ifuncs_ and
2621 local_ifuncs_. If doing a static link define __rel_iplt_start and
2623 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
2624 (Output_data_plt_i386::add_local_ifunc_entry): New function.
2625 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
2627 (Target_i386::make_plt_section): New function, broken out of
2628 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
2629 (Target_i386::make_plt_entry): Call make_plt_section.
2630 (Target_i386::make_local_ifunc_plt_entry): New function.
2631 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
2632 (Target_i386::Scan::local): Handle IFUNC symbols. Add
2633 R_386_IRELATIVE to switch.
2634 (Target_i386::Scan::global): Likewise.
2635 (Target_i386::Relocate::relocate): Likewise.
2636 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
2638 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
2639 (Target_x86_64::do_plt_section_for_global): New function.
2640 (Target_x86_64::do_plt_section_for_local): New function.
2641 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
2642 parameter; change all callers. If doing a static link define
2643 __rela_iplt_start and __rela_iplt_end.
2644 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
2645 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
2646 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
2648 (Target_x86_64::make_local_ifunc_plt_entry): New function.
2649 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
2651 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
2652 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
2653 R_X86_64_IRELATIVE to switch.
2654 (Target_x86_64::Scan::global): Likewise.
2655 (Target_x86_64::Relocate::relocate): Likewise.
2656 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
2658 * target.h (class Target): Add plt_section_for_global and
2659 plt_section_for_local functions. Add do_plt_section_for_global
2660 and do_plt_section_for_local virtual functions.
2661 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
2662 clarifying comments.
2663 (Symbol::use_plt_offset): Handle IFUNC symbol.
2664 * object.cc (Sized_relobj::Sized_relobj): Initialize
2666 (Sized_relobj::local_has_plt_offset): New function.
2667 (Sized_relobj::local_plt_offset): New function.
2668 (Sized_relobj::set_local_plt_offset): New function.
2669 (Sized_relobj::do_count): Handle IFUNC symbol.
2670 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
2671 a bit away from input_shndx_ field. Add set_is_func_symbol and
2672 is_ifunc_symbol functions.
2673 (class Sized_relobj): Update declarations. Remove Tls_got_entry
2674 and Local_tls_got_offsets. Define Local_plt_offsets. Add
2675 local_plt_offsets_ field.
2676 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
2677 * output.h (class Output_section_data): Add non-const
2678 output_section function.
2679 (class Output_data_got): Update declarations.
2680 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
2681 Add use_plt_offset parameter to global and local constructors.
2682 Change all callers. Change local_sym_index_ field to 31 bits.
2683 Change GSYM_CODE and CONSTANT_CODE accordingly.
2684 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
2685 doing a static link don't set sh_link field.
2686 (Output_data_got::Got_entry::write): Use PLT offset if
2688 (Output_data_got::add_global_plt): New function.
2689 (Output_data_got::add_local_plt): New function.
2690 * target-reloc.h (relocate_section): Handle IFUNC symbol.
2691 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
2692 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
2693 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
2694 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
2696 * testsuite/ifunc-sel.h: New file.
2697 * testsuite/ifuncmain1.c: New file.
2698 * testsuite/ifuncmain1vis.c: New file.
2699 * testsuite/ifuncmod1.c: New file.
2700 * testsuite/ifuncdep2.c: New file.
2701 * testsuite/ifuncmain2.c: New file.
2702 * testsuite/ifuncmain3.c: New file.
2703 * testsuite/ifuncmod3.c: New file.
2704 * testsuite/ifuncmain4.c: New file.
2705 * testsuite/ifuncmain5.c: New file.
2706 * testsuite/ifuncmod5.c: New file.
2707 * testsuite/ifuncmain6pie.c: New file.
2708 * testsuite/ifuncmod6.c: New file.
2709 * testsuite/ifuncmain7.c: New file.
2710 * configure, testsuite/Makefile.in: Rebuild.
2712 2010-08-18 Ian Lance Taylor <iant@google.com>
2715 (Output_section_incremental_inputs::write_input_files): Add cast
2716 to avoid signed/unsigned comparison warning.
2717 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2719 2010-08-12 Cary Coutant <ccoutant@google.com>
2721 * common.cc (Sort_commons::operator()): Remove unnecessary code.
2723 2010-08-13 Ian Lance Taylor <iant@google.com>
2725 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
2727 2010-08-12 Cary Coutant <ccoutant@google.com>
2728 Doug Kwan <dougkwan@google.com>
2730 * resolve.cc (Symbol_table::should_override): When a weak dynamic
2731 defintion overrides non-weak undef, remember that the original undef
2733 * symtab.cc (Symbol_table::sized_write_global): For undef without
2734 an original weak binding, set binding to global in output.
2735 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
2736 * testsuite/Makefile.in: Regenerate.
2737 * testsuite/strong_ref_weak_def.sh: New file.
2738 * testsuite/strong_ref_weak_def_1.c: Ditto.
2739 * testsuite/strong_ref_weak_def_2.c: Ditto.
2741 2010-08-12 Cary Coutant <ccoutant@google.com>
2743 * testsuite/incremental_test.sh: Rewrite.
2744 * testsuite/incremental_test_1.c: Rewrite.
2745 * testsuite/incremental_test_2.c: Rewrite.
2747 2010-08-12 Cary Coutant <ccoutant@google.com>
2749 * arm.cc (Target_arm::got_size): Add const.
2750 (Target_arm::got_entry_count): New function.
2751 (Target_arm::plt_entry_count): New function.
2752 (Target_arm::first_plt_entry_offset): New function.
2753 (Target_arm::plt_entry_size): New function.
2754 (Output_data_plt_arm::entry_count): New function.
2755 (Output_data_plt_arm::first_plt_entry_offset): New function.
2756 (Output_data_plt_arm::get_plt_entry_size): New function.
2757 * i386.cc (Target_i386::got_size): Add const.
2758 (Target_i386::got_entry_count): New function.
2759 (Target_i386::plt_entry_count): New function.
2760 (Target_i386::first_plt_entry_offset): New function.
2761 (Target_i386::plt_entry_size): New function.
2762 (Output_data_plt_i386::entry_count): New function.
2763 (Output_data_plt_i386::first_plt_entry_offset): New function.
2764 (Output_data_plt_i386::get_plt_entry_size): New function.
2765 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
2766 find_incremental_inputs_sections. Dump incremental_got_plt section.
2767 * incremental.cc: Include target.h.
2768 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
2769 parameter. Adjust all callers. Find incremental_got_plt section.
2770 (Incremental_inputs::create_data_sections): Create incremental_got_plt
2772 (Output_section_incremental_inputs::set_final_data_size): Calculate
2773 size of incremental_got_plt section.
2774 (Output_section_incremental_inputs::do_write): Write the
2775 incremental_got_plt section.
2776 (Got_plt_view_info): New struct.
2777 (Local_got_offset_visitor): New class.
2778 (Global_got_offset_visitor): New class.
2779 (Global_symbol_visitor_got_plt): New class.
2780 (Output_section_incremental_inputs::write_got_plt): New function.
2781 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
2782 Add parameter. Adjust all callers.
2783 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2784 (Incremental_inputs::got_plt_section): New function.
2785 (Incremental_inputs::got_plt_section_): New data member.
2786 (Incremental_got_plt_reader): New class.
2787 * layout.cc (Layout::create_incremental_info_sections): Add the
2788 incremental_got_plt section.
2789 * object.h (Got_offset_list::get_list): New function.
2790 (Got offset_list::for_all_got_offsets): New function.
2791 (Sized_relobj::local_got_offset_list): New function.
2792 * powerpc.cc (Target_powerpc::got_size): Add const.
2793 (Target_powerpc::got_entry_count): New function.
2794 (Target_powerpc::plt_entry_count): New function.
2795 (Target_powerpc::first_plt_entry_offset): New function.
2796 (Target_powerpc::plt_entry_size): New function.
2797 (Output_data_plt_powerpc::entry_count): New function.
2798 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
2799 (Output_data_plt_powerpc::get_plt_entry_size): New function.
2800 * sparc.cc (Target_sparc::got_size): Add const.
2801 (Target_sparc::got_entry_count): New function.
2802 (Target_sparc::plt_entry_count): New function.
2803 (Target_sparc::first_plt_entry_offset): New function.
2804 (Target_sparc::plt_entry_size): New function.
2805 (Output_data_plt_sparc::entry_count): New function.
2806 (Output_data_plt_sparc::first_plt_entry_offset): New function.
2807 (Output_data_plt_sparc::get_plt_entry_size): New function.
2808 * symtab.h (Symbol::got_offset_list): New function.
2809 (Symbol_table::for_all_symbols): New function.
2810 * target.h (Sized_target::got_entry_count): New function.
2811 (Sized_target::plt_entry_count): New function.
2812 (Sized_target::plt_entry_size): New function.
2813 * x86_64.cc (Target_x86_64::got_size): Add const.
2814 (Target_x86_64::got_entry_count): New function.
2815 (Target_x86_64::plt_entry_count): New function.
2816 (Target_x86_64::first_plt_entry_offset): New function.
2817 (Target_x86_64::plt_entry_size): New function.
2818 (Output_data_plt_x86_64::entry_count): New function.
2819 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
2820 (Output_data_plt_x86_64::get_plt_entry_size): New function.
2822 2010-08-12 Cary Coutant <ccoutant@google.com>
2824 * archive.cc: Include incremental.h.
2825 (Archive::Archive): Initialize incremental_info_.
2826 (Archive::include_member): Record archive members in incremental info.
2827 (Add_archive_symbols::run): Record begin and end of an archive in
2829 (Lib_group::include_member): Record objects in incremental info.
2830 * archive.h (Incremental_archive_entry): Forward declaration.
2831 (Archive::set_incremental_info): New member function.
2832 (Archive::incremental_info): New member function.
2833 (Archive::Unused_symbol_iterator): New class.
2834 (Archive::unused_symbols_begin): New member function.
2835 (Archive::unused_symbols_end): New member function.
2836 (Archive::incremental_info_): New data member.
2837 * incremental-dump.cc (find_input_containing_global): New function.
2838 (dump_incremental_inputs): Dump new incremental info sections.
2839 * incremental.cc: Include symtab.h.
2840 (Output_section_incremental_inputs): New class.
2841 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
2842 new incremental info sections.
2843 (Sized_incremental_binary::do_check_inputs): Likewise.
2844 (Incremental_inputs::report_archive): Remove.
2845 (Incremental_inputs::report_archive_begin): New function.
2846 (Incremental_inputs::report_archive_end): New function.
2847 (Incremental_inputs::report_object): New function.
2848 (Incremental_inputs::finalize_inputs): Remove.
2849 (Incremental_inputs::report_input_section): New function.
2850 (Incremental_inputs::report_script): Rewrite.
2851 (Incremental_inputs::finalize): Do nothing but finalize string table.
2852 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2853 (Incremental_inputs::sized_create_inputs_section_data): Remove.
2854 (Incremental_inputs::create_data_sections): New function.
2855 (Incremental_inputs::relocs_entsize): New function.
2856 (Output_section_incremental_inputs::set_final_data_size): New function.
2857 (Output_section_incremental_inputs::do_write): New function.
2858 (Output_section_incremental_inputs::write_header): New function.
2859 (Output_section_incremental_inputs::write_input_files): New function.
2860 (Output_section_incremental_inputs::write_info_blocks): New function.
2861 (Output_section_incremental_inputs::write_symtab): New function.
2862 * incremental.h (Incremental_script_entry): Forward declaration.
2863 (Incremental_object_entry): Forward declaration.
2864 (Incremental_archive_entry): Forward declaration.
2865 (Incremental_inputs): Forward declaration.
2866 (Incremental_inputs_header_data): Remove.
2867 (Incremental_inputs_header): Remove.
2868 (Incremental_inputs_header_write): Remove.
2869 (Incremental_inputs_entry_data): Remove.
2870 (Incremental_inputs_entry): Remove.
2871 (Incremental_inputs_entry_write): Remove.
2872 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
2873 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
2874 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2875 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
2877 (Incremental_input_entry): New class.
2878 (Incremental_script_entry): New class.
2879 (Incremental_object_entry): New class.
2880 (Incremental_archive_entry): New class.
2881 (Incremental_inputs::Incremental_inputs): Initialize new data members.
2882 (Incremental_inputs::report_inputs): Remove.
2883 (Incremental_inputs::report_archive): Remove.
2884 (Incremental_inputs::report_archive_begin): New function.
2885 (Incremental_inputs::report_archive_end): New function.
2886 (Incremental_inputs::report_object): Change prototype.
2887 (Incremental_inputs::report_input_section): New function.
2888 (Incremental_inputs::report_script): Change prototype.
2889 (Incremental_inputs::get_reloc_count): New function.
2890 (Incremental_inputs::set_reloc_count): New function.
2891 (Incremental_inputs::create_data_sections): New function.
2892 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2893 (Incremental_inputs::inputs_section): New function.
2894 (Incremental_inputs::symtab_section): New function.
2895 (Incremental_inputs::relocs_section): New function.
2896 (Incremental_inputs::get_stringpool): Add const.
2897 (Incremental_inputs::command_line): Add const.
2898 (Incremental_inputs::inputs): Remove.
2899 (Incremental_inputs::command_line_key): New function.
2900 (Incremental_inputs::input_file_count): New function.
2901 (Incremental_inputs::input_files): New function.
2902 (Incremental_inputs::relocs_entsize): New function.
2903 (Incremental_inputs::sized_create_inputs_section_data): Remove.
2904 (Incremental_inputs::finalize_inputs): Remove.
2905 (Incremental_inputs::Input_info): Remove.
2906 (Incremental_inputs::lock_): Remove.
2907 (Incremental_inputs::inputs_): Change type.
2908 (Incremental_inputs::inputs_map_): Remove.
2909 (Incremental_inputs::current_object_entry_): New data member.
2910 (Incremental_inputs::inputs_section_): New data member.
2911 (Incremental_inputs::symtab_section_): New data member.
2912 (Incremental_inputs::relocs_section_): New data member.
2913 (Incremental_inputs::reloc_count_): New data member.
2914 (Incremental_inputs_reader): New class.
2915 (Incremental_symtab_reader): New class.
2916 (Incremental_relocs_reader): New class.
2917 * layout.cc (Layout::finalize): Move finalization of incremental info
2918 and creation of incremental info sections to follow finalization of
2919 symbol table. Set offsets for postprocessing sections.
2920 (Layout::create_incremental_info_sections): Call
2921 Incremental_inputs::create_data_sections. Add incremental symtab
2922 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
2923 sections to layout after input sections.
2924 * layout.h (struct Timespec): Forward declaration.
2925 (Layout::incremental_inputs): Add const.
2926 (Layout::create_incremental_info_sections): Add parameter.
2927 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
2928 * object.cc: Include incremental.h.
2929 (Relobj::finalize_incremental_relocs): New function.
2930 (Sized_relobj::do_layout): Record input sections in incremental info.
2931 * object.h (Object::output_section): New function.
2932 (Object::output_section_offset): Moved from Relobj.
2933 (Object::get_incremental_reloc_base): New function.
2934 (Object::get_incremental_reloc_count): New function.
2935 (Object::do_output_section): New function.
2936 (Object::do_output_section_offset): Moved from Relobj.
2937 (Object::do_get_incremental_reloc_base): New function.
2938 (Object::do_get_incremental_reloc_count): New function.
2939 (Object::Object): Initialize new data members.
2940 (Relobj::output_section): Renamed do_output_section and moved to
2942 (Relobj::output_section_offset): Moved to Object.
2943 (Relobj::do_get_incremental_reloc_base): New function.
2944 (Relobj::do_get_incremental_reloc_count): New function.
2945 (Relobj::allocate_incremental_reloc_counts): New function.
2946 (Relobj::count_incremental_reloc): New function.
2947 (Relobj::finalize_incremental_relocs): New function.
2948 (Relobj::next_incremental_reloc_index): New function.
2949 (Relobj::reloc_counts_): New data member.
2950 (Relobj::reloc_bases_): New data member.
2951 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
2952 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
2953 (Sized_relobj::incremental_relocs_scan): New function.
2954 (Sized_relobj::incremental_relocs_scan_reltype): New function.
2955 (Sized_relobj::incremental_relocs_write): New function.
2956 (Sized_relobj::incremental_relocs_write_reltype): New function.
2957 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
2959 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
2960 archives and object files elsewhere.
2961 (Add_symbols::run): Report object files here.
2962 (Finish_group::run): Report end of archive at end of group.
2963 * reloc.cc: Include layout.h, incremental.h.
2964 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
2965 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
2966 (Sized_relobj::incremental_relocs_scan): New function.
2967 (Sized_relobj::incremental_relocs_scan_reltype): New function.
2968 (Sized_relobj::do_relocate_sections): Write incremental relocations.
2969 (Sized_relobj::incremental_relocs_write): New function.
2970 (Sized_relobj::incremental_relocs_write_reltype): New function.
2971 * script.cc (read_input_script): Rewrite test for incremental link.
2972 Change call to Incremental_inputs::report_script.
2973 * symtab.h (Symbol_table::first_global_index): New function.
2974 (Symbol_table::output_count): New function.
2976 2010-08-12 Doug Kwan <dougkwan@google.com>
2978 * arm.cc (Target_arm::merge_object_attributes): Check command line
2979 options --no-wchar-size-warning and --no-enum-size-warning.
2980 * options.h (General_options): Add ld-compatible options
2981 --no-enum-size-warning and --no-wchar-size-warning.
2983 2010-08-04 Ian Lance Taylor <iant@google.com>
2985 * x86_64.cc (Target_x86_64::Scan::local): Use
2986 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
2987 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
2988 (Target_x86_64::Scan::global): Likewise.
2989 (Target_x86_64::Relocate::relocate): Likewise.
2990 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
2993 2010-08-03 Cary Coutant <ccoutant@google.com>
2995 * merge.cc (Output_merge_string::do_add_input_section): Count strings
2996 to reserve space in merged_strings vector. Keep total input size
2998 (Output_merge_string::do_print_merge_stats): Print total input size.
2999 * merge.h (Output_merge_string): Add input_size_ field.
3000 * stringpool.cc (Stringpool_template::string_length): Move
3001 implementations out of Stringpool_template class and place in
3003 * stringpool.h (string_length): Move out of Stringpool_template.
3005 2010-08-03 Ian Lance Taylor <iant@google.com>
3008 * layout.cc (relaxation_loop_body): If address of load segment is
3009 set, adjust address to include headers if possible.
3011 2010-08-03 Ian Lance Taylor <iant@google.com>
3013 * version.cc (version_string): Bump to 1.10.
3015 2010-08-03 Ian Lance Taylor <iant@google.com>
3018 * layout.h (enum Output_section_order): Define.
3019 (class Layout): Update declarations.
3020 * layout.cc (Layout::get_output_section): Add order parameter.
3021 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
3022 is_first_non_relro parameters. Change all callers.
3023 (Layout::choose_output_section): Likewise.
3024 (Layout::add_output_section_data): Likewise.
3025 (Layout::make_output_section): Likewise. Set order.
3026 (Layout::default_section_order): New function.
3027 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
3028 * output.cc (Output_section::Output_section): Initialize order_.
3029 Don't initialize deleted fields.
3030 (Output_segment::Output_segment): Don't initialize deleted
3032 (Output_segment::add_output_section_to_load): New function
3033 replacing add_output_section. Change all callers to call this or
3034 add_output_section_to_nonload.
3035 (Output_segment::add_output_section_to_nonload): New function.
3036 (Output_segment::remove_output_section): Rewrite.
3037 (Output_segment::add_initial_output_data): Likewise.
3038 (Output_segment::has_any_data_sections): Likewise.
3039 (Output_segment::is_first_section_relro): Likewise.
3040 (Output_segment::maximum_alignment): Likewise.
3041 (Output_segment::has_dynamic_reloc): New function replacing
3042 dynamic_reloc_count. Change all callers.
3043 (Output_segment::has_dynamic_reloc_list): New function replacing
3044 dynamic_reloc_count_list. Change all callers.
3045 (Output_segment::set_section_addresses): Rewrite.
3046 (Output_segment::set_offset): Rewrite.
3047 (Output_segment::find_first_and_last_list): Remove.
3048 (Output_segment::set_tls_offsets): Rewrite.
3049 (Output_segment::first_section_load_address): Likewise.
3050 (Output_segment::output_section_count): Likewise.
3051 (Output_segment::section_with_lowest_load_address): Likewise.
3052 (Output_segment::write_section_headers): Likewise.
3053 (Output_segment::print_sections_to_map): Likewise.
3054 * output.h (class Output_data): Remove dynamic_reloc_count_
3055 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
3056 (Output_data::add_dynamic_reloc): Rewrite.
3057 (Output_data::has_dynamic_reloc): New function.
3058 (Output_data::dynamic_reloc_count): Remove.
3059 (class Output_section): Add order_ field. Remvoe is_relro_local_,
3060 is_last_relro_, is_first_non_relro_, is_interp_,
3061 is_dynamic_linker_section_ fields. Add order and set_order
3062 functions. Remove is_relro_local, set_is_relro_local,
3063 is_last_relro, set_is_last_relro, is_first_non_relro,
3064 set_is_first_non_relro functions, is_interp, set_is_interp,
3065 is_dynamic_linker_section, and set_is_dynamic_linker_section
3067 (class Output_segment): Change Output_data_list from std::list to
3068 std:;vector. Add output_lists_ field. Remove output_data_ and
3069 output_bss_ fields. Update declarations.
3071 2010-08-02 Ian Lance Taylor <iant@google.com>
3073 * arm.cc (Target_arm::gc_process_relocs): Use typename.
3074 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
3075 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
3077 2010-08-02 Ian Lance Taylor <iant@google.com>
3080 * script.cc (Script_options::Script_options): Initialize
3081 symbol_definitions_ and symbol_references_.
3082 (Script_options::add_symbol_assignment): Update
3083 symbol_definitions_ and symbol_references_.
3084 (Script_options::add_symbol_reference): New function.
3085 (script_symbol): New function.
3086 * script.h (class Script_options): Add symbol_definitions_ and
3087 symbol_references_ fields.
3088 (Script_options::referenced_const_iterator): New type.
3089 (Script_options::referenced_begin): New function.
3090 (Script_options::referenced_end): New function.
3091 (Script_options::is_referenced): New function.
3092 (Script_options::any_unreferenced): New function.
3093 * script-c.h (script_symbol): Declare.
3094 * yyscript.y (exp): Call script_symbol.
3095 * symtab.cc: Include "script.h".
3096 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
3097 Change all callers. Check symbols referenced by scripts.
3098 (Symbol_table::add_undefined_symbols_from_command_line): Add
3099 layout parameter. Change all callers.
3100 (Symbol_table::do_add_undefined_symbols_from_command_line):
3101 Likewise. Break out loop body. Check symbols referenced by
3103 (Symbol_table::add_undefined_symbol_from_command_line): New
3104 function broken out of
3105 do_add_undefined_symbols_from_command_line.
3106 * symtab.h (class Symbol_table): Update declarations.
3107 * archive.cc: Include "layout.h".
3108 (Archive::should_include_member): Add layout parameter. Change
3109 all callers. Check for symbol mentioned in expression.
3110 * archive.h (class Archive): Update declaration.
3111 * object.cc (Sized_relobj::do_should_include_member): Add layout
3113 * object.h (Object::should_include_member): Add layout parameter.
3115 (Object::do_should_include_member): Add layout parameter.
3116 (class Sized_relobj): Update declaration.
3117 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
3119 * dynobj.h (class Sized_dynobj): Update declaration.
3120 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
3122 * plugin.h (class Sized_pluginobj): Update declaration.
3124 2010-08-02 Ian Lance Taylor <iant@google.com>
3127 * output.cc (Output_segment::set_offset): Search for the first and
3128 last sections rather than assuming that the list is in order.
3129 (Output_segment::find_first_and_last_list): New function.
3130 * output.h (class Output_segment): Update declarations.
3131 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
3132 (relro_strip_test_SOURCES): New variable.
3133 (relro_strip_test_DEPENDENCIES): New variable.
3134 (relro_strip_test_LDFLAGS): New variable.
3135 (relro_strip_test_LDADD): New variable.
3136 (relro_strip_test.so): New target.
3138 2010-08-02 Ian Lance Taylor <iant@google.com>
3140 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
3141 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
3142 (Target_i386::got_tlsdesc_section): New function.
3143 (Target_i386::got_section): Create space for GOT entries for
3144 TLSDESC relocations.
3145 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
3147 (Target_i386::Scan::global): Likewise.
3148 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
3150 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
3151 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
3152 (Target_x86_64::got_tlsdesc_section): New function.
3153 (Target_x86_64::got_section): Create space for GOT entries for
3154 TLSDESC relocations.
3155 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
3157 (Target_x86_64::Scan::global): Likewise.
3158 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
3161 2010-08-02 Ian Lance Taylor <iant@google.com>
3163 * testsuite/final_layout.sh: Use dc to convert from hex to
3166 2010-07-29 Sriraman Tallam <tmsriram@google.com>
3168 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
3169 paramter to the call to gold::gc_process_relocs.
3170 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
3171 paramter to the call to gold::gc_process_relocs.
3172 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
3173 parameter to the call to gold::gc_process_relocs.
3174 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
3175 template parameter to the call to gold::gc_process_relocs.
3176 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
3177 paramter to the call to gold::gc_process_relocs.
3178 * gc.h (get_embedded_addend_size): New function.
3179 (gc_process_relocs): Save the size of the reloc for use by ICF.
3180 * icf.cc (get_section_contents): Get the addend from the text section
3181 for SHT_REL relocation sections.
3182 * icf.h (Icf::Reloc_addend_size_info): New typedef.
3183 (Icf::Reloc_info): Add new member reloc_addend_size_info.
3184 * int_encoding.h (read_from_pointer): New overloaded function.
3185 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
3186 * testsuite/icf_sht_rel_addend_test.sh: New file.
3187 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
3188 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
3190 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3192 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
3193 * Makefile.in: Regenerate.
3194 * testsuite/Makefile.in: Regenerate.
3196 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
3198 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
3199 * gold/testsuite/debug_msg.cc: Likewise.
3200 * gold/testsuite/odr_violation1.cc
3201 * gold/testsuite/odr_violation2.cc
3203 2010-07-21 Cary Coutant <ccoutant@google.com>
3205 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
3206 string, and length fields.
3207 (Output_merge_string::Merged_strings_list): New type.
3208 (Output_merge_string::Merged_strings_lists): New typedef.
3209 (Output_merge_string): Replace merged_strings_ with
3210 merged_strings_lists_.
3211 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
3212 Merged_strings_list per input object and section. Don't store pointer
3213 to the string. Don't store length with each merged string entry.
3214 (Output_merge_string::finalize_merged_data): Loop over list of merged
3215 strings lists. Recompute length of each merged string.
3217 2010-07-15 Cary Coutant <ccoutant@google.com>
3219 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
3222 2010-07-14 Ian Lance Taylor <iant@google.com>
3224 * descriptors.cc (Descriptors::open): Report correct name in error
3227 2010-07-13 Doug Kwan <dougkwan@google.com>
3229 * arm.cc (Arm_input_section::Arm_input_section): For a
3230 SHT_ARM_EXIDX section, always keeps the input sections.
3231 (Arm_input_section::set_exidx_section_link): New method.
3232 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
3233 has_errors_ to false.
3234 (Arm_exidx_input_section::has_errors,
3235 Arm_exidx_input_section::set_has_errors): New methods.
3236 (Arm_exidx_input_section::has_errors_): New data member.
3237 (Arm_relobj::get_exidx_shndx_list): New method.
3238 (Arm_output_section::append_text_sections_to_list): Do not skip
3239 section without SHF_EXECINSTR.
3240 (Arm_output_section::fix_exidx_coverage): Skip input sections with
3242 (Arm_relobj::make_exidx_input_section): Add new parameter for text
3243 section header. Make error messages more verbose. Check for
3244 a non-executable section linked to an EXIDX section.
3245 (Arm_relobj::do_read_symbols): Remove error checking, which has been
3246 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
3247 check that there is no deferred EXIDX section if we exit early.
3248 Instead of not making an EXIDX section in case of an error, make one
3249 and set the has_errors flag of it.
3250 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
3251 in a relocatable link.
3252 (Target_arm::do_relax): Look for the EXIDX output section instead of
3253 assuming that it is called .ARM.exidx.
3254 (Target_arm::fix_exidx_coverage): Add a new parameter for input
3255 section list. Do not check for SHF_EXECINSTR section flags but
3256 skip any input section with errors.
3257 * output.cc (Output_section::Output_section): Initialize
3258 always_keeps_input_sections_ to false.
3259 (Output_section::add_input_section): Check for
3260 always_keeps_input_sections_.
3261 * output.h (Output_section::always_keeps_input_sections,
3262 Output_section::set_always_keeps_input_sections): New methods.
3263 (Output_section::always_keeps_input_sections): New data member.
3265 2010-07-13 Rafael Espindola <espindola@google.com>
3267 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
3268 * fileread.h (Input_file): Add try_extra_search_path and find_file.
3270 2010-07-13 Philip Herron <herron.philip@googlemail.com>
3271 Ian Lance Taylor <iant@google.com>
3273 * output.h (Output_section_lookup_maps::add_merge_section):
3274 Correct check of whether value was inserted.
3275 (Output_section_lookup_maps::add_merge_input_section): Likewise.
3276 (Output_section_lookup_maps::add_relaxed_input_section):
3278 * arm.cc (Target_arm::got_section): Remove used local os.
3279 * i386.cc (Target_i386::got_section): Likewise.
3280 * x86_64.cc (Target_x86_64::got_section): Likewise.
3281 * sparc.cc (Target_sparc::got_section): Likewise.
3282 (Target_sparc::relocate): Remove unused local have_got_offset.
3283 * powerpc.cc (Target_powerpc::relocate): Likewise.
3285 2010-07-13 Ian Lance Taylor <iant@google.com>
3287 * compressed_output.cc (zlib_decompress): Fix signature in
3290 * archive.cc (Archive::include_member): Unlock an external member
3291 of a thin archive. Don't bother to delete an object we know is
3294 2010-07-12 Cary Coutant <ccoutant@google.com>
3296 * compressed_output.cc (zlib_decompress): New function.
3297 (get_uncompressed_size): New function.
3298 (decompress_input_section): New function.
3299 * compressed_output.h (get_uncompressed_size): New function.
3300 (decompress_input_section): New function.
3301 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
3302 Handle compressed debug sections.
3303 * layout.cc (is_compressed_debug_section): New function.
3304 (Layout::output_section_name): Map compressed section names to
3306 * layout.h (is_compressed_debug_section): New function.
3307 (is_debug_info_section): Recognize compressed debug sections.
3308 * merge.cc: Include compressed_output.h.
3309 (Output_merge_data::do_add_input_section): Handle compressed
3311 (Output_merge_string::do_add_input_section): Handle compressed
3313 * object.cc: Include compressed_output.h.
3314 (Sized_relobj::Sized_relobj): Initialize new data members.
3315 (build_compressed_section_map): New function.
3316 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
3317 * object.h (Object::section_is_compressed): New method.
3318 (Object::do_section_is_compressed): New method.
3319 (Sized_relobj::Compressed_section_map): New type.
3320 (Sized_relobj::do_section_is_compressed): New method.
3321 (Sized_relobj::compressed_sections_): New data member.
3322 * output.cc (Output_section::add_input_section): Handle compressed
3324 * reloc.cc: Include compressed_output.h.
3325 (Sized_relobj::write_sections): Handle compressed debug sections.
3327 2010-07-08 Cary Coutant <ccoutant@google.com>
3329 * resolve.cc (Symbol_table::resolve): Remember whether undef was
3330 weak when resolving to a dynamic def.
3331 (Symbol_table::should_override): Add adjust_dyndef flag; set it
3332 for weak undef/dynamic def cases. Adjust callers.
3333 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
3334 undef_binding_weak_.
3335 (Symbol_table::sized_write_globals): Adjust symbol binding.
3336 (Symbol_table::sized_write_symbol): Add binding parameter.
3337 * symtab.h (Symbol::set_undef_binding): New method.
3338 (Symbol::is_undef_binding_weak): New method.
3339 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
3340 (Symbol_table::should_override): Add new parameter.
3341 (Symbol_table::sized_write_symbol): Add new parameter.
3343 * testsuite/weak_undef_file1.cc: Add new test case.
3344 * testsuite/weak_undef_file2.cc: Fix header comment.
3345 * testsuite/weak_undef_test.cc: Add new test case.
3347 2010-06-29 Doug Kwan <dougkwan@google.com>
3349 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
3350 Initialize USE_SYMBOL_.
3351 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
3353 (Arm_reloc_property::uses_symbol_): New data member declaration.
3354 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
3355 uses symbol value and symbol is undefined but not weakly undefined.
3357 2010-06-28 Rafael Espindola <espindola@google.com>
3359 * plugin.cc (Plugin::load): Use dlerror.
3361 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
3363 * symtab.cc (detect_odr_violations): When reporting an ODR
3364 violation, report an object where the symbol is defined.
3366 2010-06-25 Doug Kwan <dougkwan@google.com>
3368 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
3369 (Target_arm::section_may_have_icf_unsafe_pointers): New method
3371 (Target_arm::Scan::local_reloc_may_be_function_pointer,
3372 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
3373 target hook to detect function points.
3374 (Target_arm::Scan::possible_function_pointer_reloc): New method.
3375 * icf.h (Icf::check_section_for_function_pointers): Change type of
3376 parameter SECTION_NAME to const reference to std::string. Use
3377 target hook to determine if section may have unsafe pointers.
3378 * target.h (Target::section_may_have_icf_unsafe_pointers): New
3381 2010-06-21 Rafael Espindola <espindola@google.com>
3383 * fileread.cc (Input_file::find_fie): New
3384 (Input_file::open): Use Input_file::find_fie.
3385 * fileread.h (Input_file::find_fie): New
3386 * plugin.cc (set_extra_library_path): New.
3387 (Plugin::load): Add set_extra_library_path to the transfer vector.
3388 (Plugin_manager::set_extra_library_path): New.
3389 (Plugin_manager::add_input_file): Use the extra search path if set.
3390 (set_extra_library_path(): New.
3391 * plugin.h (Plugin_manager): Add set_extra_library_path and
3394 2010-06-19 Cary Coutant <ccoutant@google.com>
3396 * layout.cc (gdb_sections): Add .debug_types.
3397 (lines_only_debug_sections): Likewise.
3399 2010-06-18 Rafael Espindola <espindola@google.com>
3401 * plugin.cc (add_input_file,add_input_library)
3402 (Plugin_manager::add_input_file): Make filename arguments const.
3403 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
3406 2010-06-16 Doug Kwan <dougkwan@google.com>
3408 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
3409 .ARM.attributes section if we have not merged any input
3410 attributes sections.
3412 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3414 * arm.cc: Allow combining objects with no EABI version
3417 2010-06-15 Rafael Espindola <espindola@google.com>
3419 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
3421 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3423 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
3424 (struct iovec): Correct !HAVE_READV definition.
3426 2010-06-10 Cary Coutant <ccoutant@google.com>
3428 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
3429 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
3431 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
3434 * symtab.h (Symbol::is_placeholder): New member function.
3435 * target-reloc.h (relocate_section): Check for placeholder symbols.
3437 * testsuite/Makefile.am (plugin_test_8): New test.
3438 (plugin_test_9): New test.
3439 * testsuite/Makefile.in: Regenerate.
3441 2010-06-09 Nick Clifton <nickc@redhat.com>
3443 * yyscript.y (input_list_element): Allow strings prefixed with
3444 the '-' character. Treat these as libraries.
3445 * script.cc (script_add_library): New function. Adds a library
3446 specified by "-l<name>" found in an input script.
3447 * script-c.h: Add prototype for script_add_library.
3449 2010-06-07 Doug Kwan <dougkwan@google.com>
3451 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
3452 Restrict stub-group size to be within long conditional branch
3453 range when working around cortex-A8 erratum.
3455 2010-06-07 Damien Diederen <dd@crosstwine.com>
3457 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
3460 2010-06-03 Sriraman Tallam <tmsriram@google.com>
3464 (Output_section::Input_section_sort_entry::compare_section_ordering):
3465 Change to return non-zero correctly.
3466 (Output_section::Input_section_sort_section_order_index_compare
3467 ::operator()): Change to fix ambiguity in comparisons.
3469 2010-06-01 Sriraman Tallam <tmsriram@google.com>
3471 * gold.h (is_wildcard_string): New function.
3472 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
3473 (Layout::layout_eh_frame): Ditto.
3474 (Layout::find_section_order_index): New method.
3475 (Layout::read_layout_from_file): New method.
3476 * layout.h (Layout::find_section_order_index): New method.
3477 (Layout::read_layout_from_file): New method.
3478 (Layout::input_section_position_): New private member.
3479 (Layout::input_section_glob_): New private member.
3480 * main.cc (main): Call read_layout_from_file here.
3481 * options.h (--section-ordering-file): New option.
3482 * output.cc (Output_section::input_section_order_specified_): New
3484 (Output_section::Output_section): Initialize new member.
3485 (Output_section::add_input_section): Add new parameter.
3486 Keep input sections when --section-ordering-file is used.
3487 (Output_section::set_final_data_size): Sort input sections when
3488 section ordering file is specified.
3489 (Output_section::Input_section_sort_entry): Add new parameter.
3491 (Output_section::Input_section_sort_entry::compare_section_ordering):
3493 (Output_section::Input_section_sort_compare::operator()): Change to
3494 consider section_order_index.
3495 (Output_section::Input_section_sort_init_fini_compare::operator()):
3496 Change to consider section_order_index.
3497 (Output_section::Input_section_sort_section_order_index_compare
3498 ::operator()): New method.
3499 (Output_section::sort_attached_input_sections): Change to sort
3500 according to section order when specified.
3501 (Output_section::add_input_section<32, true>): Add new parameter.
3502 (Output_section::add_input_section<64, true>): Add new parameter.
3503 (Output_section::add_input_section<32, false>): Add new parameter.
3504 (Output_section::add_input_section<64, false>): Add new parameter.
3505 * output.h (Output_section::add_input_section): Add new parameter.
3506 (Output_section::input_section_order_specified): New
3508 (Output_section::set_input_section_order_specified): New method.
3509 (Input_section::Input_section): Initialize section_order_index_.
3510 (Input_section::section_order_index): New method.
3511 (Input_section::set_section_order_index): New method.
3512 (Input_section::section_order_index_): New member.
3513 (Input_section::Input_section_sort_section_order_index_compare): New
3515 (Output_section::input_section_order_specified_): New member.
3516 * script-sections.cc (is_wildcard_string): Delete and move modified
3518 (Output_section_element_input::Output_section_element_input): Modify
3519 call to is_wildcard_string.
3520 (Output_section_element_input::Input_section_pattern
3521 ::Input_section_pattern): Ditto.
3522 (Output_section_element_input::Output_section_element_input): Ditto.
3523 * testsuite/Makefile.am (final_layout): New test case.
3524 * testsuite/Makefile.in: Regenerate.
3525 * testsuite/final_layout.cc: New file.
3526 * testsuite/final_layout.sh: New file.
3528 2010-06-01 Rafael Espindola <espindola@google.com>
3530 * plugin.cc (Plugin::load): Pass the output name to the plugin.
3532 2010-06-01 Rafael Espindola <espindola@google.com>
3534 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
3535 visibility of symbols.
3537 2010-05-27 Doug Kwan <dougkwan@google.com>
3539 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
3540 from start of output section instead of address for a local symbol
3541 in a merged or relaxed section when doing a relocatable link.
3543 2010-05-26 Rafael Espindola <espindola@google.com>
3546 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
3547 adding sections the garbage collector removed.
3548 * gold/testsuite/Makefile.am: Add test.
3549 * gold/testsuite/Makefile.in: Regenerate.
3550 * gold/testsuite/plugin_test_7.sh: New.
3551 * gold/testsuite/plugin_test_7_1.c: New.
3552 * gold/testsuite/plugin_test_7_2.c: New.
3554 2010-05-26 Rafael Espindola <espindola@google.com>
3556 * script-sections.cc (Output_section_definition::set_section_addresses):
3557 Check for --section-start.
3559 2010-05-26 Doug Kwan <dougkwan@google.com>
3561 * arm.cc (Arm_scan_relocatable_relocs): New class.
3562 (Target_arm::relocate_special_relocatable): New method.
3563 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
3564 (Arm_relocate_functions::thumb_branch_common): Same.
3565 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
3566 instead of Default_scan_relocatable_relocs.
3567 * target-reloc.h (relocate_for_relocatable): Let target handle
3568 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
3569 * target.h (Sized_target::relocate_special_relocatable): New method.
3571 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3573 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
3575 2010-05-23 Doug Kwan <dougkwan@google.com>
3577 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
3579 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
3580 with a direct branch, not a conditional branch, to a stub.
3581 * merge.cc (Output_merge_base::record_input_section): New method
3583 (Output_merge_data::do_add_input_section): Record input section if
3584 keeps-input-sections flag is set.
3585 (Output_merge_string::do_add_input_section): Ditto.
3586 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
3587 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
3589 (Output_merge_base::keeps_input_sections,
3590 Output_merge_base::set_keeps_input_sections,
3591 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
3593 (Output_merge_base::Input_sections): New type declaration.
3594 (Output_merge_base::input_sections_begin,
3595 Output_merge_base::input_sections_end,
3596 Output_merge_base::do_set_keeps_input_sections): New method definitions.
3597 (Output_merge_base::bool keeps_input_sections_,
3598 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
3599 Output_merge_base::input_sections_): New data members.
3600 (Output_merge_data::do_set_keeps_input_sections): New method
3602 (Output_merge_string::do_set_keeps_input_sections): Ditto.
3603 * output.cc (Output_section::Input_section::relobj): Move method
3604 defintion from class declaration to here and handle merge sections.
3605 (Output_section::Input_section::shndx): Ditto.
3606 (Output_section::Output_section): Remove initializations of removed
3607 data members and initialize new data member LOOKUP_MAPS_.
3608 (Output_section::add_input_section): Set keeps-input-sections flag
3609 for a newly created merge output section as appropriate. Adjust code
3610 to use Output_section_lookup_maps class.
3611 (Output_section::add_relaxed_input_section): Adjst code for lookup
3612 maps code refactoring.
3613 (Output_section::add_merge_input_section): Add a new parameter
3614 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
3615 class. If adding input section to a newly created merge output
3616 section fails, remove the new merge section.
3617 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
3618 Adjust code for use of the Output_section_lookup_maps class.
3619 (Output_section::find_merge_section): Ditto.
3620 (Output_section::build_lookup_maps): New method defintion.
3621 (Output_section::find_relaxed_input_section): Adjust code to use
3622 Output_section_lookup_maps class.
3623 (Output_section::get_input_sections): Export merge sections. Adjust
3624 code to use Output_section_lookup_maps class.
3625 (Output_section:::add_script_input_section): Adjust code to use
3626 Output_section_lookup_maps class. Update lookup maps for merge
3628 (Output_section::discard_states): Use Output_section_lookup_maps.
3629 (Output_section::restore_states): Same.
3630 * output.h (Merge_section_properties): Move class defintion out of
3632 (Output_section_lookup_maps): New class.
3633 (Output_section::Input_section::is_merge_section): New method
3635 (Output_section::Input_section::relobj): Move defintion out of class
3636 defintion. Declare method only.
3637 (Output_section::Input_section::shndx): Ditto.
3638 (Output_section::Input_section::output_merge_base): New method defintion.
3639 (Output_section::Input_section::u2_.pomb): New union field.
3640 (Output_section::Merge_section_by_properties_map,
3641 Output_section::Output_section_data_by_input_section_map,
3642 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
3644 (Output_section::add_merge_input_section): Add new parameter
3645 KEEPS_INPUT_SECTIONS.
3646 (Output_section::build_lookup_maps): New method declaration.
3647 (Output_section::merge_section_map_,
3648 Output_section::merge_section_by_properties_map_,
3649 Output_section::relaxed_input_section_map_,
3650 Output_section::is_relaxed_input_section_map_valid_): Remove data
3652 (Output_section::lookup_maps_): New data member.
3654 2010-05-21 Doug Kwan <dougkwan@google.com>
3657 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
3658 avoid a compilation error.
3660 2010-05-19 Rafael Espindola <espindola@google.com>
3662 * script-sections.cc (Output_section_definition::allocate_to_segment):
3663 Update the phdrs_list even when the output section is NULL.
3664 * testsuite/Makefile.am: Add test.
3665 * testsuite/Makefile.in: Regenerate.
3666 * testsuite/script_test_9.cc: New.
3667 * testsuite/script_test_9.sh: New.
3668 * testsuite/script_test_9.t: New.
3670 2010-05-19 Doug Kwan <dougkwan@google.com>
3672 * arm.cc (Arm_input_section::original_size): New method.
3673 (Arm_input_section::do_addralign): Add a cast.
3674 (Arm_input_section::do_output_offset): Remove static cast.
3675 (Arm_input_section::original_addralign,
3676 Arm_input_section::original_size_): Change type to uint32_t.
3677 (Arm_input_section::init): Add safe casts for section alignment
3679 (Arm_input_section::set_final_data_size): Do not set address and
3680 offset of stub table.
3681 (Arm_output_section::fix_exidx_coverage): Change use of of
3682 Output_section::Simple_input_section to that of
3683 Output_section::Input_section.
3684 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
3685 except for the first pass.
3686 * output.cc (Output_section::get_input_sections): Change type of
3687 input_sections to std::list<Input_section>.
3688 (Output_section::add_script_input_section): Rename from
3689 Output_section::add_simple_input_section. Change type of SIS
3690 parameter from Simple_input_section to Input_section.
3691 * output.h (Output_section::Simple_input_section): Remove class.
3692 (Output_section::Input_section): Change class visibility to public.
3693 (Output_section::Input_section::addralign): Use stored alignments
3694 for special input sections if set.
3695 (Output_section::Input_section::set_addralign): New method.
3696 (Output_section::get_input_sections): Change parameter type from
3697 list of Simple_input_section to list of Input_section.
3698 (Output_section::add_script_input_section): Rename from
3699 Output_section::add_simple_input_section. Change first parameter's
3700 type from Simple_input_section to Input_section and remove the
3701 second and third parameters.
3702 * script-sections.cc (Input_section::Input_section_list): Change
3703 type to list of Output_section::Input_section/
3704 (Input_section_info::Input_section_info): Change parameter type of
3705 INPUT_SECTION to Output_section::Input_section.
3706 (Input_section_info::input_section): Change return type.
3707 (Input_section_info::input_section_): Change type to
3708 Output_section::Input_section.
3709 (Output_section_element_input::set_section_addresses): Adjust code
3710 to use Output_section::Input_section instead of
3711 Output_section::Simple_input_section. Adjust code for renaming
3712 of Output_section::add_simple_input_section.
3713 (Orphan_output_section::set_section_addresses): Ditto.
3715 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3717 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
3718 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
3720 2010-05-18 Rafael Espindola <espindola@google.com>
3722 * options.cc (General_options::finalize): Handle -nostdlib.
3723 * options.h (nostdlib): New option.
3724 * script.cc (script_add_search_dir): Handle -nostdlib.
3726 2010-05-12 Doug Kwan <dougkwan@google.com>
3728 * arm.cc (Target_arm::do_finalize_sections): Create an empty
3729 attributes section only if there no attributes section after merging.
3730 (Target_arm::merge_object_attributes): Move value of
3731 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
3732 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
3733 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
3734 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
3735 and arm_attr_merge_7.stdout.
3736 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
3737 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
3738 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
3739 arm_attr_merge_7b.o): New rules.
3740 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
3742 * testsuite/Makefile.in: Regenerate.
3743 * testsuite/arm_attr_merge.sh: New file.
3744 * testsuite/arm_attr_merge_[67][ab].s: Same.
3746 2010-05-05 Nick Clifton <nickc@redhat.com>
3748 * po/es.po: Updated Spanish translation.
3750 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
3752 * Makefile.am (install-exec-local): Properly install gold as
3753 default cross linker.
3754 * Makefile.in: Regenerated.
3756 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
3757 Nick Clifton <nickc@redhat.com>
3759 * configure.ac (install_as_default): Define and set to false
3760 unless --enable-gold or --enable-gold=both/gold has been
3762 * configure: Regenerate.
3764 * Makefile.am (install-exec-local): Install the executable as
3765 'ld.gold'. If install_as_default is true then also install it as
3767 * Makefile.in: Regenerated.
3769 2010-04-24 Ian Lance Taylor <iant@google.com>
3771 * layout.cc (Layout::layout_reloc): In relocatable link don't
3772 combine reloc sections for grouped sections.
3774 2010-04-23 Sriraman Tallam <tmsriram@google.com>
3776 * gc.h (gc_process_relocs): Pass information on relocs pointing to
3777 sections that are not ordinary to icf.
3778 * icf.cc (get_section_contents): Handle relocation pointing to section
3779 with no object or shndx information.
3780 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
3781 * testsuite/Makefile.in: Regenerate.
3782 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
3783 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
3785 2010-04-22 Ian Lance Taylor <iant@google.com>
3787 * expression.cc (Expression::Expression_eval_info): Add
3788 result_alignment_pointer field.
3789 (Expression::eval_with_dot): Add result_alignment_pointer
3790 parameter. Change all callers.
3791 (Expression::eval_maybe_dot): Likewise.
3792 (class Binary_expression): Add alignment_pointer parameter to
3793 left_value and right_value. Change all callers.
3794 (BINARY_EXPRESSION): Set result alignment.
3795 (class Trinary_expression): Add alignment_pointer parameter to
3796 arg2_value and arg3_value. Change all callers.
3797 (Trinary_cond::value): Set result alignment.
3798 (Max_expression::value, Min_expression::value): Likewise.
3799 (Align_expression::value): Likewise.
3800 * script-sections.cc (class Sections_element): Add dot_alignment
3801 parameter to set_section_addresses virtual function. Update
3803 (class Output_section_element): Likewise.
3804 (Script_sections::create_segments): Add dot_alignment parameter.
3806 (Script_sections::create_segments_from_phdrs_clause): Likewise.
3807 (Script_sections::set_phdrs_clause_addresses): Likewise.
3808 * script-sections.h: Update declarations.
3809 * script.h: Update declarations.
3810 * output.h (Output_segment::set_minimum_p_align): Don't decrease
3812 * testsuite/script_test_3.t: Set large alignment.
3813 * testsuite/script_test_3.sh: Make sure that at least one LOAD
3814 segment has expected alignment.
3816 2010-04-22 Nick Clifton <nickc@redhat.com>
3818 * po/gold.pot: Updated by the Translation project.
3819 * po/vi.po: Updated Vietnamese translation.
3821 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
3823 * testsuite/Makefile.am (check_PROGRAMS): Add
3824 icf_virtual_function_folding_test.
3825 * testsuite/Makefile.in: Regenerated.
3827 2010-04-15 Andrew Haley <aph@redhat.com>
3829 * options.h (merge_exidx_entries): New option.
3830 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
3831 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
3832 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
3833 (Target_arm::merge_exidx_entries): New function.
3834 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
3835 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
3836 to Arm_exidx_fixup constructor.
3837 Add new arg, merge_exidx_entries.
3838 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
3839 Arm_output_section::fix_exidx_coverage.
3841 2010-04-18 Sriraman Tallam <tmsriram@google.com>
3843 * icf.cc (get_section_contents): Check for preemptible functions.
3844 Ignore addend when appropriate.
3845 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
3847 (add_from_relobj): Check for section folded.
3848 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
3849 * symtab.h (should_add_dynsym_entry): Add new parameter.
3850 * target-reloc.h (scan_relocs): Check for section folded.
3851 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
3852 Check reloc types for function pointers in shared objects.
3853 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
3855 (icf_preemptible_functions_test): New test case.
3856 (icf_string_merge_test): New test case.
3857 * testsuite.Makefile.in: Regenerate.
3858 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
3859 bar_glob. Refactor code.
3860 * testsuite/icf_preemptible_functions_test.cc: New file.
3861 * testsuite/icf_preemptible_functions_test.sh: New file.
3862 * testsuite/icf_string_merge_test.cc: New file.
3863 * testsuite/icf_string_merge_test.sh: New file.
3864 * testsuite/icf_virtual_function_folding_test.cc: New file.
3865 * testsuite/icf_virtual_function_folding_test.sh: New file.
3867 2010-04-14 Doug Kwan <dougkwan@google.com>
3869 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
3870 for local symbol recounting if we remove a section due to ICF.
3871 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
3872 there are no regular objects in input.
3874 2010-04-13 Doug Kwan <dougkwan@google.com>
3876 * arm.cc (Arm_input_section::set_final_data_size): Compute
3877 accurate final data size instead of using current data size.
3879 2010-04-09 Doug Kwan <dougkwan@google.com>
3881 * layout.cc (Layout::choose_output_section): Handle script section
3883 (Layout::make_output_section_for_script): Add section type parameter.
3884 Handle script section types.
3885 * layout.h (Layout::make_output_section_for_script): Add section
3887 * output.cc (Output_section::Output_section): Initialize data member
3889 (Output_section::do_reset_address_and_file_offset): Do not set address
3890 to 0 if section is a NOLOAD section.
3891 * output.h (Output_section::is_noload): New method.
3892 (Output_section::set_is_noload): Ditto.
3893 (Output_section::is_noload_): New data member.
3894 * script-c.h (Script_section_type): New enum type.
3895 (struct Parser_output_section_header): Add new file section_type.
3896 * script-sections.cc (Sections_element::output_section_name): Add
3897 parameter for returning script section type.
3898 (Output_section_definition::output_section_name): Ditto.
3899 (Output_section_definition::section_type)P; New method.
3900 (Output_section_definiton::script_section_type_name): Ditto.
3901 (Output_section_definition::script_section_type_): New data member.
3902 (Output_section_definition::Output_section_definition): Initialize
3903 data member Output_section_definition::script_section_type_.
3904 (Output_section_definition::create_sections): Pass script section type
3905 to Layout::make_output_section_for_script.
3906 (Output_section_definition::output_section_name): Return script
3907 section type to caller.
3908 (Output_section_definition::set_section_address): Do not advance
3909 dot value and load address if section type is NOLOAD. Set address
3910 of NOLOAD sections regardless of section flags.
3911 (Output_section_definition::print): Print section type if it is
3912 not SCRIPT_SECTION_TYPE_NONE.
3913 (Output_section_definition::section_type): New method.
3914 (Output_section_definition::script_section_type_name): Ditto.
3915 (Script_sections::output_section_name): Add new parameter
3916 PSECTION_TYPE for returning script section type. Pass it to
3917 section elements. Handle discard sections.
3918 (Sort_output_sections::operator()): Handle NOLOAD sections.
3919 * script-sections.h (Script_sections::Section_type): New enum type.
3920 (Script_sections::output_section_name): Add a new parameter for
3921 returning script section type.
3922 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
3924 * yyscript.y (union): Add new field SECTION_TYPE.
3925 (COPY, DSECT, INFO, NOLOAD): New tokens.
3926 (opt_address_and_section_type): Change type to output_section_header.
3927 (section_type): New non-terminal
3928 (section_header): Handle section type.
3929 (opt_address_and_section_type): Return section type value.
3931 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
3933 * testsuite/plugin_common_test_1.c (foo): Add prototype.
3934 * testsuite/plugin_common_test_2.c (foo): Likewise.
3936 2010-04-08 Doug Kwan <dougkwan@google.com>
3938 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
3940 * output.cc (Output_section::add_merge_input_section): Simplify
3941 code and return status of Output_merge_base::add_input_section.
3942 Update merge section map only if Output_merge_base::add_input_section
3945 2010-04-07 Doug Kwan <dougkwan@google.com>
3947 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
3948 if section is marked as containing instructions but has no mapping
3950 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
3951 correct section index.
3952 (Arm_relobj::find_linked_text_section): Ditto.
3954 2010-04-07 Cary Coutant <ccoutant@google.com>
3956 * archive.cc (include_member): Destroy Read_symbols_data object before
3958 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
3959 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
3960 (Read_symbols_data::~Read_symbols_data) New destructor.
3961 (Section_relocs::Section_relocs) New constructor.
3962 (Section_relocs::~Section_relocs) New destructor.
3963 (Read_relocs_data::Read_relocs_data) New constructor.
3964 (Read_relocs_data::~Read_relocs_data) New destructor.
3965 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
3966 pointers to NULL after deleting.
3968 2010-04-07 Doug Kwan <dougkwan@google.com>
3970 * arm.cc: Replace "endianity" with "endianness" in comments.
3971 (Arm_exidx_cantunwind): Ditto.
3972 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
3973 (Arm_relobj::merge_flags_and_attributes): New method.
3974 (Arm_relobj::merge_flags_and_attributes_): New data member.
3975 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
3976 (Arm_relobj::scan_sections_for_stubs): Ditto.
3977 (Arm_relobj::do_read_symbols): Check to see if we really want to
3978 merge processor-specific flags and attributes. Exit early if
3979 an object is empty except for section names and the undefined symbol.
3980 (Target_arm::do_finalize_sections): Move check for ELF format to
3981 Arm_relobj::do_read_symbols. Merge processor specific flags and
3982 attributes from a regular object only when we have determined that
3983 it is aapropriate. Do not create an .ARM.attributes section in
3984 output if there is no regular input object.
3985 (Target_arm::merge_processor_specific_flags): Check
3986 --warn-mismatch before printing any error.
3987 (Target_arm::merge_object_attributes): Ditto.
3988 * gold.cc (queue_middle_tasks): Handle the case in which there is
3989 no regular object in input.
3990 * options.cc (General_options::parse_EB): New method.
3991 (General_options::parse_EL): Same.
3992 (General_options::General_options): Initialize endianness_.
3993 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
3995 (General_options::Endianness): New enum.
3996 (General_options::endianness): New method.
3997 (General_options::endianness_): New data member.
3998 * parameters.cc (Parameters::set_options): Check target endianness.
3999 (Parameters::set_target_once): Ditto.
4000 (Parameters::check_target_endianness): New method.
4001 (parameters_force_valid_target): If either -EL or -EB is specified,
4002 use it to define endianness of default target.
4003 * parameters.h (Parameters::check_target_endianness): New method
4005 * target.h (class Target): Change "endianity" to "endianness"
4008 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4010 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
4011 * configure: Regenerate.
4012 * Makefile.in: Regenerate.
4013 * testsuite/Makefile.in: Regenerate.
4015 2010-04-06 Cary Coutant <ccoutant@google.com>
4018 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
4019 prevailing definitions of common symbols.
4020 * testsuite/plugin_test_6.sh: New test case.
4021 * testsuite/plugin_common_test_1.c: New test case.
4022 * testsuite/plugin_common_test_2.c: New test case.
4023 * testsuite/Makefile.am (plugin_test_6): New test case.
4024 * testsuite/Makefile.in: Regenerate.
4026 2010-04-06 Nick Clifton <nickc@redhat.com>
4028 * po/vi.po: New Vietnamese translation.
4030 2010-03-30 Doug Kwan <dougkwan@google.com>
4032 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
4034 2010-03-25 Doug Kwan <dougkwan@google.com>
4036 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
4037 to avoid a conversion warning on a 32-bit host.
4039 2010-03-24 Ian Lance Taylor <iant@google.com>
4041 * testsuite/script_test_3.t: Add a TLS segment.
4042 * testsuite/Makefile.am (check_PROGRAMS): Add
4043 tls_phdrs_script_test.
4044 (tls_phdrs_script_test_SOURCES): Define.
4045 (tls_phdrs_script_test_DEPENDENCIES): Define.
4046 (tls_phdrs_script_test_LDFLAGS): Define.
4047 (tls_phdrs_script_test_LDADD): Define.
4048 * testsuite/Makefile.in: Rebuild.
4050 2010-03-23 Cary Coutant <ccoutant@google.com>
4052 * fileread.cc (find_or_make_view): Fix comment.
4054 2010-03-23 Ian Lance Taylor <iant@google.com>
4056 * script-sections.cc (class Orphan_section_placement): Define
4057 PLACE_TLS and PLACE_TLS_BSS.
4058 (Orphan_section_placement::Orphan_section_placement): Initialize
4060 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
4061 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
4062 (tls_script_test_SOURCES): Define.
4063 (tls_script_test_DEPENDENCIES): Define.
4064 (tls_script_test_LDFLAGS): Define.
4065 (tls_script_test_LDADD): Define.
4066 * testsuite/Makefile.in: Rebuild.
4068 2010-03-22 Doug Kwan <dougkwan@google.com>
4070 * arm.cc (Arm_relocate_functions::abs8,
4071 Arm_relocate_functions::abs16): Use correct check for overflow
4072 specified in the ARM ELF specs.
4073 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
4074 target of a BLX instruction specially.
4075 (Reloc_stub::stub_type_for_reloc): Ditto.
4076 (Relocate::relocate): Use symbolic names instead of numeric relocation
4077 codes to report error.
4078 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
4080 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
4081 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
4082 thumb2_blx_out_of_range.stdout
4083 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
4084 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
4085 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
4086 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
4087 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
4088 thumb2_blx_in_range, thumb2_blx_in_range.o,
4089 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
4090 thumb2_blx_out_of_range.o): New rules.
4091 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
4092 thumb2_blx_in_range and thumb2_blx_out_of_range.
4093 * testsuite/Makefile.in: Regenerate.
4094 * arm_branch_in_range.sh: Add tests for THUMB BLX.
4095 * testsuite/thumb_blx_in_range.s: New file.
4096 * testsuite/thumb_blx_out_of_range.s: New file.
4098 2010-03-22 Rafael Espindola <espindola@google.com>
4100 * archive.cc (Should_include): Move to archive.h.
4101 (should_include_member): Make it a member of Archive.
4103 (Add_lib_group_symbols): New.
4104 * archive.h: Include options.h.
4105 (Archive_member): Moved from Archive.
4106 (Should_include): Moved from archive.cc.
4108 (Add_lib_group_symbols): New.
4109 * dynobj.cc (do_should_include_member): New.
4110 * dynobj.h (do_should_include_member): New.
4111 * gold.cc (queue_initial_tasks): Update call to queue.
4112 * main.cc (main): Print lib group stats.
4113 * object.cc (do_should_include_member): New.
4114 * object.h: Include archive.h.
4115 (Object::should_include_member): New.
4116 (Object::do_should_include_member): New.
4117 (Sized_relobj::do_should_include_member): New.
4118 * options.cc (General_options::parse_start_lib): New.
4119 (General_options::parse_end_lib): New.
4120 (Input_arguments::add_file): Handle lib groups.
4121 (Input_arguments::start_group): Check we are not in a lib.
4122 (Input_arguments::start_lib): New.
4123 (Input_arguments::end_lib): New.
4124 * options.h (General_options): Add start_lib and end_lib.
4125 (Input_argument::lib_): New.
4126 (Input_argument::lib): New.
4127 (Input_argument::is_lib): New.
4128 (Input_file_lib): New.
4129 (Input_arguments::in_lib_): New.
4130 (Input_arguments::in_lib): New.
4131 (Input_arguments::start_lib): New.
4132 (Input_arguments::end_lib_): New.
4133 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
4134 in unused members as preempted.
4135 (Sized_pluginobj::do_should_include_member): New.
4136 * plugin.h (Sized_pluginobj::do_should_include_member): New.
4137 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
4139 (Read_symbols::do_whole_lib_group): New.
4140 (Read_symbols::do_lib_group): New.
4141 (Read_symbols::do_read_symbols): Handle lib groups.
4142 (Read_symbols::get_name): Handle lib groups.
4143 * readsyms.h (Read_symbols): Add an archive member pointer.
4144 (Read_symbols::do_whole_lib_group): New.
4145 (Read_symbols::do_lib_group): New.
4146 (Read_symbols::member_): New.
4147 * script.cc (read_input_script): Update call to queue_soon.
4149 2010-03-19 Doug Kwan <dougkwan@google.com>
4151 * arm.cc (Stub_table::Stub_table): Initialize new data members
4152 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
4153 (Stub_table::add_reloc_stub): Assign stub offset and update
4154 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
4155 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
4157 (Stub_table::update_data_size_and_addralign): Use
4158 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
4159 instead of going over all reloc stubs.
4160 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
4161 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
4162 Stringpool_template::offset_ to size of Stringpool_char.
4163 (Stringpool_template::new_key_offset): Remove code to initialize
4164 Stringpool_template::offset_.
4165 * stringpool.h (Stringpool_template::set_no_zero_null): Set
4166 Stringpool_template::offset_ to zero.
4168 2010-03-15 Doug Kwan <dougkwan@google.com>
4170 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
4172 (Stringpool_template::new_key_offset): New method.
4173 (Stringpool_template::add_string): Assign offsets when adding new
4175 (Stringpool_template::set_string_offsets): Do not set string offsets
4176 when not optimizing.
4177 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
4179 (Chunked_vector::clear): Clear size_.
4180 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
4181 (Chunked_vector::size): Return size_.
4182 (Chunked_vector::push_back): Use size_ to find insert position.
4183 (Chunked_vector::size_): New data member.
4184 (Stringpool_template::set_no_zero_null): Assert string set is empty.
4185 (Stringpool_template::new_key_offset): New method declaration.
4186 (Stringpool_template::offset_): New data member.
4188 2010-03-15 Rafael Espindola <espindola@google.com>
4190 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
4191 Add_symbols' constructor.
4192 * readsyms.h (Add_symbols): Remove the input_group member.
4194 2010-03-10 Ian Lance Taylor <iant@google.com>
4196 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
4197 target to ask whether a reference to a symbol requires a stack
4199 * target.h (Target::is_call_to_non_split): New function.
4200 (Target::do_is_call_to_non_split): Declare virtual function.
4201 * target.cc: Include "symtab.h".
4202 (Target::do_is_call_to_non_split): New function.
4203 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
4205 2010-03-10 Cary Coutant <ccoutant@google.com>
4207 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
4208 (File_read::open[1]): Remove initial mapping of whole_file_view_.
4209 (File_read::open[2]): Add whole_file_view_ to list of views.
4210 (File_read::make_view): Remove test of whole_file_view_.
4211 (File_read::find_or_make_view): Create whole_file_view_ if
4213 (File_read::clear_views): Replace bool parameter with enum;
4214 adjust all callers. Don't delete views with permanent data;
4215 do delete cached views and views from archives if
4216 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
4217 if clearing the corresponding view.
4218 * fileread.h (File_read::Clear_views_mode): New enum.
4219 (File_read::View::is_permanent_view): New method.
4220 (File_read::clear_views): Replace bool parameter
4221 with enum; adjust all callers.
4222 * options.h (General_options): Change keep_files_mapped option;
4223 add map_whole_files.
4224 * readsyms.cc (Add_symbols::run): Delete sd_ object before
4226 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
4229 2010-03-10 David S. Miller <davem@davemloft.net>
4231 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
4233 2010-03-09 Sriraman Tallam <tmsriram@google.com>
4235 * icf.cc (get_section_contents): Add '@' marker after processing the
4238 2010-03-08 Doug Kwan <dougkwan@google.com>
4240 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
4241 due to a conversion warning.
4242 (Arm_relobj::update_output_local_symbol_count): Check for local
4243 symbol with unset output index.
4245 2010-03-05 Ian Lance Taylor <iant@google.com>
4247 * options.h (class General_options): Add --spare-dynamic-tags.
4248 * output.cc (Output_data_dynamic::set_final_data_size): Implement
4249 --spare-dynamic-tags.
4251 2010-03-05 Ian Lance Taylor <iant@google.com>
4253 * incremental.cc: Include "libiberty.h".
4255 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
4257 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
4258 function, is_info_ member.
4259 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
4260 (Versions::Versions): Update caller.
4261 (Versions::define_base_version): Likewise.
4262 (Versions::add_def): Likewise.
4264 2010-03-03 Sriraman Tallam <tmsriram@google.com>
4266 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
4267 (Scan::possible_function_pointer_reloc): New function.
4268 (Scan::local_reloc_may_be_function_pointer): Change to call
4269 possible_function_pointer_reloc.
4270 (Scan::global_reloc_may_be_function_pointer): Ditto.
4271 * icf.h (Icf::check_section_for_function_pointers): Change to reject
4272 relocations in ".data.rel.ro._ZTV" section.
4273 * testsuite/icf_safe_so_test.sh: Change to pass i386.
4274 * testsuite/icf_safe_so_test.cc: Ditto.
4275 * testsuite/icf_safe_test.cc: Ditto.
4276 * testsuite/icf_safe_test.sh: Ditto.
4278 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4279 Ian Lance Taylor <iant@google.com>
4281 * target-reloc.h (relocate_section): Check the symbol table index
4282 for -1U before setting the local symbol index.
4283 (scan_relocatable_relocs): If copying the relocation, record that
4284 the local symbol is required.
4285 * object.h (Symbol_value::is_output_symtab_index_set): New
4287 (Symbol_value::may_be_discarded_from_output_symtab): New
4289 (Symbol_value::has_output_symtab_entry): New function.
4290 (Symbol_value::needs_output_symtab_entry): Remove.
4291 (Symbol_value::output_symtab_index): Make sure the symbol index is
4293 (Symbol_value::set_output_symtab_index): Make sure the symbol
4294 index is not set. Make sure the new index is valid.
4295 (Symbol_value::set_must_have_output_symtab_entry): New function.
4296 (Symbol_value::has_output_dynsym_entry): New function.
4297 (Symbol_value::set_output_dynsym_index): Make sure the new index
4299 (Sized_relobj::set_must_have_output_symtab_entry): New function.
4300 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
4301 local symbol if permitted.
4302 (Sized_relobj::do_finalize_local_symbols): Call
4303 is_output_symtab_index_set rather than needs_output_symtab_entry.
4304 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
4305 rather than needs_output_symtab_entry. Call
4306 has_output_dynsym_entry rather than needs_output_dynsym_entry.
4307 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
4308 is_output_symtab_index_set rather than needs_output_symtab_entry.
4309 * testsuite/discard_locals_relocatable_test.c: New file.
4310 * testsuite/discard_locals_test.sh: Test -r.
4311 * testsuite/Makefile.am (check_DATA): Add
4312 discard_locals_relocatable_test1.syms,
4313 discard_local_relocatable_test2.syms.
4314 (MOSTLYCLEANFILES): Likewise. Also add
4315 discard_locals_relocatable_test1.lout and
4316 discard_locals_relocatable_test2.out.
4317 (discard_locals_relocatable_test1.syms): New target.
4318 (discard_locals_relocatable_test.o): New target.
4319 (discard_locals_relocatable_test1.out): New target.
4320 (discard_locals_relocatable_test2.syms): New target.
4321 (discard_locals_relocatable_test2.out): New target.
4322 (various): Add missing ../ld-new dependencies.
4323 * testsuite/Makefile.in: Rebuild.
4325 2010-03-03 Nick Clifton <nickc@redhat.com>
4327 * po/fi.po: New Finnish translation.
4329 2010-03-01 Doug Kwan <dougkwan@google.com>
4331 * layout.cc (Layout::Layout): Force section types of .init_array*,
4332 .preinit_array* and .fini_array* sections.
4333 * output.cc (Output_section::Input_section_sort_entry::has_priority):
4334 Fix check of return value of std::string::find.().
4335 (Output_section::Input_section_sort_compare::operator()): Remove
4336 comment about .init_array.
4337 (Output_section::Input_section_sort_init_fini_compare::operator()):
4339 (Output_section::sort_attached_input_sections): Handle .init_array
4340 and .fini_array specially.
4341 * output.h (Output_section::Inut_section_sort_compare): Update
4343 (Output_section::Input_section_sort_init_fini_compare): New struct.
4345 2010-02-26 Doug Kwan <dougkwan@google.com>
4347 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
4348 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
4349 * testsuite/debug_msg.sh: Avoid matching source line number for
4350 use of global variable undef_int.
4352 2010-02-26 Doug Kwan <dougkwan@google.com>
4354 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
4355 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
4356 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
4357 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
4358 * options.cc (General_options::General_options): Initialize member
4360 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
4361 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
4362 and rm_no_fix_v4bx.stdout
4363 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
4364 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
4365 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
4366 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
4367 and arm_no_fix_v4bx.
4368 * Makefile.in: Regenerate.
4369 * testsuite/arm_fix_v4bx.s: New file.
4370 * testsuite/arm_fix_v4bx.sh: Ditto.
4372 2010-02-24 Doug Kwan <dougkwan@google.com>
4374 * arm.cc (Target_arm::got_section): Make the .got section the first
4375 non RELRO section in the data segment.
4376 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
4377 suffixes of section names.
4379 2010-02-24 Doug Kwan <dougkwan@google.com>
4381 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
4382 flags and attributes merging if an input file is a binary file.
4383 * fileread.cc (Input_file::open): Record format of original file.
4384 * fileread.h (Input_file::Format): New enum type.
4385 (Input_file::Input_file): Initialize data member format_.
4386 (Input_file::format): New method definition.
4387 (Input_file::format_):: New data member.
4389 2010-02-24 Doug Kwan <dougkwan@google.com>
4391 * arm.cc (Arm_output_data_got): New class.
4392 (ARM_TCB_SIZE): New constant
4393 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
4394 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
4395 If user uses a script with a SECTIONS clause, issue only a warning
4396 for a misplaced EXIDX input section. Otherwise, issue an error.
4397 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
4399 (Target_arm::got_mode_index_entry): Handle static linking.
4400 (Target_arm::Scan::local): Ditto.
4401 (Target_arm::Scan::global): Ditto.
4402 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
4403 all incorrectly implemented relocations.
4404 (Target_arm::fix_exidx_coverage): Pass layout to
4405 Arm_output_section::fix_exidx_coverage.
4406 * layout.cc (Layout::section_name_mapping): Remove trailing dots
4407 from ".ARM.exidx." and ".ARM.extab.".
4409 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4411 * arm.cc (Target_arm::do_finalize_sections): Create attribute
4412 section if it does not already exist.
4413 * attributes.cc (Attributes_section_data::Attributes_section_data):
4414 Don't crash if size is zero.
4416 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4417 Ian Lance Taylor <iant@google.com>
4419 * gold.cc (queue_middle_tasks): If no input files were opened,
4421 * workqueue.h (Task_function::Task_function): Assert that there is
4424 2010-02-22 Doug Kwan <dougkwan@google.com>
4426 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
4427 * icf.cc (get_section_contents): Cast snprintf arguments to long long
4428 types to avoid warnings due to different uint64_t implementations
4431 2010-02-21 Doug Kwan <dougkwan@google.com>
4433 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
4434 handling of the maximum backward branch offset.
4435 (Arm_relocate_functions::thumb_branch_common): Ditto.
4436 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
4437 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
4438 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
4439 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
4440 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
4441 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
4442 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
4443 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
4444 thumb_bl_out_of_range thumb_bl_out_of_range.o,
4445 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
4446 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
4447 thumb2_bl_out_of_range.o): New rules.
4448 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
4449 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
4450 thumb2_bl_out_of_range
4451 * testsuite/Makefile.in: Regenerate.
4452 * testsuite/arm_bl_in_range.s: New file.
4453 * testsuite/arm_bl_out_of_range.s: Ditto.
4454 * testsuite/arm_branch_in_range.sh: Ditto.
4455 * testsuite/arm_branch_range.t: Ditto.
4456 * testsuite/thumb2_branch_range.t: Ditto.
4457 * testsuite/thumb_bl_in_range.s: Ditto.
4458 * testsuite/thumb_bl_out_of_range.s: Ditto.
4459 * testsuite/thumb_branch_range.t: Ditto.
4461 2010-02-20 Sriraman Tallam <tmsriram@google.com>
4463 * gc.h (gc_process_relocs): Change vectors to point to the new list.
4464 Add reloc offset information.
4465 * icf.cc (get_section_contents): Change iterators to point to the new
4466 vectors. Add reloc offset information to the contents.
4467 * icf.h (Icf::Sections_reachable_info): New typedef.
4468 (Icf::Sections_reachable_list): New typedef.
4469 (Icf::Offset_info): New typedef.
4470 (Icf::Reloc_info): New struct typedef.
4471 (Icf::Reloc_info_list): New typedef.
4472 (Icf::symbol_reloc_list): Delete method.
4473 (Icf::addend_reloc_list): Delete method.
4474 (Icf::section_reloc_list): Delete method.
4475 (Icf::reloc_info_list): New method.
4476 (Icf::reloc_info_list_): New member.
4478 2010-02-19 Doug Kwan <dougkwan@google.com>
4480 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
4481 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
4482 * arm.cc (Arm_relocation_functions): New forward declaration.
4483 (Target_arm::Target_arm): Initialize new data members
4484 got_mod_index_offset_ and tls_base_symbol_defined_.
4485 (Target_arm::Relocate::relocate_tls): New method.
4486 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
4487 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
4489 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
4490 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
4491 (Target_arm::got_mod_index_offset_,
4492 Target_arm::tls_base_symbol_defined_): New data members.
4493 (Target_arm::Scan::local, Target::Scan::global,
4494 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
4497 2010-02-18 Doug Kwan <dougkwan@google.com>
4499 * arm.cc (Arm_relobj::find_linked_text_section): New method.
4500 (Arm_relobj::make_exidx_input_section): Pass section index of linked
4501 text section as a parameter becuase some broken tools may not set
4502 the link in section header.
4503 (Target_arm::has_got_section): New method.
4504 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
4505 without any mapping symbol as data only. Remove warning.
4506 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
4507 link in its section header, try to discover the link by inspecting the
4508 REL31 relocation at the beginning of the section.
4509 (Target_arm::Scan::check_non_pic): Report name of offending relocation
4511 (Target_arm::Scan::global): Treat any reference to the symbol
4512 _GLOBAL_OFFSET_TABLE_ as a GOT access.
4514 2010-02-12 Sriraman Tallam <tmsriram@google.com>
4516 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
4517 (Scan::global_reloc_may_be_function_pointer): New function.
4518 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
4519 (Scan::global_reloc_may_be_function_pointer): New function.
4520 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
4521 (Scan::global_reloc_may_be_function_pointer): New function.
4522 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
4523 (Scan::global_reloc_may_be_function_pointer): New function.
4524 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
4525 (Scan::global_reloc_may_be_function_pointer): New function.
4526 (Scan::possible_function_pointer_reloc): New function.
4527 (Target_x86_64::can_check_for_function_pointers): New function.
4528 * gc.h (gc_process_relocs): Scan relocation types to determine if
4529 function pointers were taken for targets that support it.
4530 * icf.cc (Icf::find_identical_sections): Include functions for
4531 folding in safe ICF whose pointer is not taken.
4532 * icf.h (Secn_fptr_taken_set): New typedef.
4533 (fptr_section_id_): New member.
4534 (section_has_function_pointers): New function.
4535 (set_section_has_function_pointers): New function.
4536 (check_section_for_function_pointers): New function.
4537 * options.h: Fix comment for safe ICF option.
4538 * target.h (can_check_for_function_pointers): New function.
4539 * testsuite/Makefile.am: Add icf_safe_so_test test case.
4540 Modify icf_safe_test for X86-64.
4541 * testsuite/Makefile.in: Regenerate.
4542 * testsuite/icf_safe_so_test.cc: New file.
4543 * testsuite/icf_safe_so_test.sh: New file.
4544 * testsuite/icf_safe_test.cc (kept_func_3): New function.
4545 (main): Change to take pointer to function kept_func_3.
4546 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
4547 folding is done correctly for X86-64.
4549 2010-02-12 David S. Miller <davem@davemloft.net>
4551 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
4552 is_symbolless parameter.
4553 (Output_reloc<SHT_REL>::is_symbolless): New.
4554 (Output_reloc<SHT_REL>::is_symbolless_): New.
4555 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
4556 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
4557 (Output_reloc<SHT_RELA>::is_symbolless): New.
4558 (Output_data_reloc::add_global): Handle is_symbolless.
4559 (Output_data_reloc::add_global_relative): Likewise.
4560 (Output_data_reloc::add_local): Likewise.
4561 (Output_data_reloc::add_local_relative): Likewise.
4562 (Output_data_reloc::add_symbolless_global_addend): New.
4563 (Output_data_reloc::add_symbolless_local_addend): New.
4564 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
4566 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
4567 instead of ->is_relative_
4568 (Output_reloc::write): Likewise.
4569 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
4570 (Output_reloc::write_rel): Simplify.
4572 * sparc.cc (Target_sparc::Scan::local): Use
4573 ->add_symbolless_local_addend as needed.
4574 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
4575 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
4576 based upon relocation offset.
4578 2010-02-11 Doug Kwan <dougkwan@google.com>
4580 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
4581 (Target_arm::Scan::global): Ditto. Also remove a comment before the
4582 beginning of function.
4583 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
4584 and MOVT_ABS relocations. Those are non issued in scanning. Fix
4585 parameter is_32bit in calls to should_apply_static_reloc.
4586 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
4587 (check_DATA): Add arm_abs_global.stdout.
4588 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
4589 arm_abs_global.stdout): New rules.
4590 (MOSTLLYCLEANFILES): Add arm_abs_global
4591 * Makefile.in: Regenerate.
4592 * testsuite/arm_abs_global.s: New file.
4593 * testsuite/arm_abs_global.sh: Ditto.
4594 * testsuite/arm_abs_lib.s: Ditto.
4596 2010-02-11 Ian Lance Taylor <iant@google.com>
4598 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
4600 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
4601 Allocate_commons_task first.
4602 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
4603 task, rather than symtab_lock_.
4604 (Gc_process_relocs::~Gc_process_relocs): New function.
4605 (Gc_process_relocs::is_runnable): Check this_blocker_.
4606 (Gc_process_relocs::locks): Use next_blocker_ rather than
4608 (Scan_relocs::~Scan_relocs): New function.
4609 (Scan_relocs::is_runnable): Check this_blocker_ rather than
4611 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
4613 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
4614 fields. Add this_blocker_ and next_blocker_ fields. Adjust
4615 constructor accordingly.
4616 (class Gc_process_relocs): Likewise.
4617 (class Scan_relocs): Likewise.
4618 * common.h (class Allocate_commons_task): Remove symtab_lock_
4619 field, and corresponding constructor parameter.
4620 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
4622 (Allocate_commons_task::locks): Likewise.
4624 2010-02-11 Ian Lance Taylor <iant@google.com>
4626 * gold-threads.h (class Once): Define.
4627 (class Initialize_lock): Rewrite as child of Once.
4628 * gold-threads.cc (class Once_initialize): Define.
4629 (once_pointer_control): New static variable.
4630 (once_pointer, once_arg): New static variables.
4631 (c_run_once): New static function.
4632 (Once::Once, Once::run_once, Once::internal_run): New functions.
4633 (class Initialize_lock_once): Remove.
4634 (initialize_lock_control): Remove.
4635 (initialize_lock_pointer): Remove.
4636 (initialize_lock_once): Remove.
4637 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
4638 (Initialize_lock::initialize): Rewrite.
4639 (Initialize_lock::do_run_once): New function.
4640 * archive.cc (Archive::interpret_header): Only clear name if it is
4642 * fileread.cc: Include "gold-threads.h"
4643 (file_counts_lock): New static variable.
4644 (file_counts_initialize_lock): Likewise.
4645 (File_read::release): Only increment counts when using --stats.
4646 Use a lock around the increment.
4647 * parameters.cc (class Set_parameters_target_once): Define.
4648 (set_parameters_target_once): New static variable.
4649 (Parameters::Parameters): Move here from parameters.h.
4650 (Parameters::set_target): Rewrite.
4651 (Parameters::set_target_once): New function.
4652 (Parameters::clear_target): Move here and rewrite.
4653 * parameters.h (class Parameters): Update declarations. Add
4654 set_parameters_target_once_ field.
4655 (Parameters::Parameters): Move to parameters.cc.
4656 (Parameters::clear_target): Likewise.
4657 * readsyms.cc (Read_symbols::do_group): Create a Start_group
4659 (Start_group::~Start_group): New function.
4660 (Start_group::is_runnable): New function.
4661 (Start_group::locks, Start_group::run): New functions.
4662 (Finish_group::run): Change saw_undefined to size_t.
4663 * readsyms.h (class Start_group): Define.
4664 (class Finish_group): Change saw_undefined_ field to size_t.
4665 (Finish_group::Finish_group): Remove saw_undefined and
4666 this_blocker parameters. Change all callers.
4667 (Finish_group::set_saw_undefined): New function.
4668 (Finish_group::set_blocker): New function.
4669 * symtab.h (class Symbol_table): Change saw_undefined to return
4670 size_t. Change saw_undefined_ field to size_t.
4671 * target-select.cc (Set_target_once::do_run_once): New function.
4672 (Target_selector::Target_selector): Initialize set_target_once_
4673 field. Don't initialize lock_ and initialize_lock_ fields.
4674 (Target_selector::instantiate_target): Rewrite.
4675 (Target_selector::set_target): New function.
4676 * target-select.h (class Set_target_once): Define.
4677 (class Target_selector): Update declarations. Make
4678 Set_target_once a friend. Remove lock_ and initialize_lock_
4679 fields. Add set_target_once_ field.
4681 2010-02-10 Ian Lance Taylor <iant@google.com>
4683 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
4685 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
4686 (queue_middle_tasks): Add all blockers before queueing any tasks.
4687 (queue_final_tasks): Likewise.
4688 * token.h (Task_token::add_blockers): New function.
4689 * object.h (Input_objects::number_of_relobjs): New function.
4691 2010-02-10 Ian Lance Taylor <iant@google.com>
4693 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
4694 shared, not if not position independent.
4695 * x86_64.cc (Relocate::relocate_tls): Likewise.
4696 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
4697 (tls_pie_pic_test): New target.
4698 * testsuite/Makefile.in: Rebuild.
4700 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
4701 (tls_test_main_pie.o, tls_test_pie.o): New targets.
4702 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
4703 * testsuite/Makefile.in: Rebuild.
4705 2010-02-09 David S. Miller <davem@davemloft.net>
4707 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
4708 R_SPARC_RELATIVE using ->add_local_relative().
4709 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
4711 * output.h (Output_data_dynamic::add_section_size): New method
4712 that takes two Output_data objects.
4713 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
4714 entry param. Handle it in initializers.
4715 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
4716 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
4717 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
4719 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
4720 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
4721 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
4722 for dynrel_includes_plt.
4723 * i386.cc (Target_i386::do_finalize_sections): Likewise.
4724 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4725 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
4727 (Target_sparc::do_finalize_sections): Update to pass true for
4728 dynrel_includes_plt.
4729 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
4730 output before .rela.plt
4731 (Target_powerpc::do_finalize_sections): Update to pass true for
4732 dynrel_includes_plt when 32-bit.
4734 2010-02-08 Doug Kwan <dougkwan@google.com>
4736 * arm.cc (Arm_relobj::simple_input_section_output_address): New
4738 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
4739 Arm_relobj::scan_section_for_cortex_a8_stubs,
4740 Arm_relobj::do_relocation_section): Instead of calling
4741 Output_section::output_address, use faster
4742 Arm_relobj::simple_input_section_output_address.
4744 2010-02-08 David S. Miller <davem@davemloft.net>
4746 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
4747 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
4748 relocation helper function.
4750 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
4751 just like R_SPARC_GOT{10,13,22}.
4752 (Target_sparc::Scan::local): Likewise.
4753 (Target_sparc::Relocate:relocate): Likewise.
4755 2010-02-06 Ian Lance Taylor <iant@google.com>
4757 * configure.ac: Rewrite targetobjs duplicate removal code to use
4758 only shell constructs.
4759 * configure: Rebuild.
4761 2010-02-05 Doug Kwan <dougkwan@google.com>
4764 * arm.cc (Arm_relobj::section_is_scannable): New method.
4765 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
4766 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
4768 2010-02-04 Doug Kwan <dougkwan@google.com>
4771 * arm-reloc-property.cc (cstdio): Include.
4772 * configure.ac (targetobjs): Remove duplicates.
4773 * configure: Regenerate.
4774 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
4775 big and little endian version for a given address size.
4777 2010-02-03 Doug Kwan <dougkwan@google.com>
4779 * arm-reloc-property.cc
4780 (Arm_reloc_property_table::reloc_name_in_error_message): New method
4782 * arm-reloc-property.h
4783 (Arm_reloc_property_table::get_implemented_static_reloc_property):
4784 New method definition.
4785 (Arm_reloc_property_table::reloc_name_in_error_message): New method
4787 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
4789 (GOT_PREL): Change implemented to Y.
4790 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
4791 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
4792 (Arm_relocate_functions::movw_abs_nc): Remove method.
4793 (Arm_relocate_functions::movt_abs): Ditto.
4794 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
4795 (Arm_relocate_functions::thm_movt_abs): Ditto.
4796 (Arm_relocate_functions::movw_rel_nc): Ditto.
4797 (Arm_relocate_functions::movw_rel): Ditto.
4798 (Arm_relocate_functions::movt_rel): Ditto.
4799 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
4800 (Arm_relocate_functions:thm_movw_rel): Ditto.
4801 (Arm_relocate_functions:thm_movt_rel): Ditto.
4802 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
4803 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
4804 New method definitions.
4805 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
4806 (Arm_relocation_functions::arm_grp_ldr): Ditto.
4807 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
4808 (Arm_relocation_functions::arm_grp_ldc): Ditto.
4809 (Target_arm::Relocate::relocate): Check for non-static or
4810 unimplemented relocation code and exit early. Change calls to
4811 Target_arm::reloc_uses_thumb_bit and
4812 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
4813 instead. Refactor code to handle similar relocations to increase
4814 code sharing. Remove check for unsupported relocation code in switch
4816 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
4817 relocation property table to find out size. Change error message to
4818 print out the name of a relocation code instead of the numeric value.
4819 (Target_arm::scan_reloc_for_stub): Use relocation property table
4820 instead of calling Target_arm::reloc_uses_thumb_bit().
4822 2010-02-02 Doug Kwan <dougkwan@google.com>
4824 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
4825 types of relaxed input section.
4827 2010-02-02 Doug Kwan <dougkwan@google.com>
4829 * Makefile.am (HFILES): Add arm-reloc-property.h.
4831 (TARGETSOURCES): Add arm-reloc-property.cc
4832 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
4833 (libgold_a_SOURCES): $(DEFFILES)
4834 * Makefile.in: Regenerate.
4835 * arm-reloc-property.cc: New file.
4836 * arm-reloc-property.h: New file.
4837 * arm-reloc.def: New file.
4838 * arm.cc: Update comments.
4839 (arm-reloc-property.h): New included header.
4840 (arm_reloc_property_table): New global variable.
4841 (Target_arm::do_select_as_default_target): New method definition.
4842 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
4843 arm-reloc-property to targ_extra_obj.
4844 * parameters.cc (set_parameters_target): Call
4845 Target::select_as_default_target().
4846 * target.h (Target::select_as_default_target): New method definition.
4847 (Target::do_select_as_default_target): Same.
4849 2010-02-01 Doug Kwan <dougkwan@google.com>
4851 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
4852 first_output_text_section_.
4853 (Arm_exidx_fixup::first_output_text_section): New method definition.
4854 (Arm_exidx_fixup::first_output_text_section_): New data member.
4855 (Arm_exidx_fixup::process_exidx_section): Record the first text
4856 output section seen.
4857 (Arm_output_section::fix_exidx_coverage): Set correct linked section
4858 and entsize in output section header.
4860 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4862 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
4863 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
4864 (Arm_relocate_functions::thm_alu11): New Method.
4865 (Arm_relocate_functions::thm_pc8): New Method.
4866 (Arm_relocate_functions::thm_pc12): New Method.
4867 (Target_arm::Scan::local): Handle the relocations.
4868 (Target_arm::Scan::global): Likewise.
4869 (Target_arm::Relocate::relocate): Likewise.
4870 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
4872 2010-01-29 Doug Kwan <dougkwan@google.com>
4874 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
4875 of relocation types as ld.
4877 2010-01-29 Doug Kwan <dougkwan@google.com>
4879 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
4881 (Arm_relocate_functions::thumb_branch_common): Ditto.
4882 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
4883 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
4884 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
4885 Arm_relocate_functions::jump24): Remove.
4886 (Target_arm::Relocate::relocate): Adjust code to call
4887 Arm_relocation_functions::arm_branch_common and
4888 Arm_relocation_functions::thumb_branch_common instead of their removed
4889 wrappers. Merge switch-cases together to reduce source code size.
4891 2010-01-29 Doug Kwan <dougkwan@google.com>
4893 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
4894 output_local_symbol_count_needs_update_.
4895 (Arm_relobj::output_local_symbol_count_needs_update,
4896 Arm_relobj::set_output_local_symbol_count_needs_update,
4897 Arm_relobj::update_output_local_symbol_count): New methods.
4898 (Arm_relobj::output_local_symbol_count_needs_update_): New data
4900 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
4901 of pointed function as in a R_ARM_PREL31 relocation.
4902 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
4903 for output local symbol count updating.
4904 (Target_arm::do_relax): Update output local symbol counts in objects
4906 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
4908 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4910 * arm.cc: Added support for the ARM relocations:
4911 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
4912 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
4913 (Arm_relocate_functions::movw_rel_nc): Renamed (was
4915 (Arm_relocate_functions::movw_rel): New method.
4916 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
4917 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
4919 (Arm_relocate_functions::thm_movw_rel): New method.
4920 (Arm_relocate_functions::thm_movt_rel): Renamed (was
4922 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
4924 (Target_arm::Scan::global): Likewise.
4925 (Target_arm::Relocate::relocate): Likewise.
4926 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4929 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4931 * arm.cc: Added support for ARM group relocations.
4932 (Target_arm::reloc_needs_sym_origin): New method.
4933 (Arm_relocate_functions::calc_grp_kn): New method.
4934 (Arm_relocate_functions::calc_grp_residual): New method.
4935 (Arm_relocate_functions::calc_grp_gn): New method.
4936 (Arm_relocate_functions::arm_grp_alu): New Method.
4937 (Arm_relocate_functions::arm_grp_ldr): New Method.
4938 (Arm_relocate_functions::arm_grp_ldrs): New Method.
4939 (Arm_relocate_functions::arm_grp_ldc): New Method.
4940 (Target_arm::Scan::local): Handle the ARM group relocations.
4941 (Target_arm::Scan::global): Likewise.
4942 (Target_arm::Relocate::relocate): Likewise.
4943 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4946 2010-01-26 Doug Kwan <dougkwan@google.com>
4948 * arm.cc (set): Include.
4949 (class Arm_exidx_fixup): Change type of last_input_section_ to const
4951 (Arm_output_section::Text_section_list): New type.
4952 (Arm_output_section::append_text_sections_to_list): New method.
4953 (Arm_output_section::fix_exidx_coverage): Ditto.
4954 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
4955 (Arm_relobj::convert_input_section_to_relaxed_section): Use
4956 Relobj::set_section_offset() instead of
4957 Sized_relobj::invalidate_section_offset().
4958 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
4959 parameter for section headers. Ignore relocation sections for
4960 unallocated sections and EXIDX sections.
4961 (Target_arm::fix_exidx_coverage): New method.
4962 (Target_arm::output_section_address_less_than): New type.
4963 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
4964 linked text section instead of the EXIDX section.
4965 (Arm_output_section::create_stub_group): Add an assertion to check
4966 that this is not an EXIDX output section.
4967 (Arm_output_section::append_text_sections_to_list): New method.
4968 (Arm_output_section::fix_exidx_coverage): Ditto.
4969 (Arm_relobj::scan_sections_for_stubs): Adjust call to
4970 Arm_relobj::section_needs_reloc_stub_scanning.
4971 (Target_arm::do_relax): Fix EXIDX output section coverage in the
4973 (Target_arm::fix_exidx_coverage): New method.
4974 * object.h (Relobj::set_output_section): New method.
4975 (Sized_relobj::invalidate_section_offset): Remove method.
4976 (Sized_relobj::do_invalidate_section_offset): Remove method.
4977 (Sized_relobj::do_set_section_offset): Handle offset value -1.
4979 2010-01-25 Doug Kwan <dougkwan@google.com>
4981 * arm.cc (Arm_exidx_merged_section::do_output_offset):
4982 Fix warning due to signed and unsigned comparison on a 32-bit host.
4984 2010-01-22 Doug Kwan <dougkwan@google.com>
4986 * arm.cc (Target_arm::do_relax): Record an output section for section
4987 offset adjustment it contains any stub table that has changed.
4988 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
4989 offsets in an output section if necessary.
4990 * output.cc (Output_section::Output_section): Initialize
4991 section_offsets_need_adjustments_.
4992 (Output_section::add_input_section_for_script): Renamed to
4993 Output_section::add_simple_input_section.
4994 (Output_section::save_states): Add a comment.
4995 (Output_section::discard_states): New method defintion.
4996 (Output_section::adjust_section_offsets): Same.
4997 * output.h (Output_section::add_input_section_for_script): Renamed to
4998 Output_section::add_simple_input_section.
4999 (Output_section::discard_states): New method declaration.
5000 (Output_section::adjust_section_offsets): Same.
5001 (Output_section::section_offsets_need_adjustment,
5002 Output_section::set_section_offsets_need_adjustment): New method
5004 (Output_section::section_offsets_need_adjustment_): New data member.
5005 * script-sections.cc
5006 (Output_section_element_input::set_section_address): Adjust code for
5007 renaming of Output_section::add_input_section_for_script.
5008 (Orphan_output_section::set_section_address): Same.
5010 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5012 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
5013 Fix_v4bx enum values .
5014 * gold/options.h (General_options): New option definitions.
5015 (General_options::fix_v4bx): New method.
5016 (General_options::Fix_v4bx): New enum.
5017 * gold/options.cc (General_options::parse_fix_v4bx): New method.
5018 (General_options::parse_fix_v4bx_interworking): New method.
5020 2010-01-22 Doug Kwan <dougkwan@google.com>
5022 * arm.cc (Arm_exidx_fixup): New class.
5024 2010-01-21 Doug Kwan <dougkwan@google.com>
5026 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
5028 (Arm_exidx_section_offset_map): New type.
5030 2010-01-21 Doug Kwan <dougkwan@google.com>
5032 * arm.cc (Arm_exidx_input_section): New class.
5033 (Arm_relobj::exidx_input_section_by_link,
5034 Arm_relobj::exidx_input_section_by_shndx,
5035 Arm_relobj::make_exidx_input_section): New methods.
5036 (read_arm_attributes_section): Remove.
5037 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
5038 information about them.
5039 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
5042 2010-01-20 Doug Kwan <dougkwan@google.com>
5044 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
5045 Input_section_specifier to Section_id.
5046 (Target_arm::new_arm_input_section: Adjust code for change of key
5048 (Target_arm::find_arm_input_section): Ditto.
5049 * gc.h (object.h): Include for Section_id nand Section_id_hash.
5050 (Section_id): Remove.
5051 (Garbage_collection::Section_id_hash): Remove.
5052 * icf.h (object.h): Include for Section_id nand Section_id_hash.
5053 (Section_id): Remove.
5054 (Icf::Section_id_hash): Remove.
5055 * object.h (Section_id, Const_section_id, Section_id_hash,
5056 Const_section_id_hash): New type definitions.
5057 * output.cc (Output_section::add_relaxed_input_section): Change to
5058 use Const_section_id instead of Input_section_specifier as key type.
5059 (Output_section::add_merge_input_section): Ditto.
5060 (Output_section::build_relaxation_map): Change to use Section_id
5061 instead of Input_section_specifier as key type.
5062 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5064 (Output_section::convert_input_sections_to_relaxed_sections): Change
5065 to use Const_section_id instead of Input_section_specifier as key type.
5066 (Output_section::find_merge_section): Ditto.
5067 (Output_section::find_relaxed_input_section): Ditto.
5068 * output.h (Input_section_specifier): Remove class.
5069 (Output_section::Output_section_data_by_input_section_map): Change
5070 key type to Const_section_id.
5071 (Output_section::Output_relaxed_input_section_by_input_section_map):
5073 (Output_section::Relaxation_map): Change key type to Section_id.
5075 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5077 * gold/arm.cc: Added support for R_ARM_V4BX relocation
5078 (class Arm_v4bx_stub): New class.
5079 (DEF_STUBS): Updated definition to support v4_veneer_bx.
5080 (Stub_factory::make_arm_v4bx_stub): New method.
5081 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
5082 (Stub_table::empty): Handle v4bx stubs.
5083 (Stub_table::add_arm_v4bx_stub): New method.
5084 (Stub_table::find_arm_v4bx_stub): New method.
5085 (Arm_relocate_functions::v4bx): New method.
5086 (Target_arm::fix_v4bx): New method.
5087 (Target_arm::Target_arm): Handle R_ARM_V4BX.
5088 (Stub_table::relocate_stubs): Likewise.
5089 (Stub_table::do_write): Likewise.
5090 (Stub_table::update_data_size_and_addralign): Likewise.
5091 (Stub_table::finalize_stubs): Likewise.
5092 (Target_arm::Scan::local): Likewise.
5093 (Target_arm::Scan::global): Likewise.
5094 (Target_arm::do_finalize_sections): Likewise.
5095 (Target_arm::Relocate::relocate): Likewise.
5096 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5098 (Target_arm::scan_reloc_for_stub): Likewise.
5099 (Target_arm::scan_reloc_section_for_stubs): Likewise.
5101 2010-01-19 Ian Lance Taylor <iant@google.com>
5103 * output.cc (Output_section_headers::do_sized_write): Write large
5104 segment count to sh_info field.
5105 (Output_file_header::do_sized_write): For large segment count,
5106 write PN_XNUM to e_phnum field.
5108 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5110 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
5111 (Arm_relocate_functions::thm_jump8): New function.
5112 (Arm_relocate_functions::thm_jump11): New function.
5113 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
5115 (Target_arm::Scan::global): Likewise.
5116 (Target_arm::Relocate::relocate): Likewise.
5117 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5120 2010-01-14 Doug Kwan <dougkwan@google.com>
5122 * arm.cc (map, utility): Include headers.
5123 (Target_arm::apply_cortex_a8_workaround): New method.
5124 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
5125 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
5126 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
5127 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
5128 the --[no-]fix-cortex-a8 command line options.
5129 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
5130 (Target_arm::relocate_stub): Use addend in instruction template.
5131 * options.h (DEFINE_bool): Set the user-set flag.
5132 (General_options): Add --[no-]-fix-cortex options.
5133 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
5134 : Update fast look-up map after conversion.
5136 2010-01-14 Sriraman Tallam <tmsriram@google.com>
5138 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
5139 in the first pass of do_layout.
5141 2010-01-13 Doug Kwan <dougkwan@google.com>
5143 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
5144 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
5145 apparent compiler problem of not folding static constant integral
5146 data members of elfcpp::Elf_sizes<32>.
5148 2010-01-13 Doug Kwan <dougkwan@google.com>
5150 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
5151 Arm_relobj::section_needs_cortex_a8_stub_scanning,
5152 Arm_relobj::scan_section_for_cortex_a8_erratum,
5153 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
5154 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
5155 sections to scan for relocation stubs into a new method
5156 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
5157 relocation and Cortex-A8 stub scanning.
5158 (Target_arm::do_relax): Force stubs to be after stubbed sections
5159 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
5160 the beginning of a new relaxation pass. Update a comment.
5161 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
5163 2010-01-12 Ian Lance Taylor <iant@google.com>
5165 * target-reloc.h (visibility_error): New inline function.
5166 (relocate_section): Call visibility_error.
5167 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
5168 (MOSTLYCLEANFILES): Likewise.
5169 (protected_4_pic.o, protected_3.err): New targets.
5170 * testsuite/protected_4.cc: New file.
5172 2010-01-12 Doug Kwan <dougkwan@google.com>
5174 * arm.cc (Cortex_a8_reloc): New class.
5175 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
5176 and cortex_a8_relocs_info_.
5177 (Target_arm::fix_cortex_a8): New method definition.
5178 (Target_arm::Cortex_a8_relocs_info): New type.
5179 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
5180 New data member declarations.
5181 (Target_arm::scan_reloc_for_stub): Record information about
5182 relocations for THUMB branches that might be exempted from the
5183 Cortex-A8 workaround.
5184 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
5185 at the beginning of a relaxation pass.
5187 2010-01-12 Doug Kwan <dougkwan@google.com>
5189 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
5190 (Arm_relobj::Mapping_symbol_position,
5191 Arm_reloj::Mapping_symbol_position_less,
5192 Arm_relobj::Mapping_symbols_info): New types.
5193 (Target_arm::is_mapping_symbol_name): New method definition.
5194 (Arm_relobj::do_count_local_symbols): Save information about mapping
5197 2010-01-11 Doug Kwan <dougkwan@google.com>
5199 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
5200 Arm_relocate_functions::thumb32_branch_upper,
5201 Arm_relocate_functions::thumb32_branch_lower,
5202 Arm_relocate_functions::thumb32_cond_branch_offset,
5203 Arm_relocate_functions::thumb32_cond_branch_upper,
5204 Arm_relocate_functions::thumb32_cond_branch_lower,
5205 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
5206 branch offset encoding.
5207 (Arm_relocate_functions::thumb_branch_common): Use new branch
5208 offset encoding methods to avoid code duplication.
5209 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
5210 (Stub_addend_reader::operator()): Use new branch encoding method
5211 to avoid code duplication.
5213 2010-01-11 Doug Kwan <dougkwan@google.com>
5215 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
5216 (Target_arm::do_finalize_sections): Define special EXIDX section
5217 symbols only if referenced.
5218 * gc.h (Garbage_collection::add_reference): New method.
5219 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
5222 2010-01-11 Ian Lance Taylor <iant@google.com>
5224 * script.cc (Version_script_info::build_expression_list_lookup):
5225 Change complaing about duplicate wildcard match from error to
5228 * script.cc (class Lazy_demangler): Recreate--revert part of patch
5230 (Version_script_info::Version_script_info): Initialize globs_,
5231 default_version_, default_is_global_, and exact_. Don't
5232 initialize globals_ or locals_.
5233 (Version_script_info::build_lookup_tables): Build local symbols
5235 (Version_script_info::unquote): New function.
5236 (Version_script_info::add_exact_match): New function.
5237 (Version_script_info::build_expression_list_lookup): Remove lookup
5238 parameter. Add is_global parameter. Change all callers. Handle
5239 wildcard pattern specially. Unquote pattern. Call
5241 (Version_script_info::get_name_to_match): New function.
5242 (Version_script_info::get_symbol_version): New function.
5243 (Version_script_info::get_symbol_version_helper): Remove.
5244 (Version_script_info::check_unmatched_names): Call unquote.
5245 * script.h (class Version_script_info): Change get_symbol_version
5246 to be non-inline and add is_global parameter; change all callers.
5247 Rewrite symbol_is_local. Update declarations. Define struct
5248 Version_tree_match, Exact, Globs. Don't define struct Lookup.
5249 Remove globals_ and locals_ members. Add exact_, globs_,
5250 default_version_, is_global_.
5251 (Version_script_info::Glob): Remove pattern, add expression and
5252 is_global. Update constructor. Change all callers.
5253 * dynobj.cc (Versions::finalize): Mark the version symbol as the
5255 (Versions::symbol_section_contents): If a symbol is undefined, or
5256 defined in a dynamic object, set the version index to
5258 * symtab.cc (Symbol_table::add_from_relobj): Don't call
5260 (Symbol_table::add_from_pluginobj): Likewise.
5261 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
5263 2010-01-11 Doug Kwan <dougkwan@google.com>
5265 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
5266 (incremental_dump_LDADD): Add linking option for libintl.
5267 * Makefile.in: Regenerate.
5269 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
5272 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
5274 * testsuite/Makefile.in: Regenerated.
5276 2010-01-10 Doug Kwan <dougkwan@google.com>
5278 * options.h (DEFINE_var): Use parentheses around argument varname__
5279 in macro body to avoid any unintended subsequent substitutions.
5281 2010-01-10 Ian Lance Taylor <iant@google.com>
5283 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
5284 candidates before doing symbol resolution.
5286 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
5287 ODR candidates if only one is weak.
5289 2010-01-08 Ian Lance Taylor <iant@google.com>
5291 * script.cc (Version_script_info::build_expression_list_lookup):
5292 Don't warn about ambiguous version, just record the ambiguity.
5293 (Version_script_info::get_symbol_version_helper): Give error if
5294 version is ambiguous.
5296 2010-01-08 Doug Kwan <dougkwan@google.com>
5298 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
5299 prev_data_size_ and prev_addralign_. Remove initializer for
5300 deleted data member has_been_changed_.
5301 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
5302 to determine if the table is empty.
5303 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
5305 (Stub_table::add_reloc_stub): Define method in class definition
5306 instead of just declaring it there.
5307 (Stub_table::add_cortex_a8_stub): New method definition.
5308 (Stub_table::update_data_size_and_addralign): Ditto.
5309 (Stub_table::finalize_stubs): Ditto.
5310 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
5311 (Stub_table::do_addralign_): Return address alignment in the
5312 (Stub_table::do_reset_address_and_file_offset): Define method in
5313 class definition instead of declaring it there. Set current data
5314 size to be the data size of the previous pass.
5315 (Stub_table::set_final_data_size): Use current data size as the
5317 (Stub_table::relocate_stub): Change parameter type of stub from
5318 Reloc_stub pointer to Stub pointer.
5319 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
5320 (Stub_table::Cortex_a8_stub_list): New typedef.
5321 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
5322 Stub_table::prev_addralign_): New data member.
5323 (Arm_relobj::Arm_relobj): Initialize data member
5324 section_has_cortex_a8_workaround_.
5325 (Arm_relobj::section_has_cortex_a8_workaround,
5326 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
5328 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
5330 (Target_arm::relocate_stub): Change parameter type of stub from
5331 Reloc_stub pointer to Stub pointer.
5332 (Insn_template::size, Insn_template::alignment): Handle
5333 THUMB16_SPECIAL_TYPE.
5334 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
5335 Stub_table::update_data_size_and_addralign,
5336 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
5338 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
5339 (Stub_table::do_write): Ditto.
5340 (Target_arm::do_relax): Adjust code for changes in Stub_table.
5342 2010-01-08 Ian Lance Taylor <iant@google.com>
5345 * symtab.h (class Symbol): Remove fields is_target_special_ and
5346 has_plt_offset_. Add field is_defined_in_discarded_section_.
5347 (Symbol::is_defined_in_discarded_section): New function.
5348 (Symbol::set_is_defined_in_discarded_section): New function.
5349 (Symbol::has_plt_offset): Rewrite.
5350 (Symbol::set_plt_offset): Verify that new offset is not -1U.
5351 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
5352 Don't initialize is_target_special_ or has_plt_offset_.
5353 Initialize is_defined_in_discarded_section_.
5354 (Symbol_table::add_from_relobj): If appropriate, set
5355 is_defined_in_discarded_section.
5356 * resolve.cc (Symbol::override_base_with_special): Don't test
5357 is_target_special_. Change has_plt_offset_ to has_plt_offset().
5358 * target-reloc.h (relocate_section): Do special handling for
5359 symbols defined in discarded sections for global symbols as well
5362 2010-01-08 Ian Lance Taylor <iant@google.com>
5364 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
5365 the SHT_SYMTAB case.
5367 2010-01-08 Ian Lance Taylor <iant@google.com>
5369 * object.cc (Sized_relobj::do_layout): Don't get confused if
5370 layout_eh_frame returns NULL.
5372 2010-01-08 Ian Lance Taylor <iant@google.com>
5375 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
5376 dynamic symbol table, use the normal symbol table.
5377 (Sized_dynobj::do_read_symbols): Remove assertion about type of
5380 2010-01-08 Ian Lance Taylor <iant@google.com>
5383 * layout.cc (Layout::include_section): Remove .gnu_debuglink
5386 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
5388 * version.cc (print_version): Change to "Copyright 2010".
5390 2010-01-08 Ian Lance Taylor <iant@google.com>
5394 * i386.cc (class Target_i386): Change return type of plt_section
5396 (class Output_data_plt_i386): Add tls_desc_rel_ field.
5397 (Output_data_plt_i386::Output_data_plt_i386): Initialize
5398 tls_desc_rel_ field.
5399 (Output_data_plt_i386::rel_tls_desc): New function.
5400 (Target_i386::rel_tls_desc_section): New function.
5401 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
5402 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
5403 R_386_TLS_DESC reloc in rel_tls_desc_section.
5404 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
5405 Define struct Tlsdesc_info.
5406 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
5407 (Target_x86_64::do_reloc_symbol_index): New function.
5408 (Target_x86_64::add_tlsdesc_info): New function.
5409 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
5410 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
5412 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
5414 (Output_data_plt_x86_64::rela_tlsdesc): New function.
5415 (Target_x86_64::rela_tlsdesc_section): New function.
5416 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
5418 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
5419 (Target_x86_64::do_reloc_addend): New function.
5420 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
5421 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
5422 declarations. Define TARGET_CODE. Add arg field to u1_ union.
5423 (Output_reloc::type): New function.
5424 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
5425 (Output_reloc::is_target_specific): New function.
5426 (Output_reloc::target_arg): New function.
5427 (class Output_reloc) [SHT_RELA]: Add four new constructors for
5428 absolute relocs and target specific relocs.
5429 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
5430 add_target_specific.
5431 (class Output_data_reloc) [SHT_RELA]: Likewise.
5432 * output.cc (Output_reloc::Output_reloc): Add four new versions
5433 for absolute relocs and target specific relocs.
5434 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
5435 (Output_reloc::get_symbol_index): Likewise.
5436 (Output_reloc::local_section_offset): Check that local_sym_index_
5437 is not TARGET_CODE or 0.
5438 (Output_reloc::symbol_value): Likewise.
5439 (Output_reloc::write) [SHT_RELA]: Call target for target specific
5441 * target.h (class Target): Add reloc_symbol_index and reloc_addend
5442 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
5444 * layout.cc (add_target_dynamic_tags): Use output section for
5445 DT_PLTRELSZ and DT_JMPREL.
5447 2010-01-07 Ian Lance Taylor <iant@google.com>
5450 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
5452 (class Output_data_reloc_generic): Define.
5453 (class Output_data_reloc_base): Change base class to
5454 Output_data_reloc_generic. Change add() method to call
5455 bump_relative_reloc_count for a relative reloc. Remove
5457 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
5459 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
5460 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
5462 * layout.h (class Layout): Update declaration.
5464 2010-01-07 Ian Lance Taylor <iant@google.com>
5466 * output.h (class Output_data): Add const version of
5467 output_section and do_output_section.
5468 (class Output_section_data): Add const version of
5470 (class Output_section): Likewise.
5471 * layout.cc (Layout::add_target_dynamic_tags): New function.
5472 * layout.h (class Layout): Update declarations.
5473 * arm.cc (Target_arm::do_finalize_sections): Use
5474 add_target_dynamic_tags.
5475 * i386.cc (Target_i386::do_finalize_sections): Likewise.
5476 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
5477 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
5478 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5480 2010-01-07 Ian Lance Taylor <iant@google.com>
5483 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
5486 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
5487 Ian Lance Taylor <iant@google.com>
5490 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
5491 Xindex::read_symtab_xindex.
5493 2010-01-07 Doug Kwan <dougkwan@google.com>
5495 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
5496 (Insn_template::thumb16_bcond_insn): New method declaration.
5497 (Insn_template): Fix spelling.
5498 (Stub::thumb16_special): New method declaration.
5499 (Stub::do_write): Define virtual method which was previously pure
5501 (Stub::do_thumb16_special): New method declaration.
5502 (Stub::do_fixed_endian_write): New template member.
5503 (Reloc_stub::do_write): Remove.
5504 (Reloc_stub::do_fixed_endian_write): Remove.
5505 (Cortex_a8_stub): New class definition.
5506 (Stub_factory::make_cortex_a8_stub): New method definition.
5507 (Stub_factory::Stub_factory): Add missing static storage class
5508 qualifier for elf32_arm_stub_a8_veneer_blx.
5510 2010-01-07 Ian Lance Taylor <iant@google.com>
5513 * options.h (class General_options): Add --warn-unresolved-symbols
5514 and --error-unresolved-symbols.
5515 * errors.cc (Errors::undefined_symbol): Implement
5516 --warn-unresolved-symbols.
5518 * options.h (class General_options): Add -z text and -z textoff.
5519 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
5521 2010-01-06 Sriraman Tallam <tmsriram@google.com>
5523 * gc.h (Garbage_collection::Cident_section_map): New typedef.
5524 (Garbage_collection::cident_sections): New function.
5525 (Garbage_collection::add_cident_section): New function.
5526 (Garbage_collection::cident_sections_): New member.
5527 (gc_process_relocs): Add references to sections whose names are C
5529 * gold.h (cident_section_start_prefix): New constant.
5530 (cident_section_stop_prefix): New constant.
5531 (is_cident): New function.
5532 * layout.cc (Layout::define_section_symbols): Replace string constants
5533 with the newly defined constants.
5534 * object.cc (Sized_relobj::do_layout): Track sections whose names are
5536 * testsuite/Makefile.am: Add gc_orphan_section_test.
5537 * testsuite/Makefile.in: Regenerate.
5538 * testsuite/gc_orphan_section_test.cc: New file.
5539 * testsuite/gc_orphan_section_test.sh: New file.
5541 2010-01-06 Ian Lance Taylor <iant@google.com>
5544 * options.h (class General_options): Add --warn-shared-textrel.
5545 * layout.cc (Layout::finish_dynamic_section): Implement
5546 --warn-shared-textrel.
5549 * options.h (class General_options): Add --warn-multiple-gp.
5551 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5553 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
5554 $(THREADSLIB) and $(LIBDL).
5555 * Makefile.in: Rebuild.
5557 2010-01-06 Ian Lance Taylor <iant@google.com>
5560 * options.cc (General_options::parse_section_start): New function.
5561 (General_options::section_start): New function.
5562 (General_options::General_options): Initialize all members.
5563 * options.h: Include <map>
5564 (class General_options): Add --section-start. Add section_starts_
5566 * layout.cc (Layout::attach_allocated_section_to_segment): If
5567 --section-start was used, set the address of the segment. Remove
5568 local sort_sections.
5569 (Layout::relaxation_loop_body): If the address of the load segment
5570 has been set by --section-start, don't use it.
5571 * output.h (Output_segment::update_flags_for_output_section): New
5573 * output.cc (Output_segment::add_output_section): Call
5574 update_flags_for_output_section.
5576 2010-01-05 Ian Lance Taylor <iant@google.com>
5579 * options.h (class General_options): Add --undefined-version.
5580 * script.cc (struct Version_expression): Add was_matched_by_symbol
5582 (Version_script_info::matched_symbol): New function.
5583 (Version_script_info::get_symbol_version_helper): Call
5585 (Version_script_info::check_unmatched_names): New function.
5586 * script.h (class Version_script_info): Update declarations.
5587 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
5589 * options.h (class General_options): Use DEFINE_bool_alias for
5590 allow_multiple_definition.
5591 * resolve.cc (Symbol_table::should_override): Don't test
5592 allow_multiple_definition.
5595 * options.h (class General_options): Add --cref.
5596 * main.cc (main): Print cref table if --cref. Don't close mapfile
5597 until after printing cref table.
5598 * cref.cc: Include "symtab.h".
5599 (class Cref_inputs): Define Cref_table_compare and Cref_table.
5600 (Cref_table_compare::operator()): New function.
5601 (Cref_inputs::gather_cref): New function.
5602 (filecol): New static const.
5603 (Cref_inputs::print_cref): New function.
5604 (Cref::print_cref): New function.
5605 * cref.h: Include <cstdio>.
5606 (class Cref): Update declarations.
5607 * mapfile.h (Mapfile::file): New function.
5608 * object.h (class Object): Define Symbols. Declare virtual
5609 do_get_global_symbols.
5610 (Object::get_global_symbols): New function.
5611 * object.cc (Input_objects::add_object): Pass object to cref_ if
5613 (Input_objects::archive_start): Likewise.
5614 (Input_objects::archive_stop): Likewise.
5615 (Input_objects::print_cref): New function.
5616 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
5617 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
5619 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
5621 * plugin.h (class Sized_pluginobj): Update declarations.
5623 2010-01-05 Ian Lance Taylor <iant@google.com>
5625 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
5626 to is_default_version. Rename insdef to insdefault.
5627 (Symbol_table::add_from_relobj): Rename def to is_default_version
5628 and local to is_forced_local.
5629 (Symbol_table::add_from_pluginobj): Likewise.
5630 (Symbol_table::add_from_dynobj): Likewise.
5631 (Symbol_table::define_special_symbol): Rename insdef to
5634 2010-01-04 Ian Lance Taylor <iant@google.com>
5637 * options.h (class General_options): Add
5638 --allow-multiple-definition and -z muldefs.
5639 * resolve.cc (Symbol_table::should_override): Don't warn about a
5640 multiple symbol definition if --allow-multiple-definition or -z
5644 * options.h (class General_options): Add --add-needed and
5645 --copy-dt-needed-entries. Tweak --as-needed help entry.
5646 * object.cc (Input_objects::check_dynamic_dependencies): Give an
5647 error if --copy-dt-needed-entries aka --add-needed is used and
5648 would cause a change in behaviour.
5651 * options.h (class General_options): Add -G as a short version of
5652 --shared. Add no-op options -assert, -g, and -i.
5654 2010-01-04 Sriraman Tallam <tmsriram@google.com>
5656 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
5657 check for .text or .gnu.linkonce.t sections.
5658 * icf.cc (Icf::find_identical_sections): Ditto.
5659 Change the detection for mangled function name within the section
5661 * icf.h (is_section_foldable_candidate): New function.
5663 2009-12-30 Ian Lance Taylor <iant@google.com>
5666 * options.h (class General_options): Permit two dashes with
5667 --retain-symbols-file.
5669 2009-12-30 Ian Lance Taylor <iant@google.com>
5672 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
5673 don't put the file header and segment headers in the text
5677 * common.cc (Sort_commons::operator()): Stabilize sort when both
5679 (Symbol_table::do_allocate_commons_list): When allocating common
5680 symbols, skip a symbol which is no longer common.
5681 * symtab.h (Symbol::is_common): Test whether the symbol comes from
5682 an object before checking its type.
5683 * testsuite/common_test_2.c: New file.
5684 * testsuite/common_test_3.c: New file.
5685 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
5686 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
5687 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
5688 (common_test_2_pic.o, common_test_2.so): New targets.
5689 (common_test_3_pic.o, common_test_3.so): New targets.
5690 * testsuite/Makefile.in: Rebuild.
5693 * script.cc (read_input_script): If we see a new SECTIONS clause,
5694 and we have added an input section, give an error.
5695 * layout.h (class Layout): Add have_added_input_section function.
5696 Add have_added_input_section_ field.
5697 * layout.cc (Layout::Layout): Initialize
5698 have_added_input_section_.
5699 (Layout::layout): Set have_added_input_section_.
5700 (Layout::layout_eh_frame): Likewise.
5702 2009-12-30 Ian Lance Taylor <iant@google.com>
5705 * options.h (class General_options): Add --sort-common option.
5706 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
5707 * common.cc (Sort_common): Add sort_order parameter to
5708 constructor. Add sort_order_ field.
5709 (Sort_commons::operator): Check sort_order_.
5710 (Symbol_table::allocate_commons): Determine the sort order.
5711 (Symbol_table::do_allocate_commons): Add sort_order parameter.
5713 (Symbol_table::do_allocate_commons_list): Likewise.
5715 2009-12-30 Ian Lance Taylor <iant@google.com>
5718 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
5719 symbols from this object, don't change the visibility of an
5721 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
5723 2009-12-30 Ian Lance Taylor <iant@google.com>
5726 * script.h (class Version_script_info): Define Language enum.
5727 Update declarations. Define Glob, Exact, and Lookup types. Add
5728 new fields globals_, locals_, and is_finalized_.
5729 * script.cc: Various formatting fixes.
5730 (class Parser_closure): Change language_stack_ from a vector of
5731 std::string to one of Version_script_info::Language. Adjust all
5733 (class Lazy_demangler): Remove.
5734 (struct Version_expression): Change language from std::string to
5735 Version_script_info::Language.
5736 (Version_script_info::Version_script_info): New function.
5737 (Version_script_info::~Version_script_info): Don't call clear.
5738 (Version_script_info::finalize): New function.
5739 (Version_script_info::build_lookup_tables): New function.
5740 (Version_script_info::build_expression_list_lookup): New
5742 (Version_script_info::get_symbol_version_helper): Rewrite to use
5744 (Version_script_info::print_expression_list): Adjust to use
5745 Version_script_info::Language.
5746 (script_push_lex_into_version_mode): Check that the version script
5747 has not been finalized.
5748 (version_script_push_lang): Change language string to
5749 Version_script_info::Language.
5750 * options.cc (Command_line::version_script): New function.
5751 * options.h (class General_options): Add finalize_dynamic_list
5752 function. Change version_script from declaration to definition.
5753 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
5754 * testsuite/version_script.map: Remove duplicate def of foo.
5755 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
5757 * testsuite/Makefile.in: Rebuild.
5759 2009-12-30 Ian Lance Taylor <iant@google.com>
5762 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
5763 if the input symbol index is 0, make the output symbol index 0.
5765 2009-12-30 Ian Lance Taylor <iant@google.com>
5768 * options.h (class General_options): Add -x/--discard-all.
5769 * object.cc (Sized_relobj::do_count_local_symbols): Handle
5770 --discard-all. If the local symbol needs a dynamic entry, check
5771 that before handling --discard-locals.
5773 2009-12-30 Ian Lance Taylor <iant@google.com>
5776 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
5778 (Output_segment::add_output_section): Don't change the flags if
5782 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
5783 GNU hash table if they need a dynamic value. Otherwise, don't add
5784 them if they are defined in a dynamic object or are forced local.
5786 2009-12-29 Ian Lance Taylor <iant@google.com>
5789 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
5790 .gnu.hash table for a 32-bit target.
5793 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
5794 regular and a dynamic object only needs a dynamic symbol table
5795 entry if it is externally visible.
5798 * i386.cc (class Target_i386): Initialize global_offset_table_ in
5799 constructor. Add global_offset_table_ field.
5800 (Target_i386::got_section): Set global_offset_table_.
5801 (Target_i386::do_finalize_sections): Set global_offset_table_
5803 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
5804 in constructor. Add global_offset_table_ field.
5805 (Target_x86_64::got_section): Set global_offset_table_.
5806 (Target_x86_64::do_finalize_sections): Set global_offset_table_
5809 * layout.cc (Layout::Layout): Initialize increase_relro_.
5810 (Layout::get_output_section): Add is_relro, is_last_relro, and
5811 is_first_non_relro parameters. Change all callers.
5812 (Layout::choose_output_section): Likewise.
5813 (Layout::add_output_section_data): Likewise.
5814 (Layout::make_output_section): Likewise.
5815 (Layout::set_segment_offsets): Clear increase_relro when using a
5817 * layout.h (class Layout): Add increase_relro method. Add
5818 increase_relro_ field. Update declarations.
5819 * output.cc (Output_section::Output_section): Initialize
5820 is_last_relro_ and is_first_non_relro_.
5821 (Output_segment::add_output_section): Group relro sections is
5822 do_sort is true. Handle is_last_relro and is_first_non_relro.
5823 (Output_segment::maximum_alignment): Remove relro handling.
5824 (Output_segment::set_section_addresses): Add increase_relro
5825 parameter. Change all callers. Add initial alignment to align
5826 relro sections on separate page. Remove old relro handling.
5827 (Output_segment::set_section_list_addresses): Remove in_relro
5828 parameter. Change all callers.
5829 (Output_segment::set_offset): Add increase parameter. Change all
5830 callers. Remove old relro handling.
5831 * output.h (class Output_section): Add new methods: is_last_relro,
5832 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
5833 Add is_last_relro_ and is_first_non_relro_ fields.
5834 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
5835 Create separate .got.plt section. Call increase_relro.
5836 * x86_64.cc (Target_x86_64::got_section): Likewise.
5837 * testsuite/relro_script_test.t: Add .got.plt.
5840 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
5841 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
5842 (Layout::finalize): Call set_dynamic_symbol_size.
5843 (Layout::set_dynamic_symbol_size): New function.
5844 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
5845 set_dynamic_symbol_size.
5848 * output.h (class Output_section): Add is_entsize_zero_ field.
5849 * output.cc (Output_section::Output_section): Initialize
5851 (Output_section::set_entsize): If two different entsizes are
5852 requested, force it to zero.
5853 (Output_section::add_input_section): Set flags for .debug_str
5854 before updating section flags. Set entsize.
5855 (Output_section::update_flags_for_input_section): Set SHF_MERGE
5856 and SHF_STRING if all input sections have those flags.
5858 2009-12-29 Rafael Espindola <espindola@google.com>
5860 * main.cc (main): Fix the sys time reporting.
5861 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
5864 2009-12-29 Sriraman Tallam <tmsriram@google.com>
5866 * options.cc (General_options::parse_version): Allow -v to exit
5867 without an error if there is nothing to link.
5869 2009-12-29 Ian Lance Taylor <iant@google.com>
5871 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
5872 using a version of gcc before 4.1.
5873 * configure: Rebuild.
5875 2009-12-28 Chris Demetriou <cgd@google.com>
5877 * attributes.cc (Output_attributes_section_data::do_write): Use
5878 std::vector::front rather than std::vector::data.
5880 2009-12-28 Ian Lance Taylor <iant@google.com>
5882 * symtab.h (class Symbol_table): Add enum Defined.
5883 * resolve.cc (Symbol_table::should_override): Add defined
5884 parameter. Change all callers. Test whether object is NULL
5885 before calling a method on it.
5886 (Symbol_table::report_resolve_problem): Add defined parameter.
5888 (Symbol_table::should_override_with_special): Likewise.
5889 * symtab.cc (Symbol_table::define_in_output_data): Add defined
5890 parameter. Change all callers.
5891 (Symbol_table::do_define_in_output_data): Likewise.
5892 (Symbol_table::define_in_output_segment): Likewise.
5893 (Symbol_table::do_define_in_output_segment): Likewise.
5894 (Symbol_table::define_as_constant): Likewise.
5895 (Symbol_table::do_define_as_constant): Likewise.
5896 * script.h (class Symbol_assignment): Add is_defsym parameter to
5897 constructor; change all callers.
5898 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
5899 parameter. Change all callers. Add is_defsym_ field.
5900 (class Parser_closure): Add parsing_defsym parameter to
5901 constructor; change all callers. Add parsing_defsym accessor
5902 function. Add parsing_defsym_ field.
5904 2009-12-28 Ian Lance Taylor <iant@google.com>
5906 * gold.cc (queue_middle_tasks): Fix formatting.
5907 * object.cc (Relobj::is_section_name_included): Likewise.
5909 2009-12-23 Ian Lance Taylor <iant@google.com>
5911 * i386.cc (Target_i386::do_calls_non_split): Recognize
5912 -fsplit-stack prologue for a function with a static chain.
5913 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
5914 -fsplit-stack prologue when using %r11.
5916 2009-12-21 Sriraman Tallam <tmsriram@google.com>
5918 * options.cc (General_options::parse_version): Make -v continue and do
5919 the link like GNU ld does.
5921 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
5923 * Makefile.am (CCFILES): Add timer.cc.
5924 (HFILES): Add timer.h.
5925 * configure.ac: Check for sysconf and times.
5926 * main.cc: include timer.h.
5927 (main): Use Timer instead of get_run_time.
5930 * workqueue.cc: include timer.h.
5931 (Workqueue::find_and_run_task):
5932 Report user, sys and wall time.
5933 * Makefile.in: Regenerate.
5934 * config.in: Regenerate.
5935 * configure: Regenerate.
5937 2009-12-16 Doug Kwan <dougkwan@google.com>
5939 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
5941 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
5942 relaxed input sections.
5943 * output.cc (Output_section::find_relaxed_input_section): Change
5944 return type to Output_relaxed_input_section pointer. Adjust code
5945 for new type of relaxed_input_section_map_.
5946 * output.h (Output_section::find_relaxed_input_section): Change
5947 return type to Output_relaxed_input_section pointer.
5948 (Output_section::Output_relaxed_input_section_by_input_section_map):
5950 (Output_section::relaxed_input_section_map_): Change type to
5951 Output_section::Output_relaxed_input_section_by_input_section_map.
5952 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
5955 2009-12-15 Ian Lance Taylor <iant@google.com>
5957 * layout.cc (Layout::create_shstrtab): Only write out after input
5958 sections if we are compressing debug sections.
5960 2009-12-15 Ian Lance Taylor <iant@google.com>
5962 * archive.cc (Archive::add_symbols): Only look up a symbol without
5963 a version if there is, in fact, a version.
5965 2009-12-14 Ian Lance Taylor <iant@google.com>
5967 Revert -Wshadow changes, all changes from:
5968 2009-12-11 Doug Kwan <dougkwan@google.com>
5969 2009-12-11 Nick Clifton <nickc@redhat.com>
5970 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
5972 2009-12-11 Doug Kwan <dougkwan@google.com>
5974 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
5976 * attributes.cc (Object_attribute::size): Ditto.
5977 (Attributes_section_data::size): Ditto.
5978 (Attributes_section_data::Attributes_section_data): Ditto.
5979 (Output_attributes_section_data::do_write): Ditto.
5980 * attributes.h (Object_attribute::set_type): Ditto.
5981 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
5983 2009-12-11 Nick Clifton <nickc@redhat.com>
5985 * archive.cc: Fix shadowed variable warnings.
5987 * compressed_output.cc: Likewise.
5988 * compressed_output.h: Likewise.
5989 * configure: Likewise.
5990 * dwarf_reader.cc: Likewise.
5991 * dynobj.cc: Likewise.
5992 * dynobj.h: Likewise.
5993 * ehframe.cc: Likewise.
5994 * ehframe.h: Likewise.
5995 * errors.cc: Likewise.
5996 * expression.cc: Likewise.
5997 * fileread.cc: Likewise.
5998 * fileread.h: Likewise.
5999 * freebsd.h: Likewise.
6000 * i386.cc: Likewise.
6002 * incremental.h: Likewise.
6003 * layout.cc: Likewise.
6004 * layout.h: Likewise.
6005 * mapfile.cc: Likewise.
6006 * merge.cc: Likewise.
6007 * merge.h: Likewise.
6008 * object.cc: Likewise.
6009 * object.h: Likewise.
6010 * options.h: Likewise.
6011 * output.cc: Likewise.
6012 * output.h: Likewise.
6013 * parameters.cc: Likewise.
6014 * plugin.cc: Likewise.
6015 * powerpc.cc: Likewise.
6016 * reduced_debug_output.cc: Likewise.
6017 * reduced_debug_output.h: Likewise.
6018 * reloc.cc: Likewise.
6019 * reloc.h: Likewise.
6020 * resolve.cc: Likewise.
6021 * script-sections.cc: Likewise.
6022 * script.cc: Likewise.
6023 * script.h: Likewise.
6024 * sparc.cc: Likewise.
6025 * symtab.cc: Likewise.
6026 * symtab.h: Likewise.
6027 * target-select.cc: Likewise.
6028 * target-select.h: Likewise.
6029 * token.h: Likewise.
6030 * workqueue.cc: Likewise.
6031 * workqueue.h: Likewise.
6032 * x86_64.cc: Likewise.
6034 2009-12-10 Doug Kwan <dougkwan@google.com>
6036 * arm.cc (attributes.h): New include.
6037 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
6038 (Arm_relobj::~Arm_relobj): Delete object pointed by
6039 attributes_section_data_.
6040 (Arm_relobj::attributes_section_data): New method definition.
6041 (Arm_relobj::attributes_section_data_): New data member declaration.
6042 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
6043 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
6044 attributes_section_data_.
6045 (Arm_dynobj::attributes_section_data): New method definition.
6046 (Arm_dynobj::attributes_section_data_): New data member declaration.
6047 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
6048 initialization value of may_use_blx_ to false.
6049 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
6050 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
6051 object attributes to compute results instead of hard-coding.
6052 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
6053 Target_arm::get_secondary_compatible_arch,
6054 Target_arm::set_secondary_compatible_arch
6055 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
6056 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
6057 New method declarations.
6058 (Target_arm::get_aeabi_object_attribute): New method definition.
6059 (Target_arm::attributes_section_data_): New data member declaration.
6060 (read_arm_attributes_section): New template definition.
6061 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
6062 (Arm_dynobj::do_read_symbols): Ditto.
6063 (Target_arm::do_finalize_sections): Merge attributes sections from
6064 input. Check for BLX use after attributes section merging.
6065 Fix __exidx_start and __exidx_end visibility. Create an
6066 .ARM.attributes section if necessary.
6067 (Target_arm::get_secondary_compatible_arch,
6068 Target_arm::set_secondary_compatible_arch,
6069 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
6070 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
6071 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
6072 New method definitions.
6074 2009-12-09 Ian Lance Taylor <iant@google.com>
6076 * plugin.cc (Plugin::load): Don't cast from void* to a function
6079 2009-12-09 Ian Lance Taylor <iant@google.com>
6081 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
6084 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
6086 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
6087 Replace two_file_shared_1.so with two_file_shared_2.so.
6088 * testsuite/Makefile.in: Regenerated.
6090 2009-12-08 Doug Kwan <dougkwan@google.com>
6092 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
6093 (HFILES): Add attributes.h and int_encoding.h.
6094 * Makefile.in: Regenerate.
6095 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
6096 function definitions to int_encoding.cc
6097 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
6098 prototypes to int_encoding.h
6099 * reduced_debug_output.cc (int_encoding.h): New include.
6100 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
6101 function definitions to int_encoding.cc
6102 (insert_into_vector, read_from_pointer): Move template definitions to
6104 * attributes.cc: New file.
6105 * attributes.h: New file.
6106 * int_encoding.cc: New file.
6107 * int_encoding.h: New file.
6109 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
6112 * incremental-dump.cc (dump_incremental_inputs): New.
6113 (main): Use dump_incremental_inputs.
6115 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
6118 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
6119 checking elfcpp::STT_FUNC.
6120 (Target_i386::Relocate::relocate): Likewise.
6121 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
6123 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
6124 symbols from shared libraries into normal FUNC symbols.
6126 * symtab.h (Symbol): Add is_func and use it.
6128 2009-12-05 Doug Kwan <dougkwan@google.com>
6130 * arm.cc (Target_arm::arm_info): Initialize new fields
6131 attributes_section and attributes_vendor.
6132 * i386.cc (Target_i386::i386_info): Same.
6133 * object.cc (Sized_relobj::do_layout): Skip attribute section.
6134 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
6135 fields attributes_section and attributes_vendor.
6136 * sparc.cc (Target_sparc::sparc_info): Same.
6137 * target.h (Target::attributes_section, Target::attributes_vendor,
6138 Target::is_attributes_section, Target::attribute_arg_type,
6139 Target::attributes_order): New method definitions.
6140 (Target::Target_info::attributes_section,
6141 Target::Target_info::attributes_vendor): New fields.
6142 (Target::do_attribute_arg_type, Target::do_attributes_order): New
6143 virtual method definitions.
6144 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
6145 attributes_section and attributes_vendor.
6146 * testsuite/testfile.cc (Target_test::test_target_info): Same.
6148 2009-12-05 Doug Kwan <dougkwan@google.com>
6150 * arm.cc: Update comments about interworking and stub generation.
6151 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
6152 considered as non-PIC.
6153 (Arm_relocate_functions::base_abs): Fix formatting.
6154 (Arm_relocate_functions::got_prel): Fix comment. Change interface
6155 of function to use GOT entry address instead of offset.
6156 (Target_arm::Scan::global): Issue an error if a symbol would need a
6157 PLT does not get one because it is untyped. Remove code to create
6158 dynamic symbols for relative branches.
6159 (Target_arm::Relocate::relocate: Use 0 instead of false since function
6160 takes unsigned integer instead of boolean.
6162 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
6164 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
6165 (two_file_test_LDADD): Likewise.
6166 (common_test_1_LDADD): Likewise.
6167 (exception_test_LDADD) Likewise.
6168 (weak_test_LDADD): Likewise.
6169 (many_sections_test_LDADD): Likewise.
6170 (initpri1_LDADD): Likewise.
6171 (script_test_1_LDADD): Likewise.
6172 (script_test_2_LDADD): Likewise.
6173 (justsyms_LDADD): Likewise.
6174 (binary_test_LDADD): Likewise.
6175 (large_LDADD): Likewise.
6176 * testsuite/Makefile.in: Regenerated.
6178 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
6180 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
6181 (Symbol_table::override_with_special): Likewise.
6182 (Symbol_table::add_from_object): Likewise.
6184 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
6186 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
6187 Don't set the data_offset twice.
6189 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
6191 * testsuite/Makefile.in: Regenerate.
6193 2009-12-03 Doug Kwan <dougkwan@google.com>
6195 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
6196 (Target_arm::do_finalize_sections): Add parameter for symbol table
6197 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
6198 * i386.cc (Target_i386::do_finalize_sections): Add an additional
6199 parameter for symbol table pointer.
6200 * layout.cc (Layout::finalize): Call Target::finalize_sections with
6201 an additional parameter for a pointer to symbol table.
6202 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
6203 parameter for a symbol table pointer.
6204 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
6205 * target.h (Target::finalize_sections, Target::do_finalize_sections):
6207 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
6208 parameter for a symbol table pointer.
6210 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
6212 * incremental.cc (Incremental_inputs_header)
6213 (Incremental_inputs_header_write, Incremental_inputs_entry)
6214 (Incremental_inputs_entry_write): Move ...
6215 * incremental.h (Incremental_inputs_header)
6216 (Incremental_inputs_header_write, Incremental_inputs_entry)
6217 (Incremental_inputs_entry_write): here.
6219 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
6221 * incremental.cc (make_sized_incremental_binary): Set the target.
6222 Error if it is incompatible.
6223 * output.h (Output_file): Add filename method.
6225 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
6227 * incremental.cc (Incremental_inputs_entry): Remove unused argument
6228 from the get_* methods.
6230 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
6232 * incremental-dump.cc (main): Check that the offeset of a script is 0.
6233 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
6234 Write 0 for the data_offset of scripts.
6236 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
6238 * testsuite/Makefile.am: Add the incremental_test.sh test.
6239 * testsuite/incremental_test.sh: New.
6240 * testsuite/incremental_test_1.c: New.
6241 * testsuite/incremental_test_2.c: New.
6243 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
6245 * incremental-dump.cc (main): Fix typos.
6247 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
6250 * incremental-dump.cc (main): Use llu to print 64 bit values.
6252 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
6253 H.J. Lu <hongjiu.lu@intel.com>
6255 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
6257 (incremental_dump_LDADD): Likewise.
6258 * Makefile.in: Regenerated.
6260 2009-11-25 Doug Kwan <dougkwan@google.com>
6264 2009-11-25 Doug Kwan <dougkwan@google.com>
6266 * arm.cc (Target_arm::Target_arm): Move method definition
6267 outside of class definition. Add code to handle
6268 --target1-rel, --target1-abs and --target2= options.
6269 (Target_arm::get_reloc_reloc_type): Change method to be
6270 non-static and const.
6271 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
6272 New data member declaration.
6273 (Target_arm::Scan::local, Target_arm::Scan::global,
6274 Target_arm::Relocate::relocate,
6275 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6276 Adjust call to Target_arm::get_real_reloc_type.
6277 (Target_arm::get_real_reloc_type): Use command line options
6278 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
6279 * options.h (--target1-rel, --target1-abs, --target2): New
6282 2009-11-25 Doug Kwan <dougkwan@google.com>
6284 * arm.cc (Target_arm::Target_arm): Move method definition outside of
6285 class definition. Add code to handle --target1-rel, --target1-abs
6286 and --target2= options.
6287 (Target_arm::get_reloc_reloc_type): Change method to be non-static
6289 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
6291 (Target_arm::Scan::local, Target_arm::Scan::global,
6292 Target_arm::Relocate::relocate,
6293 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
6294 call to Target_arm::get_real_reloc_type.
6295 (Target_arm::get_real_reloc_type): Use command line options to
6296 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
6297 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
6300 2009-11-25 Doug Kwan <dougkwan@google.com>
6302 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
6303 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
6304 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
6306 (Arm_relocate_functions::thm_call): Replace body with a call to
6307 Arm_relocate_functions::thumb_branch_common.
6308 (Arm_relocate_functions::thm_jump24,
6309 Arm_relocate_functions::thm_xpc22): New method definitions.
6310 (Arm_relocate_functions::thumb_branch_common): New method definition.
6311 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
6313 (Target_arm::Relocate::relocate): Adjust call to thm_call.
6314 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
6316 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
6318 * Makefile.am: Build incremental-dump
6319 * Makefile.in: Regenerate.
6320 * incremental-dump.cc: New.
6321 * incremental.cc (Incremental_inputs_header_data,
6322 Incremental_inputs_entry_data): Move to incremental.h
6323 * incremental.h: (Incremental_inputs_header_data,
6324 Incremental_inputs_entry_data): Move from incremental.cc
6326 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
6328 * incremental.cc (Incremental_inputs_header,
6329 Incremental_inputs_header_write, Incremental_inputs_entry,
6330 Incremental_inputs_entry_write): Add a typedef with the data type.
6332 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
6334 * incremental.cc (Incremental_inputs_header,
6335 Incremental_inputs_header_write, Incremental_inputs_entry,
6336 Incremental_inputs_entry_write): Update comment about which
6337 type has the filed descriptions.
6339 2009-11-15 Doug Kwan <dougkwan@google.com>
6341 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
6342 (Arm_relocate_functions::arm_branch_common): Change method defintion
6343 in class definition to a method declaration and update list of formal
6345 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
6346 Arm_relocation_functions::jump24): Adjust call to
6347 Arm_relocate_functions::arm_branch_common. Update list of formal
6349 (Arm_relocate_functions::xpc25): New method definition.
6350 (Arm_relocate_functions::arm_branch_common): Move method defintion
6351 out from class definition. Use stubs for mode-switching and extending
6353 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
6354 specially. Change code to enable use of stubs in ARM branches.
6356 2009-11-10 Doug Kwan <dougkwan@google.com>
6358 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
6359 in method declaration.
6360 (Target_arm::relocate_stub): New method declaration.
6361 (Target_arm::default_target): Change to return a pointer instead of
6363 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
6364 Target_arm::default_target.
6365 (Arm_Relobj::do_relocate_sections): Remove options paramater in
6367 (Target_arm::relocate_section): Adjust view.
6368 (Target_arm::relocate_stub): New method definition.
6370 2009-11-10 Doug Kwan <dougkwan@google.com>
6372 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
6374 * incremental.cc (open_incremental_binary): Initialized local
6375 variables to avoid warnings.
6376 * object.cc (make_elf_object): Ditto.
6377 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
6380 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
6383 * testsuite/plugin_test.c: Include "config.h".
6385 2009-11-09 Doug Kwan <dougkwan@google.com>
6387 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
6388 (arm_symbol_value): Remove.
6389 (Arm_relocate_functions::arm_branch_common,
6390 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
6391 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
6392 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
6393 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
6394 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
6395 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
6396 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
6397 Arm_relocate_functions::thm_mobw_abs_nc,
6398 Arm_relocate_functions::thm_mov_abs,
6399 Arm_relocate_functions::movw_prel_nc,
6400 Arm_relocate_functions::thm_movt_abs,
6401 Arm_relocate_functions::movt_prel,
6402 Arm_relocate_functions::thm_movw_prel_nc,
6403 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
6404 (Target_arm::Relocate::relocate): Only decompose address into two
6405 parts if relocation type uses the thumb-bit and pass the actual
6406 bit instead of a flag indicating that the thumb-bit is used. Adjust
6407 calls to methods in Arm_relocate_functions for this change.
6409 2009-11-08 Ian Lance Taylor <iant@google.com>
6412 * reloc.cc: Instantiate
6413 Sized_relobj::initialize_input_to_output_maps and
6414 Sized_relobj:free_input_to_output_maps.
6416 2009-11-06 Ian Lance Taylor <iant@google.com>
6419 * defstd.cc (in_segment): Set only_if_ref true for "end".
6421 2009-11-06 Doug Kwan <dougkwan@google.com>
6423 * arm.cc (class Reloc_stub): Correct a comment.
6424 (Target_arm::Target_arm): Initialize arm_input_section_map_.
6425 (Target_arm::scan_section_for_stubs): New method declaration.
6426 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
6427 Change methods from private to protected.
6428 (Target_arm::do_may_relax): New method definition.
6429 (Target_arm::do_relax, Target_arm::group_sections,
6430 Target_arm::scan_reloc_for_stub,
6431 Target_arm::scan_reloc_section_for_stubs): New method declarations.
6432 (Target_arm::arm_input_section_map_): New data member declaration.
6433 (Target_arm::scan_reloc_for_stub,
6434 Target_arm::scan_reloc_section_for_stubs,
6435 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
6436 Target_arm::do_relax): New method definitions.
6438 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
6440 * configure.ac: Check for (struct stat)::st_mtim
6441 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
6442 * config.in: Regenerate.
6443 * configure: Regenerate.
6445 2009-11-05 Ian Lance Taylor <iant@google.com>
6448 * output.cc (Output_segment::add_output_section): Add missing
6451 2009-11-04 Ian Lance Taylor <iant@google.com>
6454 * object.h (class Object): Add is_needed and set_is_needed
6455 methods. Add is_needed_ field. Make bool fields into bitfields.
6456 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
6457 defined in a dynamic object and referenced by a regular object,
6458 set is_needed for the dynamic object.
6459 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
6460 if the file is marked with as_needed and it is not needed.
6462 2009-11-04 Ian Lance Taylor <iant@google.com>
6465 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
6466 tags if data is discarded by linker script.
6467 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6468 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6469 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6470 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6472 2009-11-04 Ian Lance Taylor <iant@google.com>
6474 * layout.cc (Layout::get_output_section): Add is_interp and
6475 is_dynamic_linker_section parameters. Change all callers.
6476 (Layout::choose_output_section): Likewise.
6477 (Layout::make_output_section): Likewise.
6478 (Layout::add_output_section_data): Add is_dynamic_linker_section
6479 parameter. Change all callers.
6480 * layout.h (class Layout): Update declarations.
6481 * output.h (class Output_section): Add is_interp, set_is_interp,
6482 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
6483 Add is_interp_, is_dynamic_linker_section_ fields. Change
6484 generate_code_fills_at_write_ to a bitfield.
6485 * output.cc (Output_section::Output_sections): Initialize new
6487 (Output_segment::add_output_section): Add do_sort parameter.
6490 2009-11-03 Ian Lance Taylor <iant@google.com>
6493 * options.h (class General_options): Add --warn-common.
6494 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
6495 merging two common symbols.
6496 (Symbol_table::should_override): Handle --warn-common when merging
6497 a common symbol with a defined symbol. Use report_resolve_problem
6498 for multiple definitions.
6499 (Symbol_table::report_resolve_problem): New function.
6500 * symtab.h (class Symbol_table): Declare report_resolve_problem.
6502 2009-11-03 Doug Kwan <dougkwan@google.com>
6504 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
6506 (Target_arm::stub_factory): New method definition.
6507 (Target_arm::new_arm_input_section,
6508 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
6509 Target_arm::reloc_uses_thumb_bit): New method declarations.
6510 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
6511 New type definitions.
6512 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
6513 member declarations.
6514 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
6515 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
6516 New method definitions.
6518 2009-11-03 Ian Lance Taylor <iant@google.com>
6520 * options.h (class General_options): Add --warn_constructors.
6522 2009-11-03 Ian Lance Taylor <iant@google.com>
6525 * defstd.cc (in_section): Add entries for __rel_iplt_start,
6526 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
6528 2009-11-03 Ian Lance Taylor <iant@google.com>
6531 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
6532 --msgid-bugs-address.
6533 (install-pdf): New target.
6534 (install-data_yes): Look up one directory to find mkinstalldirs.
6536 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
6538 * po/Make-in (.po.gmo): Don't generate .gmo files in source
6541 2009-10-30 Doug Kwan <dougkwan@google.com>
6543 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
6545 2009-10-30 Doug Kwan <dougkwan@google.com>
6547 * arm.cc (Stub_addend_reader): New struct template definition
6548 and partial specializations.
6549 (Stub_addend_reader::operator()): New method definition for a
6550 partially specialized template.
6552 2009-10-30 Doug Kwan <dougkwan@google.com>
6554 * arm.cc (Arm_relobj::processor_specific_flags): New method
6556 (Arm_relobj::do_read_symbols): New method declaration.
6557 (Arm_relobj::processor_specific_flags_): New data member declaration.
6558 (Arm_dynobj): New class definition.
6559 (Target_arm::do_finalize_sections): Add input_objects parameter.
6560 (Target_arm::do_adjust_elf_header): New method declaration.
6561 (Target_arm::are_eabi_versions_compatible,
6562 (Target_arm::merge_processor_specific_flags): New method declaration.
6563 (Target_arm::do_make_elf_object): New overloaded method definitions
6565 (Arm_relobj::do_read_symbols): New method definition.
6566 (Arm_dynobj::do_read_symbols): Ditto.
6567 (Target_arm::do_finalize_sections): Add input_objects parameters.
6568 Merge processor-specific flags from all input objects.
6569 (Target_arm::are_eabi_versions_compatible,
6570 Target_arm::merge_processor_specific_flags,
6571 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
6572 New method definitions.
6573 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
6574 Input_objects pointer type parameter.
6575 * layout.cc (Layout::finalize): Pass input objects to target's.
6576 finalize_sections function.
6577 * output.cc (Output_file_header::do_sized_write): Set ELF file
6578 header's processor-specific flags.
6579 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
6580 Input_objects pointer type parameter.
6581 * sparc.cc (Target_sparc::do_finalize_sections): Same.
6582 * target.h (Input_objects): New forward class declaration.
6583 (Target::processor_specific_flags,
6584 Target::are_processor_specific_flags_sect): New method definitions.
6585 (Target::finalize_sections): Add input_objects parameter.
6586 (Target::Target): Initialize processor_specific_flags_ and
6587 are_processor_specific_flags_set_.
6588 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
6590 (Target::set_processor_specific_flags): New method definition.
6591 (Target::processor_specific_flags_,
6592 Target::are_processor_specific_flags_set_): New data member
6594 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
6595 Input_objects pointer type parameter.
6597 2009-10-30 Doug Kwan <dougkwan@google.com>
6599 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
6601 2009-10-28 Ian Lance Taylor <iant@google.com>
6603 * object.h (class Relobj): Drop options parameter from
6604 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
6605 do_scan_relocs, do_relocate. Change all callers.
6606 (class Sized_relobj): Drop options parameters from
6607 do_gc_process_relocs, do_scan_relocs, do_relocate,
6608 do_relocate_sections, relocate_sections, emit_relocs_scan,
6609 emit_relocs_scan_reltype. Change all callers.
6610 (struct Relocate_info): Remove options field and all references to
6612 * reloc.h (class Read_relocs): Remove options constructor
6613 parameter and options_ field. Change all callers.
6614 (class Gc_process_relocs, class Scan_relocs): Likewise.
6615 (class Relocate_task): Likewise.
6616 * target-reloc.h (scan_relocs): Remove options parameter. Change
6618 (scan_relocatable_relocs): Likewise.
6619 * target.h (class Sized_target): Remove options parameter from
6620 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
6622 * gc.h (gc_process_relocs): Remove options parameter. Change all
6624 * arm.cc: Update functions to remove options parameters.
6625 * i386.cc: Likewise.
6626 * powerpc.cc: Likewise.
6627 * sparc.cc: Likewise.
6628 * x86_64.cc: Likewise.
6629 * testsuite/testfile.cc: Likewise.
6631 2009-10-28 Doug Kwan <dougkwan@google.com>
6633 * arm.cc (Arm_relobj): New class definition.
6634 (Arm_relobj::scan_sections_for_stubs,
6635 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
6636 New method definitions.
6638 2009-10-28 Cary Coutant <ccoutant@google.com>
6640 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
6641 (Plugin::cleanup_done_): New member.
6642 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
6643 (Plugin_manager::cleanup_done_): Remove.
6644 (Plugin_manager::add_input_file): Edit error message.
6645 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
6646 (Plugin_manager::cleanup): Remove use of cleanup_done_.
6648 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
6650 * fileread.cc: (File_read::View::~View): Use the new
6651 data_ownership_ filed.
6652 (File_read::~File_read): Dispose the new whole_file_view_.
6653 (File_read::open): Mmap the whole file if needed.
6654 (File_read::open): Use whole_file_view_ instead of contents_.
6655 (File_read::find_view): Use whole_file_view_ if applicable.
6656 (File_read::do_read): Use whole_file_view_ instead of contents_.
6657 (File_read::make_view): Use whole_file_view_ instead of contents_,
6658 update File_read::View::View call.
6659 (File_read::find_or_make_view): Update File_read::View::View
6661 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
6663 (File_read::View::Data_ownership): New enum.
6664 (File_read::View::View): Replace bool mapped_ with Data_ownership
6666 (File_read::View::mapped_): Remove (replaced by data_ownership_).
6667 (File_read::View::data_ownership_): New field.
6668 (File_read::contents_): Remove (replaced by whole_file_view_).
6669 (File_read::whole_file_view_): New field.
6670 * options.h (class General_options): Add --keep-files-mapped.
6672 2009-10-27 Cary Coutant <ccoutant@google.com>
6674 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
6675 * testsuite/Makefile.am (plugin_test_5): New test case.
6676 * testsuite/Makefile.in: Regenerate.
6678 2009-10-25 Doug Kwan <dougkwan@google.com>
6680 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
6681 from private to protected to allow access by child class.
6682 (Sized_relobj::do_relocate_sections): New method declaration.
6683 (Sized_relobj::relocate_sections): Virtualize.
6684 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
6685 Sized_relobj::relocate_sections. Instantiate template explicitly
6686 for different target sizes and endianity.
6688 2009-10-24 Doug Kwan <dougkwan@google.com>
6690 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
6691 (Arm_input_section::as_arm_input_section): New method.
6692 (Arm_output_section): New class definition.
6693 (Arm_output_section::create_stub_group,
6694 Arm_output_section::group_sections): New method definitions.
6696 2009-10-22 Doug Kwan <dougkwan@google.com>
6698 * arm.cc (Arm_input_section): New class definition.
6699 (Arm_input_section::init, Arm_input_section:do_write,
6700 Arm_input_section::set_final_data_size,
6701 Arm_input_section::do_reset_address_and_file_offset): New method
6704 2009-10-21 Doug Kwan <dougkwan@google.com>
6706 * arm.cc (Stub_table, Arm_input_section): New forward class
6708 (Stub_table): New class defintion.
6709 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
6710 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
6711 New method definition.
6713 2009-10-21 Doug Kwan <dougkwan@google.com>
6715 * arm.cc: Update copyright comments.
6716 (Target_arm): New forward class template declaration.
6717 (Arm_address): New type.
6718 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
6719 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
6720 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
6722 (Insn_template): Same.
6723 (DEF_STUBS): New macro.
6724 (Stub_type): New enum type.
6725 (Stub_template): New class definition.
6728 (Stub_factory): Same.
6729 (Target_arm::Target_arm): Initialize may_use_blx_ and
6730 should_force_pic_veneer_.
6731 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
6732 Target_arm::should_force_pic_veneer,
6733 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
6734 Target_arm::using_thumb_only, Target_arm:;default_target): New
6736 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
6737 New data member declarations.
6738 (Insn_template::size, Insn_template::alignment): New method defintions.
6739 (Stub_template::Stub_template): New method definition.
6740 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
6741 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
6742 (Stub_factory::Stub_factory): New method definition.
6743 * gold.h (string_hash): New template.
6744 * output.h (Input_section_specifier::hash_value): Use
6746 (Input_section_specifier::string_hash): Remove.
6747 * stringpool.cc (Stringpool_template::string_hash): Use
6750 2009-10-20 Doug Kwan <dougkwan@google.com>
6752 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
6753 symbols of relaxed input sections.
6754 * output.h (Output_section::find_relaxed_input_section): Make
6757 2009-10-16 Doug Kwan <dougkwan@google.com>
6759 * dynobj.cc (Versions::Versions): Initialize version_script_.
6760 Only insert base version symbol definition for a shared object
6761 if version script defines any version versions.
6762 (Versions::define_base_version): New method definition.
6763 (Versions::add_def): Check that base version is not needed.
6764 (Versions::add_need): Define base version lazily.
6765 * dynobj.h (Versions::define_base_version): New method declaration.
6766 (Versions::needs_base_version_): New data member declaration.
6767 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
6768 (check_DATA): Add no_version_test.stdout.
6769 (libno_version_test.so, no_version_test.o no_version_test.stdout):
6771 * testsuite/Makefile.in: Regenerate.
6772 * testsuite/no_version_test.c: New file.
6773 * testsuite/no_version_test.sh: Ditto.
6775 2009-10-16 Doug Kwan <dougkwan@google.com>
6777 * expression.cc (class Segment_start_expression): New class definition.
6778 (Segment_start_expression::value): New method definition.
6779 (script_exp_function_segment_start): Return a new
6780 Segment_start_expression.
6781 * gold/script-c.h (script_saw_segment_start_expression): New function
6783 * script-sections.cc (Script_sections::Script_sections): Initialize
6784 SAW_SEGMENT_START_EXPRESSION_ to false.
6785 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
6786 and -Tbbs options to specify section addresses if given in
6787 command line and no SEGMENT_START expression is seen in a script.
6788 * script-sections.h (Script_sections::saw_segment_start_expression,
6789 Script_sections::set_saw_segment_start_expression): New method
6791 (Script_sections::saw_segment_start_expression_): New data member
6793 * script.cc (script_saw_segment_start_expression): New function.
6794 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
6795 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
6796 script_test_7.sh and script_test_8.sh.
6797 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
6798 script_test_8.stdout.
6799 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
6800 (script_test_6, script_test_6.stdout, script_test_7,
6801 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
6802 * Makefile.in: Regenerate.
6803 * testsuite/script_test_6.sh: New file.
6804 * testsuite/script_test_6.t: Same.
6805 * testsuite/script_test_7.sh: Same.
6806 * testsuite/script_test_7.t: Same.
6807 * testsuite/script_test_8.sh: Same.
6809 2009-10-16 Doug Kwan <dougkwan@google.com>
6811 * output.cc (Output_segment::set_section_list_address): Cast
6812 expressions to unsigned long long type to avoid format warnings.
6814 2009-10-15 Ian Lance Taylor <iant@google.com>
6816 * script.cc (Script_options::add_symbol_assignment): Always add a
6817 dot assignment to script_sections_.
6818 * script-sections.cc (Script_sections::add_dot_assignment):
6819 Initialize if necessary.
6821 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
6822 program headers with no load segment if there is a linker script.
6824 * layout.cc (Layout::set_segment_offsets): Align the file offset
6825 to the segment aligment for -N or -n with no load segment.
6826 * output.cc (Output_segment::add_output_section): Don't crash if
6827 the first section is a TLS section.
6828 (Output_segment::set_section_list_addresses): Print an error
6829 message if the address moves backward in a linker script.
6830 * script-sections.cc
6831 (Output_section_element_input::set_section_addresses): Don't
6832 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
6833 (Orphan_output_section::set_section_addresses): Likewise.
6835 2009-10-15 Doug Kwan <dougkwan@google.com>
6837 * layout.cc (Layout::finish_dynamic_section): Generate tags
6838 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
6839 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
6840 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
6842 2009-10-14 Ian Lance Taylor <iant@google.com>
6844 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
6846 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
6847 data_shdr fields of relinfo.
6848 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
6849 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
6850 R_386_TLS_LDO_32, adjust based on section flags.
6851 (Target_i386::Relocate::fix_up_ldo): Remove.
6853 2009-10-13 Ian Lance Taylor <iant@google.com>
6855 Add support for -pie.
6856 * options.h (class General_options): Add -pie and
6858 (General_options::output_is_position_independent): Test -pie.
6859 (General_options::output_is_executable): Return true if not shared
6860 and not relocatable.
6861 (General_options::output_is_pie): Remove.
6862 * options.cc (General_options::finalize): Reject incompatible uses
6864 * gold.cc (queue_middle_tasks): A -pie link is not static.
6865 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
6866 * symtab.cc (Symbol::final_value_is_known): Return false if
6867 output_is_position_independent.
6868 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
6869 output_is_position_independent.
6870 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
6871 output_is_position_independent.
6872 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
6873 output_is_position_independent.
6874 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
6876 (basic_pie_test.o, basic_pie_test): New targets.
6877 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
6878 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
6879 (two_file_pie_test): New target.
6880 * testsuite/Makefile.in: Rebuild.
6881 * README: Remove note saying that -pie is not supported.
6883 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
6885 * options.h (class General_options): Add -init and -fini.
6886 * layout.cc (Layout::finish_dynamic_section): Emit
6887 given init and fini functions.
6889 2009-10-13 Sriraman Tallam <tmsriram@google.com>
6891 * gc.h (gc_process_relocs): Check if icf is enabled using new
6893 * gold.cc (queue_initial_tasks): Likewise.
6894 (queue_middle_tasks): Likewise.
6895 * object.cc (do_layout): Likewise.
6896 * symtab.cc (is_section_folded): Likewise.
6897 * main.cc (main): Likewise.
6898 * reloc.cc (Read_relocs::run): Likewise.
6899 (Sized_relobj::do_scan_relocs): Likewise.
6900 * icf.cc (is_function_ctor_or_dtor): New function.
6901 (Icf::find_identical_sections): Check if function is ctor or dtor when
6903 * options.h (General_options::icf): Change option to be an enum.
6904 (Icf_status): New enum.
6905 (icf_enabled): New method.
6906 (icf_safe_folding): New method.
6907 (set_icf_status): New method.
6908 (icf_status_): New variable.
6909 * (options.cc) (General_options::finalize): Set icf_status_.
6910 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
6911 icf_test and icf_keep_unique_test to use the --icf enum flag.
6912 * testsuite/icf_safe_test.sh: New file.
6913 * testsuite/icf_safe_test.cc: New file.
6915 2009-10-12 Sriraman Tallam <tmsriram@google.com>
6917 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
6918 includes to gc.h and icf.h.
6919 * arm.cc: Include gc.h.
6920 * gold.cc: Likewise.
6921 * i386.cc: Likewise.
6922 * powerpc.cc: Likewise.
6923 * sparc.cc: Likewise.
6924 * x86_64.cc: Likewise.
6925 * gc.h: Include icf.h.
6927 2009-10-11 Ian Lance Taylor <iant@google.com>
6929 * plugin.cc: Include "gold.h" before other header files.
6931 2009-10-10 Chris Demetriou <cgd@google.com>
6933 * options.h (Input_file_argument::Input_file_type): New enum.
6934 (Input_file_argument::is_lib_): Replace with...
6935 (Input_file_argument::type_): New member.
6936 (Input_file_argument::Input_file_argument): Take Input_file_type
6937 'type' rather than boolean 'is_lib' as second argument.
6938 (Input_file_argument::is_lib): Use type_.
6939 (Input_file_argument::is_searched_file): New function.
6940 (Input_file_argument::may_need_search): Handle is_searched_file.
6941 * options.cc (General_options::parse_library): Support -l:filename.
6942 (General_options::parse_just_symbols): Update for Input_file_argument
6944 (Command_line::process): Likewise.
6945 * archive.cc (Archive::get_file_and_offset): Likewise.
6946 * plugin.cc (Plugin_manager::release_input_file): Likewise.
6947 * script.cc (read_script_file, script_add_file): Likewise.
6948 * fileread.cc (Input_file::Input_file): Likewise.
6949 (Input_file::will_search_for): Handle is_searched_file.
6950 (Input_file::open): Likewise.
6951 * readsyms.cc (Read_symbols::get_name): Likewise.
6952 * testsuite/Makefile.am (searched_file_test): New test.
6953 * testsuite/Makefile.in: Regenerate.
6954 * testsuite/searched_file_test.cc: New file.
6955 * testsuite/searched_file_test_lib.cc: New file.
6957 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6958 Ian Lance Taylor <iant@google.com>
6960 * descriptor.cc: Include <cstdio> and "binary-io.h".
6961 (Descriptors::open): Open the files in binary mode always.
6962 * script.cc (Lex::get_token): Treat \r as whitespace.
6964 2009-10-09 Ian Lance Taylor <iant@google.com>
6966 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
6968 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6969 Ian Lance Taylor <iant@google.com>
6971 * configure.ac: Check for readv function also.
6972 * fileread.cc (readv): Define if not HAVE_READV.
6973 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
6975 * config.in: Regenerate.
6976 * configure: Regenerate.
6978 2009-10-09 Doug Kwan <dougkwan@google.com>
6980 * layout.cc (Layout::make_output_section): Call target hook to make
6981 ordinary output section.
6982 (Layout::finalize): Adjust parameter list of call the
6983 Target::may_relax().
6984 * layout.h (class Layout::section_list): New method.
6985 * merge.h (Output_merge_base::entsize): Change visibility to public.
6986 (Output_merge_base::is_string, Output_merge_base::do_is_string):
6988 (Output_merge_string::do_is_string): New method.
6989 * object.cc (Sized_relobj::do_setup): renamed from
6990 Sized_relobj::set_up.
6991 * object.h (Sized_relobj::adjust_shndx,
6992 Sized_relobj::initializ_input_to_output_maps,
6993 Sized_relobj::free_input_to_output_maps): Change visibilities to
6995 (Sized_relobj::setup): Virtualize.
6996 (Sized_relobj::do_setup): New method declaration.
6997 (Sized_relobj::invalidate_section_offset,
6998 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
6999 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
7000 * options.cc (parse_int): New function.
7001 * options.h (parse_int): New declaration.
7002 (DEFINE_int): New macro.
7003 (stub_group_size): New option.
7004 * output.cc (Output_section::Output_section): Initialize memebers
7005 merge_section_map_, merge_section_by_properties_map_,
7006 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
7007 (Output_section::add_input_section): Handled deferred code-fill
7008 generation and remove an old comment.
7009 (Output_section::add_relaxed_input_section): New method definition.
7010 (Output_section::add_merge_input_section): Use merge section by
7011 properties map to speed to search. Update merge section maps
7013 (Output_section::build_relaxation_map): New method definition.
7014 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7016 (Output_section::relax_input_section): Renamed to
7017 Output_section::convert_input_sections_to_relaxed_sections and change
7018 interface to take a vector of pointers to relaxed sections.
7019 (Output_section::find_merge_section,
7020 Output_section::find_relaxed_input_section): New method definitions.
7021 (Output_section::is_input_address_mapped,
7022 Output_section::output_offset, Output_section::output_address):
7023 Use output section data maps to speed up searching.
7024 (Output_section::find_starting_output_address): Add comments.
7025 (Output_section::do_write,
7026 Output_section::write_to_postprocessing_buffer): Do code-fill
7027 generation as appropriate.
7028 (Output_section::get_input_sections): Invalidate relaxed input section
7030 (Output_section::restore_states): Adjust type of checkpoint .
7031 Invalidate relaxed input section map.
7032 * output.h (Output_merge_base): New class declaration.
7033 (Input_section_specifier): New class defintion.
7034 (class Output_relaxed_input_section) Change base class to
7035 Output_section_data_build.
7036 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
7037 base class initializer.
7038 (Output_section::add_relaxed_input_section): New method declaration.
7039 (Output_section::Input_section): Change visibility to protected.
7040 (Output_section::Input_section::relobj,
7041 Output_section::Input_section::shndx): Handle relaxed input sections.
7042 Output_section::input_sections) Change visibility to protected. Also
7043 define overload to return a non-const pointer.
7044 (Output_section::Merge_section_properties): New class defintion.
7045 (Output_section::Merge_section_by_properties_map,
7046 Output_section::Output_section_data_by_input_section_map,
7047 Output_section::Relaxation_map): New types.
7048 (Output_section::relax_input_section): Rename method to
7049 Output_section::convert_input_sections_to_relaxed_sections and change
7050 interface to take a vector of relaxed section pointers.
7051 (Output_section::find_merge_section,
7052 Output_section::find_relaxed_input_section,
7053 Output_section::build_relaxation_map,
7054 Output_section::convert_input_sections_in_list_to_relaxed_sections):
7055 New method declarations.
7056 (Output_section::merge_section_map_
7057 Output_section::merge_section_by_properties_map_,
7058 Output_section::relaxed_input_section_map_,
7059 Output_section::is_relaxed_input_section_map_valid_,
7060 Output_section::generate_code_fills_at_write_): New data members.
7061 * script-sections.cc
7062 (Output_section_element_input::set_section_addresses): Call
7063 current_data_size and addralign methods of relaxed input sections.
7064 (Orphan_output_section::set_section_addresses): Call current_data_size
7065 and addralign methods of relaxed input sections.
7066 * symtab.cc (Symbol_table::compute_final_value): Extract template
7067 from the body of Symbol_table::sized_finalize_symbol.
7068 (Symbol_table::sized_finalized_symbol): Call
7069 Symbol_table::compute_final_value.
7070 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
7071 (Symbol_table::compute_final_value): New templated method declaration.
7072 * target.cc (Target::do_make_output_section): New method defintion.
7073 * target.h (Target::make_output_section): New method declaration.
7074 (Target::relax): Add more parameters for input objects, symbol table
7075 and layout. Adjust call to do_relax.
7076 (Target::do_make_output_section): New method declaration.
7077 (Target::do_relax): Add parameters for input objects, symbol table
7080 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7082 * pread.c: Include stdio.h.
7084 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7086 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
7089 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7091 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7092 Change read_shndx type to unsigned int.
7093 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
7095 (Sized_dwarf_line_info::read_line_mappings): Likewise.
7096 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
7097 Change read_shndx type to unsigned int.
7098 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
7100 (Sized_dwarf_line_info::read_line_mappings): Likewise.
7101 * layout.cc (Layout::create_symtab_sections): Cast the result of
7102 local_symcount * symsize to off_t in the gold_assert.
7104 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7106 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
7107 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
7109 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
7110 (Arm_relocate_functions::thm_abs5): New function.
7111 (Arm_relocate_functions::abs12): New function.
7112 (Arm_relocate_functions::abs16): New function.
7113 (Arm_relocate_functions::base_abs): New function.
7114 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
7115 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
7116 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
7118 (Scan::global): Likewise.
7119 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
7120 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
7121 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
7122 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
7125 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7127 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
7128 (Arm_relocate_functions::movt_prel): New function.
7129 (Arm_relocate_functions::thm_movw_prel_nc): New function.
7130 (Arm_relocate_functions::thm_movt_prel): New function.
7131 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
7132 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
7133 (Scan::global, Relocate::relocate): Likewise.
7134 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7136 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
7138 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
7139 Incremental_checker.
7140 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
7142 (class Incremental_inputs_header): New class.
7143 (Incremental_inputs_header_writer): Edit comment.
7144 (Incremental_inputs_entry): New class.
7145 (Incremental_inputs_entry_writer): Edit comment.
7146 (Sized_incremental_binary::do_find_incremental_inputs_section):
7147 Add *strtab_shndx parameter, fill it.
7148 (Sized_incremental_binary::do_check_inputs): New method.
7149 (Incremental_checker::can_incrementally_link_output_file): Use
7150 Sized_incremental_binary::check_inputs.
7151 (Incremental_inputs::report_command_line): Save command line in
7154 (Incremental_binary::find_incremental_inputs_section): New
7156 (Incremental_binary::do_find_incremental_inputs_section): Add
7157 strtab_shndx parameter.
7158 (Incremental_binary::do_check_inputs): New pure virtual method.
7159 (Sized_incremental_binary::do_check_inputs): Declare.
7160 (Incremental_checker::Incremental_checker): Add incremental_inputs
7161 parameter, use it to initialize incremental_inputs_.
7162 (Incremental_checker::incremental_inputs_): New field.
7163 (Incremental_checker::command_line): New method.
7164 (Incremental_checker::inputs): New method.
7165 (Incremental_checker::command_line_): New field.
7167 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
7169 * incremental.cc: Include <cstdarg> and "target-select.h".
7170 (vexplain_no_incremental): New function.
7171 (explain_no_incremental): New function.
7172 (Incremental_binary::error): New method.
7173 (Sized_incremental_binary::do_find_incremental_inputs_section): New
7175 (make_sized_incremental_binary): New function.
7176 (open_incremental_binary): New function.
7177 (can_incrementally_link_file): Add checks if output is ELF and has
7179 * incremental.h: Include "elfcpp_file.h" and "output.h".
7180 (Incremental_binary): New class.
7181 (Sized_incremental_binary): New class.
7182 (open_incremental_binary): Declare.
7183 * object.cc (is_elf_object): Use
7184 elfcpp::Elf_recognizer::is_elf_file.
7185 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
7186 * output.h (Output_file::filesize): New method.
7188 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7190 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
7192 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
7193 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
7195 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
7197 (Arm_relocate_functions::movw_abs_nc): New function.
7198 (Arm_relocate_functions::movt_abs): New function.
7199 (Arm_relocate_functions::thm_movw_abs_nc): New function.
7200 (Arm_relocate_functions::thm_movt_abs): New function.
7201 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
7202 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
7203 (Scan::global): Likewise.
7204 (Relocate::relocate): Likewise.
7205 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7207 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7209 * arm.cc (Arm_relocate_functions::got_prel) New function.
7210 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
7211 (Relocate::relocate): Likewise.
7212 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7214 2009-10-06 Ian Lance Taylor <iant@google.com>
7216 * options.h (class General_options): Define
7217 split_stack_adjust_size parameter.
7218 * object.h (class Object): Add uses_split_stack_ and
7219 has_no_split_stack_ fields. Add uses_split_stack and
7220 has_no_split_stack accessor functions. Declare
7221 handle_split_stack_section.
7222 (class Reloc_symbol_changes): Define.
7223 (class Sized_relobj): Define Function_offsets. Declare
7224 split_stack_adjust, split_stack_adjust_reltype, and
7226 * object.cc (Object::handle_split_stack_section): New function.
7227 (Sized_relobj::do_layout): Call handle_split_stack_section.
7228 * dynobj.cc (Sized_dynobj::do_layout): Call
7229 handle_split_stack_section.
7230 * reloc.cc (Sized_relobj::relocate_sections): Call
7231 split_stack_adjust for executable sections in split_stack
7232 objects. Pass reloc_map to relocate_section.
7233 (Sized_relobj::split_stack_adjust): New function.
7234 (Sized_relobj::split_stack_adjust_reltype): New function.
7235 (Sized_relobj::find_functions): New function.
7236 * target-reloc.h: Include "object.h".
7237 (relocate_section): Add reloc_symbol_changes parameter. Change
7239 * target.h (class Target): Add calls_non_split method. Declare
7240 do_calls_non_split virtual method. Declare match_view and
7242 * target.cc: Include "elfcpp.h".
7243 (Target::do_calls_non_split): New function.
7244 (Target::match_view): New function.
7245 (Target::set_view_to_nop): New function.
7246 * gold.cc (queue_middle_tasks): Give an error if mixing
7247 split-stack and non-split-stack objects with -r.
7248 * i386.cc (Target_i386::relocate_section): Add
7249 reloc_symbol_changes parameter.
7250 (Target_i386::do_calls_non_split): New function.
7251 * x86_64.cc (Target_x86_64::relocate_section): Add
7252 reloc_symbol_changes parameter.
7253 (Target_x86_64::do_calls_non_split): New function.
7254 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
7256 * powerpc.cc (Target_powerpc::relocate_section): Add
7257 reloc_symbol_changes parameter.
7258 * sparc.cc (Target_sparc::relocate_section): Add
7259 reloc_symbol_changes parameter.
7260 * configure.ac: Call AM_CONDITIONAL for the default target.
7261 * configure: Rebuild.
7262 * testsuite/Makefile.am (TEST_AS): New variable.
7263 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
7264 (check_DATA): Add split_i386 and split_x86_64 files.
7265 (SPLIT_DEFSYMS): Define.
7266 (split_i386_[1234n].o): New targets.
7267 (split_i386_[124]): New targets.
7268 (split_i386_[1234r].stdout): New targets.
7269 (split_x86_64_[1234n].o): New targets.
7270 (split_x86_64_[124]): New targets.
7271 (split_x86_64_[1234r].stdout): New targets.
7272 (MOSTLYCLEANFILES): Add new executables.
7273 * testsuite/split_i386.sh: New file.
7274 * testsuite/split_x86_64.sh: New file.
7275 * testsuite/split_i386_1.s: New file.
7276 * testsuite/split_i386_2.s: New file.
7277 * testsuite/split_i386_3.s: New file.
7278 * testsuite/split_i386_4.s: New file.
7279 * testsuite/split_i386_n.s: New file.
7280 * testsuite/split_x86_64_1.s: New file.
7281 * testsuite/split_x86_64_2.s: New file.
7282 * testsuite/split_x86_64_3.s: New file.
7283 * testsuite/split_x86_64_4.s: New file.
7284 * testsuite/split_x86_64_n.s: New file.
7285 * testsuite/testfile.cc (Target_test): Update relocation_section
7287 * testsuite/Makefile.in: Rebuild.
7289 2009-10-06 Ian Lance Taylor <iant@google.com>
7291 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
7292 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
7293 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
7294 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
7295 the address on ldo_addrs_.
7296 (Target_i386::Relocate::fix_up_ldo): New function.
7298 2009-10-06 Rafael Espindola <espindola@google.com>
7300 * plugin.cc (add_input_library): New.
7301 (Plugin::load): Add add_input_library to tv.
7302 (Plugin_manager::add_input_file): Add the is_lib argument.
7303 (add_input_file): Update call to Plugin_manager::add_input_file.
7304 (add_input_library): New.
7305 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
7307 2009-09-30 Doug Kwan <dougkwan@google.com>
7309 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
7310 symbol and call Symbol::may_need_copy_reloc to determine if
7311 a copy reloc is needed.
7312 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
7313 nocopyreloc is given in command line.
7314 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
7315 given in command line.
7316 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
7317 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
7318 of the removed Target_i386::may_need_copy_reloc.
7319 * options.h (copyreloc): New option with default value false.
7320 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
7321 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
7322 instead of the removed Target_powerpc::may_need_copy_reloc.
7323 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
7324 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
7325 instead of the removed Target_sparc::may_need_copy_reloc.
7326 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
7327 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
7328 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
7329 instead of the removed Target_x86_64::may_need_copy_reloc.
7331 2009-09-30 Ian Lance Taylor <iant@google.com>
7333 * object.h (class Object): Remove target_ field, and target,
7334 sized_target, and set_target methods.
7335 (Object::sized_target): Remove.
7336 (class Sized_relobj): Update declarations. Remove sized_target.
7337 * object.cc (Sized_relobj::setup): Remove target parameter.
7339 (Input_objects::add_object): Don't do anything with the target.
7340 (make_elf_sized_object): Add punconfigured parameter. Change all
7341 callers. Set or test parameter target.
7342 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
7344 * parameters.cc (Parameters::set_target): Change parameter type to
7346 (Parameters::default_target): Remove.
7347 (set_parameters_target): Change parameter type to be non-const.
7348 (parameters_force_valid_target): New function.
7349 (parameters_clear_target): New function.
7350 * parameters.h (class Parameters): Update declarations. Remove
7351 default_target method. Add sized_target and clear_target
7352 methods. Change target_ to be non-const.
7353 (set_parameters_target): Update declaration.
7354 (parameters_force_valid_target): Declare.
7355 (parameters_clear_target): Declare.
7356 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
7357 as NULL if we aren't searching.
7358 (Add_symbols::run): Don't check for compatible target.
7359 * fileread.cc (Input_file::open_binary): Call
7360 parameters_force_valid_target.
7361 * gold.cc (queue_middle_tasks): Likewise.
7362 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
7363 set_target on object.
7364 * dynobj.h (class Sized_dynobj): Update declarations.
7365 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
7366 make_elf_object returns NULL.
7367 (Archive::include_member): Don't check whether object target is
7369 * output.cc (Output_section::add_input_section): Get target from
7371 (Output_section::relax_input_section): Likewise.
7372 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
7374 (Sized_relobj::do_scan_relocs): Likewise.
7375 (Sized_relobj::relocate_sections): Likewise.
7376 * resolve.cc (Symbol_table::resolve): Likewise.
7377 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
7378 parameter. Change all callers.
7379 (Symbol_table::add_from_object): Get target from parameters.
7380 (Symbol_table::add_from_relobj): Don't check object target.
7381 (Symbol_table::add_from_dynobj): Likewise.
7382 (Symbol_table::define_special_symbol): Get target from
7384 * symtab.h (class Symbol_table): Update declaration.
7385 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
7386 parameter. Change all callers. Clear parameter target.
7387 (Binary_test): Test target here.
7388 * testsuite/object_unittest.cc (gold_testsuite): Remove
7389 target_test_pointer parameter. Change all callers.
7390 (Object_test): Test target here.
7392 2009-09-26 Ian Lance Taylor <iant@google.com>
7394 * testsuite/initpri1.c: Don't try to use constructor priorities if
7395 compiling with gcc before 4.3.
7397 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
7399 * testsuite/retain_symbols_file_test.sh (check_present): Change
7400 output file name to retain_symbols_file_test.stdout.
7401 (check_absent): Likewise.
7403 2009-09-18 Craig Silverstein <csilvers@google.com>
7405 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
7406 * options.cc: Include <cerrno> and <fstream>.
7407 (General_options::finalize): Parse -retain-symbols-file tag.
7408 * options.h: New flag.
7409 (General_options): New method should_retain_symbol, new
7410 variable symbols_to_retain.
7411 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
7412 should_retain_symbol map.
7413 * testsuite/Makefile.am (retain_symbols_file_test): New test.
7414 * testsuite/Makefile.in: Regenerate.
7415 * testsuite/retain_symbols_file_test.sh: New file.
7417 2009-09-18 Nick Clifton <nickc@redhat.com>
7419 * po/es.po: Updated Spanish translation.
7421 2009-09-17 Doug Kwan <dougkwan@google.com>
7423 * debug.h (DEBUG_RELAXATION): New constant.
7424 (DEBUG_ALL): Add DEBUG_RELAXATION.
7425 (debug_string_to_enum): Add relaxation debug option.
7427 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
7428 Layout::Relaxation_debug_check::read_sections,
7429 Layout::Relaxation_debug_check::read_sections): New method definitions.
7430 (Layout::Layout): Initialize data members
7431 record_output_section_data_from_scrips_,
7432 script_output_section_data_list_ and relaxation_debug_check_.
7433 (Layout::save_segments, Layout::restore_segments,
7434 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7435 Layout::relaxation_loop_body): New method definitions.
7436 (Layout::finalize): Support relaxation. Move section layout code to
7437 Layout::relaxation_loop_body.
7438 (Layout::set_asection_address_from_script): Move code for orphan
7439 section placement out.
7440 (Layout::place_orphan_sections_in_script): New method definition.
7441 * layout.h (Output_segment_headers, Output_file_header):
7442 New forward class declarations.
7443 (Layout::~Layout): Define.
7444 (Layout::new_output_section_data_from_script): New method definition.
7445 (Layout::place_orphan_sections_in_script): New method declaration.
7446 (Layout::Segment_states): New type declaration.
7447 (Layout::save_segments, Layout::restore_segments,
7448 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7449 Layout::relaxation_loop_body): New method declarations.
7450 (Layout::Output_section_data_list): New type declaration.
7451 (Layout::Relaxation_debug_check): New class definition.
7452 (Layout::record_output_section_data_from_script_,
7453 Layout::script_output_section_data_list_, Layout::segment_states_,
7454 Layout::relaxation_debug_check_): New data members.
7455 * output.cc: (Output_section_headers::do_size): New method definition.
7456 (Output_section_headers::Output_section_headers): Move size
7457 computation to Output_section_headers::do_size.
7458 (Output_segment_headers::do_size): New method definition.
7459 (Output_file_header::Output_file_header): Move size computation to
7460 Output_file_header::do_size and call it.
7461 (Output_file_header::do_size): New method definition.
7462 (Output_data_group::Output_data_group): Adjust call to
7463 Output_section_data.
7464 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
7465 (Output_symtab_xindex::do_write): Add array bound check.
7466 (Output_section::Input_section::print_to_mapfile): Handle
7467 RELAXED_INPUT_SECTION_CODE.
7468 (Output_section::Output_section): Initialize data member checkpoint_.
7469 (Output_section::~Output_section): Delete checkpoint object pointed
7471 (Output_section::add_input_section): Always add an Input_section if
7473 (Output_section::add_merge_input_section): Add assert.
7474 (Output_section::relax_input_section): New method definition.
7475 (Output_section::set_final_data_size): Set load address to zero for
7476 an unallocated section.
7477 (Output_section::do_address_and_file_offset_have_reset_values):
7478 New method definition.
7479 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
7480 Handle relaxed input section.
7481 (Output_section::sort_attached_input_sections): Checkpoint input
7482 section list lazily.
7483 (Output_section::get_input_sections): Change type of input_sections to
7484 list of Simple_input_section pointers. Checkpoint input section list
7485 lazily. Also handle relaxed input sections.
7486 (Output_section::add_input_section_for_script): Take a reference to
7487 a Simple_input_section object instead of Relobj pointer and section
7488 index as parameter. Handle relaxed input sections.
7489 (Output_section::save_states, Output_section::restore_states): New
7491 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
7492 (Output_data::is_data_size_fixed): New method definition.
7493 (Output_data::reset_addresss_and_file_offset): Do not reset data size
7495 (Output_data::address_and_file_offset_have_reset_values): New method
7497 (Output_data::do_address_and_file_offset_have_reset_values): New method
7499 (Output_data::set_data_size): Check that data size is not fixed.
7500 (Output_data::fix_data_size): New method definition.
7501 (Output_data::is_data_size_fixed_): New data member.
7502 (Output_section_headers::set_final_data_size): New method definition.
7503 (Output_section_headers::do_size): New method declaration.
7504 (Output_segment_headers::set_final_data_size): New method definition.
7505 (Output_segment_headers::do_size): New method declaration.
7506 (Output_file_header::set_final_data_size)::New method definition.
7507 (Output_file_header::do_size)::New method declaration.
7508 (Output_section_data::Output_section_data): Add new parameter
7509 is_data_size_fixed and use it to fix data size.
7510 (Output_data_const::Output_data_const): Adjust call to base class
7511 constructor and fix data size.
7512 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
7513 base class constructor and fix data size.
7514 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
7515 base class constructor and fix data size.
7516 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
7517 class constructor and fix data size.
7518 (Output_data_group::set_final_data_size): New method definition.
7519 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
7520 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
7521 class constructor and fix data size.
7522 (Output_relaxed_input_section): New class definition.
7523 (Output_section::Simple_input_section): New class definition.
7524 (Output_section::get_input_sections): Adjust parameter list.
7525 (Output_section::add_input_section_for_script): Same.
7526 (Output_section::save_states, Output_section::restore_states,
7527 Output_section::do_address_and_file_offset_have_reset_values,
7528 (Output_section::Input_section::Input_section): Handle
7529 RELAXED_INPUT_SECTION_CODE. Add new overload for
7530 Output_relaxed_input_section.
7531 (Output_section::Input_section::is_input_section,
7532 Output_section::Input_section::set_output_section): Handle relaxed
7534 (Output_section::Input_section::is_relaxed_input_section,
7535 Output_section::Input_section::output_section_data,
7536 Output_section::Input_section::relaxed_input_section): New method
7538 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
7540 (Output_section::Input_section::u1_): Update comments.
7541 (Output_section::Input_section::u2_): Add new union member poris.
7542 (Output_section::Checkpoint_output_section): New classs definition.
7543 (Output_section::relax_input_section): New method declaration.
7544 (Output_section::checkpoint_): New data member.
7545 (Output_segment): Update comments.
7546 (Output_segment::Output_segment): Un-privatize copy constructor.
7547 (Output_segment::operator=): Un-privatize.
7548 * script-sections.cc (Output_section_element::Input_section_list):
7549 Change element type to Output_section::Simple_input_section.
7550 (Output_section_element_dot_assignment::set_section_addresses):
7551 Register output section data for relaxation clean up.
7552 (Output_data_exression::Output_data_expression): Adjust call to base
7553 constructor to fix data size.
7554 (Output_section_element_data::set_section_addresses): Register
7555 Output_data_expression object for relaxation clean up.
7556 (struct Input_section_info): Replace Relobj pointer and section index
7557 pair with Output_section::Simple_input_section and Convert struct to a
7559 (Input_section_sorter::operator()): Adjust access to
7560 Input_section_info data member to use accessors.
7561 (Output_section_element_input::set_section_addresses): Use layout
7562 parameter. Adjust code to use Output_section::Simple_input_section
7563 and Input_secction_info classes. Register filler for relaxation
7565 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
7566 and section index pair with Output_section::Simple_input_section
7567 class. Adjust code accordingly.
7568 (Phdrs_element::release_segment): New method definition.
7569 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
7571 (Script_sections::release_segments): New method definition.
7572 * gold/script-sections.h (Script_sections::release_segments): New
7574 * gold/target.h (Target::may_relax, Target::relax,
7575 Target::do_may_relax, Target::do_relax): New method definitions.
7577 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7579 * arm.cc (has_signed_unsigned_overflow): New function.
7580 (Arm_relocate_functions::abs8): New function.
7581 (Target_arm::Scan::local): Handle R_ARM_ABS8.
7582 (Target_arm::Scan::global): Likewise.
7583 (Target_arm::relocate::relocate): Likewise.
7584 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7587 2009-09-16 Cary Coutant <ccoutant@google.com>
7589 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
7590 * testsuite/Makefile.in: Regenerate.
7592 2009-09-11 Nick Clifton <nickc@redhat.com>
7594 * po/gold.pot: Updated by the Translation project.
7596 2009-09-08 Cary Coutant <ccoutant@google.com>
7598 * output.cc (Output_file::open): Add execute permission to empty file.
7599 * testsuite/Makefile.am (permission_test): New test.
7600 * testsuite/Makefile.in: Regenerate.
7602 2009-09-02 Ian Lance Taylor <iant@google.com>
7604 * output.cc (Output_file::resize): Call map_no_anonymous rather
7607 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
7609 * gold.cc: Include "incremental.h".
7610 (queue_initial_tasks): Call Incremental_checker methods.
7611 * incremental.cc: Include "output.h".
7612 (Incremental_checker::can_incrementally_link_output_file): New
7614 * incremental.h (Incremental_checker): New class.
7616 * output.cc (Output_file::open_for_modification): New method.
7617 (Output_file::map_anonymous): Changed return type to bool. Record
7619 (Output_file::map_no_anonymous): New method, broken out of map.
7620 (Output_file::map): Use map_no_anonymous and map_anonymous.
7621 * output.h (class Output_file): Update declarations.
7623 2009-08-24 Cary Coutant <ccoutant@google.com>
7625 * options.h (Command_line::Pre_options): New class.
7626 (Command_line::pre_options): New member.
7627 * options.cc (gold::options::ready_to_register): New variable.
7628 (One_option::register_option): Do nothing if not registering options.
7629 Assert if same short option registered twice.
7630 (General_options::General_options): Turn off option registration when
7632 (Command_line::Pre_options::Pre_options): New constructor.
7634 2009-08-24 Cary Coutant <ccoutant@google.com>
7636 * options.h (General_options::no_keep_memory): Remove incorrect
7639 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7641 * Makefile.am (am__skiplex, am__skipyacc): New.
7642 * Makefile.in: Regenerate.
7644 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7646 * Makefile.am (AM_CPPFLAGS): Renamed from ...
7647 (INCLUDES): ... this.
7648 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
7649 (AM_CPPFLAGS): Renamed from ...
7650 (INCLUDE): ... this.
7651 * Makefile.in, testsuite/Makefile.in: Regenerate.
7653 * Makefile.in: Regenerate.
7654 * aclocal.m4: Likewise.
7655 * config.in: Likewise.
7656 * configure: Likewise.
7657 * testsuite/Makefile.in: Likewise.
7659 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7660 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7661 * Makefile.in: Regenerate.
7662 * testsuite/Makefile.in: Regenerate.
7664 2009-08-19 Cary Coutant <ccoutant@google.com>
7666 * resolve.cc (Symbol_table::resolve): Don't complain about defined
7667 symbols in shared libraries overridden by hidden or internal symbols
7668 in the main program.
7670 2009-08-19 Chris Demetriou <cgd@google.com>
7672 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
7673 checking source file names in error messages.
7675 2009-08-18 Doug Kwan <dougkwan@google.com>
7677 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
7678 an elcpp::Ehdr as parameter. Adjust call to set_target.
7679 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
7680 an elfcpp::Ehdr as parameter.
7681 * object.cc (Object::set_target): Remove the version that looks up
7682 a target and sets it.
7683 (Sized_relobj::setup): Take a Target object instead of
7684 an elfcpp::Ehdr as parameter. Adjust call to set_target.
7685 (make_elf_sized_object): Find target and ask target to
7687 * object.h: (Object::set_target): Remove the version that looks up
7688 a target and sets it.
7689 (Sized_relobj::setup): Take a Target object instead of
7690 an elfcpp:Ehdr as parameter.
7691 * target.cc: Include dynobj.h.
7692 (Target::do_make_elf_object_implementation): New.
7693 (Target::do_make_elf_object): New.
7694 * target.h (Target::make_elf_object): New template declaration.
7695 (Target::do_make_elf_object): New method declarations.
7696 (Target::do_make_elf_object_implementation): New template declaration.
7698 2009-08-14 Ian Lance Taylor <iant@google.com>
7700 * gold.h (FUNCTION_NAME): Define.
7701 (gold_unreachable): Use FUNCTION_NAME.
7703 2009-08-12 Sriraman Tallam <tmsriram@google.com>
7705 * icf.cc (Icf::find_identical_sections): Issue a warning when a
7706 symbol in the --keep-unique list is not found.
7708 2009-08-12 Sriraman Tallam <tmsriram@google.com>
7710 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
7711 been maked as --keep-unique.
7712 (Icf::unfold_section): New function.
7713 * icf.h (Icf::unfold_section): New function.
7714 * options.h (General_options::keep_unique): New option.
7715 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
7716 * testsuite/Makefile.in: Regenerate.
7717 * testsuite/icf_keep_unique_test.sh: New file.
7718 * testsuite/icf_keep_unique_test.cc: New file.
7720 2009-08-12 Cary Coutant <ccoutant@google.com>
7723 * resolve.cc (Symbol_table::resolve): Check for references from
7724 dynamic objects to hidden and internal symbols.
7725 * testsuite/Makefile.am (hidden_test.sh): New test.
7726 * testsuite/Makefile.in: Regenerate.
7727 * testsuite/hidden_test.sh: New script.
7728 * testsuite/hidden_test_1.c: New test source.
7729 * testsuite/hidden_test_main.c: New test source.
7731 2009-08-11 Doug Kwan <dougkwan@google.com>
7733 * arm.cc: Update comments.
7734 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
7735 segment to locate the .ARM.exidx section if present.
7737 2009-08-09 Doug Kwan <dougkwan@google.com>
7739 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
7742 2009-08-07 Sriraman Tallam <tmsriram@google.com>
7743 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
7746 2009-08-06 Sriraman Tallam <tmsriram@google.com>
7748 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
7749 valid tls_segment only for non-debug-section relocations.
7750 * testsuite/Makefile.am: Add gc_tls_test.
7751 * testsuite/Makefile.in: Regenerate.
7752 * testsuite/gc_tls_test.cc: New file.
7753 * testsuite/gc_tls_test.sh: New file.
7755 2009-08-05 Sriraman Tallam <tmsriram@google.com>
7759 * Makefile.am (CCFILES): Add icf.cc.
7761 * Makefile.in: Regenerate.
7762 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
7763 * gc.h (gc_process_relocs): Populate lists used by icf to contain
7764 section, symbol and addend information for the relocs.
7765 * gold.cc (queue_middle_tasks): Call identical code folding.
7766 * gold.h: Add defines for multimap.
7767 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
7768 to the call of finalize_local_symbols.
7769 * main.cc (main): Create object of class Icf.
7770 * object.cc (Sized_relobj::do_layout): Allow this function to be
7771 called twice during icf.
7772 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
7773 to sections marked as identical by icf.
7774 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
7776 (Sized_relobj::do_section_entsize): New function.
7777 * object.h (Object::section_entsize): New function.
7778 (Object::do_section_entsize): New pure virtual function.
7779 (Relobj::finalize_local_symbols): Add new parameter.
7780 (Relobj::do_section_entsize): New function.
7781 * options.h (General_options::icf): New option.
7782 (General_options::icf_iterations): New option.
7783 (General_options::print_icf_sections): New option.
7784 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
7785 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
7786 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
7788 * symtab.cc (Symbol_table::is_section_folded): New function.
7789 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
7790 to sections marked as identical by icf.
7791 * symtab.h (Symbol_table::set_icf): New function.
7792 (Symbol_table::icf): New function.
7793 (Symbol_table::is_section_folded): New function.
7794 (Symbol_table::icf_): New data member.
7795 * target-reloc.h (relocate_section): Ignore sections folded by icf.
7796 * testsuite/Makefile.am: Add commands to build icf_test.
7797 * testsuite/Makefile.in: Regenerate.
7798 * testsuite/icf_test.sh: New file.
7799 * testsuite/icf_test.cc: New file.
7801 2009-07-24 Chris Demetriou <cgd@google.com>
7803 * layout.cc (is_compressible_debug_section): Fix incorrect
7804 comment about compressed section names.
7806 2009-07-20 Ian Lance Taylor <ian@airs.com>
7809 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
7811 2009-07-16 Ian Lance Taylor <iant@google.com>
7814 * layout.h: #include <map>.
7815 (class Kept_section): Change from struct to class. Add accessors
7816 and setters. Add section size to Comdat_group mapping. Change
7817 Comdat_group to std::map. Add is_comdat_ field. Add
7818 linkonce_size field in union.
7819 (class Layout): Update declaration of find_or_add_kept_section.
7820 Don't declare find_kept_object.
7821 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
7822 parameter. Add object, shndx, is_comdat, and is_group_name
7823 parameters. Change all callers. Adjust for new Kept_section.
7824 (Layout::find_kept_object): Remove.
7825 * object.cc (Sized_relobj::include_section_group): Update use of
7826 Kept_section. Rename secnum to shndx. Only record
7827 Kept_comdat_section if sections are the same size.
7828 (Sized_relobj::include_linkonce_section): Update use of
7829 Kept_section. Only record Kept_comdat_section if sections are the
7830 same size. Set size of linkonce section.
7831 (Sized_relobj::map_to_kept_section): Update call to
7832 get_kept_comdat_section.
7833 * object.h (class Sized_relobj): Rename fields in
7834 Kept_comdat_section to drop trailing underscores; change object
7835 field to Relobj*. Change Kept_comdat_section_table to store
7836 struct rather than pointer.
7837 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
7838 Add kept_object and kept_shndx parameters. Change all callers.
7839 (Sized_relobj::get_kept_comdat_section): Change return type to
7840 bool. Add kept_object and kept_shndx parameters. Change all
7842 * plugin.cc (Pluginobj::include_comdat_group): Update call to
7843 Layout::find_or_add_kept_section.
7845 2009-07-09 Ian Lance Taylor <iant@google.com>
7847 * merge.cc (Object_merge_map::initialize_input_to_output_map):
7848 Reserve space in the hash table.
7850 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
7852 * fileread.cc (File_read::get_mtime): New method.
7853 * fileread.h (Timespec): New structure.
7854 (File_read::get_mtime): New method.
7855 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
7856 Renamed from timestamp_nsec.
7857 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
7859 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
7861 (Incremental_inputs::report_archive): Save mtime; style fix.
7862 (Incremental_inputs::report_obejct): Save mtime; style fix.
7863 (Incremental_inputs::report_script): Save mtime; style fix.
7864 (Incremental_inputs::finalize_inputs): Style fix.
7865 (Incremental_inputs::finalize): Style fix.
7866 (Incremental_inputs::create_input_section_data): Store inputs
7868 * incremental.h (Incremental_inputs::report_script): Add mtime
7870 (Incremental_inputs::Input_info::Input_info): Intialize only one
7872 (Incremental_inputs::Input_info::archive): Move to nameless
7874 (Incremental_inputs::Input_info::obejct): Move to nameless union.
7875 (Incremental_inputs::Input_info::script): Move to nameless union.
7876 (Incremental_inputs::mtime): New field.
7877 * script.cc (read_input_script): Pass file mtime to
7879 * script.h (Script_info::inputs): Style fix.
7881 2009-07-01 Ian Lance Taylor <ian@airs.com>
7883 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
7886 2009-06-24 Ian Lance Taylor <iant@google.com>
7889 * layout.cc (Layout::choose_output_section): If we find an
7890 existing section, update the flags.
7891 (Layout::create_notes): New function, broken out of
7893 (Layout::finalize): Don't create note sections.
7894 (Layout::create_note): Don't crash if linker script discards
7896 (Layout::create_gold_note): Likewise.
7897 (Layout::create_build_id): Likewise. Don't set
7898 after_input_sections on the section.
7899 (Layout::create_executable_stack_info): Remove target parameter.
7901 * layout.h (class Layout): Declare create_notes. Update
7902 declaration of create_executable_stack_info.
7903 * gold.cc (queue_middle_tasks): Call create_notes.
7904 * output.cc (Output_section::update_flags_for_input_section): Move
7905 here from output.h. If SHF_ALLOC flag is newly set, mark address
7907 * output.h (Output_data::mark_address_invalid): New function.
7908 (class Output_section): Only declare, not define,
7909 update_flags_for_input_section. Remove set_flags.
7911 2009-06-24 Ian Lance Taylor <iant@google.com>
7913 * script-sections.cc (Output_section_definition::
7914 set_section_addresses): Rename shadowing local load_address to
7917 2009-06-24 Ian Lance Taylor <iant@google.com>
7920 * reloc.cc (relocate_sections): Skip empty relocation sections.
7922 2009-06-23 Ian Lance Taylor <iant@google.com>
7925 * layout.cc (Layout::create_note): Use choose_output_section
7926 rather than make_output_section.
7928 2009-06-23 Ian Lance Taylor <iant@google.com>
7931 * options.cc (General_options::parse_V): Set printed_version_.
7932 (General_options::General_options): Initialize printed_version_.
7933 * options.h (class General_options): Add printed_version_ field.
7934 * gold.cc (queue_initial_tasks): If there are no input files,
7935 don't give a fatal error if we printed the version information.
7936 (queue_middle_tasks): If using -r with a shared object, give a
7937 fatal error rather than an ordinary error.
7939 2009-06-23 Ian Lance Taylor <iant@google.com>
7942 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
7943 (Layout::make_output_section): Set have_stabstr_section_ if we see
7944 a .stab*str section.
7945 (Layout::finalize): Call link_stabs_sections.
7946 (Layout::link_stabs_sections): New file.
7947 * layout.h (class Layout): Add have_stabstr_section_ field.
7948 Declare link_stabs_sections.
7950 2009-06-23 Doug Kwan <dougkwan@google.com>
7952 * Makefile.am (libgold_a_LIBADD): New.
7953 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
7954 * Makefile.in: Regenerate.
7955 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
7956 * configure: Regenerate.
7957 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
7958 * fileread.cc: Include sys/state.h
7959 * gold.h: Declare memmem and strndup if found missing.
7960 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
7962 2009-06-23 Ian Lance Taylor <iant@google.com>
7964 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
7965 * configure: Rebuild.
7967 2009-06-23 Ian Lance Taylor <iant@google.com>
7970 * object.cc (Object::section_contents): Don't try to get a view if
7971 the section has length zero.
7972 (Object::handle_gnu_warning_section): If the section is empty, use
7973 the name of the section as the warning.
7975 2009-06-23 Ian Lance Taylor <iant@google.com>
7978 * stringpool.h (class Stringpool_template): Add optimize_ field.
7979 (Stringpool_template::set_optimize): New function.
7980 * stringpool.cc (Stringpool_template::Stringpool_template):
7981 Initialize optimize_ field.
7982 (Stringpool_template::set_string_offsets): Test local optimize
7983 fild rather than parameter.
7984 * layout.cc (Layout::Layout): Call set_optimize on the section
7987 2009-06-22 Ian Lance Taylor <iant@google.com>
7990 * yyscript.y: Parse TARGET.
7991 * script.cc (script_set_target): New function.
7992 * script-c.h (script_set_target): Declare.
7993 * options.cc (General_options::string_to_object_format): Rename
7994 from string_to_object_format in anonymous namespace. Change
7996 * options.h (class General_options): Declare
7997 string_to_object_format.
7999 2009-06-22 Ian Lance Taylor <iant@google.com>
8001 * script-sections.cc (Script_sections::create_segments): Don't put
8002 program headers in a PT_LOAD segment if -n or -N.
8004 2009-06-22 Ian Lance Taylor <iant@google.com>
8007 * options.h (class General_options): Add -z lazy and -z now. Sort
8008 -z options into alphabetical order.
8009 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
8011 2009-06-21 Ian Lance Taylor <iant@google.com>
8013 * layout.cc (Layout::make_output_section): Call
8014 Target::new_output_section.
8015 (Layout::attach_allocated_section_to_segment): Put large section
8016 sections in a separate load segment with the large segment flag
8018 (Layout::segment_precedes): Sort large data segments after other
8020 (align_file_offset): New static function.
8021 (Layout::set_segment_offsets): Use align_file_offset.
8022 * output.h (class Output_section): Add is_small_section_ and
8023 is_large_section_ fields.
8024 (Output_section::is_small_section): New function.
8025 (Output_section::set_is_small_section): New function.
8026 (Output_section::is_large_section): New function.
8027 (Output_section::set_is_large_section): New function.
8028 (Output_section::is_large_data_section): New function.
8029 (class Output_segment): Add is_large_data_segment_ field.
8030 (Output_segment::is_large_data_segment): New function.
8031 (Output_segment::set_is_large_data_segment): New function.
8032 * output.cc (Output_section::Output_section): Initialize new
8034 (Output_segment::Output_segment): Likewise.
8035 (Output_segment::add_output_section): Add assertion that large
8036 data sections always go in large data segments. Force small data
8037 sections to the end of the list of data sections. Force small BSS
8038 sections to the start of the list of BSS sections. For large BSS
8039 sections to the end of the list of BSS sections.
8040 * symtab.h (class Symbol): Declare is_common_shndx.
8041 (Symbol::is_defined): Check Symbol::is_common_shndx.
8042 (Symbol::is_common): Likewise.
8043 (class Symbol_table): Define enum Commons_section_type. Update
8044 declarations. Add small_commons_ and large_commons_ fields.
8045 * symtab.cc (Symbol::is_common_shndx): New function.
8046 (Symbol_table::Symbol_table): Initialize new fields.
8047 (Symbol_table::add_from_object): Put small and large common
8048 symbols in the right list.
8049 (Symbol_table::sized_finalized_symbol): Check
8050 Symbol::is_common_shndx.
8051 (Symbol_table::sized_write_globals): Likewise.
8052 * common.cc (Symbol_table::do_allocate_commons): Allocate new
8053 common symbol lists. Don't call do_allocate_commons_list if the
8055 (Symbol_table::do_allocate_commons_list): Remove is_tls
8056 parameter. Add comons_section_type parameter. Change all
8057 callers. Handle small and large common symbols.
8058 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
8059 Symbol::is_common_shndx.
8060 * resolve.cc (symbol_to_bits): Likewise.
8061 * target.h (Target::small_common_shndx): New function.
8062 (Target::small_common_section_flags): New function.
8063 (Target::large_common_shndx): New function.
8064 (Target::large_common_section_flags): New function.
8065 (Target::new_output_section): New function.
8066 (Target::Target_info): Add small_common_shndx, large_common_shndx,
8067 small_common_section_flags, and large_common_section_flags
8069 (Target::do_new_output_section): New virtual function.
8070 * arm.cc (Target_arm::arm_info): Initialize new fields.
8071 * i386.cc (Target_i386::i386_info): Likewise.
8072 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
8074 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
8075 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
8076 (Target_x86_64::do_new_output_section): New function.
8077 * configure.ac: Define conditional MCMODEL_MEDIUM.
8078 * testsuite/Makefile.am (check_PROGRAMS): Add large.
8079 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
8080 (large_LDFLAGS): Define.
8081 * testsuite/large.c: New file.
8082 * testsuite/testfile.cc (Target_test::test_target_info):
8083 Initialize new fields.
8084 * configure, testsuite/Makefile.in: Rebuild.
8086 2009-06-05 Doug Kwan <dougkwan@google.com>
8088 * Makefile.am (CCFILES): Add target.cc.
8089 * Makefile.in: Regenerate.
8090 * i386.cc (class Target_i386): Define new virtual method to
8091 override do_is_local_label_name in parent.
8092 * object.cc (Sized_relobj::do_count_local_symbols): Discard
8093 local symbols if --discard-locals or -X is given.
8094 * options.h (class General_options): Declare new options
8095 '--discard-locals' and '-X' for discarding locals.
8096 * target.h (class Target): Define new methods is_local_label_name.
8097 Declare new virtual method do_is_local_label_name.
8098 * target.cc: New file.
8099 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
8100 (check_SCRIPTS): Add discard_locals_test.sh.
8101 (check_DATA): Add discard_local_tests.syms.
8102 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
8103 (discard_local_tests.syms, discard_locals_test.o): New make rules.
8104 * testsuite/Makefile.in: Regenerate.
8105 * testsuite/discard_locals_test.c: New file.
8106 * testsuite/discard_locals_test.sh: Same.
8108 2009-06-05 Doug Kwan <dougkwan@google.com>
8110 * object.cc (Sized_relobj::Sized_relobj): Initialize
8111 discarded_eh_frame_shndx_ to -1U.
8112 (Sized_relobj::do_layout): Record index of a discard .eh_frame
8114 (Sized_relobj::do_count_local_symbols): Skip local symbols in
8115 a discarded .eh_frame section.
8116 (Sized_relobj::do_finalize_local_symbols): Ditto.
8117 * object.h (class Sized_relobj): Declare new member
8118 discarded_eh_frame_shndx_.
8119 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
8120 (local_labels_test.o, local_labels_test): New rules.
8121 * testsuite/Makefile.in: Regenerate.
8123 2009-06-04 Doug Kwan <dougkwan@google.com>
8125 * layout.cc (Layout::section_name_mapping): Add mapping for
8126 special ARM sections.
8128 2009-06-03 Doug Kwan <dougkwan@google.com>
8130 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
8131 (utils::has_overflow): Same.
8133 2009-06-03 Ian Lance Taylor <iant@google.com>
8135 * layout.cc (Layout::section_name_mapping): New array, replacing
8136 Layout::linkonce_mapping.
8137 (Layout::section_name_mapping_count): New variable, replacing
8138 Layout::linkonce_mapping_count.
8139 (Layout::linkonce_output_name): Remove.
8140 (Layout::output_section_name): Rewrite.
8141 * layout.h (class Layout): Rename Linkonce_mapping to
8142 Section_name_mapping, linkonce_mapping to section_name_mapping,
8143 linkonce_mapping_count to section_name_mapping_count. Don't
8144 declare linkonce_output_name.
8146 2009-06-03 Doug Kwan <dougkwan@google.com>
8148 * gold/arm.cc (namespace utils): New.
8149 (Target_arm::reloc_is_non_pic): Define new method.
8150 (class Arm_relocate_functions): New.
8151 (Target_arm::Relocate::relocate): Handle relocation types used by
8154 2009-06-03 Ian Lance Taylor <iant@google.com>
8156 * arm.cc (Target_arm::scan::global): Use || instead of |.
8158 2009-06-02 Doug Kwan <dougkwan@google.com>
8160 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
8161 issued_non_pic_error_.
8162 (class Target_arm::Scan): Declare new method check_non_pic.
8163 Define new method symbol_needs_plt_entry.
8164 Declare new data member issued_non_pic_error_.
8165 (class Target_arm::Relocate): Declare new method
8166 should_apply_static_reloc.
8167 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
8168 (Target_arm::Scan::check_non_pic): Define new method.
8169 (Target_arm::Scan::local): Handle a small subset of reloc types used
8171 (Target_arm::Scan::local): Same.
8172 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
8174 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
8176 * incremental.cc (Incremental_inputs::report_command_line): Filter
8177 out --incremental-* options.
8179 2009-05-29 Doug Kwan <dougkwan@google.com>
8181 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
8183 (class Target_arm): Update comment.
8184 (Target_arm::Target_arm): Initialize new data members GOT_,
8185 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
8186 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
8187 and Target_arm::rel_dyn_section.
8188 Declare new_enum Target_arm::Got_type.
8189 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
8191 Update commments for member do_dynsym_value.
8192 (Target_arm::got_size, Target_arm::plt_section,
8193 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
8194 new methods inside class defintion.
8195 (Target_arm::got_section): Define new method.
8196 (Target_arm::rel_dyn_section): Same.
8197 (Output_data_plt_arm): New template class.
8198 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
8199 (Output_data_plt_arm:do_adjust_output_section): Define new method.
8200 (Output_data_plt_arm::add_entry): Same.
8201 (Output_data_plt_arm::first_plt_entry): Define new
8202 static data member for PLT instruction template.
8203 (Output_data_plt_arm::plt_entry): Same.
8204 (Output_data_plt_arm::do_write): Define new method.
8205 (Target_arm::make_plt_entry): Same.
8206 (Target_arm::do_finalize_sections): Same.
8207 (Target_arm::do_dynsym_value): Same.
8209 2009-05-28 Doug Kwan <dougkwan@google.com>
8211 * Makefile.am (TARGETSOURCES): Add arm.cc.
8212 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
8213 * Makefile.in: Regenerate.
8215 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
8217 2009-05-26 Doug Kwan <dougkwan@google.com>
8219 * options.cc (General_options::parse_exclude_libs). Fix a comment.
8220 (General_options::check_excluded_libs): Strip off directories in
8221 archive name before matching like GNU ld does.
8222 * testsuite/Makefile.am (MOSTLYCLEANFILES,
8223 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
8224 (exclude_libs_test_LDFLAGS): Add linker option
8225 -Wl,--exclude-libs,libexclude_libs_test_3
8226 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
8227 an explicit archive without using -l.
8228 (alt/libexclude_libs_test_3.a): New make rule.
8229 * testsuite/Makefile.in: Regenerate.
8230 * testsuite/exclude_libs_test.c : Declare lib3_default().
8232 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
8233 * exclude_libs_test_3.c: New file.
8235 2009-05-26 Nick Clifton <nickc@redhat.com>
8237 * po/id.po: New Indonesian translation.
8238 * po/gold.pot: Updated template file.
8240 2009-05-22 Sriraman Tallam <tmsriram@google.com>
8242 * testsuite/Makefile.am: Add -ffunction-sections to compile
8243 gc_comdat_test files. Add -Wl,--gc-sections to build
8245 * testsuite/Makefile.in: Regenerate.
8246 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
8248 2009-05-21 Sriraman Tallam <tmsriram@google.com>
8250 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
8251 kept comdat section was garbage collected.
8252 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
8253 * testsuite/Makefile.in: Regenerate.
8254 * testsuite/gc_comdat_test.sh: New file.
8255 * testsuite/gc_comdat_test_1.cc: New file.
8256 * testsuite/gc_comdat_test_2.cc: New file.
8258 2009-05-19 Doug Kwan <dougkwan@google.com>
8260 * archive.cc (Archive::Archive): Move constructor from archive.h
8261 to here. Initialize no_export_.
8262 (Archive::get_elf_object_for_member): Set no_export flag of object.
8263 * archive.h (Archive::Archive): Move constructor body to
8265 (Archive::no_export): New method.
8266 (Archive::no_export_): New field.
8267 * object.h (Object::Object): Initialize no_export_ to false.
8268 (Object::no_export, Object::set_no_export): New methods.
8269 (Object::no_export_): New field.
8270 * options.cc (General_options::parse_exclude_libs): New method.
8271 (General_options::check_excluded_libs) Same.
8272 * options.h (exclude_libs): New option.
8273 (General_options::check_excluded_libs): New method declaration.
8274 (General_options::excluded_libs_): New field.
8275 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
8276 default or protected visibility if an object has no-export flag set.
8277 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
8278 (check_SCRIPTS): Add exclude_libs_test.sh.
8279 (check_DATA): Add exclude_libs_test.syms.
8280 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
8281 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
8282 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
8283 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
8284 (exclude_libs_test.syms, libexclude_libs_test_1.a,
8285 libexclude_libs_test_2.a): New rules.
8286 * testsuite/Makefile.in: Regenerate.
8287 * testsuite/exclude_libs_test.c: New file.
8288 * testsuite/exclude_libs_test.sh: Ditto.
8289 * testsuite/exclude_libs_test_1.c: Ditto.
8290 * testsuite/exclude_libs_test_2.c: Ditto.
8292 2009-05-15 Ian Lance Taylor <iant@google.com>
8294 * configure.ac: Check for declarations for cases where libiberty.h
8295 checks HAVE_DECL_xxx.
8296 * configure, config.in: Rebuild.
8298 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
8300 * gold.h (Incremental_argument_list): Remove (invalid) forward
8302 * incremental.cc (Incremental_inputs::report_achive): New method.
8303 (Incremental_inputs::report_object): New method.
8304 (Incremental_inputs::report_script): New method.
8305 (Incremental_inputs::finalize_inputs): New method.
8306 (Incremental_inputs::finalize): Call finalize_inputs().
8307 (Incremental_inputs::sized_create_incremental_inputs_section_data):
8308 Create inputs entries.
8309 * incremental.h (Incremental_input_type): New enum.
8310 (Incremental_inputs::Incremental_input): Initialize new fields.
8311 (Incremental_inputs::report_inputs): New method.
8312 (Incremental_inputs::report_achive): New method.
8313 (Incremental_inputs::report_object): New method.
8314 (Incremental_inputs::report_script): New method.
8315 (Incremental_inputs::finalize_inputs): New method.
8316 (Incremental_inputs::Input_info): New struct.
8317 (Incremental_inputs::Input_info_map): New typedef.
8318 (Incremental_inputs::lock_): New field.
8319 (Incremental_inputs::Inputs_): New field.
8320 (Incremental_inputs::Inputs_map): New field.
8321 * main.cc (main): Call Incremental_input::report_inputs.
8322 * options.h (Input_argument_list): Typedef moved from
8324 (Input_file_group::Files): Remove, use ::Input_argument_list.
8325 (Input_file_group::Input_argument_list): Remove, use
8326 ::Input_argument_list.
8327 * plugin.cc (Plugin_manager::add_input_file): Add error in
8329 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
8331 * script.cc (read_input_script): Call
8332 Incremental_input::report_script.
8333 * script.h (Script_info): New class.
8335 2009-04-27 Ian Lance Taylor <iant@google.com>
8337 * x86_64.cc (do_adjust_output_section): Set entsize to
8340 2009-04-23 Elliott Hughes <enh@google.com>
8342 * output.cc (Output_file::close): After short writes, continue
8343 writing from the correct offset in the buffer being written.
8345 2009-04-23 Chris Demetriou <cgd@google.com>
8347 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
8348 * configure: Regenerate.
8349 * config.in: Regenerate.
8350 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
8351 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
8353 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
8355 * incremental.cc (Incremental_inputs_header_data): Renamed from
8356 Incremental_input_header_data.
8357 (Incremental_inputs_header_data::data_size): New field.
8358 (Incremental_inputs_header_data::put_input_file_count): Renamed
8359 from input_file_count.
8360 (Incremental_inputs_header_data::put_command_line_offset): Renamed
8361 from command_line_offset.
8362 (Incremental_inputs_header_data::put_reserved): Renamed from
8364 (Incremental_inputs_entry_data): Renamed from
8365 Incremental_input_entry_data.
8366 (Incremental_inputs_entry_data::data_size): New field.
8367 (Incremental_inputs::report_command_line): New method.
8368 (Incremental_inputs::finalize): New method.
8369 (Incremental_inputs::create_incremental_inputs_data): New method.
8370 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
8371 * incremental.h: New file.
8372 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
8373 (Layout::finalize): Create incremental inputs section in
8375 (Layout::create_incremental_info_sections): New method.
8376 * layout.h (Layout::incremental_inputs): New method.
8377 (Layout::create_incremental_info_sections): New method.
8378 (Layout::incremental_inputs_): New field.
8379 * main.cc (main): Notify Incremental_input of the command line.
8381 2009-04-01 Ian Lance Taylor <iant@google.com>
8382 Mikolaj Zalewski <mikolajz@google.com>
8384 * gold.h (reserve_unordered_map): Define, three versions, one for
8385 each version of Unordered_map.
8386 * layout.cc (Layout::Layout): Remove options parameter. Add
8387 number_of_input_files parameter. Don't initialize options_.
8388 Initialize number_of_input_files_ and resized_signatures_. Move
8389 sections_are_attached_.
8390 (Layout::layout_group): Reserve space for group_signatures_.
8391 (Layout::find_or_add_kept_section): Change name parameter to be a
8392 reference. Resize signatures_ map when it gets large enough.
8393 (Layout::layout_eh_frame): Use parameters->options() instead of
8395 (Layout::make_output_section): Likewise.
8396 (Layout::attach_allocated_section_to_segment): Likewise.
8397 (Layout::finalize, Layout::create_executable_stack): Likewise.
8398 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
8399 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
8400 * layout.h (class Layout): Update declarations. Remove options_
8401 field. Add number_of_input_files_ and resized_signatures_
8402 fields. Move sections_are_attached_ field.
8403 * main.cc (main): Pass number of input files to Layout
8404 constructor. Don't pass options.
8406 2009-03-30 Ian Lance Taylor <iant@google.com>
8408 * ffsll.c (ffsll): Correct implementation.
8410 2009-03-27 Ian Lance Taylor <iant@google.com>
8412 * ffsll.c: New file.
8413 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
8414 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
8415 * ftruncate.c (ftruncate): Declare before definition.
8416 * mremap.c (mremap): Likewise.
8417 * pread.c (pread): Likewise.
8418 * configure, Makefile.in, config.in: Rebuild.
8420 * mremap.c: New file.
8421 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
8422 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
8423 (mremap): Declare if HAVE_MREMAP is not defined.
8424 * configure, Makefile.in, config.in: Rebuild.
8426 2009-03-27 Cary Coutant <ccoutant@google.com>
8428 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
8429 position independent.
8430 * sparc.cc (Target_sparc::check_non_pic): Likewise.
8431 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
8433 2009-03-24 Cary Coutant <ccoutant@google.com>
8435 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
8437 (needs_dynamic_reloc): Likewise.
8439 2009-03-24 Ian Lance Taylor <iant@google.com>
8441 * yyscript.y (file_cmd): Recognize EXTERN.
8442 (extern_name_list, extern_name_list_body): New nonterminals.
8443 * script.cc (script_add_extern): Define.
8444 * script-c.h (script_add_extern): Declare.
8446 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
8448 * object.cc (is_elf_object): Define.
8449 * object.h (is_elf_object): Declare.
8450 * archive.cc (Archive::get_elf_object_for_member): Call
8452 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
8454 2009-03-24 Elliott Hughes <enh@google.com>
8456 * output.cc (Output_file::map_anonymous): Define.
8457 (Output_file::map): Use map_anonymous. If the regular mmap fails,
8458 try an anonymous one. Report the size if the mmap fails.
8459 * output.h (class Output_file): Declare map_anonymous.
8461 2009-03-24 Ian Lance Taylor <iant@google.com>
8463 * target-select.cc (instantiate_target): Don't acquire the lock if
8464 the instantiated_target_ field has already been set.
8466 2009-03-23 Ian Lance Taylor <iant@google.com>
8468 * gold-threads.h (class Initialize_lock): Define.
8469 * gold-threads.cc (class Initialize_lock_once): Define.
8470 (initialize_lock_control): New static variable.
8471 (initialize_lock_pointer): New static variable.
8472 (initialize_lock_once): New static function.
8473 (Initialize_lock::Initialize_lock): Define.
8474 (Initialize_lock::initialize): Define.
8475 * target-select.h: Include "gold-threads.h".
8476 (class Target_selector): Add lock_ and initialize_lock_ fields.
8477 Don't define instantiate_target, just declare it.
8478 * target-select.cc (Target_selector::Target_selector): Initialize
8480 (Target_selector::instantiate_target): Define.
8481 * descriptors.h: Include "gold-threads.h".
8482 (class Descriptors): Add initialize_lock_ field.
8483 * descriptors.cc (Descriptors::Descriptors): Initialize new
8485 (Descriptors::open): Use initialize_lock_ field
8486 * errors.h (class Errors): Add initialize_lock_ field.
8487 * errors.cc (Errors::Errors): Initialize new field.
8488 (Errors::initialize_lock): Use initialize_lock_ field.
8489 * powerpc.cc (class Target_selector_powerpc): Remove
8490 instantiated_target_ field. In do_recognize call
8491 instantiate_target rather than do_instantiate_target. In
8492 do_instantiate_target just allocate a new target.
8493 * sparc.cc (class Target_selector_sparc): Likewise.
8495 * freebsd.h: New file.
8496 * i386.cc: Include "freebsd.h".
8497 (Target_i386): Derive from Target_freebsd rather than
8499 (Target_selector_i386): Derive from Target_selector_freebsd rather
8500 than Target_selector.
8501 * x86_64.cc: Include "freebsd.h".
8502 (Target_x86_64): Derive from Target_freebsd rather than
8504 (Target_selector_x86_64): Derive from Target_selector_freebsd
8505 rather than Target_selector.
8506 * target.h (class Target): Add adjust_elf_header and
8507 do_adjust_elf_header.
8508 * output.cc (Output_file_header:: do_sized_write): Call target
8509 adjust_elf_header routine.
8510 * configure.tgt: Set targ_osabi.
8511 * configure.ac: Define GOLD_DEFAULT_OSABI.
8512 * parameters.cc (Parameters::default_target): Pass
8513 GOLD_DEFAULT_OSABI to select_target.
8514 * target-select.h (class Target_selector): Make instantiate_target
8515 protected rather than private.
8516 * Makefile.am (HFILES): Add freebsd.h.
8517 * configure, Makefile.in, config.in: Rebuild.
8519 * merge.cc (do_add_input_section): Correct pend value. Change
8520 message about last entry not being null terminated from error to
8523 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
8525 * incremental.cc: New file.
8526 * Makefile.am (CCFILES): Add incremental.cc.
8527 * Makefile.in: Rebuild.
8529 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
8531 * layout.cc (Layout::output_section_name): Preserve names
8532 of '.note.' sections.
8534 2009-03-19 Ian Lance Taylor <iant@google.com>
8536 * descriptors.cc (Descriptors::open): Check that the options are
8537 valid before using them.
8539 2009-03-18 Ian Lance Taylor <iant@google.com>
8541 * script-sections.h: Include <list>.
8542 (class Script_sections): Change Sections_elements from std::vector
8543 to std::list. Typedef public Elements_iterator. Add
8544 orphan_section_placement_, data_segment_align_start_, and
8545 saw_data_segment_align_ fields. Remove data_segment_align_index_
8547 * script-sections.cc (class Orphan_section_placement): New class.
8548 (class Sections_element): Add virtual functions is_relro and
8549 orphan_section_init. Remove virtual function place_orphan_here.
8550 (class Output_section_definition): Add is_relro and
8551 orphan_section_init. Remove place_orphan_here.
8552 (class Orphan_output_section): Likewise.
8553 (Script_sections::Script_sections): Update for field changes.
8554 (Script_sections::data_segment_align): Set saw_data_segment_align_
8555 and data_segment_align_start_, not data_segment_align_index.
8556 (Script_sections::data_segment_relro_end): Check
8557 saw_data_segment_align_. Use data_segment_align_start_ rather
8558 than data_segment_align_index_.
8559 (Script_sections::place_orphan): Rewrite to use
8560 Orphan_section_placement.
8562 2009-03-17 Ian Lance Taylor <iant@google.com>
8564 * archive.cc (Archive::add_symbols): Check for a version attached
8565 to the symbol name in the archive map.
8566 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
8567 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
8568 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
8569 (ver_test_11.a): New target.
8570 * testsuite/Makefile.in: Rebuild.
8572 * configure.ac: Check for chsize and posix_fallocate. Replace
8574 * ftruncate.c: New file, from gnulib.
8575 * output.cc (posix_fallocate): Define dummy version if not
8576 HAVE_POSIX_FALLOCATE.
8577 (Output_file::map): Call posix_fallocate rather than lseek and
8579 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
8580 * configure, Makefile.in, config.in: Rebuild.
8582 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
8584 * layout.h (Layout::create_note): Add section_name parameter.
8585 * layout.cc (Layout::create_note): Likewise.
8586 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
8588 2009-03-17 Ian Lance Taylor <iant@google.com>
8590 * descriptors.cc: Include "options.h".
8591 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
8592 (Descriptors::open): Always use O_CLOEXEC when opening a new
8593 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
8594 then set FD_CLOEXEC.
8596 * sparc.cc (class Target_sparc): Add has_got_section.
8597 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
8598 make sure we have a GOT section.
8600 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
8601 (Target_sparc::Scan::local): Likewise.
8602 (Target_sparc::Scan::global): Likewise.
8603 (Target_sparc::Relocate::relocate): Likewise.
8604 (Target_sparc::Relocate::relocate_tls): Likewise.
8606 * symtab.cc (Symbol_table::define_default_version): New function,
8607 broken out of add_from_object.
8608 (Symbol_table::add_from_object): Call define_default_version.
8609 (Symbol_table::define_special_symbol): Add resolve_oldsym
8610 parameter. Change all callers. If the version for a symbol comes
8611 from a version script, resolve it with the symbol with the same
8612 name with no version. Also add the symbol without a version if
8614 (do_define_in_output_data): If resolving with oldsym, don't delete
8616 (do_define_in_output_segment): Likewise.
8617 (do_define_as_constant): Likewise.
8618 * symtab.h (class Symbol_table): Update declarations.
8620 2009-03-13 Ian Lance Taylor <iant@google.com>
8622 * readsyms.cc (Read_symbols::incompatible_warning): New function.
8623 (Read_symbols::requeue): New function.
8624 (Read_symbols::do_read_symbols): If make_elf_object fails because
8625 the target type is not configured, and the file was searched for,
8626 issue a warning and retry with the next directory.
8627 (Add_symbols::run): If the file has an incompatible format, and
8628 it was searched for, requeue the Read_symbols task. On error,
8630 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
8631 dirindex parameter to constructor. Change all callers. Declare
8632 incompatible_warning and requeue.
8633 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
8634 input_argument_ and input_group_ fields. Add them to
8635 constructor. Change all callers.
8636 (class Read_script): Add dirindex_ field. Add it to constructor.
8638 * archive.cc (Archive::setup): Remove input_objects parameter.
8640 (Archive::get_file_and_offset): Likewise.
8641 (Archive::read_all_symbols): Likewise.
8642 (Archive::read_symbols): Likewise.
8643 (Archive::get_elf_object_for_member): Remove input_objects
8644 parameter. Add punconfigured parameter. Change all callers.
8645 (Archive::add_symbols): Change return type to bool. Check return
8646 value of include_member.
8647 (Archive::include_all_members): Likewise.
8648 (Archive::include_member): Change return type to bool. Return
8649 false if first included object has incompatible target. Set
8650 included_member_ field.
8651 (Add_archive_symbols::run): If add_symbols returns false, requeue
8653 * archive.h (class Archive): Add included_member_ field.
8654 Initialize it in constructor. Add input_file and searched_for
8655 methods. Update declarations.
8656 (class Add_archive_symbols): Add dirpath_, dirindex_, and
8657 input_argument_ fields. Add them to constructor. Change all
8659 * script.cc: Include "target-select.h".
8660 (class Parser_closure): Add skip_on_incompatible_target_ and
8661 found_incompatible_target_ fields. Add
8662 skip_on_incompatible_target parameter to constructor. Change all
8663 callers. Add methods skip_on_incompatible_target,
8664 clear_skip_on_incompatible_target, found_incompatible_target, and
8665 set_found_incompatible_target.
8666 (read_input_script): Add dirindex parameter. Change all callers.
8667 If parser finds an incompatible target, requeue Read_symbols
8669 (script_set_symbol): Clear skip_on_incompatible_target in
8671 (script_add_assertion, script_parse_option): Likewise.
8672 (script_start_sections, script_add_phdr): Likewise.
8673 (script_check_output_format): New function.
8674 * script.h (read_input_script): Update declaration.
8675 * script-c.h (script_check_output_format): Declare.
8676 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
8677 (ignore_cmd): Remove OUTPUT_FORMAT.
8678 * fileread.cc (Input_file::Input_file): Add explicit this.
8679 (Input_file::will_search_for): New function.
8680 (Input_file::open): Add pindex parameter. Change all callers.
8681 * fileread.h (class Input_file): Add input_file_argument method.
8682 Declare will_search_for. Update declarations.
8683 * object.cc (make_elf_object): Add punconfigured parameter.
8685 * object.h (class Object): Make input_file public. Add
8686 searched_for method.
8687 (make_elf_object): Update declaration.
8688 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
8690 * dirsearch.h (class Dirsearch): Update declaration.
8691 * options.h (class General_options): Add --warn-search-mismatch.
8692 * parameters.cc (Parameters::is_compatible_target): New function.
8693 * parameters.h (class Parameters): Declare is_compatible_target.
8694 * workqueue.cc (Workqueue::add_blocker): New function.
8695 * workqueue.h (class Workqueue): Declare add_blocker.
8697 * fileread.cc (Input_file::open): Remove options parameter.
8699 (Input_file::open_binary): Likewise.
8700 * script.cc (read_input_script): Likewise.
8701 * readsyms.h (class Read_symbols): Remove options_ field. Remove
8702 options parameter from constructor. Change all callers.
8703 (class Read_script): Likewise.
8704 * fileread.h (class Input_file): Update declarations.
8705 * script.h (read_input_script): Update declaration.
8707 2009-03-10 Nick Clifton <nickc@redhat.com>
8709 * po/es.po: New Spanish translation.
8711 2009-03-06 Cary Coutant <ccoutant@google.com>
8713 * options.cc (parse_short_option): Keep dash_z from registering itself.
8715 2009-03-03 Ian Lance Taylor <iant@google.com>
8718 * target-reloc.h (relocate_section): Pass output_section to
8720 * i386.cc (Target_i386::should_apply_static_reloc): Add
8721 output_section parameter. Change all callers.
8722 (Target_i386::Relocate::relocate): Add output_section parameter.
8723 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8724 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
8725 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
8726 * testsuite/two_file_shared.sh: New script.
8727 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
8728 (check_DATA): Add two_file_shared.dbg.
8729 (two_file_shared.dbg): New target.
8730 * testsuite/Makefile.in: Rebuild.
8732 2009-03-01 Ian Lance Taylor <iant@google.com>
8734 * configure.ac: Check for byteswap.h.
8735 * configure: Rebuild.
8736 * config.in: Rebuild.
8738 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
8740 * layout.cc (Layout::find_or_add_kept_section): New function.
8741 (Layout::add_comdat): Removed.
8742 * layout.h (struct Kept_section): Move out of class Layout.
8743 Remove trailing underscores from field names. Add group_sections
8744 field. Rename group_ field to is_group. Change all uses.
8745 (class Layout): Declare find_or_add_kept_section, not add_comdat.
8746 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
8747 comdat_groups_ field.
8748 (Sized_relobj::include_section_group): Use
8749 find_or_add_kept_section and Kept_section::group_sections.
8750 (Sized_relobj::include_linkonce_section): Likewise.
8751 * object.cc (class Sized_relobj): Don't define Comdat_group or
8752 Comdat_group_table. Remove find_comdat_group and
8753 add_comdat_group. Remove comdat_groups_ field.
8754 * plugin.cc (include_comdat_group): Use
8755 Layout::find_or_add_kept_section.
8757 2009-02-28 Ian Lance Taylor <iant@google.com>
8759 * README: --gc-sections and map files are now supported. Document
8760 some build requirements.
8763 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
8764 relocatable link set the value of the section symbol to zero.
8765 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
8766 relocatable link don't include the section address in the local
8769 2009-02-27 Ian Lance Taylor <iant@google.com>
8772 * options.h (class Search_directory): Add is_system_directory.
8773 (class General_options): Declare is_in_system_directory.
8774 * options.cc (get_relative_sysroot): Make static.
8775 (get_default_sysroot): Make static.
8776 (General_optoins::is_in_system_directory): New function.
8777 * fileread.cc (Input_file::is_in_system_directory): New function.
8778 * fileread.h (class Input_file): Declare is_in_system_directory.
8779 * object.h (class Object): Add is_in_system_directory.
8780 (class Input_objects): Remove system_library_directory_ field.
8781 * object.cc (Input_objects::add_object): Don't set
8782 system_library_directory_.
8783 (input_objects::found_in_system_library_directory): Remove.
8784 * symtab.cc (Symbol_table::write_globals): Remove input_objects
8785 parameter. Change all callers.
8786 (Symbol_table::sized_write_globals): Likewise.
8787 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
8788 Call Object::is_in_system_directory.
8789 * symtab.h (class Symbol_table): Update declarations.
8792 * descriptors.h (Open_descriptor): Add is_on_stack field.
8793 * descriptors.cc (Descriptors::open): If the descriptor is on the
8794 top of the stack, remove it. Initialize is_on_stack field.
8795 (Descriptors::release): Only add pod to stack if it is not on the
8797 (Descriptors::close_some_descriptor): Clear stack_next and
8801 * output.cc (Output_section::find_starting_output_address): Rename
8802 from starting_output_address; add PADDR parameter; change return
8804 * output.h (class Output_section): Declare
8805 find_starting_output_address instead of starting_output_address.
8806 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
8807 section symbol for which we can't find a merge section.
8810 * symtab.cc (Symbol_table::add_from_object): If the visibility is
8811 hidden or internal, force the symbol to be local.
8812 * resolve.cc (Symbol::override_visibility): Define.
8813 (Symbol::override_base): Use override_visibility.
8814 (Symbol_table::resolve): Likewise.
8815 (Symbol::override_base_with_special): Likewise.
8816 (Symbol_table::override_with_special): If the visibility is hidden
8817 or internal, force the symbol to be local.
8818 * symtab.h (class Symbol): Add set_visibility and
8819 override_visibility.
8820 * testsuite/ver_test_1.sh: New file.
8821 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
8822 (check_DATA): Add ver_test_1.syms.
8823 (ver_test_1.syms): New target.
8824 * testsuite/Makefile.in: Rebuild.
8826 2009-02-25 Cary Coutant <ccoutant@google.com>
8828 * layout.cc (Layout::choose_output_section): Don't rename sections
8829 when using a linker script that has a SECTIONS clause.
8830 * Makefile.in: Regenerate.
8832 * testsuite/Makefile.am (script_test_5.sh): New test case.
8833 * testsuite/Makefile.in: Regenerate.
8834 * testsuite/script_test_5.cc: New file.
8835 * testsuite/script_test_5.sh: New file.
8836 * testsuite/script_test_5.t: New file.
8838 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
8840 * archive.cc (Archive::include_member): Update calls to add_symbols.
8841 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
8842 the Layout argument.
8843 * dynobj.h (do_add_symbols): Add the Layout argument.
8844 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
8846 * object.h (Object::add_symbols): Add the Layout argument.
8847 (Object::do_add_symbols): Add the Layout argument.
8848 (Sized_relobj::do_add_symbols): Add the Layout argument.
8849 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
8850 Unify the two versions.
8851 (Add_plugin_symbols): Remove.
8852 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
8853 (Sized_pluginobj::do_add_symbols): Unify the two versions.
8854 (Add_plugin_symbols): Remove.
8855 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
8856 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
8857 (Add_symbols::run): Make it work with Pulginobj.
8859 2009-02-06 Ian Lance Taylor <iant@google.com>
8861 * object.cc (Sized_relobj::do_layout): Make info message start
8862 with lower case letter.
8864 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
8866 * binary.cc: Fix file comment.
8868 * options.h (enum Incremental_disposition): Define.
8869 (class General_options): Add new options: --incremental,
8870 --incremental_changed, --incremental_unchanged,
8871 --incremental_unknown. Add incremental_disposition_ and
8872 implicit_incremental_ fields.
8873 (General_options::incremental_disposition): New function.
8874 (class Position_dependent_options): Add incremental_disposition
8876 (Position_dependent_options::copy_from_options): Set incremental
8878 * options.cc (General_options::parse_incremental_changed): New
8880 (General_options::parse_incremental_unchanged): New function.
8881 (General_options::parse_incremental_unknown): New function.
8882 (General_options::General_options): Initialize new fields
8883 incremental_disposition_ and implicit_incremental_.
8884 (General_options::finalize): Check for uasge of --incremental-*
8885 without --incremental.
8887 2009-02-06 Chris Demetriou <cgd@google.com>
8889 * gold.h (gold_undefined_symbol): Change to take only a Symbol
8890 pointer and to report location as the file name associated with
8892 (gold_undefined_symbol_at_location): New function to replace the
8893 old gold_undefined_symbol functionality.
8894 * target-reloc.h (relocate_section): Update to use
8895 gold_undefined_symbol_at_location.
8896 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
8897 Call gold_undefined_symbol function rather than gold_error.
8898 * errors.h (Errors::undefined_symbol): Take location as a
8899 string, rather than calculating it from a relocation.
8900 * errors.cc (Errors::fatal): Print "fatal error:" before the
8902 (Errors::error, Errors::error_at_location): Print "error: "
8903 before the formatted message.
8904 (Errors::undefined_symbol): Take location as a string, rather
8905 than calculating it from a relocation.
8906 (gold_undefined_symbol_at_location): New function akin to
8907 old gold_undefined_symbol, calculates location from relocation.
8908 (gold_undefined_symbol): Change to take only a Symbol pointer
8909 and to report location as the file name associated with the symbol.
8910 * testsuite/debug_msg.sh: Update for changed error messages.
8911 * testsuite/undef_symbol.sh: Likewise.
8913 2009-02-04 Duncan Sands <baldrick@free.fr>
8916 * reduced_debug_output.h
8917 (Output_reduced_debug_abbrev_section::failed): Use format for
8919 (Output_reduced_debug_info_section::faild): Likewise.
8921 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
8923 * script.cc (Lazy_demangler): New class.
8924 (Version_script_info::get_symbol_version_helper): Demangle a
8927 2009-01-29 Cary Coutant <ccoutant@google.com>
8929 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
8931 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8933 2009-01-28 Ian Lance Taylor <iant@google.com>
8935 * version.cc (version_string): Bump to 1.9.
8937 * gold.h: Include <cstring> and <stdint.h>.
8938 * version.cc: Include <cstdio>.
8939 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
8941 * reduced_debug_output.cc (insert_into_vector): Rename from
8942 Insert_into_vector; change all callers. Use Swap_unaligned to
8943 avoid aliasing issue; remove union since it is unnecessary.
8945 2009-01-27 Sriraman Tallam <tmsriram@google.com>
8947 * Makefile.am (CCFILES): Add gc.cc.
8949 * Makefile.in: Regenerate.
8950 * gold.cc (Gc_runner): New class.
8951 (queue_initial_tasks): Call garbage collection related tasks
8952 when corresponding options are invoked.
8953 (queue_middle_gc_tasks): New function.
8954 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
8955 processed early before laying out sections during garbage collection.
8956 * gold.h (queue_middle_gc_tasks): New function.
8957 (is_prefix_of): Move from "layout.cc".
8958 * i386.cc (Target_i386::gc_process_relocs): New function.
8959 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
8960 * main.cc (main): Create object of class "Garbage_collection".
8961 * object.cc (Relobj::copy_symbols_data): New function.
8962 (Relobj::is_section_name_included): New function.
8963 (Sized_relobj::do_layout): Allow this function to be called twice
8964 during garbage collection and defer layout of section during the
8966 * object.h (Relobj::get_symbols_data): New function.
8967 (Relobj::is_section_name_included): New function.
8968 (Relobj::copy_symbols_data): New function.
8969 (Relobj::set_symbols_data): New function.
8970 (Relobj::get_relocs_data): New function.
8971 (Relobj::set_relocs_data): New function.
8972 (Relobj::is_output_section_offset_invalid): New pure virtual function.
8973 (Relobj::gc_process_relocs): New function.
8974 (Relobj::do_gc_process_relocs): New pure virtual function.
8975 (Relobj::sd_): New data member.
8976 (Sized_relobj::is_output_section_offset_invalid): New function.
8977 (Sized_relobj::do_gc_process_relocs): New function.
8978 * options.h (General_options::gc_sections): Modify to not be a no-op.
8979 (General_options::print_gc_sections): New option.
8980 * plugin.cc (Plugin_finish::run): Remove function call to
8981 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
8982 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
8983 * reloc.cc (Read_relocs::run): Add task to process relocs and
8984 determine unreferenced sections when doing garbage collection.
8985 (Gc_process_relocs): New class.
8986 (Sized_relobj::do_gc_process_relocs): New function.
8987 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
8988 sections that are garbage collected.
8989 * reloc.h (Gc_process_relocs): New class.
8990 * sparc.cc (Target_sparc::gc_process_relocs): New function.
8991 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
8992 symbols whose corresponding sections are garbage collected.
8993 (Symbol_table::Symbol_table): Add new parameter for the garbage
8995 (Symbol_table::gc_mark_undef_symbols): New function.
8996 (Symbol_table::gc_mark_symbol_for_shlib): New function.
8997 (Symbol_table::gc_mark_dyn_syms): New function.
8998 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
9000 (Symbol_table::add_from_object): Likewise.
9001 (Symbol_table::add_from_relobj): When building shared objects, do not
9002 treat externally visible symbols as garbage.
9003 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
9004 table information for static and relocatable links.
9005 * symtab.h (Symbol_table::set_gc): New function.
9006 (Symbol_table::gc): New function.
9007 (Symbol_table::gc_mark_undef_symbols): New function.
9008 (Symbol_table::gc_mark_symbol_for_shlib): New function.
9009 (Symbol_table::gc_mark_dyn_syms): New function.
9010 (Symbol_table::gc_): New data member.
9011 * target.h (Sized_target::gc_process_relocs): New pure virtual
9013 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
9014 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
9016 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
9018 * options.h (General_options::gc_sections): Define as a no-op for now.
9019 (General_options::no_keep_memory): Ditto.
9020 (General_options::Bshareable): Define.
9021 * options.cc (General_options::finalize): Honor -Bshareable.
9023 2009-01-20 Andreas Schwab <schwab@suse.de>
9025 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
9026 read the value in the contents, since we don't use it. Use the
9027 template endianness when writing.
9028 (Relocate::relocate): Use it for R_PPC_REL16_HA.
9030 2009-01-19 Andreas Schwab <schwab@suse.de>
9032 * configure.tgt (powerpc64-*): Fix targ_obj.
9034 2009-01-15 Ian Lance Taylor <iant@google.com>
9036 * object.cc (Sized_relobj::write_local_symbols): Don't write out
9037 local symbols when stripping all symbols.
9039 2009-01-14 Cary Coutant <ccoutant@google.com>
9041 * output.cc (Output_reloc): Add explicit instantiations.
9043 2009-01-14 Cary Coutant <ccoutant@google.com>
9045 * archive.cc (Archive::get_elf_object_for_member): Remove call
9046 to File_read::claim_for_plugin.
9047 * descriptors.cc (Descriptors::open): Remove reference to
9049 (Descriptors::claim_for_plugin): Remove.
9050 * descriptors.h (Descriptors::claim_for_plugin): Remove.
9051 (Descriptors::is_claimed): Remove.
9052 (claim_descriptor_for_plugin): Remove.
9053 * fileread.cc (File_read::claim_for_plugin): Remove.
9054 * fileread.h (File_read::claim_for_plugin): Remove.
9055 (File_read::descriptor): Reopen descriptor if necessary.
9056 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
9057 (Plugin_manager::all_symbols_read): Add task parameter. Change
9059 (Plugin_manager::get_input_file): New function.
9060 (Plugin_manager::release_input_file): New function.
9061 (Pluginobj::Pluginobj): Add filesize parameter and initialize
9062 corresponding data member.
9063 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
9064 and pass to base constructor. Change all callers.
9065 (get_input_file, release_input_file): New functions.
9066 (make_sized_plugin_object): Add filesize parameter. Change all callers.
9067 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
9068 (Plugin_manager::all_symbols_read): Add task parameter.
9069 (Plugin_manager::get_input_file): New function.
9070 (Plugin_manager::release_input_file): New function.
9071 (Plugin_manager::task_): New data member.
9072 (Pluginobj::Pluginobj): Add filesize parameter.
9073 (Pluginobj::filename): New function.
9074 (Pluginobj::descriptor): New function.
9075 (Pluginobj::filesize): New function.
9076 (Pluginobj::filesize_): New data member.
9077 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
9078 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
9079 File_read::claim_for_plugin; use Object::unlock to unlock the file.
9081 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
9082 with archive libraries.
9083 * testsuite/Makefile.in: Regenerate.
9084 * testsuite/plugin_test.c (struct sym_info): New type.
9085 (get_input_file, release_input_file): New static variables.
9086 (onload): Capture new transfer vector entries.
9087 (claim_file_hook): Stop reading at end of file according to filesize.
9088 Factor out parsing of readelf output into separate function.
9089 (all_symbols_read_hook): Exercise get_input_file and release_input_file
9090 APIs and get the source file name from the symbol table. Convert
9091 source file name to corresponding object file name. Print info
9092 message when adding new input files.
9093 (parse_readelf_line): New function.
9094 * testsuite/plugin_test_1.sh: Add checks for new info messages.
9095 * testsuite/plugin_test_2.sh: Likewise.
9096 * testsuite/plugin_test_3.sh: Likewise.
9097 * testsuite/plugin_test_4.sh: New test case.
9099 2009-01-07 Ian Lance Taylor <iant@google.com>
9101 * version.cc (version_string): Bump to 1.8.
9103 2008-12-23 Cary Coutant <ccoutant@google.com>
9105 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
9106 * plugin.cc (Plugin_manager::finish): Rename as
9107 layout_deferred_objects. Move cleanup to separate function.
9108 (Plugin_manager::cleanup): New function.
9109 (Plugin_finish::run): Call layout_deferred_objects and cleanup
9111 * plugin.h (Plugin_manager::finish): Rename as
9112 layout_deferred_objects.
9113 (Plugin_manager::cleanup): New function.
9114 (Plugin_manager::cleanup_done): New field.
9116 2008-12-23 Cary Coutant <ccoutant@google.com>
9118 * plugin.cc (is_visible_from_outside): New function.
9119 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
9120 so we don't return "IR only" status for exported symbols or -r links.
9122 * testsuite/Makefile.am (plugin_test_3): New test case.
9123 * testsuite/Makefile.in: Regenerate.
9124 * testsuite/plugin_test_3.sh: New file.
9126 2008-12-22 Cary Coutant <ccoutant@google.com>
9128 * object.cc (Sized_relobj::layout_section): New function.
9129 (Sized_relobj::do_layout): Defer layout of input sections until after
9130 plugin has provided replacement files.
9131 (Sized_relobj::do_layout_deferred_sections): New function.
9132 * object.h (Relobj::set_section_offset): Remove virtual keyword.
9133 (Relobj::layout_deferred_sections): New function.
9134 (Relobj::do_layout_deferred_sections): New function.
9135 (Sized_relobj::do_layout_deferred_sections): New function.
9136 (Sized_relobj::layout_section): New function.
9137 (Sized_relobj::Deferred_layout): New structure.
9138 (Sized_relobj::deferred_layout_): New field.
9139 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
9140 Change all callers. Layout deferred sections.
9141 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
9143 (Plugin_hook::run): Move code from do_plugin_hook inline.
9144 (Plugin_hook::do_plugin_hook): Remove.
9145 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
9146 (Plugin_manager::finish): Renamed, was cleanup.
9147 (Plugin_manager::should_defer_layout): New function.
9148 (Plugin_manager::add_deferred_layout_object): New function.
9149 (Plugin_manager::Deferred_layout_list): New type.
9150 (Plugin_manager::deferred_layout_objects_): New field.
9151 (Plugin_hook::do_plugin_hook): Remove.
9153 2008-12-17 Ian Lance Taylor <iant@google.com>
9155 * options.h (class General_options): Add --no case for
9158 2008-12-16 Cary Coutant <ccoutant@google.com>
9160 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
9162 (Plugin_manager::claim_file): Create plugin object even if
9163 plugin did not call the add_symbols callback.
9164 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
9165 asking for more symbols than were added.
9166 * testsuite/Makefile.am (plugin_test_1): Add test case with
9168 (empty.syms): New target.
9169 * testsuite/Makefile.in: Regenerate.
9170 * testsuite/plugin_test.c (claim_file_hook): Add new debug
9171 message. Don't call add_symbols if no globals.
9172 (all_symbols_read_hook): Don't provide replacement for empty
9175 2008-12-12 Ian Lance Taylor <iant@google.com>
9177 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
9178 r_type == 0 for a local symbol with r_sym == 0.
9179 (scan_relocatable_relocs): Pass r_sym to
9180 local_non_section_strategy.
9181 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
9184 * configure.ac: Update test for TLS descriptors: they are
9185 supported as of glibc 2.9.
9186 * configure: Rebuild.
9188 2008-12-11 Ian Lance Taylor <iant@google.com>
9191 * target-reloc.h (Default_scan_relocatable_relocs): For each
9192 function, map r_type == 0 to RELOC_DISCARD.
9194 2008-12-10 Cary Coutant <ccoutant@google.com>
9196 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
9197 object to override a kept COMDAT group from a plugin object.
9199 2008-12-09 Ian Lance Taylor <iant@google.com>
9202 * yyscript.y (file_cmd): Handle INPUT.
9204 * testsuite/initpri1.c: Change all declarations to be full
9205 prototypes by adding void, to avoid compiler warnings.
9207 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
9209 * options.cc (General_options::parse_plugin_opt): New.
9210 (General_options::add_plugin): The argument now is just the filename.
9211 (General_options::add_plugin_option): New.
9212 * options.h (plugin_opt): New.
9213 (add_plugin): Change argument name.
9214 (add_plugin_option): New.
9215 * plugin.cc (Plugin::load): Don't parse the plugin option.
9216 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
9217 (Plugin::add_option): New.
9218 (Plugin::args_): Change type.
9219 (Plugin::filename_): New.
9220 (Plugin_manager::add_plugin_option): New.
9221 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
9222 * testsuite/Makefile.in: Regenerate.
9224 2008-12-05 Cary Coutant <ccoutant@google.com>
9226 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
9227 Handle --strip-lto-sections option.
9228 * options.h (strip_lto_sections): New option.
9230 2008-12-01 Cary Coutant <ccoutant@google.com>
9232 * plugin.cc (ld_plugin_message): Change format parameter to const.
9233 Fix mismatch between new[] and delete.
9235 2008-11-14 Cary Coutant <ccoutant@google.com>
9237 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
9240 2008-11-05 Craig Silverstein <csilvers@google.com>
9242 * options.cc (General_options::parse_dynamic_list): New function.
9243 * options.h (General_options): New flags dynamic_list,
9244 dynamic_list_data, dynamic_list_cpp_new, and
9245 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
9246 (General_options::in_dynamic_list): New function.
9247 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
9248 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
9249 (Lex::can_continue_name): Likewise.
9251 (read_script_file): New parameter script_options.
9252 (read_dynamic_list): New function.
9253 (Script_options::define_dynamic_list): New function.
9254 (dynamic_list_keyword_parsecodes): New variable.
9255 (dynamic_list_keywords): New variable.
9256 * script.h (Script_options::define_dynamic_list): New function
9258 (read_dynamic_list): New function prototype.
9259 * symtab.cc (strprefix): New macro.
9260 (Symbol::should_add_dynsym_entry): Support dynamic_list,
9261 dynamic_list_data, dynamic_list_cpp_new, and
9262 dynamic_list_cpp_typeinfo.
9263 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
9264 (dynamic_list_expr): New rule.
9265 (dynamic_list_nodes): Likewise.
9266 (dynamic_list_node): Likewise.
9267 * testsuite/Makefile.am (dynamic_list): New test.
9268 * testsuite/Makefile.in: Regenerated.
9269 * testsuite/dynamic_list.t: New file.
9270 * testsuite/dynamic_list.sh: New file.
9272 2008-11-05 Craig Silverstein <csilvers@google.com>
9274 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
9275 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
9276 (t11_last): Likewise.
9277 * testsuite/ver_test_6.c (main): Likewise.
9279 2008-10-07 Cary Coutant <ccoutant@google.com>
9281 * options.c (General_options::finalize): Add check for -static and
9283 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
9286 2008-10-02 Cary Coutant <ccoutant@google.com>
9288 * plugin.cc (make_sized_plugin_object): Fix conditional
9289 compilation to work when not all targets are enabled.
9291 2008-09-29 Cary Coutant <ccoutant@google.com>
9293 * archive.cc (Archive::get_file_and_offset): Use filename instead
9294 of name to get library path.
9295 (Archive::include_member): Unlock external member of a thin archive.
9297 * testsuite/Makefile.am (TEST_AR): New variable.
9298 (thin_archive_test_1): New test.
9299 (thin_archive_test_2): New test.
9300 * testsuite/Makefile.in: Regenerate.
9301 * testsuite/thin_archive_main.cc: New file.
9302 * testsuite/thin_archive_test_1.cc: New file.
9303 * testsuite/thin_archive_test_2.cc: New file.
9304 * testsuite/thin_archive_test_3.cc: New file.
9305 * testsuite/thin_archive_test_4.cc: New file.
9307 2008-09-29 Cary Coutant <ccoutant@google.com>
9309 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
9310 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
9312 (Sized_relobj::do_finalize_local_symbols): Likewise.
9313 (Sized_relobj::map_to_kept_section): Likewise.
9314 * object.h (Sized_relobj::invalid_address): New constant.
9315 (Sized_relobj::do_output_section_offset): Check for invalid_address
9317 * output.cc (Output_reloc::local_section_offset): Use constant
9318 invalid_address instead of -1U.
9319 (Output_reloc::get_address): Likewise.
9320 (Output_section::output_address): Change -1U to -1ULL.
9321 * output.h (Output_reloc::invalid_address): New constant.
9322 * reloc.cc (Sized_relobj::write_sections): Use constant
9323 invalid_address instead of -1U.
9324 (Sized_relobj::relocate_sections): Likewise.
9325 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
9326 values for merge sections.
9327 * target-reloc.h (relocate_for_relocatable): Use constant
9328 invalid_address instead of -1U.
9330 2008-09-19 Cary Coutant <ccoutant@google.com>
9332 Add plugin functionality for link-time optimization (LTO).
9333 * configure.ac (plugins): Add --enable-plugins option.
9334 * configure: Regenerate.
9335 * config.in: Regenerate.
9336 * Makefile.am (LIBDL): New variable.
9337 (CCFILES): Add plugin.cc.
9338 (HFILES): Add plugin.h.
9339 (ldadd_var): Add LIBDL.
9340 * Makefile.in: Regenerate.
9342 * archive.cc: Include "plugin.h".
9343 (Archive::setup): Don't preread archive symbols when using a plugin.
9344 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
9345 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
9347 (Archive::include_member): Add symbols from plugin objects.
9348 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
9349 * descriptors.cc (Descriptors::open): Check for file descriptors
9350 abandoned by plugins.
9351 (Descriptors::claim_for_plugin): New function.
9352 * descriptors.h (Descriptors::claim_for_plugin): New function.
9353 (Open_descriptor::is_claimed): New field.
9354 (claim_descriptor_for_plugin): New function.
9355 * fileread.cc (File_read::claim_for_plugin): New function.
9356 * fileread.h (File_read::claim_for_plugin): New function.
9357 (File_read::descriptor): New function.
9358 * gold.cc: Include "plugin.h".
9359 (queue_initial_tasks): Add task to call plugin hooks for generating
9361 * main.cc: Include "plugin.h".
9362 (main): Load plugin libraries.
9363 * object.h (Pluginobj): Declare.
9364 (Object::pluginobj): New function.
9365 (Object::do_pluginobj): New function.
9366 (Object::set_target): New function.
9367 * options.cc: Include "plugin.h".
9368 (General_options::parse_plugin): New function.
9369 (General_options::General_options): Initialize plugins_ field.
9370 (General_options::add_plugin): New function.
9371 * options.h (Plugin_manager): Declare.
9372 (General_options): Add --plugin option.
9373 (General_options::has_plugins): New function.
9374 (General_options::plugins): New function.
9375 (General_options::add_plugin): New function.
9376 (General_options::plugins_): New field.
9377 * plugin.cc: New file.
9378 * plugin.h: New file.
9379 * readsyms.cc: Include "plugin.h".
9380 (Read_symbols::do_read_symbols): Check for archive before checking
9381 for ELF file. Call plugin hooks to claim files.
9382 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
9383 from a real object file; force override when processing replacement
9385 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
9386 (Symbol::init_base_object): Likewise.
9387 (Symbol::init_base_output_data): Likewise.
9388 (Symbol::init_base_output_segment): Likewise.
9389 (Symbol::init_base_constant): Likewise.
9390 (Symbol::init_base_undefined): Likewise.
9391 (Symbol::output_section): Assert that object is not a plugin.
9392 (Symbol_table::add_from_pluginobj): New function.
9393 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
9395 (Symbol_table::sized_write_globals): Likewise.
9396 (Symbol_table::add_from_pluginobj): Instantiate template.
9397 * symtab.h (Sized_pluginobj): Declare.
9398 (Symbol::in_real_elf): New function.
9399 (Symbol::set_in_real_elf): New function.
9400 (Symbol::in_real_elf_): New field.
9401 (Symbol_table::add_from_pluginobj): New function.
9403 * testsuite/Makefile.am (AM_CFLAGS): New variable.
9404 (LIBDL): New variable.
9406 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
9407 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
9408 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
9409 (MOSTLYCLEANFILES): Likewise.
9410 * testsuite/Makefile.in: Regenerate.
9411 * testsuite/plugin_test.c: New file.
9412 * testsuite/plugin_test_1.sh: New file.
9413 * testsuite/plugin_test_2.sh: New file.
9415 2008-09-16 Ian Lance Taylor <iant@google.com>
9417 * target-reloc.h (relocate_section): Check whether a symbol is
9418 defined by the ABI before reporting an undefined symbol error.
9419 * target.h (Target::is_defined_by_abi): Make parameter const.
9420 (Target::do_is_defined_by_abi): Likewise.
9421 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
9422 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
9423 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
9424 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
9425 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
9426 * testsuite/Makefile.in: Rebuild.
9428 * fileread.cc (make_view): Add casts to avoid warning.
9430 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
9432 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
9433 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
9435 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
9437 * options.h (General_options::output_is_executable): New.
9438 (General_options::output_is_pie): New.
9439 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
9440 for shared libraries.
9441 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
9443 2008-09-11 Chris Demetriou <cgd@google.com>
9445 * options.h (origin): New -z option.
9446 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
9447 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
9450 2008-09-05 Cary Coutant <ccoutant@google.com>
9452 * fileread.cc (File_read::make_view): Add check for attempt to map
9455 2008-09-05 Cary Coutant <ccoutant@google.com>
9457 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
9458 explicit instantiations.
9460 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
9463 * options.cc (General_options::finalize): Allow undefined symbols
9464 in shlibs if linking -shared.
9467 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
9468 symbols as not needing a dynsym entry.
9470 2008-08-20 Craig Silverstein <csilvers@google.com>
9472 * fileread.cc (File_read::open): Do not lock the file unless it
9473 was successfully opened.
9475 2008-08-14 Cary Coutant <ccoutant@google.com>
9477 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
9478 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
9479 * testsuite/tls_test.cc (struct int128): 128-bit struct
9480 for testing TLS relocs with non-zero addend.
9481 (v12): New TLS variable.
9483 (t_last): Add check for v12.
9484 * testsuite/tls_test.h (t12): New function.
9485 * testsuite/tls_test_main.cc (thread_routine): Call new test.
9487 2008-08-13 Ian Lance Taylor <iant@google.com>
9489 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
9490 set tls_segment_ or relro_segment_.
9491 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
9493 * output.h (Output_section::clear_is_relro): New function.
9494 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
9495 sections specially even when output_data_ is empty.
9496 (Output_segment::maximum_alignment): When first section is relro,
9497 only force alignment for PT_LOAD segments.
9498 * script.cc (script_data_segment_align): New function.
9499 (script_data_segment_relro_end): New function.
9500 * script-c.h (script_data_segment_align): Declare.
9501 (script_data_segment_relro_end): Declare.
9502 * script-sections.h (class Script_sections): Declare
9503 data_segment_align and data_segment_relro_end. Add fields
9504 segment_align_index_ and saw_relro_end_.
9505 * script-sections.cc (class Sections_element): Add set_is_relro
9506 virtual function. Add new bool* parameter to place_orphan_here.
9507 Add get_output_section virtual function.
9508 (class Output_section_definition): Add set_is_relro. Add new
9509 bool* parameter to place_orphan_here. Add get_output_section.
9510 Add is_relro_ field.
9511 (Output_section_definition::Output_section_definition): Initialize
9512 evaluated_address_, evaluated_load_address, evaluated_addralign_,
9513 and is_relro_ fields.
9514 (Output_section_definition::place_orphan_here): Add is_relro
9516 (Output_section_definition::set_section_addresses): Set relro for
9518 (Output_section_definition::alternate_constraint): Likewise.
9519 (class Orphan_output_section): Add new bool* parameter to
9520 place_orphan_here. Add get_output_section.
9521 (Orphan_output_section::place_orphan_here): Add is_relro
9523 (Script_sections::Script_sections): Initialize
9524 data_segment_align_index_ and saw_relro_end_.
9525 (Script_sections::data_segment_align): New function.
9526 (Script_sections::data_segment_relro_end): New function.
9527 (Script_sections::place_orphan): Set or clear is_relro.
9528 (Script_sections::set_section_addresses): Force alignment of first
9530 * yyscript.y (exp): Call script_data_segment_align and
9531 script_data_segment_relro_end.
9532 * testsuite/relro_script_test.t: New file.
9533 * testsuite/relro_test.cc (using_script): Declare.
9534 (t1, t2): Test using_script.
9535 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
9536 (relro_script_test_SOURCES): Define.
9537 (relro_script_test_DEPENDENCIES): Define.
9538 (relro_script_test_LDFLAGS): Define.
9539 (relro_script_test_LDADD): Define.
9540 (relro_script_test.so): New target.
9541 * testsuite/Makefile.in: Rebuild.
9543 2008-08-06 Cary Coutant <ccoutant@google.com>
9545 * archive.cc (Archive::total_archives, Archive::total_members)
9546 (Archive::total_members_loaded): New variables.
9547 (Archive::setup): Add parameter. Add option to preread
9549 (Archive::read_armap): Add counter.
9550 (Archive::get_file_and_offset): New function.
9551 (Archive::get_elf_object_for_member): New function.
9552 (Archive::read_all_symbols): New function.
9553 (Archive::read_symbols): New function.
9554 (Archive::add_symbols): Add counters.
9555 (Archive::include_all_members): Use armap to find members if it's
9557 (Archive::include_member): Skip reading symbols if already read.
9558 Factored code into Archive::get_file_and_offset and
9559 Archive::get_elf_object_for_member. Changed call to
9560 Mapfile::report_include_archive_member.
9561 (Archive::print_stats): New function.
9562 * archive.h: Declare Object and Read_symbols_data classes.
9563 (Archive::Archive): Add initializers for new members.
9564 (Archive::setup): Add parameter.
9565 (Archive::print_stats): New function.
9566 (Archive::total_archives, Archive::total_members)
9567 (Archive::total_members_loaded): New variables.
9568 (Archive::get_file_and_offset): New function.
9569 (Archive::get_elf_object_for_member): New function.
9570 (Archive::read_all_symbols): New function.
9571 (Archive::read_symbols): New function.
9572 (Archive::Archive_member): New class.
9573 (Archive::members_): New member.
9574 (Archive::num_members_): New member.
9575 * main.cc: Include archive.h.
9576 (main): Call Archive::print_stats.
9577 * mapfile.cc (Mapfile::report_include_archive_member): Delete
9578 archive parameter; member_name is now the fully-decorated name.
9579 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
9580 * options.h: (General_options): Add --preread-archive-symbols option.
9581 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
9584 2008-08-04 Ian Lance Taylor <iant@google.com>
9586 * symtab.h (Symbol::use_plt_offset): New function.
9587 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
9588 * powerpc.cc (Relocate::relocate): Likewise.
9589 * sparc.cc (Relocate::relocate): Likewise.
9590 * x86_64.cc (Relocate::relocate): Likewise.
9591 * testsuite/weak_plt.sh: New test.
9592 * testsuite/weak_plt_main.cc: New test.
9593 * testsuite/weak_plt_shared.cc: New test.
9594 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
9595 (check_PROGRAMS): Add weak_plt.
9596 (check_DATA): Add weak_plt_shared.so.
9597 (weak_plt_main_pic.o, weak_plt): New targets.
9598 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
9599 * testsuite/Makefile.in: Rebuild.
9601 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
9603 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
9604 * testsuite/Makefile.in: Rebuild.
9606 2008-08-04 Alan Modra <amodra@bigpond.net.au>
9608 * Makefile.am (POTFILES.in): Set LC_ALL=C.
9609 * Makefile.in: Regenerate.
9610 * po/POTFILES.in: Regenerate.
9612 2008-07-29 Ian Lance Taylor <iant@google.com>
9614 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
9615 symbols before other symbols.
9616 * testsuite/script_test_2.cc (test_addr): Declare.
9617 (test_addr_alias): Declare.
9618 (main): Check that test_addr and test_addr_alias have the right
9620 * testsuite/script_test_2.t: Define test_addr_alias and
9623 2008-07-24 Ian Lance Taylor <iant@google.com>
9626 * descriptors.cc: New file.
9627 * descriptors.h: New file.
9628 * gold-threads.h (class Hold_optional_lock): New class.
9629 * fileread.cc: Include "descriptors.h".
9630 (File_read::~File_read): Release descriptor rather than closing
9632 (File_read::open) [file]: Call open_descriptor rather than open.
9633 Set is_descriptor_opened_.
9634 (File_read::open) [memory]: Assert that descriptor is not open.
9635 (File_read::reopen_descriptor): New function.
9636 (File_read::release): Release descriptor.
9637 (File_read::do_read): Make non-const. Reopen descriptor.
9638 (File_read::read): Make non-const.
9639 (File_read::make_view): Reopen descriptor.
9640 (File_read::do_readv): Likewise.
9641 * fileread.h (class File_read): Add is_descriptor_opened_ field.
9642 Update declarations.
9643 * layout.cc: Include "descriptors.h".
9644 (Layout::create_build_id): Use open_descriptor rather than open.
9645 * output.cc: Include "descriptors.h".
9646 (Output_file::open): Use open_descriptor rather than open.
9647 * archive.cc (Archive::const_iterator): Change Archive to be
9649 (Archive::begin, Archive::end): Make non-const.
9650 (Archive::count_members): Likewise.
9651 * archive.h (class Archive): Update declarations.
9652 * object.h (Object::read): Make non-const.
9653 * Makefile.am (CCFILES): Add descriptors.cc.
9654 (HFILES): Add descriptors.h.
9655 * Makefile.in: Rebuild.
9658 * gold.h: Always include <clocale>. Add Solaris workarounds
9659 following code in binutils/sysdep.h.
9662 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
9663 this->eh_frame_hdr_ is NULL before using it.
9665 * dynobj.cc (Versions::Versions): Update comment.
9667 * dynobj.cc (Versions::Versions): If there is an soname, use it as
9668 the base version name.
9670 * stringpool.cc (Stringpool_template::add_with_length): Set key to
9671 array size plus one.
9672 (Stringpool_template::set_string_offsets): Subtract one from key
9673 before using it as an array index.
9674 (Stringpool_template::get_offset_with_length): Likewise.
9675 (Stringpool_template::write_to_buffer): Likewise.
9676 * stringpool.h (Stringpool_template::get_offset_from_key):
9679 2008-07-23 Ian Lance Taylor <iant@google.com>
9682 * object.h (Merged_symbol_value::value): Do our best to handle a
9686 * script.cc (Version_script_info::get_versions): Don't add empty
9687 version tag to return value.
9688 (Version_script_info::get_symbol_version_helper): Change return
9689 type to bool. Add pversion parameter. Change all callers.
9690 (script_register_vers_node): Don't require a non-NULL tag.
9691 * script.h (class Version_script_info): Update declarations.
9692 (Version_script_info::get_symbol_version): Change return type to
9693 bool. Add version parameter. Change all callers.
9694 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
9695 handling. Handle an empty version from a version script.
9696 (Symbol_table::define_special_symbol): Likewise.
9697 * testsuite/ver_test_10.script: New file.
9698 * testsuite/ver_test_10.sh: New file.
9699 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
9700 (check_DATA): Add ver_test_10.syms.
9701 (ver_test_10.syms, ver_test_10.so): New target.
9702 * testsuite/Makefile.in: Rebuild.
9704 2008-07-23 Simon Baldwin <simonb@google.com>
9706 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
9707 to zero for undefined symbols from dynamic libraries.
9709 2008-07-23 Ian Lance Taylor <iant@google.com>
9711 * symtab.cc (Symbol_table::resolve): Remove version parameter.
9713 * symtab.h (class Symbol_table): Update declaration.
9714 * testsuite/ver_test_9.cc: New file.
9715 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
9716 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
9717 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
9718 (ver_test_9.so, ver_test_9.o): New targets.
9719 * testsuite/Makefile.in: Rebuild.
9721 2008-07-22 Ian Lance Taylor <iant@google.com>
9723 * options.h (class General_options): Define --check-sections.
9724 * layout.cc (Layout::set_segment_offsets): Handle
9727 * options.h (class General_options): Define -n/--nmagic and
9729 * options.cc (General_options::finalize): For -n/--nmagic or
9730 -N/--omagic, set -static.
9731 * layout.cc (Layout::attach_allocated_section_to_segment): If
9732 -N/--omagic, don't put read-only and read-write sections in
9734 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
9735 finding a read-only segment.
9736 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
9737 don't set the minimum segment alignment to the common page size,
9738 and don't set the file offset to the address modulo the page size.
9739 * script-sections.cc (Script_sections::create_segments): If
9740 -n/--omagic, don't put read-only and read-write sections in
9743 * cref.cc: New file.
9745 * options.h (class General_options): Add --print-symbol-counts.
9746 * main.cc (main): Issue defined symbol report if requested.
9747 * archive.cc (Archive::interpret_header): Make into a const member
9749 (Archive::add_symbols): Call Input_objects::archive_start and
9751 (Archive::const_iterator): Define new class.
9752 (Archive::begin, Archive::end): New functions.
9753 (Archive::include_all_members): Rewrite to use iterator.
9754 (Archive::count_members): New function.
9755 * archive.h (class Archive): Update declarations.
9756 (Archive::filename): New function.
9757 * object.cc: Include "cref.h".
9758 (Sized_relobj::Sized_relobj): Initialize defined_count_.
9759 (Sized_relobj::do_get_global_symbol_counts): New function.
9760 (Input_objects::add_object): Add object to cross-referencer.
9761 (Input_objects::archive_start): New function.
9762 (Input_objects::archive_stop): New function.
9763 (Input_objects::print_symbol_counts): New function.
9764 * object.h: Declare Cref and Archive.
9765 (Object::get_global_symbol_counts): New function.
9766 (Object::do_get_global_symbol_counts): New pure virtual function.
9767 (class Sized_relobj): Add defined_count_ field. Update
9769 (class Input_objects): Add cref_ field. Update constructor.
9770 Update declarations.
9771 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
9773 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
9775 (Sized_dynobj::do_get_global_symbol_counts): New function.
9776 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
9777 defined_count_. Update declarations. Define Symbols typedef.
9778 * symtab.cc (Symbol_table::add_from_relobj): Add defined
9779 parameter. Change all callers.
9780 (Symbol_table::add_from_dynobj): Add sympointers and defined
9781 parameters. Change all callers.
9782 * symtab.h (class Symbol_table): Update declarations.
9783 * Makefile.am (CCFILES): Add cref.cc.
9784 (HFILES): Add cref.h.
9785 * Makefile.in: Rebuild.
9787 2008-07-22 Simon Baldwin <simonb@google.com>
9789 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
9790 to zero when writing undefined symbols.
9792 2008-07-22 Ian Lance Taylor <iant@google.com>
9794 * output.cc (Output_section::add_input_section): Don't try to
9795 merge empty merge sections.
9797 2008-07-21 Craig Silverstein <csilvers@google.com>
9799 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9800 Include symbol version in error message.
9802 2008-07-20 Chris Demetriou <cgd@google.com>
9804 * configure.ac (gold_cv_c_random_seed): New configured variable.
9805 (RANDOM_SEED_CFLAGS): New substituted variable.
9806 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
9807 * configure: Rebuild.
9808 * Makefile.in: Likewise.
9809 * testsuite/Makefile.in: Likewise.
9811 2008-07-18 Ian Lance Taylor <iant@google.com>
9813 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
9814 where we see NAME/NULL and NAME/VERSION as separate symbols.
9815 * testsuite/ver_test_main.cc (main): Call t4.
9816 (t4, t4_2a): Define.
9817 * testsuite/ver_test_2.cc (t4_2): Define.
9818 * testsuite/ver_test_2.script: Put t4_2a in VER2.
9819 * testsuite/ver_test_4.cc (t4_2a): Define.
9820 * testsuite/ver_test_4.script: Put t4_2a in VER2.
9821 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
9823 2008-07-17 Ian Lance Taylor <iant@google.com>
9825 * dynobj.cc (Versions::add_def): If we give an error about a
9826 missing version, go ahead and create the version anyhow.
9828 2008-07-10 Ian Lance Taylor <iant@google.com>
9830 Handle output sections with more than 0x7fffffff bytes.
9831 * object.h (class Relobj): Change map_to_output_ to
9832 output_sections_, and just keep a section pointer. Change all
9833 uses. Move comdat group support to Sized_relobj.
9834 (Relobj::is_section_specially_mapped): Remove.
9835 (Relobj::output_section): Remove poff parameter. Change all
9837 (Relobj::output_section_offset): New function.
9838 (Relobj::set_section_offset): Rewrite.
9839 (Relobj::map_to_output): Remove.
9840 (Relobj::output_sections): New function.
9841 (Relobj::do_output_section_offset): New pure virtual function.
9842 (Relobj::do_set_section_offset): Likewise.
9843 (class Sized_relobj): Add section_offsets_ field. Add comdat
9844 group support from Relobj. Update declarations.
9845 (Sized_relobj::get_output_section_offset): New function.
9846 (Sized_relobj::do_output_section_offset): New function.
9847 (Sized_relobj::do_set_section_offset): New function.
9848 * object.cc (Relobj::output_section_address): Remove.
9849 (Sized_relobj::Sized_relobj): Initialize new fields.
9850 (Sized_relobj::include_section_group): Cast find_kept_object to
9852 (Sized_relobj::include_linkonce_section): Likewise.
9853 (Sized_relobj::do_layout): Use separate arrays for output section
9855 (Sized_relobj::do_count_local_symbols): Change map_to_output to
9857 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
9858 output_sections and section_offsets.
9859 (Sized_relobj::write_local_symbols): Likewise.
9860 (map_to_kept_section): Compute output address directly.
9861 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
9862 output_sections and section_offsets.
9863 (Sized_relobj::write_sections): Likewise.
9864 (Sized_relobj::relocate_sections): Likewise.
9865 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
9866 * output.h (class Output_reloc): Update declarations. Change
9867 u2_.relobj to Sized_relobj*.
9868 (class Output_data_reloc): Change add functions to use
9870 * output.cc (Output_reloc::Output_reloc): Change relobj to
9872 (Output_reloc::local_section_offset): Change return type to
9873 Elf_Addr. Use get_output_section_offset.
9874 (Output_reloc::get_address): Likewise.
9875 (Output_section::is_input_address_mapped): Don't call
9876 is_section_specially_mapped.
9877 (Output_section::output_offset): Likewise.
9878 (Output_section::output_address): Likewise.
9879 (Output_section::starting_output_address): Likewise.
9880 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
9881 parameter to Sized_relobj*.
9882 (Copy_relocs::need_copy_reloc): Likewise.
9883 (Copy_relocs::save): Likewise.
9884 * copy-relocs.h (class Copy_relocs): Update declarations.
9885 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
9886 Sized_relobj*. Change relobj_ field to Sized_relobj*.
9887 * target-reloc.h (relocate_for_relocatable): Change
9888 offset_in_output_section type to Elf_Addr. Change code that uses
9890 * layout.cc (Layout::layout): Always set *off.
9891 * mapfile.cc (Mapfile::print_input_section): Use
9892 output_section_offset.
9893 * i386.cc (Target_i386::copy_reloc): Change object parameter to
9895 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
9896 * sparc.cc (Target_sparc::copy_reloc): Likewise.
9897 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
9899 2008-07-03 Ian Lance Taylor <iant@google.com>
9901 * layout.cc (Layout::include_section): Do not discard unrecognized
9902 SHT_STRTAB sections.
9904 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
9906 * script.cc (Lex::can_continue_name): Make '?' allowable in
9907 version-script names.
9908 * testsuite/version_script.map: Change glob pattern to use '?'
9910 2008-06-30 Manish Singh <yosh@gimp.org>
9913 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
9916 2008-06-30 Ian Lance Taylor <iant@google.com>
9920 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
9921 versions]: Don't try to read the value in the contents, since we
9922 don't use it. Use the template endianness when writing.
9924 2008-06-25 Cary Coutant <ccoutant@google.com>
9926 * fileread.cc (File_read::make_view): Assert on zero-length view.
9927 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
9928 symbol table when there are no symbols to read.
9930 2008-06-23 Craig Silverstein <csilvers@google.com>
9932 * version.cc (version_string): Bump to 1.7
9934 2008-06-18 Craig Silverstein <csilvers@google.com>
9936 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
9937 constant 0xFFFF to type Valtype.
9938 (Powerpc_relocate_functions::rel16_ha): Likewise.
9940 2008-06-17 Ian Lance Taylor <iant@google.com>
9942 * output.h (Output_section::Input_section): Initialize p2align_ to
9943 zero for Output_section_data constructors.
9944 (Output_section::Input_section::addralign): If not an input
9945 section, return the alignment of the Output_section_data.
9946 * testsuite/copy_test.cc: New file.
9947 * testsuite/copy_test_1.cc: New file.
9948 * testsuite/copy_test_2.cc: New file.
9949 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
9950 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
9951 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
9952 (copy_test_1_pic.o, copy_test_1.so): New targets.
9953 (copy_test_2_pic.o, copy_test_2.so): New targets.
9954 * testsuite/Makefile.in: Rebuild.
9956 * script-sections.cc (Script_sections::place_orphan): Initialize
9957 local variable exact.
9959 2008-06-13 David Edelsohn <edelsohn@gnu.org>
9961 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
9963 2008-06-12 David Edelsohn <edelsohn@gnu.org>
9964 David S. Miller <davem@davemloft.net>
9966 * powerpc.cc: New file.
9967 * Makefile.am (TARGETSOURCES): Add powerpc.cc
9968 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
9969 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
9970 * Makefile.in: Rebuild.
9972 2008-06-09 Ian Lance Taylor <iant@google.com>
9974 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
9976 (throwing, orig_terminate): New static variables.
9977 (terminate_handler): New static function.
9978 (t2): Set terminate handler.
9980 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
9983 * binary.cc (Binary_to_elf::sized_convert): Fix .data
9986 2008-05-30 Cary Coutant <ccoutant@google.com>
9988 * archive.cc (Archive::include_all_members) Correct to step
9989 over symbol table and extended name table in thin archives.
9991 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
9994 * target-reloc.h (relocate_for_relocatable): Fix new_offset
9997 2008-05-28 Caleb Howe <cshowe@google.com>
9999 * reduced_debug_output.cc: New file.
10000 * reduced_debug_output.h: New file.
10001 * options.h (class General_options): Add --strip-debug-non-line.
10002 * options.cc (General_options::finalize): Add strip_debug_non_line
10003 to the strip heirarchy.
10004 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
10006 * layout.cc: Include "reduced_debug_output.h".
10007 (Layout::Layout): Initialize new fields.
10008 (line_only_debug_sections): New static array.
10009 (is_lines_only_debug_sections): New static inline function.
10010 (Layout::include_section): Handle --strip-debug-non-line.
10011 (Layout::make_output_section): If --strip-debug-non-line, build
10012 new output sections for .debug_abbrev and .debug_info.
10013 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
10014 gold. Warn about possible overflow.
10015 (read_signed_LEB_128): Likewise.
10016 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
10017 (read_signed_LEB_128): Declare.
10018 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
10019 (HFILES): Add reduced_debug_output.h.
10020 * Makefile.in: Rebuild.
10022 2008-05-21 Ian Lance Taylor <iant@google.com>
10024 * mapfile.cc: New file.
10025 * mapfile.h: New file.
10026 * options.h (class General_options): Add -M/--print-map and -Map.
10027 * options.cc (General_options::finalize): Make -M equivalent to
10029 * main.cc: Include <cstdio> and "mapfile.h".
10030 (main): Open mapfile if requested.
10031 * gold.cc (class Middle_runner): Add mapfile_ field. Update
10032 constructor. Change caller.
10033 (queue_initial_tasks): Add mapfile parameter. Change caller.
10034 (queue_middle_tasks): Likewise.
10035 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
10037 * archive.cc: Include "mapfile.h".
10038 (Archive::add_symbols): Add mapfile parameter. Change all
10039 callers. Pass mapfile, symbol, and reason to include_member.
10040 (Archive::include_all_members): Add mapfile parameter. Change all
10042 (Archive::include_member): Add mapfile, sym, and why parameters.
10043 Change all callers. Report inclusion to map file.
10044 * archive.h: Include "fileread.h".
10045 (class Archive): Update declarations.
10046 (Archive::file): New const method.
10047 (class Add_archive_symbols): Add mapfile_ field. Update
10048 constructor. Change all callers.
10049 * readsyms.h (class Read_symbols): Likewise.
10050 (class Finish_group): Likewise.
10051 (class Read_script): Likewise.
10052 * common.cc: Include "mapfile.h".
10053 (Symbol_table::allocate_commons): Add mapfile parameter. Change
10055 (Symbol_table::do_allocate_commons): Likewise.
10056 (Symbol_table::do_allocate_commons_list): Likewise. Report common
10057 symbol allocation to mapfile.
10058 * common.h (class Allocate_commons_task): Add mapfile_ field.
10059 Update constructor. Change all callers.
10060 * symtab.h (class Symbol_table): Update declarations.
10061 * layout.cc: Include "mapfile.h".
10062 (Layout_task_runner::run): Print information to mapfile.
10063 (Layout::create_gold_note): Change Output_data_fixed_space to
10064 Output_data_zero_fill.
10065 (Layout::create_build_id): Likewise.
10066 (Layout::print_to_mapfile): New function.
10067 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
10068 constructor. Change caller.
10069 (class Layout): Declare print_to_mapfile.
10070 * output.cc (Output_section::Input_section::print_to_mapfile): New
10072 (Output_section::add_input_section): If producing a map, always
10073 add to input_sections_ list.
10074 (Output_section::do_print_to_mapfile): New function.
10075 (Output_segment::print_sections_to_mapfile): New function.
10076 (Output_segment::print_section_list_to_mapfile): New function.
10077 * output.h: Include "mapfile.h".
10078 (Output_data::print_to_mapfile): New function.
10079 (Output_data::do_print_to_mapfile): New virtual function.
10080 (Output_segment_headers::do_print_to_mapfile): New function.
10081 (Output_file_header::do_print_to_mapfile): New function.
10082 (Output_data_const::do_print_to_mapfile): New function.
10083 (class Output_data_const_buffer): Add map_name_ field. Update
10084 constructor. Change all callers. Add do_print_to_mapfile
10086 (class Output_data_fixed_space): Likewise.
10087 (class Output_data_space): Likewise.
10088 (class Output_data_zero_fill): New class.
10089 (Output_data_strtab::do_print_to_mapfile): New function.
10090 (Output_data_reloc_base::do_print_to_mapfile): New function.
10091 (Output_relocatable_relocs::do_print_to_mapfile): New function.
10092 (Output_data_group::do_print_to_mapfile): New function.
10093 (Output_data_got::do_print_to_mapfile): New function.
10094 (Output_data_dynamic::do_print_to_mapfile): New function.
10095 (Output_symtab_xindex::do_print_to_mapfile): New function.
10096 (class Output_section): Declare do_print_to_mapflie. Declare
10097 print_to_mapfile in Input_section.
10098 (class Output_segment): Declare new functions.
10099 * object.h (Sized_relobj::symbol_count): New function.
10100 * script-sections.cc
10101 (Output_section_element_dot_assignment::set_section_addresses):
10102 Change Output_data_fixed_space to Output_data_zero_fill.
10103 (Output_data_expression::do_print_to_mapfile): New function.
10104 * script.cc (read_input_script): Add mapfile parameter. Change
10106 * script.h (read_input_script): Update declaration.
10107 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
10108 (Eh_frame::do_print_to_mapfile): New function.
10109 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
10110 (Output_merge_string::do_print_to_mapfile): New function.
10111 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
10113 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
10115 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
10117 * Makefile.am (CCFILES): Add mapfile.cc.
10118 (HFILES): Add mapfile.h.
10119 * Makefile.in: Rebuild.
10121 2008-05-19 Ian Lance Taylor <iant@google.com>
10123 * options.h (class General_options): Add -z relro.
10124 * layout.cc (Layout::Layout): Initialize relro_segment_.
10125 (Layout::add_output_section_data): Return the output section.
10126 (Layout::make_output_section): Rcognize relro sections and mark
10127 them appropriately.
10128 (Layout::attach_allocated_section_to_segment): Put relro sections
10129 in a PT_GNU_RELRO segment.
10130 (Layout::create_initial_dynamic_sections): Mark the .dynamic
10132 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
10134 (Layout::linkonce_mapping): Map d.rel.ro.local to
10135 .data.rel.ro.local.
10136 (Layout::output_section_name): Us .data.rel.ro.local for any
10137 section which begins with that.
10138 * layout.h (class Layout): Update add_output_section_data
10139 declaration. Add relro_segment_ field.
10140 * output.cc (Output_section::Output_section): Initialize is_relro_
10141 and is_relro_local_ fields.
10142 (Output_segment::add_output_section): Group relro sections.
10143 (Output_segment::is_first_section_relro): New function.
10144 (Output_segment::maximum_alignment): If there is a relro section,
10145 align the segment to the common page size.
10146 (Output_segment::set_section_addresses): Track whether we are
10147 looking at relro sections. If the last section is a relro
10148 section, align to the common page size.
10149 (Output_segment::set_section_list_addresses): Add in_relro
10150 parameter. Change all callers. Align to the page size when
10151 moving from relro to non-relro section.
10152 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
10154 * output.h (class Output_section): Add is_relro_ and
10155 is_relro_local_ fields.
10156 (Output_section::is_relro): New function.
10157 (Output_section::set_is_relro): New function.
10158 (Output_section::is_relro_local): New function.
10159 (Output_section::set_is_relro_local): New function.
10160 (class Output_segment): Update declarations.
10161 * i386.cc (Target_i386::got_section): Mark .got section as relro.
10162 * sparc.cc (Target_sparc::got_section): Likewise.
10163 * x86_64.cc (Target_x86_64::got_section): Likewise.
10164 * testsuite/relro_test_main.cc: New file.
10165 * testsuite/relro_test.cc: New file.
10166 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
10167 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
10168 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
10169 (relro_test.so, relro_test_pic.o): New targets.
10170 * testsuite/Makefile.in: Rebuild.
10172 2008-05-16 Ian Lance Taylor <iant@google.com>
10174 * output.cc (Output_segment::add_output_section): Remove front
10176 * output.h (class Output_segment): Remove
10177 add_initial_output_section and overloaded add_output_section.
10178 Update declaration of remaining add_output_section.
10179 * layout.cc (Layout::create_interp): Call add_output_section
10180 rather than add_initial_output_section.
10181 (Layout::finish_dynamic_section): Likewise.
10183 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
10184 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
10185 know the dynamic type.
10186 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
10187 field. Initialize it in constructor.
10188 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
10189 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
10190 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
10193 * output.cc (Output_reloc::get_address): Change return type to
10195 * output.h (class Output_reloc): Update get_address declaration.
10196 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
10197 for section addresses.
10199 2008-05-09 Ian Lance Taylor <iant@google.com>
10202 * gold.cc (gold_nomem): Use return value of write.
10204 2008-05-08 Ian Lance Taylor <iant@google.com>
10206 * symtab.c (Symbol::init_base_output_data): Add version
10207 parameter. Change all callers.
10208 (Symbol::init_base_output_segment): Likewise.
10209 (Symbol::init_base_constant): Likewise.
10210 (Symbol::init_base_undefined): Likewise.
10211 (Sized_symbol::init_output_data): Likewise.
10212 (Sized_symbol::init_output_segment): Likewise.
10213 (Sized_symbol::init_constant): Likewise.
10214 (Sized_symbol::init_undefined): Likewise.
10215 (Symbol_table::do_define_in_output_data): If the new symbol has a
10216 version, mark it as the default.
10217 (Symbol_table::do_define_in_output_segment): Likewise.
10218 (Symbol_table::do_define_as_constant): Likewise.
10219 * symtab.h (class Symbol): Update declarations.
10220 (class Sized_symbol): Likewise.
10221 * resolve.cc (Symbol::override_version): New function.
10222 (Symbol::override_base): Call override_version.
10223 (Symbol::override_base_with_special): Likewise.
10224 * testsuite/ver_script_8.script: New file.
10225 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
10226 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
10227 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
10228 (ver_test_8_1.so, ver_test_8_2.so): New targets.
10230 2008-05-06 Ian Lance Taylor <iant@google.com>
10233 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
10235 (class General_options): Remove existing --undefined, and add
10236 --no-undefined instead. Add new --undefined as synonym for -u.
10237 * archive.cc (Archive::add_symbols): Check whether symbol was
10239 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
10240 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
10241 all uses. Add IS_UNDEFINED. Update declarations to split
10242 different versions of init_base. Declare init_base_undefined.
10243 (Symbol::is_defined): Handle IS_UNDEFINED.
10244 (Symbol::is_undefined): Likewise.
10245 (Symbol::is_weak_undefined): Call is_undefined.
10246 (Symbol::is_absolute): Handle IS_CONSTANT.
10247 (class Sized_symbol): Update declarations to split different
10248 versions of init. Declare init_undefined.
10249 (class Symbol_table): Declare new functions.
10250 * symtab.cc (Symbol::init_base_object): Rename from init_base.
10251 Change all callers.
10252 (Symbol::init_base_output_data): Likewise.
10253 (Symbol::init_base_output_segment): Likewise.
10254 (Symbol::init_base_constant): Likewise.
10255 (Symbol::init_base_undefined): New function.
10256 (Sized_symbol::init_object): Rename from init. Change all
10258 (Sized_symbol::init_output_data): Likewise.
10259 (Sized_symbol::init_output_segment): Likewise.
10260 (Sized_symbol::init_constant): Likewise.
10261 (Sized_symbol::init_undefined): New function.
10262 (Symbol_table::add_undefined_symbols_from_command_line): New
10264 (Symbol_table::do_add_undefined_symbols_from_command_line): New
10266 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
10267 (Symbol::output_section): Likewise.
10268 (Symbol::set_output_section): Likewise.
10269 (Symbol_table::sized_finalize_symbol): Likewise.
10270 (Symbol_table::sized_write_globals): Likewise.
10271 * resolve.cc (Symbol_table::should_override): Likewise.
10272 (Symbol::override_base_with_special): Likewise.
10274 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
10275 symbol, change it to have default visibility.
10276 * testsuite/protected_1.cc: New file.
10277 * testsuite/protected_2.cc: New file.
10278 * testsuite/protected_3.cc: New file.
10279 * testsuite/protected_main_1.cc: New file.
10280 * testsuite/protected_main_2.cc: New file.
10281 * testsuite/protected_main_3.cc: New file.
10282 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
10283 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
10284 (protected_1_LDFLAGS, protected_1_LDADD): Define.
10285 (protected_1.so): New target.
10286 (protected_1_pic.o, protected_2_pic.o): New targets.
10287 (protected_3_pic.o): New target.
10288 (check_PROGRAMS): Add protected_2.
10289 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
10290 (protected_2_LDFLAGS, protected_2_LDADD): Define.
10291 * testsuite/Makefile.in: Rebuild.
10293 * options.h (DEFINE_var): Add set_user_set_##varname__.
10294 (DEFINE_bool_alias): New macro.
10295 (class General_options): Define -Bstatic using DEFINE_bool_alias
10296 rather than DEFINE_special. Add --undefined as an alias for -z
10298 * options.cc (General_options::parse_Bstatic): Remove.
10300 * options.h (class General_options): Add --fatal-warnings.
10301 * main.cc (main): Implement --fatal-warnings.
10302 * errors.h (Errors::warning_count): New function.
10304 * options.h (class General_options): Add -Bsymbolic-functions.
10305 * symtab.h (Symbol::is_preemptible): Check for
10306 -Bsymbolic-functions.
10308 2008-05-05 Ian Lance Taylor <iant@google.com>
10310 * options.h (DEFINE_bool): For DASH_Z, create the negative option
10311 as noVARNAME rather than no-VARNAME.
10312 (class General_options): Add option -z combreloc.
10313 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
10315 (Output_reloc::sort_before) [SHT_REL]: New function.
10316 (Output_reloc::sort_before) [SHT_RELA]: New function.
10317 (class Output_data_reloc_base): Add sort_relocs_ field. Define
10318 Sort_relocs_comparison.
10319 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
10320 parameter. Change all callers.
10321 (Output_data_reloc::Output_data_reloc) [both versions]: Add
10322 sort_relocs parameter. Change all callers.
10323 * output.cc (Output_reloc::get_address): New function, broken out
10325 (Output_reloc::write_rel): Call it.
10326 (Output_reloc::compare): New function.
10327 (Output_data_reloc_base::do_write): Optionally sort relocs.
10329 * configure.ac: If targ_extra_obj is set, link it in.
10330 * configure.tgt: Initialize all variables.
10331 (x86_64*): Set targ_extra_obj and targ_extra_size.
10332 * configure: Rebuild.
10334 * object.cc (Sized_relobj::include_section_group): Adjust section
10335 indexes read from group data. Build vector to pass to
10337 * layout.cc (Layout::layout_group): Add flags and shndxes
10338 parameters. Remove contents parameter. Change caller. Update
10339 explicit instantiations.
10340 * layout.h (class Layout): Update layout_group declaration.
10341 * output.cc (Output_data_group::Output_data_group): Add flags and
10342 input_shndxes parameters. Remove contents parameter. Change
10344 (Output_data_group::do_write): Change input_sections_ to
10346 * output.h (class Output_data_group): Update constructor
10347 declaration. Rename input_sections_ to input_shndxes_.
10348 * testsuite/many_sections_test.cc: Add template.
10350 2008-04-30 Cary Coutant <ccoutant@google.com>
10352 * target-reloc.h (relocate_section): Fix dead-pointer bug.
10354 * layout.cc (Layout::include_section): Refactored check for debug
10356 (Layout::add_comdat): Add new parameters. Change type
10357 of signature parameter. Add object and shndx to signatures table.
10358 (Layout::find_kept_object): New function.
10359 * layout.h: Include <cstring>.
10360 (Layout::is_debug_info_section): New function.
10361 (Layout::add_comdat): Add new parameters.
10362 (Layout::find_kept_object): New function.
10363 (Layout::Kept_section): New struct.
10364 (Layout::Signatures): Change type of map range.
10365 * object.cc (Relobj::output_section_address): New function.
10366 (Sized_relobj::include_section_group): Add new parameters. Change
10367 calls to Layout::add_comdat. Change to build table of kept comdat
10368 groups and table mapping discarded sections to kept sections.
10369 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
10370 (Sized_relobj::do_layout): Change calls to include_section_group and
10371 include_linkonce_section.
10372 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
10373 value to zero when section is discarded.
10374 (Sized_relobj::map_to_kept_section): New function.
10375 * object.h (Relobj::output_section_address): New function.
10376 (Relobj::Comdat_group): New type.
10377 (Relobj::find_comdat_group): New function.
10378 (Relobj::Comdat_group_table): New type.
10379 (Relobj::Kept_comdat_section): New type.
10380 (Relobj::Kept_comdat_section_table): New type.
10381 (Relobj::add_comdat_group): New function.
10382 (Relobj::set_kept_comdat_section): New function.
10383 (Relobj::get_kept_comdat_section): New function.
10384 (Relobj::comdat_groups_): New field.
10385 (Relobj::kept_comdat_sections_): New field.
10386 (Symbol_value::input_value): Update comment.
10387 (Sized_relobj::map_to_kept_section) New function.
10388 (Sized_relobj::include_linkonce_section): Add new parameter.
10389 * target-reloc.h (Comdat_behavior): New type.
10390 (get_comdat_behavior): New function.
10391 (relocate_section): Add code to map a discarded section to the
10392 corresponding kept section when applying a relocation.
10394 2008-04-30 Craig Silverstein <csilvers@google.com>
10396 * dwarf_reader.cc (next_generation_count): New static var.
10397 (Addr2line_cache_entry): New struct.
10398 (addr2line_cache): New static var.
10399 (Dwarf_line_info::one_addr2line): Added caching.
10400 (Dwarf_line_info::clear_addr2line_cache): New function.
10401 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
10402 cache-size parameter.
10403 (Dwarf_line_info::one_addr2line_cache): New function.
10404 * symtab.cc (Symbol_table::detect_odr_violations): Pass
10405 new cache-size argument to one_addr2line(), and clear cache.
10407 2008-04-28 Cary Coutant <ccoutant@google.com>
10409 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
10410 R_386_PC8 relocations.
10412 2008-04-23 Ian Lance Taylor <iant@google.com>
10414 * object.cc (Sized_relobj::include_section_group): Check for
10415 invalid section group.
10417 * object.cc (make_elf_object): Correct test for 64-bit ELF file
10420 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
10421 than read for file header.
10422 * archive.cc (Archive::include_member): Likewise.
10424 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
10426 * aclocal.m4: Regenerate.
10427 * configure: Regenerate.
10429 2008-04-19 Ian Lance Taylor <iant@google.com>
10431 * version.cc (version_string): Bump to 1.6.
10433 * testsuite/Makefile.am (many_sections_r_test): New target.
10434 (many_sections_r_test_SOURCES): Remove.
10435 (many_sections_r_test_DEPENDENCIES): Remove.
10436 (many_sections_r_test_LDFLAGS): Remove.
10437 (many_sections_r_test_LDADD): Remove.
10439 * object.cc (Sized_relobj::do_add_symbols): Always pass
10440 local_symbol_count_ to add_from_relobj.
10442 * testsuite/Makefile.am (many_sections_check.h): Only check one in
10443 every thousand variables.
10444 * testsuite/Makefile.in: Rebuild.
10446 * object.cc (Xindex::initialize_symtab_xindex): New function.
10447 (Xindex::read_symtab_xindex): New function.
10448 (Xindex::sym_xindex_to_shndx): New function.
10449 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
10451 (Sized_relobj::do_initialize_xindex): New function.
10452 (Sized_relobj::do_read_symbols): Adjust section links.
10453 (Sized_relobj::symbol_section_and_value): Add is_ordinary
10454 parameter. Change all callers.
10455 (Sized_relobj::include_section_group): Adjust section links and
10456 symbol section indexes.
10457 (Sized_relobj::do_layout): Adjust section links.
10458 (Sized_relobj::do_count_local_symbols): Adjust section links and
10459 symbol section indexes.
10460 (Sized_relobj::do_finalize_local_symbols): Distinguish between
10461 ordinary and special symbols.
10462 (Sized_relobj::write_local_symbols): Add symtab_xindex and
10463 dynsym_xindex parameters. Change all callers. Adjust section
10464 links. Use SHN_XINDEX when needed.
10465 (Sized_relobj::get_symbol_location_info): Adjust section links.
10466 Don't get fooled by special symbols.
10467 * object.h (class Xindex): Define.
10468 (class Object): Add xindex_ parameter. Declare virtual functoin
10469 do_initialize_xindex.
10470 (Object::adjust_sym_shndx): New function.
10471 (Object::set_xindex): New protected function.
10472 (class Symbol_value): Add is_ordinary_shndx_ field.
10473 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
10474 (Symbol_value::value): Assert ordinary section.
10475 (Symbol_value::initialize_input_to_output_map): Likewise.
10476 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
10477 Change all callers.
10478 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
10480 (class Sized_relobj): Update declarations.
10481 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
10482 parameter. Change all callers.
10483 (Sized_relobj::adjust_shndx): New function.
10484 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
10486 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
10487 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
10488 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
10489 (Sized_dynobj::read_dynsym_section): Adjust section links.
10490 (Sized_dynobj::read_dynamic): Likewise.
10491 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
10493 (Sized_dynobj::do_initialize_xindex): New function.
10494 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
10495 do_initialize_xindex.
10496 (Sized_dynobj::adjust_shndx): New function.
10497 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
10498 dynsym_xindex_ fields.
10499 (Layout::finalize): Add a call to set_section_indexes before
10500 creating the symtab sections.
10501 (Layout::set_section_indexes): Don't do anything if the section
10502 already has a section index.
10503 (Layout::create_symtab_sections): Add shnum parameter. Change
10504 caller. Create .symtab_shndx section if needed.
10505 (Layout::create_shdrs): Add shstrtab_section parameter. Change
10507 (Layout::allocated_output_section_count): New function.
10508 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
10510 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
10511 fields. Update declarations.
10512 (Layout::symtab_xindex): New function.
10513 (Layout::dynsym_xindex): New function.
10514 (class Write_symbols_task): Add layout_ field.
10515 (Write_symbols_task::Write_symbols_task): Add layout parameter.
10517 * output.cc (Output_section_headers::Output_section_headers): Add
10518 shstrtab_section parameter. Change all callers.
10519 (Output_section_headers::do_sized_write): Store overflow values
10520 for section count and section string table section index in
10521 section header zero.
10522 (Output_file_header::do_sized_write): Check for overflow of
10523 section count and section string table section index.
10524 (Output_symtab_xindex::do_write): New function.
10525 (Output_symtab_xindex::endian_do_write): New function.
10526 * output.h (class Output_section_headers): Add shstrtab_section_.
10527 Update declarations.
10528 (class Output_symtab_xindex): Define.
10529 (Output_section::has_out_shndx): New function.
10530 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
10532 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
10533 Change all callers.
10534 (Sized_symbol::init): Likewise.
10535 (Symbol::output_section): Check for ordinary symbol.
10536 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
10537 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
10539 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
10540 Change all callers. Simplify handling of symbols from sections
10541 not included in the link.
10542 (Symbol_table::add_from_dynobj): Handle ordinary symbol
10544 (Weak_alias_sorter::operator()): Assert that symbols are
10546 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
10548 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
10549 parameters. Change all callers.
10550 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
10551 symbol distinction. Use SHN_XINDEX when needed.
10552 (Symbol_table::write_section_symbol): Add symtab_xindex
10553 parameter. Change all callers.
10554 (Symbol_table::sized_write_section_symbol): Likewise. Use
10555 SHN_XINDEX when needed.
10556 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
10558 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
10559 (Symbol::is_defined): Check is_ordinary.
10560 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
10561 (Symbol::is_absolute, Symbol::is_common): Likewise.
10562 (class Sized_symbol): Update declarations.
10563 (class Symbol_table): Update declarations.
10564 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
10565 parameters. Change all callers.
10566 (Sized_symbol::override): Likewise.
10567 (Symbol_table::override): Likewise.
10568 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
10569 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
10570 is_ordinary, and orig_st_shndx parameters. Change all callers.
10571 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
10572 to be in an ordinary section.
10573 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
10574 object and is_ordinary parameters. Change all callers.
10575 (Sized_dwarf_line_info::read_relocs): Add object parameter.
10576 Change all callers. Don't add undefined or non-ordinary symbols
10578 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
10579 Change all callers.
10580 * dwarf_reader.h (class Sized_dwarf_line_info): Update
10582 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
10583 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
10584 (Sized_relobj::relocate_sections): Likewise.
10585 * target-reloc.h (scan_relocs): Adjust section symbol index.
10586 (scan_relocatable_relocs): Likewise.
10587 * i386.cc (Scan::local): Check for ordinary symbols.
10588 * sparc.cc (Scan::local): Likewise.
10589 * x86_64.cc (Scan::local): Likewise.
10590 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
10591 to symbol_section_and_value.
10592 * testsuite/many_sections_test.cc: New file.
10593 * testsuite/Makefile.am (BUILT_SOURCES): Define.
10594 (check_PROGRAMS): Add many_sections_test.
10595 (many_sections_test_SOURCES): Define.
10596 (many_sections_test_DEPENDENCIES): Define.
10597 (many_sections_test_LDFLAGS): Define.
10598 (BUILT_SOURCES): Add many_sections_define.h.
10599 (many_sections_define.h): New target.
10600 (BUILT_SOURCES): Add many_sections_check.h.
10601 (many_sections_check.h): New target.
10602 (check_PROGRAMS): Add many_sections_r_test.
10603 (many_sections_r_test_SOURCES): Define.
10604 (many_sections_r_test_DEPENDENCIES): Define.
10605 (many_sections_r_test_LDFLAGS): Define.
10606 (many_sections_r_test_LDADD): Define.
10607 (many_sections_r_test.o): New target.
10608 * testsuite/Makefile.in: Rebuild.
10610 2008-04-17 Cary Coutant <ccoutant@google.com>
10612 * errors.cc (Errors::info): New function.
10613 (gold_info): New function.
10614 * errors.h (Errors::info): New function.
10615 * gold.h (gold_info): New function.
10616 * object.cc (Input_objects::add_object): Print trace output.
10617 * options.cc (options::parse_set): New function.
10618 (General_options::parse_wrap): Deleted.
10619 (General_options::General_options): Deleted initializer.
10620 * options.h (options::String_set): New typedef.
10621 (options::parse_set): New function.
10622 (DEFINE_set): New macro.
10623 (General_options::wrap): Changed to use DEFINE_set. Changed
10624 callers of any_wrap_symbols and is_wrap_symbol.
10625 (General_options::trace, General_options::trace_symbol):
10627 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
10628 (General_options::wrap_symbols_): Deleted.
10629 * symtab.cc (Symbol_table::add_from_object): Print trace output.
10631 2008-04-17 David S. Miller <davem@davemloft.net>
10633 * options.cc (General_options::parse_V): New function.
10634 * options.h: Add entries for -V and -Qy.
10636 2008-04-17 Ian Lance Taylor <iant@google.com>
10638 * common.cc (Symbol_table::allocate_commons): Remove options
10639 parameter. Change caller.
10640 (Symbol_table::do_allocate_commons): Remove options parameter.
10641 Change caller. Just call do_allocate_commons_list twice.
10642 (Symbol_table::do_allocate_commons_list): New function, broken out
10643 of do_allocate_commons.
10644 * common.h (class Allocate_commons_task): Remove options_ field.
10645 Update constructor.
10646 * symtab.cc (Symbol_table::Symbol_table): Initialize
10648 (Symbol_table::add_from_object): Put TLS common symbols on
10650 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
10651 which are IN_OUTPUT_DATA.
10652 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
10653 allocate_commons and do_allocate_commons declarations. Declare
10654 do_allocate_commons_list.
10655 * gold.cc (queue_middle_tasks): Update creation of
10656 Allocate_commons_task to not pass options.
10657 * testsuite/Makefile.am (INCLUDES): Add -I.. .
10658 (TLS_TEST_C_FLAGS): New variable.
10659 (tls_test_c_pic.o): New target.
10660 (tls_test_shared.so): Link in tls_test_c_pic.o.
10661 (tls_test_c_pic_ie.o): New target.
10662 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
10663 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
10664 (tls_test_c.o): New target.
10665 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
10666 (tls_pic_test_LDADD): Likewise.
10667 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
10668 (tls_shared_gd_to_ie_test_LDADD): Likewise.
10669 (tls_test_c_gnu2.o): New target.
10670 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
10672 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
10673 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
10674 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
10675 * testsuite/tls_test.cc: Include "config.h".
10676 (t_last): Call t11_last.
10677 * testsuite/tls_test.h (t11, t11_last): Declare.
10678 * testsuite/tls_test_c.c: New file.
10679 * testsuite/tls_test_main.cc (thread_routine): Call t11.
10680 * configure.ac: Check for OpenMP support.
10681 * configure, config.in, Makefile.in: Rebuild.
10682 * testsuite/Makefile.in: Rebuild.
10684 2008-04-16 Cary Coutant <ccoutant@google.com>
10686 * i386.cc (Target_i386::define_tls_base_symbol): New function.
10687 (Target_i386::tls_base_symbol_defined_): New field.
10688 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10689 (Target_i386::Scan::global): Likewise.
10690 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
10691 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
10692 (Target_x86_64::tls_base_symbol_defined_): New field.
10693 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10694 (Target_x86_64::Scan::global): Likewise.
10696 2008-04-16 Cary Coutant <ccoutant@google.com>
10698 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
10699 (Symbol::needs_plt_entry): Allow weak undefined symbols.
10700 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
10701 building shared libraries.
10702 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
10703 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
10704 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
10705 * testsuite/Makefile.in: Rebuild.
10706 * testsuite/weak_undef.h: New file.
10707 * testsuite/weak_undef_file1.cc: Add extra test cases.
10708 * testsuite/weak_undef_file2.cc: Likewise.
10709 * testsuite/weak_undef_test.cc: Likewise.
10711 2008-04-16 David S. Miller <davem@davemloft.net>
10713 * sparc.cc (Target_sparc::Scan): Change from struct to class.
10714 Add issued_non_pic_error_ field. Declare check_non_pic.
10715 (Target_sparc::Scan::check_non_pic): New function.
10716 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
10717 (Target_sparc::Scan::global): Likewise.
10719 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
10720 * configure: Rebuild.
10722 * options.h (DEFINE_enable): New macro.
10723 (new_dtags): New enable option.
10724 (initfirst, interpose, loadfltr, nodefaultlib,
10725 nodelete, nodlopen, nodump): New -z options.
10726 * layout.cc (Layout:finish_dynamic_section): If new
10727 dtags enabled, emit DT_RUNPATH. Also, emit a
10728 DT_FLAGS_1 containing any specified -z flags.
10730 2008-04-16 Ian Lance Taylor <iant@google.com>
10732 * copy-relocs.cc: New file.
10733 * copy-relocs.h: New file.
10734 * reloc.cc: Remove Copy_relocs code.
10735 * reloc.h: Likewise.
10736 * reloc-types.h (struct Reloc_types) [both versions]: Add
10737 get_reloc_addend_noerror.
10738 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
10739 variants of add_global which take an addend which must be zero.
10740 * i386.cc: Include "copy-relocs.h".
10741 (class Target_i386): Change type of copy_relocs_ to variable,
10742 update initializer.
10743 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
10744 Change all callers.
10745 (Target_i386::do_finalize_sections): Change handling of
10747 * sparc.cc: Include "copy-relocs.h".
10748 (class Target_sparc): Change type of copy_relocs_ to variable,
10749 update initializer.
10750 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
10751 Change all callers.
10752 (Target_sparc::do_finalize_sections): Change handling of
10754 * x86_64.cc: Include "copy-relocs.h".
10755 (class Target_x86_64): Change type of copy_relocs_ to variable,
10756 update initializer.
10757 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
10758 class. Change all callers.
10759 (Target_x86_64::do_finalize_sections): Change handling of
10761 * Makefile.am (CCFILES): Add copy-relocs.cc.
10762 (HFILES): Add copy-relocs.h.
10764 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
10766 * testsuite/script_test_4.sh: Permit leading zeroes.
10768 2008-04-15 Ian Lance Taylor <iant@google.com>
10770 * script-sections.cc (Script_sections::create_segments): Use
10771 header_size_adjustment even when there is enough room for the
10773 * testsuite/script_test_4.sh: New file.
10774 * testsuite/script_test_4.t: New file.
10775 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
10776 (check_DATA): Add script_test_4.stdout.
10777 (MOSTLYCLEANFILES): Likewise.
10778 (script_test_4): New target.
10779 (script_test_4.stdout): New target.
10780 * testsuite/Makefile.in: Rebuild.
10782 * sparc.cc: Add definitions for Output_data_plt_sparc class
10785 2008-04-14 David S. Miller <davem@davemloft.net>
10787 * sparc.cc: New file.
10788 * Makefile.am (TARGETSOURCES): Add sparc.cc
10789 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
10790 * configure.tgt: Document targ_extra_size and
10791 targ_extra_big_endian. Add entries for sparc-* and
10793 * configure.ac: Handle targ_extra_size and
10794 targ_extra_big_endian.
10795 * Makefile.in: Rebuild.
10796 * configure: Likewise.
10797 * po/POTFILES.in: Likewise.
10798 * po/gold.pot: Likewise.
10800 2008-04-14 Ian Lance Taylor <iant@google.com>
10802 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
10803 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
10804 in the name/type/flags to section mapping. Don't call
10805 allocate_output_section.
10806 (Layout::choose_output_section): Change parameter from adjust_name
10807 to is_input_section. Don't permit input sections after sections
10808 are attached to segments. Don't call allocate_output_section.
10809 (Layout::layout_eh_frame): Call update_flags_for_input_section,
10810 not write_enable_output_section.
10811 (Layout::make_output_section): Don't push to
10812 unattached_section_list_ nor call attach_to_segment. Call
10813 attach_section_to_segment if sections are attached.
10814 (Layout::attach_sections_to_segments): New function.
10815 (Layout::attach_section_to_segment): New function.
10816 (Layout::attach_allocated_section_to_segment): Rename from
10817 attach_to_segment. Remove flags parameter.
10818 (Layout::allocate_output_section): Remove function.
10819 (Layout::write_enable_output_section): Remove function.
10820 * layout.h (class Layout): Update for above changes. Add new
10821 field sections_are_attached_.
10822 * output.h (Output_section::update_flags_for_input_section): New
10824 * output.cc (Output_section::add_input_section): Call
10825 update_flags_for_input_section.
10826 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
10828 2008-04-11 Cary Coutant <ccoutant@google.com>
10830 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
10831 thought unnecessary.
10832 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
10834 2008-04-11 Ian Lance Taylor <iant@google.com>
10836 * output.h (class Output_section_data): Remove inline definition
10838 * output.cc (Output_section_data::set_addralign): New function.
10840 2008-04-11 Cary Coutant <ccoutant@google.com>
10842 Add support for TLS descriptors for i386 and x86_64.
10843 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
10844 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
10845 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
10847 (Target_i386::got_mod_index_entry): Remove unnecessary code.
10848 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
10849 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
10851 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
10852 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
10853 Fix problem with initial-exec relocations.
10854 (Target_i386::Relocate::relocate_tls): Likewise.
10855 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
10857 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
10858 support for section-plus-offset dynamic table entries.
10859 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
10860 (Output_data_dynamic::Dynamic_entry): Add support for
10861 section-plus-offset dynamic table entries.
10862 (Output_data_dynamic::Classification): Likewise.
10863 (Output_data_dynamic::classification_): Renamed offset_.
10864 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
10865 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
10866 (Target_x86_64::make_plt_section): New function.
10867 (Target_x86_64::reserve_tlsdesc_entries): New function.
10868 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
10869 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
10870 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
10871 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
10872 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
10873 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
10874 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
10875 add extra PLT entry for TLS descriptors.
10876 (Output_data_plt_x86_64::got_): New field.
10877 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
10878 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
10880 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
10882 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
10883 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
10884 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
10885 R_386_TLS_DESC_CALL relocations.
10886 (Target_x86_64::Scan::global): Likewise.
10887 (Target_x86_64::do_finalize_sections): Add dynamic table entries
10888 for TLS descriptors.
10889 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
10890 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
10891 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
10892 GD-to-IE relaxation.
10893 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
10894 and TLS_DESCRIPTORS.
10895 * Makefile.in: Rebuild.
10896 * configure: Rebuild.
10897 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
10898 (tls_test_shared2.so): New target.
10899 (tls_shared_gd_to_ie_test_SOURCES): New variable.
10900 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
10901 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
10902 (tls_shared_gd_to_ie_test_LDADD): New variable.
10903 (tls_shared_gnu2_gd_to_ie_test): New target.
10904 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
10906 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
10907 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
10908 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
10909 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
10910 (tls_shared_gnu2_test): New target.
10911 (tls_test_gnu2_shared.so): New target.
10912 (tls_shared_gnu2_test_SOURCES): New variable.
10913 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
10914 (tls_shared_gnu2_test_LDFLAGS): New variable.
10915 (tls_shared_gnu2_test_LDADD): New variable.
10916 * testsuite/Makefile.in: Rebuild.
10917 * testsuite/Makefile.
10919 2008-04-11 Ian Lance Taylor <iant@google.com>
10921 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
10923 * testsuite/Makefile.in: Rebuild.
10925 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
10927 * testsuite/script_test_2.cc (main): Adjust test.
10929 2008-04-11 David S. Miller <davem@davemloft.net>
10930 Ian Lance Taylor <iant@google.com>
10932 * options.h (General_options): Add entries for '-Y' and
10934 * options.cc (General_options:finalize): If -Y was used, add those
10935 entries to the library path instead of the default "/lib" and
10938 2008-04-11 David S. Miller <davem@davemloft.net>
10940 * testsuite/justsyms.t: Start at 0x100.
10941 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
10942 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
10944 * testsuite/script_test_2.cc: Adjust string and section length
10947 2008-04-09 Ian Lance Taylor <iant@google.com>
10950 * script-sections.cc (Sections_element::allocate_to_segment): Add
10952 (Output_section_definition::allocate_to_segment): Likewise.
10953 (Orphan_output_section::allocate_to_segment): Likewise.
10954 (Script_sections::attach_sections_using_phdrs_clause): Don't
10955 propagate non-PT_LOAD segments to orphan sections.
10956 * testsuite/Makefile.am (script_test_3.stdout): Generate using
10957 readelf rather than objdump.
10958 * testsuite/script_test_3.sh: Adjust accordingly. Test that
10959 .interp section and PT_INTERP segment are the same size.
10960 * testsuite/Makefile.in: Rebuild.
10962 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
10963 aliases for symbols defined in the same object.
10964 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
10965 (weak_alias_test_SOURCES): New variable.
10966 (weak_alias_test_DEPENDENCIES): New variable.
10967 (weak_alias_test_LDFLAGS): New variable.
10968 (weak_alias_test_LDADD): New variable.
10969 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
10970 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
10971 (weak_alias_test_3.o): New target.
10972 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
10973 * testsuite/weak_alias_test_main.cc: New file.
10974 * testsuite/weak_alias_test_1.cc: New file.
10975 * testsuite/weak_alias_test_2.cc: New file.
10976 * testsuite/weak_alias_test_3.cc: New file.
10978 2008-04-08 Ian Lance Taylor <iant@google.com>
10980 * options.h (class General_options): Add --noinhibit-exec option.
10981 * main.cc (main): Check --noinhibit-exec.
10983 * options.h (class General_options): Define --wrap as a special
10984 option. Add wrap_symbols_ field.
10985 (General_options::any_wrap_symbols): New function.
10986 (General_options::is_wrap_symbol): New function.
10987 * options.cc (General_options::parse_wrap): New function.
10988 (General_options::General_options): Initialize wrap_symbols_.
10989 * symtab.cc (Symbol_table::wrap_symbol): New function.
10990 (Symbol_table::add_from_object): Handle --wrap.
10991 * symtab.h (class Symbol_table): Declare wrap_symbol.
10992 * target.h (Target::wrap_char): New function.
10993 (Target::Target_info): Add wrap_char field.
10994 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
10995 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10996 * testsuite/testfile.cc (Target_test::test_target_info):
10999 * errors.cc (Errors::undefined_symbol): Mention symbol version if
11002 * layout.h (class Layout): Add added_eh_frame_data_ field.
11003 * layout.cc (Layout::Layout): Initialize new field.
11004 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
11005 output section until we find a section we merged successfully.
11006 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
11007 that the size be non-zero.
11009 * merge.cc (Object_merge_map::get_output_offset): Remove inline
11012 2008-04-08 Craig Silverstein <csilvers@google.com>
11014 * configure.ac: Export new conditional variable HAVE_ZLIB.
11015 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
11017 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
11018 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11020 2008-04-07 Ian Lance Taylor <iant@google.com>
11022 * version.cc (version_string): Set to "1.5".
11024 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
11025 Add issued_non_pic_error_ field. Declare check_non_pic.
11026 (Target_x86_64::Scan::check_non_pic): New function.
11027 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
11028 (Target_x86_64::Scan::global): Likewise.
11030 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
11031 addend parameter. Change caller. Handle merge sections.
11032 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
11033 Address to Addend. Don't add in the result of
11034 local_section_offset, pass down the addend and use the returned
11036 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
11037 Update declarations of local_section_offset and symbol_value.
11038 * testsuite/two_file_test_1.cc (t18): New function.
11039 * testsuite/two_file_test_2.cc (f18): New function.
11040 * testsuite/two_file_test_main.cc (main): Call t18.
11041 * testsuite/two_file_test.h (t18, f18): Declare.
11043 * configure.ac: Don't test for objdump, c++filt, or readelf.
11044 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
11046 (TEST_READELF): New variable.
11047 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
11048 (check_PROGRAMS): Add two_file_strip_test.
11049 (two_file_strip_test): New target.
11050 (check_PROGRAMS): Add two_file_same_shared_strip_test.
11051 (two_file_same_shared_strip_test_SOURCES): New variable.
11052 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
11053 (two_file_same_shared_strip_test_LDFLAGS): New variable.
11054 (two_file_same_shared_strip_test_LDADD): New variable.
11055 (two_file_shared_strip.so): New target.
11056 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
11057 (ver_test_5.syms, ver_test_7.syms): Likewise.
11058 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
11059 (strip_test_3.stdout): Use TEST_OBJDUMP.
11060 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11062 2008-04-04 Cary Coutant <ccoutant@google.com>
11064 * symtab.h (Symbol::is_weak_undefined): New function.
11065 (Symbol::is_strong_undefined): New function.
11066 (Symbol::is_absolute): New function.
11067 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
11068 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
11070 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
11071 (weak_undef_test): New target.
11072 * testsuite/Makefile.in: Rebuild.
11073 * testsuite/weak_undef_file1.cc: New file.
11074 * testsuite/weak_undef_file2.cc: New file.
11075 * testsuite/weak_undef_test.cc: New file.
11077 2008-04-03 Craig Silverstein <csilvers@google.com>
11079 * compressed_output.h (class Output_compressed_section): Use
11081 * compressed_output.cc (zlib_compress): Use unsigned buffers,
11083 (zlib_compressed_suffix): Removed.
11084 (Output_compressed_section::set_final_data_size): Use unsigned
11086 * testsuite/Makefile.am (flagstest_compress_debug_sections):
11087 Fix linker invocation.
11088 (flagstest_o_specialfile_and_compress_debug_sections):
11090 * testsuite/Makefile.in: Regenerated.
11092 2008-04-02 David S. Miller <davem@davemloft.net>
11094 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
11095 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
11097 2008-04-02 Craig Silverstein <csilvers@google.com>
11101 2008-04-02 Ian Lance Taylor <iant@google.com>
11103 * fileread.cc (File_read::find_view): Add byteshift and vshifted
11104 parameters. Update for new key type to views_. Change all
11106 (File_read::read): Adjust for byteshift in returned view.
11107 (File_read::add_view): New function, broken out of
11108 find_and_make_view.
11109 (File_read::make_view): New function, broken out of
11110 find_and_make_view.
11111 (File_read::find_or_make_view): Add offset and aligned
11112 parameters. Rewrite accordingly. Change all callers.
11113 (File_read::get_view): Add offset and aligned parameters. Adjust
11114 for byteshift in return value.
11115 (File_read::get_lasting_view): Likewise.
11116 * fileread.h (class File_read): Update declarations.
11117 (class File_read::View): Add byteshift_ field. Add byteshift to
11118 constructor. Add byteshift method.
11119 * archive.h (Archive::clear_uncached_views): New function.
11120 (Archive::get_view): Add aligned parameter. Change all callers.
11121 * object.h (Object::get_view): Add aligned parameter. Change all
11123 (Object::get_lasting_view): Likewise.
11125 * fileread.cc (File_read::release): Don't call clear_views if
11126 there are multiple objects.
11127 * fileread.h (File_read::clear_uncached_views): New function.
11128 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
11131 2008-03-31 Cary Coutant <ccoutant@google.com>
11133 Add thin archive support.
11134 * archive.cc (Archive::armagt): New const.
11135 (Archive::setup): Remove task parameter and calls to unlock.
11136 (Archive::unlock_nested_archives): New function.
11137 (Archive::read_header): Add nested_off parameter. Change
11139 (Archive::interpret_header): Likewise.
11140 (Archive::include_all_members): Change to handle thin
11142 (Archive::include_member): Likewise.
11143 * archive.h (Archive::Archive): Add new parameters and
11145 (Archive::armagt): New const.
11146 (Archive::setup): Remove task parameter.
11147 (Archive::unlock_nested_archives): New function.
11148 (Archive::read_header): Add nested_off parameter.
11149 (Archive::interpret_header): Likewise.
11150 (Archive::Nested_archive_table): New typedef.
11151 (Archive::is_thin_archive_): New field.
11152 (Archive::nested_archives_): New field.
11153 (Archive::options_): New field.
11154 (Archive::dirpath_): New field.
11155 (Archive::task_): New field.
11156 * readsyms.cc (Read_symbols::do_read_symbols): Add check
11157 for thin archives. Pass additional parameters to
11158 Archive::Archive. Unlock the archive file after calling
11161 2008-03-29 Ian Lance Taylor <iant@google.com>
11163 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
11164 version symbol to be local.
11165 * testsuite/ver_test_4.sh: New file.
11166 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
11167 (check_DATA): Add ver_test_4.syms.
11168 (ver_test_4.syms): New target.
11169 * testsuite/Makefile.in: Rebuild.
11172 (Output_section::Input_section_sort_entry::has_priority): New
11174 (Output_section::Input_section_sort_entry::match_file_name): New
11176 (Output_section::Input_section_sort_entry::match_section_name):
11178 (Output_section::Input_section_sort_entry::match_section_name_prefix):
11180 (Output_section::Input_section_sort_entry::match_section_file):
11182 (Output_section::Input_section_sort_compare::operator()): Rewrite
11183 using new Input_section_sort_entry functions. Sort crtbegin and
11184 crtend first. Sort sections with no priority before sections with
11186 * testsuite/initpri1.c (d3): Check j != 4.
11187 (cd5): New constructor/destructor function.
11188 (main): Check j != 2.
11190 * symtab.cc (Symbol_table::add_from_object): If we don't use the
11191 new symbol when resolving, don't call set_is_default.
11192 * testsuite/ver_test_7.cc: New file.
11193 * testsuite/ver_test_7.sh: New file.
11194 * testsuite/Makefile.am (ver_test_7.so): New target.
11195 (ver_test_7.o): New target.
11196 (check_SCRIPTS): Add ver_test_7.sh.
11197 (check_DATA): Add ver_test_7.syms.
11198 (ver_test_7.syms): New target.
11200 2008-03-28 Ian Lance Taylor <iant@google.com>
11202 * layout.cc (Layout::layout): If we see an input section with a
11203 name that needs sorting, set the must_sort flag for the output
11205 (Layout::make_output_section): If the name of the output section
11206 indicates that it might require sorting, set the may_sort flag.
11207 * output.h (Output_section::may_sort_attached_input_sections): New
11209 (Output_section::set_may_sort_attached_input_sections): New
11211 (Output_section::must_sort_attached_input_sections): New
11213 (Output_section::set_must_sort_attached_input_sections): New
11215 (class Output_section): Declare Input_section_sort_entry. Define
11216 Input_section_sort_compare. Declare
11217 sort_attached_input_sections. Add new fields:
11218 may_sort_attached_input_sections_,
11219 must_sort_attached_input_sections_,
11220 attached_input_sections_are_sorted_.
11221 * output.cc (Output_section::Output_section): Initialize new
11223 (Output_section::add_input_section): Add an entry to
11224 input_sections_ if may_sort or must_sort are true.
11225 (Output_section::set_final_data_size): Call
11226 sort_attached_input_sections if necessary.
11227 (Output_section::Input_section_sort_entry): Define new class.
11228 (Output_section::Input_section_sort_compare::operator()): New
11230 (Output_section::sort_attached_input_sections): New function.
11231 * configure.ac: Check whether the compiler supports constructor
11232 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
11233 * testsuite/initpri1.c: New file.
11234 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
11235 CONSTRUCTOR_PRIORITY.
11236 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
11237 (initpri1_LDFLAGS): New variable.
11238 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11240 2008-03-27 Ian Lance Taylor <iant@google.com>
11242 * common.cc (Sort_commons::operator): Correct sorting algorithm.
11243 * testsuite/common_test_1.c: New file.
11244 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
11245 (common_test_1_SOURCES): New variable.
11246 (common_test_1_DEPENDENCIES): New variable.
11247 (common_test_1_LDFLAGS): New variable.
11249 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
11250 and commons_ correctly when NAME/VERSION does not override
11252 * testsuite/ver_test_6.c: New file.
11253 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
11254 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
11255 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
11257 2008-03-26 Ian Lance Taylor <iant@google.com>
11259 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
11260 of an undefined symbol from a version script.
11261 * testsuite/Makefile.am (ver_test_5.so): New target.
11262 (ver_test_5.o): New target.
11263 (check_SCRIPTS): Add ver_test_5.sh.
11264 (check_DATA): Add ver_test_5.syms.
11265 (ver_test_5.syms): New target.
11266 * testsuite/ver_test_5.cc: New file.
11267 * testsuite/ver_test_5.script: New file.
11268 * testsuite/ver_test_5.sh: New file.
11269 * Makefile.in, testsuite/Makefile.in: Rebuild.
11272 Fix problems building gold with gcc 4.3.0.
11273 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
11274 (gold_error_at_location, gold_warning_at_location): Use it.
11275 * configure.ac: Check whether we can compile and use a template
11276 function with a printf attribute.
11277 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
11278 when jumping over bytes.
11279 * object.cc: Instantiate Object::read_section_data.
11280 * debug.h: Include <cstring>
11281 * dwarf_reader.cc: Include <algorithm>
11282 * main.cc: Include <cstring>.
11283 * options.cc: Include <cstring>.
11284 * output.cc: Include <cstring>.
11285 * script.cc: Include <cstring>.
11286 * script.h: Include <string>.
11287 * symtab.cc: Include <cstring> and <algorithm>.
11288 * target-select.cc: Include <cstring>.
11289 * version.cc: Include <string>.
11290 * testsuite/testmain.cc: Include <cstdlib>.
11291 * configure, config.in: Rebuild.
11293 2008-03-25 Ian Lance Taylor <iant@google.com>
11295 * options.cc: Include "../bfd/bfdver.h".
11296 (options::help): Print bug reporting address.
11298 * version.cc (print_version): Adjust output for current value of
11299 BFD_VERSION_STRING.
11303 * options.cc (options::help): Print list of supported targets.
11304 * target-select.h: Include <vector>.
11305 (class Target_selector): Make machine_, size_, and is_big_endian_
11306 fields const. Add bfd_name_ and instantiated_target_ fields.
11307 (Target_selector::Target_selector): Add bfd_name parameter.
11308 (Target_selector::recognize): Make non-virtual, call
11310 (Target_selector::recognize_by_name): Make non-virtual, call
11311 do_recognize_by_name.
11312 (Target_selector::supported_names): New function.
11313 (Target_selector::bfd_name): New function.
11314 (Target_selector::do_instantiate_target): New pure virtual
11316 (Target_selector::do_recognize): New virtual function.
11317 (Target_selector::do_recognize_by_name): New virtual function.
11318 (Target_selector::instantiate_target): New private function.
11319 (supported_target_names): Declare.
11320 * target-select.cc (Target_selector::Target_selector): Update for
11321 new parameter and fields.
11322 (select_target_by_name): Check that the name matches before
11323 calling recognize_by_name.
11324 (supported_target_names): New function.
11325 * i386.cc (class Target_selector_i386): Update Target_selector
11326 constructor call. Remove recognize and recognize_by_name. Add
11327 do_instantiate_target.
11328 * x86_64.cc (class Target_selector_x86_64): Likewise.
11329 * testsuite/testfile.cc (class Target_selector_test): Update for
11330 changes to Target_selector.
11332 * README: Rewrite, with some notes on unsupported features.
11334 2008-03-24 Cary Coutant <ccoutant@google.com>
11336 * i386.cc (Target_i386::Got_type): New enum declaration.
11337 (Target_i386::Scan::local): Updated callers of Output_data_got
11339 (Target_i386::Scan::global): Likewise.
11340 (Target_i386::Relocate::relocate): Likewise.
11341 (Target_i386::Relocate::relocate_tls): Likewise.
11342 * object.h (Got_offset_list): New class.
11343 (Sized_relobj::local_has_got_offset): Added got_type parameter.
11344 (Sized_relobj::local_got_offset): Likewise.
11345 (Sized_relobj::set_local_got_offset): Likewise.
11346 (Sized_relobj::local_has_tls_got_offset): Removed.
11347 (Sized_relobj::local_tls_got_offset): Removed.
11348 (Sized_relobj::set_local_tls_got_offset): Removed.
11349 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
11350 * output.cc (Output_data_got::add_global): Added got_type parameter.
11351 (Output_data_got::add_global_with_rel): Likewise.
11352 (Output_data_got::add_global_with_rela): Likewise.
11353 (Output_data_got::add_global_pair_with_rel): New function.
11354 (Output_data_got::add_global_pair_with_rela): New function.
11355 (Output_data_got::add_local): Added got_type parameter.
11356 (Output_data_got::add_local_with_rel): Likewise.
11357 (Output_data_got::add_local_with_rela): Likewise.
11358 (Output_data_got::add_local_pair_with_rel): New function.
11359 (Output_data_got::add_local_pair_with_rela): New function.
11360 (Output_data_got::add_global_tls): Removed.
11361 (Output_data_got::add_global_tls_with_rel): Removed.
11362 (Output_data_got::add_global_tls_with_rela): Removed.
11363 (Output_data_got::add_local_tls): Removed.
11364 (Output_data_got::add_local_tls_with_rel): Removed.
11365 (Output_data_got::add_local_tls_with_rela): Removed.
11366 * output.h (Output_data_got::add_global): Added got_type parameter.
11367 (Output_data_got::add_global_with_rel): Likewise.
11368 (Output_data_got::add_global_with_rela): Likewise.
11369 (Output_data_got::add_global_pair_with_rel): New function.
11370 (Output_data_got::add_global_pair_with_rela): New function.
11371 (Output_data_got::add_local): Added got_type parameter.
11372 (Output_data_got::add_local_with_rel): Likewise.
11373 (Output_data_got::add_local_with_rela): Likewise.
11374 (Output_data_got::add_local_pair_with_rel): New function.
11375 (Output_data_got::add_local_pair_with_rela): New function.
11376 (Output_data_got::add_global_tls): Removed.
11377 (Output_data_got::add_global_tls_with_rel): Removed.
11378 (Output_data_got::add_global_tls_with_rela): Removed.
11379 (Output_data_got::add_local_tls): Removed.
11380 (Output_data_got::add_local_tls_with_rel): Removed.
11381 (Output_data_got::add_local_tls_with_rela): Removed.
11382 * resolve.cc (Symbol::override_base_with_special): Removed
11383 reference to has_got_offset_ field.
11384 * symtab.cc (Symbol::init_fields): Replaced initialization
11385 of got_offset_ with got_offsets_. Removed initialization
11387 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
11388 (Symbol::got_offset): Likewise.
11389 (Symbol::set_got_offset): Likewise.
11390 (Symbol::has_tls_got_offset): Removed.
11391 (Symbol::tls_got_offset): Removed.
11392 (Symbol::set_tls_got_offset): Removed.
11393 (Symbol::got_offset_): Removed.
11394 (Symbol::tls_mod_got_offset_): Removed.
11395 (Symbol::tls_pair_got_offset_): Removed.
11396 (Symbol::got_offsets_): New field.
11397 (Symbol::has_got_offset): Removed.
11398 (Symbol::has_tls_mod_got_offset): Removed.
11399 (Symbol::has_tls_pair_got_offset): Removed.
11400 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
11401 (Target_x86_64::Scan::local): Updated callers of Output_data_got
11403 (Target_x86_64::Scan::global): Likewise.
11404 (Target_x86_64::Relocate::relocate): Likewise.
11405 (Target_x86_64::Relocate::relocate_tls): Likewise.
11407 2008-03-25 Ben Elliston <bje@au.ibm.com>
11409 * yyscript.y: Fix spelling error in comment.
11411 2008-03-24 Ian Lance Taylor <iant@google.com>
11413 * options.h (class General_options): Define build_id option.
11414 * layout.h (class Layout): Declare write_build_id, create_note,
11415 create_build_id. Add build_id_note_ member.
11416 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
11417 "libiberty.h", "md5.h", "sha1.h".
11418 (Layout::Layout): Initialize eh_frame_data_,
11419 eh_frame_hdr_section_, and build_id_note_.
11420 (Layout::finalize): Call create_build_id.
11421 (Layout::create_note): New function, broken out of
11422 Layout::create_gold_note.
11423 (Layout::create_gold_note): Call create_note.
11424 (Layout::create_build_id): New function.
11425 (Layout::write_build_id): New function.
11426 (Close_task_runner::run): Call write_build_id.
11428 * x86_64.cc: Correct license to GPLv3.
11430 2008-03-23 Ian Lance Taylor <iant@google.com>
11432 * options.cc: Include "demangle.h".
11433 (parse_optional_string): New function.
11434 (parse_long_option): Handle takes_optional_argument.
11435 (parse_short_option): Update dash_z initializer. Handle
11436 takes_optional_argument.
11437 (General_options::General_options): Initialize do_demangle_.
11438 (General_options::finalize): Set do_demangle_. Handle demangling
11440 * options.h (parse_optional_string): Declare.
11441 (struct One_option): Add optional_arg field. Update constructor.
11442 Update call constructor calls. Add takes_optional_argument
11444 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
11445 (DEFINE_optional_string): Define.
11446 (General_options::demangle): Change from DEFINE_bool to
11447 DEFINE_optional_string.
11448 (General_options::no_demangle): New function.
11449 (General_options::do_demangle): New function.
11450 (General_options::set_do_demangle): New function.
11451 (General_options::execstack_status_): Move definition to end of
11453 (General_options::static_): Likewise.
11454 (General_options::do_demangle_): New field.
11455 * object.cc (big_endian>::get_symbol_location_info): Call
11456 Options::do_demangle, not Options::demangle.
11457 * symtab.cc (demangle): Likewise.
11459 2008-03-22 Ian Lance Taylor <iant@google.com>
11461 * gold.h: Include <cstddef> and <sys/types.h>
11462 * options.h: Include <cstring>.
11464 2008-03-21 Ian Lance Taylor <iant@google.com>
11466 * Added source code to GNU binutils.