1 2011-06-29 Ian Lance Taylor <iant@google.com>
3 * script.cc (Token::integer_value): Accept trailing M/m/K/k
5 (Lex::gather_token): Accept trailing M/m/K/k for integers.
7 2011-06-29 Ian Lance Taylor <iant@google.com>
10 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
12 * layout.cc (Layout::layout_eh_frame): Likewise.
14 2011-06-29 Ian Lance Taylor <iant@google.com>
17 * layout.cc (Layout::symtab_section_shndx): New function.
18 * layout.h (class Layout): Declare symtab_section_shndx.
19 * output.cc (Output_section::write_header): Call it.
21 2011-06-29 Ian Lance Taylor <iant@google.com>
24 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
25 symbols which are not used in a relocation.
27 2011-06-28 Ian Lance Taylor <iant@google.com>
30 * layout.cc (Layout::segment_precedes): Don't crash if a linker
31 script create indistinguishable segments.
32 (Layout::set_segment_offsets): Use stable_sort when sorting
33 segments. Pass this to Compare_segments constructor.
34 * layout.h (class Layout): Make segment_precedes non-static.
35 (class Compare_segments): Change from struct to class. Add
36 layout_ field. Add constructor.
38 (Script_sections::attach_sections_using_phdrs_clause): Rename
39 local orphan to is_orphan. Don't report failure to put empty
40 section in segment. On attachment failure, report name of
41 section, and attach to first PT_LOAD segment.
43 2011-06-28 Ian Lance Taylor <iant@google.com>
46 * target-select.cc (Target_selector::Target_selector): Add
47 emulation parameter. Change all callers.
48 (select_target_by_bfd_name): Rename from select_target_by_name.
50 (select_target_by_emulation): New function.
51 (supported_emulation_names): New function.
52 * target-select.h (class Target_selector): Add emulation_ field.
54 (Target_selector::recognize_by_bfd_name): Rename from
55 recognize_by_name. Change all callers.
56 (Target_selector::supported_bfd_names): Rename from
57 supported_names. Change all callers.
58 (Target_selector::recognize_by_emulation): New function.
59 (Target_selector::supported_emulations): New function.
60 (Target_selector::emulation): New function.
61 (Target_selector::do_recognize_by_bfd_name): Rename from
62 do_recognize_by_name. Change all callers.
63 (Target_selector::do_supported_bfd_names): Rename from
64 do_supported_names. Change all callers.
65 (Target_selector::do_recognize_by_emulation): New function.
66 (Target_selector::do_supported_emulations): New function.
67 (select_target_by_bfd_name): Change name in declaration.
68 (select_target_by_emulation): Declare.
69 (supported_emulation_names): Declare.
70 * parameters.cc (parameters_force_valid_target): Try to find
71 target based on emulation from -m option.
72 * options.h (class General_options): Change doc string for -m.
73 * options.cc (help): Print emulations.
74 (General_options::parse_V): Likewise.
75 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
76 Add emulation parameter. Change all callers.
78 2011-06-28 Ian Lance Taylor <iant@google.com>
80 * target.h (class Target): Add osabi_ field.
81 (Target::osabi): New function.
82 (Target::set_osabi): New function.
83 (Target::Target): Initialize osabi_.
84 (Target::do_adjust_elf_header): Make pure virtual.
85 (Sized_target::do_adjust_elf_header): Declare.
86 * target.cc (Sized_target::do_adjust_elf_header): New function.
87 (class Sized_target): Instantiate all versions.
88 * freebsd.h (class Target_freebsd): Remove.
89 (Target_selector_freebsd::do_recognize): Call set_osabi on
91 (Target_selector_freebsd::do_recognize_by_name): Likewise.
92 (Target_selector_freebsd::set_osabi): Remove.
93 * i386.cc (class Target_i386): Inherit from Sized_target rather
95 * x86_64.cc (class Target_x86_64): Likewise.
97 2011-06-28 Ian Lance Taylor <iant@google.com>
99 * target.h (Target::can_check_for_function_pointers): Rewrite.
101 (Target::can_icf_inline_merge_sections): Likewise.
102 (Target::section_may_have_icf_unsafe_poineters): Likewise.
103 (Target::Target_info): Add can_icf_inline_merge_sections field.
104 (Target::do_can_check_for_function_pointers): New virtual
106 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
107 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
108 from can_check_for_function_pointers, move in file.
109 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
110 section_may_have_icf_unsafe_poineters, move in file.
111 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
112 * i386.cc (Target_i386::do_can_check_for_function_pointers):
113 Rename from can_check_for_function_pointers, move in file.
114 (Target_i386::can_icf_inline_merge_sections): Remove.
115 (Target_i386::i386_info): Initialize
116 can_icf_inline_merge_sections.
117 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
118 Initialize can_icf_inline_merge_sections.
119 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
120 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
121 Rename from can_check_for_function_pointers, move in file.
122 (Target_x86_64::can_icf_inline_merge_sections): Remove.
123 (Target_x86_64::x86_64_info): Initialize
124 can_icf_inline_merge_sections.
125 * testsuite/testfile.cc (Target_test::test_target_info):
127 * icf.cc (get_section_contents): Correct formatting.
129 2011-06-27 Ian Lance Taylor <iant@google.com>
131 * symtab.cc (Symbol::versioned_name): New function.
132 (Symbol_table::add_to_final_symtab): Use versioned_name when
134 (Symbol_table::sized_write_symbol): Likewise.
135 * symtab.h (class Symbol): Declare versioned_name.
136 * stringpool.h (class Stringpool_template): Add variant of add
137 which takes a std::basic_string.
138 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
139 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
140 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
141 (ver_test_12.o): New target.
142 * testsuite/Makefile.in: Rebuild.
144 2011-06-27 Doug Kwan <dougkwan@google.com>
146 * arm.cc (Arm_relocate_functions::thm_jump8,
147 Arm_relocate_functions::thm_jump11): Use a wider signed
148 type to compute offset.
149 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
151 * testsuite/Makefile.in: Regenerate.
152 * testsuite/arm_branch_in_range.sh: Check test results of
153 arm_thm_jump11 and arm_thm_jump8.
154 * testsuite/arm_thm_jump11.s: New test source file.
155 * testsuite/arm_thm_jump11.t: New linker script.
156 * testsuite/arm_thm_jump8.s: New test source file.
157 * testsuite/arm_thm_jump8.t: New linker script.
159 2011-06-24 Ian Lance Taylor <iant@google.com>
161 * layout.cc: Include "object.h".
162 (ctors_sections_in_init_array): New static variable.
163 (Layout::is_ctors_in_init_array): New function.
164 (Layout::layout): Add entry to ctors_sections_in_init_array if
166 * layout.h (class Layout): Declare is_ctors_in_init_array.
167 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
168 is_ctors_reverse_view is set.
169 (Sized_relobj_file::write_sections): Add layout parameter. Change
170 all callers. Set is_ctors_reverse_view field of View_size.
171 (Sized_relobj_file::reverse_words): New function.
172 * object.h (Sized_relobj_file::View_size): Add
173 is_ctors_reverse_view field.
174 (class Sized_relobj_file): Update declarations.
175 * testsuite/initpri3.c: New test.
176 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
178 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
179 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
180 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
181 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
182 * testsuite/Makefile.in: Rebuild.
184 2011-06-24 Cary Coutant <ccoutant@google.com>
186 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
187 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
188 (debug_msg_cdebug.err): New targets.
189 * testsuite/Makefile.in: Regenerate.
190 * testsuite/debug_msg.sh: Check output of link with compressed debug.
191 Fix checks for link with shared library.
193 2011-06-24 Doug Kwan <dougkwan@google.com>
195 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
196 skip empty text sections.
197 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
199 2011-06-22 Ian Lance Taylor <iant@google.com>
202 * options.h (class General_options): Add --ctors-in-init-array.
203 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
204 friends as SHT_PROGBITS for merging sections.
205 (Layout::layout): Remove special handling of .init_array and
206 friends. Don't sort if doing relocatable link. Sort for .ctors
207 and .dtors if ctors_in_init_array.
208 (Layout::make_output_section): Force correct section types for
209 .init_array and friends. Don't sort if doing relocatable link,
210 Don't sort .ctors and .dtors if ctors_in_init_array.
211 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
212 (Layout::output_section_name): Add relobj parameter. Change all
213 callers. Handle .ctors. and .dtors. in code rather than table.
214 Handle .ctors and .dtors if ctors_in_init_array.
215 (Layout::match_file_name): New function, moved from output.cc.
216 * layout.h (class Layout): Update declarations.
217 * output.cc: Include "layout.h".
218 (Input_section_sort_entry::get_priority): New function.
219 (Input_section_sort_entry::match_file_name): Just call
220 Layout::match_file_name.
221 (Output_section::Input_section_sort_init_fini_compare::operator()):
222 Handle .ctors and .dtors. Sort by explicit priority rather than
224 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
225 * testsuite/initpri2.c: New test.
226 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
227 (check_PROGRAMS): Add initpri2.
228 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
229 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
230 * configure, testsuite/Makefile.in: Rebuild.
232 2011-06-19 Ian Lance Taylor <iant@google.com>
235 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
236 .interp section to a PT_INTERP segment even if we have seen a
237 --dynamic-linker option. Don't do it if we have seen a PHDRS
238 clause in a linker script.
239 (Layout::finalize): Don't create a .interp section if we've
240 already create a PT_INTERP segment.
241 (Layout::create_interp): Always call choose_output_section (revert
242 patch of 2011-06-17). Don't create PT_INTERP segment.
244 (Script_sections::create_note_and_tls_segments): Add a .interp
245 section to a PT_INTERP segment even if we have seen a
246 --dynamic-linker option.
248 2011-06-18 Ian Lance Taylor <iant@google.com>
250 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
251 merely because a non-PT_LOAD segment has a dynamic reloc.
253 2011-06-18 Ian Lance Taylor <iant@google.com>
255 * layout.cc (Layout::finish_dynamic_section): Don't create
256 DT_FLAGS entry if not needed.
258 2011-06-18 Ian Lance Taylor <iant@google.com>
261 * layout.cc (Layout::layout_eh_frame): Correct handling of
262 writable .eh_frame section.
264 2011-06-17 Ian Lance Taylor <iant@google.com>
267 * resolve.cc (Symbol_table::resolve): Don't give an error if a
268 symbol is redefined with the exact same object and value.
270 2011-06-17 Ian Lance Taylor <iant@google.com>
273 * layout.h (class Layout): Add interp_segment_ field.
274 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
275 (Layout::attach_allocated_section_to_segment): If making shared
276 library, put .interp section in PT_INTERP segment.
277 (Layout::finalize): Also call create_interp if -dynamic-linker
279 (Layout::create_interp): Assert that there is no PT_INTERP
280 segment. If not using a SECTIONS clause, use make_output_section.
281 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
283 (Script_sections::create_note_and_tls_segments): If making shared
284 library, put .interp section in PT_INTERP segment.
286 2011-06-17 Ian Lance Taylor <iant@google.com>
288 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
289 when making a shared library.
291 2011-06-17 Ian Lance Taylor <iant@google.com>
293 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
294 parameter. Change all callers. Don't issue warning about PC32
295 against locally defined symbol.
297 2011-06-16 Ian Lance Taylor <iant@google.com>
299 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
300 occurs in same object.
302 2011-06-14 Alan Modra <amodra@gmail.com>
304 * po/POTFILES.in: Regenerate.
306 2011-06-09 Ian Lance Taylor <iant@google.com>
309 (Orphan_output_section::set_section_addresses): For a relocatable
310 link set address to 0.
312 2011-06-09 Cary Coutant <ccoutant@google.com>
315 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
316 used with --compress-debug-sections.
317 * gold/object.cc (Sized_relobj_file::do_layout): Report
318 uncompressed size of compressed input sections.
320 2011-06-08 Cary Coutant <ccoutant@google.com>
323 * testsuite/two_file_test_2_v1.cc: Change initialization of
324 v2 to keep it in .data.
326 2011-06-07 Cary Coutant <ccoutant@google.com>
328 * common.cc (Symbol_table::do_allocate_commons_list): Call
330 * errors.cc (Errors::fatal): Adjust call to gold_exit.
331 (Errors::fallback): New function.
332 (gold_fallback): New function.
333 * errors.h (Errors::fallback): New function.
334 * gold.cc (gold_exit): Change status parameter to enum; adjust
336 (queue_initial_tasks): Call gold_fallback.
337 * gold.h: Include cstdlib.
338 (Exit_status): New enum type.
339 (gold_exit): Change status parameter to enum.
340 (gold_fallback): New function.
341 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
342 (Layout::create_symtab_sections): Likewise.
343 (Layout::create_shdrs): Likewise.
344 * main.cc (main): Adjust call to gold_exit.
345 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
346 (Output_data_got::add_got_entry_pair): Likewise.
347 (Output_section::add_input_section): Likewise.
348 (Output_section::add_output_section_data): Likewise.
349 (Output_segment::set_section_list_addresses): Likewise.
350 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
352 2011-06-07 Cary Coutant <ccoutant@google.com>
354 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
355 for incremental links.
356 * output.cc (Output_segment::set_section_list_addresses): Remove
357 FIXME and test for TLS or BSS.
359 2011-06-07 Cary Coutant <ccoutant@google.com>
361 * testsuite/Makefile.am: Add incremental_copy_test,
362 incremental_common_test_1.
363 * testsuite/Makefile.in: Regenerate.
364 * testsuite/common_test_1_v1.c: New source file.
365 * testsuite/common_test_1_v2.c: New source file.
366 * testsuite/copy_test_v1.cc: New source file.
368 2011-06-07 Cary Coutant <ccoutant@google.com>
370 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
371 update, allocate common from bss section's free list.
372 * incremental-dump.cc (dump_incremental_inputs): Print flag for
373 linker-defined symbols.
374 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
375 Skip GOT and PLT entries that are no longer referenced.
376 (Output_section_incremental_inputs::write_info_blocks): Mark
377 linker-defined symbols.
378 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
379 * output.cc (Output_section::allocate): New function.
380 * output.h (Output_section::allocate): New function.
381 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
382 linker-defined symbols.
383 (Symbol::override_base_with_special): Copy is_predefined_ flag.
384 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
385 (Symbol::init_base_output_data): Likewise.
386 (Symbol::init_base_output_segment): Likewise.
387 (Symbol::init_base_constant): Likewise.
388 (Sized_symbol::init_output_data): Likewise.
389 (Sized_symbol::init_output_segment): Likewise.
390 (Sized_symbol::init_constant): Likewise.
391 (Symbol_table::do_define_in_output_data): Likewise.
392 (Symbol_table::do_define_in_output_segment): Likewise.
393 (Symbol_table::do_define_as_constant): Likewise.
394 * symtab.h (Symbol::is_predefined): New function.
395 (Symbol::init_base_output_data): Add is_predefined parameter.
396 (Symbol::init_base_output_segment): Likewise.
397 (Symbol::init_base_constant): Likewise.
398 (Symbol::is_predefined_): New data member.
399 (Sized_symbol::init_output_data): Add is_predefined parameter.
400 (Sized_symbol::init_output_segment): Likewise.
401 (Sized_symbol::init_constant): Likewise.
402 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
404 2011-06-07 Cary Coutant <ccoutant@google.com>
406 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
407 instead of emit_copy_reloc.
408 (Copy_relocs::emit_copy_reloc): Refactor.
409 (Copy_relocs::make_copy_reloc): New function.
410 (Copy_relocs::add_copy_reloc): Remove.
411 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
413 (Copy_relocs::make_copy_reloc): New function.
414 (Copy_relocs::add_copy_reloc): Remove.
415 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
416 unchanged input files.
417 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
418 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
419 Reserve BSS space for COPY relocations.
420 (Sized_incremental_binary::do_emit_copy_relocs): New function.
421 (Output_section_incremental_inputs::write_info_blocks): Record
422 whether a symbol is copied from a shared object.
423 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
424 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
425 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
426 (Incremental_input_entry_reader::get_output_symbol_index): Add
428 (Incremental_binary::emit_copy_relocs): New function.
429 (Incremental_binary::do_emit_copy_relocs): New function.
430 (Sized_incremental_binary::Sized_incremental_binary): Initialize
432 (Sized_incremental_binary::add_copy_reloc): New function.
433 (Sized_incremental_binary::do_emit_copy_relocs): New function.
434 (Sized_incremental_binary::Copy_reloc): New struct.
435 (Sized_incremental_binary::Copy_relocs): New typedef.
436 (Sized_incremental_binary::copy_relocs_): New data member.
437 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
438 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
439 * target.h (Sized_target::emit_copy_reloc): New function.
440 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
442 2011-06-02 Cary Coutant <ccoutant@google.com>
445 * gold/archive.cc (Archive::Archive): Initialize new data member.
446 (Archive::include_all_members): Return if archive has already been
448 * gold/archive.h (Archive::include_all_members_): New data member.
450 2011-06-02 Nick Clifton <nickc@redhat.com>
452 * dynobj.h: Fix spelling mistake in comment.
453 * output.cc: Likewise.
455 2011-05-31 Doug Kwan <dougkwan@google.com>
459 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
460 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
461 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
462 redundant arm_exidx_test.so.
463 * testsuite/Makefile.in: Regenerate.
464 (check_SCRIPTS): Add pr12826.sh
465 (check_DATA): Add pr12826.stdout
466 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
467 * testsuite/pr12826.sh: New file.
468 * testsuite/pr12826_1.s: Ditto.
469 * testsuite/pr12826_1.s: Ditto.
471 2011-05-30 Ian Lance Taylor <iant@google.com>
473 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
476 2011-05-29 Ian Lance Taylor <iant@google.com>
479 * testsuite/Makefile.am: Use different file name for two_file_test
480 temporary file for each incremental test.
481 * testsuite/Makefile.in: Rebuild.
483 2011-05-29 Ian Lance Taylor <iant@google.com>
485 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
486 binary input file is empty.
488 2011-05-27 Ian Lance Taylor <iant@google.com>
490 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
491 (ver_test_9.so): Likewise.
492 * testsuite/Makefile.in: Rebuild.
494 2011-05-26 Cary Coutant <ccoutant@google.com>
496 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
497 * incremental.cc (Incremental_inputs::report_input_section): Fix
498 comment, indentation.
499 (Incremental_inputs::report_comdat_group): New function.
500 (Output_section_incremental_inputs::set_final_data_size): Adjust size
501 of data for incremental input file entry.
502 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
503 group count, COMDAT group signatures.
504 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
505 an unchanged input file.
506 * incremental.h (Incremental_object_entry::Incremental_object_entry):
507 Initialize new data member.
508 (Incremental_object_entry::add_comdat_group): New function.
509 (Incremental_object_entry::get_comdat_group_count): New function.
510 (Incremental_object_entry::get_comdat_signature_key): New function.
511 (Incremental_object_entry::groups_): New data member.
512 (Incremental_inputs::report_comdat_group): New function.
513 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
514 data for incremental input file entry.
515 (Incremental_input_entry_reader::get_comdat_group_count): New function.
516 (Incremental_input_entry_reader::get_input_section): Adjust size of
517 data for incremental input file entry.
518 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
519 (Incremental_input_entry_reader::get_comdat_group_signature): New
521 * object.cc (Sized_relobj::include_section_group): Report kept
522 COMDAT groups for incremental links.
524 2011-05-24 David Meyer <pdox@google.com>
526 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
527 with name parameter. Add found_name parameter.
528 * fileread.cc (Input_file::find_file): Adjust code accordingly.
529 * dirsearch.h (class Dirsearch): Update declaration.
531 2011-05-24 Ian Lance Taylor <iant@google.com>
533 * archive.cc (Library_base::should_include_member): Pull in object
534 from archive if it defines the entry symbol.
535 * parameters.cc (Parameters::entry): New function.
536 * parameters.h (class Parameters): Declare entry.
537 * output.h (class Output_file_header): Remove entry_ field.
538 * output.cc (Output_file_header::Output_file_header): Remove entry
539 parameter. Change all callers.
540 (Output_file_header::entry): Use parameters->entry.
541 * gold.cc (queue_middle_tasks): Likewise.
542 * plugin.cc (Plugin_hook::run): Likewise.
544 2011-05-24 Cary Coutant <ccoutant@google.com>
546 * gold.cc (queue_initial_tasks): Pass incremental base filename
547 to Output_file::open_base_file; don't print error message.
548 * incremental-dump.cc (main): Adjust call to
549 Output_file::open_for_modification.
550 * incremental-dump.cc (main): Likewise.
551 * incremental.cc (Incremental_inputs::report_command_line):
552 Ignore --incremental-base option when comparing command lines.
553 Ignore parameter when given as separate argument.
554 * options.h (class General_options): Add --incremental-base.
555 * output.cc (Output_file::Output_file):
556 (Output_file::open_base_file): Add base_name and writable parameters;
557 read base file into new file; print error message here.
558 (Output_file::map_no_anonymous): Add writable parameter; adjust all
560 * output.h (Output_file::open_for_modification): Rename to...
561 (Output_file::open_base_file): ...this; add base_name and
562 writable parameters; adjust all callers.
563 (Output_file::map_no_anonymous): Add writable parameter; adjust all
565 * testsuite/Makefile.am (incremental_test_4): Test
567 * testsuite/Makefile.in: Regenerate.
569 2011-05-24 Cary Coutant <ccoutant@google.com>
571 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
573 * testsuite/Makefile.in: Regenerate.
574 * testsuite/two_file_test_1_v1.cc: New test source file.
575 * testsuite/two_file_test_1b_v1.cc: New test source file.
576 * testsuite/two_file_test_2_v1.cc: New test source file.
578 2011-05-24 Cary Coutant <ccoutant@google.com>
580 * dynobj.h (Dynobj::do_dynobj): New function.
581 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
582 flag and soname for shared objects.
583 * incremental.cc (Incremental_inputs::report_object): Make
584 either Incremental_object_entry or Incremental_dynobj_entry; add
585 soname to string table.
586 (Incremental_inputs::report_input_section): Add assertion.
587 (Output_section_incremental_inputs::set_final_data_size): Adjust
588 type of input file entry for shared libraries; adjust size of
589 shared library info entry.
590 (Output_section_incremental_inputs::write_input_files): Write
591 as_needed flag for shared libraries.
592 (Output_section_incremental_inputs::write_info_blocks): Adjust type
593 of input file entry for shared libraries; write soname.
594 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
595 soname from incremental info.
596 * incremental.h (enum Incremental_input_flags): Add
597 INCREMENTAL_INPUT_AS_NEEDED.
598 (Incremental_input_entry::Incremental_input_entry): Initialize new
600 (Incremental_input_entry::set_as_needed): New function.
601 (Incremental_input_entry::as_needed): New function.
602 (Incremental_input_entry::do_dynobj_entry): New function.
603 (Incremental_input_entry::as_needed_): New data member.
604 (Incremental_object_entry::Incremental_object_entry): Don't check
606 (Incremental_object_entry::do_type): Likewise.
607 (class Incremental_dynobj_entry): New class.
608 (Incremental_input_entry_reader::as_needed): New function.
609 (Incremental_input_entry_reader::get_soname): New function.
610 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
611 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
612 size of shared library info entry.
613 * layout.cc (Layout::finish_dynamic_section): Don't test for
614 incremental link when adding DT_NEEDED entries.
615 * object.h (Object::Object): Initialize new data member.
616 (Object::dynobj): New function.
617 (Object::set_as_needed): New function.
618 (Object::as_needed): New function.
619 (Object::do_dynobj): New function.
620 (Object::as_needed_): New data member.
622 2011-05-24 Cary Coutant <ccoutant@google.com>
624 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
625 info; adjust display of GOT entries.
626 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
627 vector of input objects; remove file_status_.
628 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
629 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
630 got_plt reader; call target hooks to reserve GOT entries.
631 (Output_section_incremental_inputs::set_final_data_size): Adjust size
632 of input file info header and GOT info entry.
633 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
635 (Got_plt_view_info::got_descriptor): Remove.
636 (Got_plt_view_info::sym_index): New data member.
637 (Got_plt_view_info::input_index): New data member.
638 (Local_got_offset_visitor::visit): Write input file index.
639 (Global_got_offset_visitor::visit): Write 0 for input file index.
640 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
641 with sym_index and input_index.
642 (Output_section_incremental_inputs::write_got_plt): Adjust size of
643 incremental info GOT entry; replace got_descriptor with input_index.
644 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
645 map from input file index to object.
646 (Sized_relobj_incr::do_layout): Replace direct data member reference
647 with accessor function.
648 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
649 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
650 Adjust size of input file info header.
651 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
652 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
653 (Incremental_input_entry_reader::get_input_section): Adjust size of
654 input file info header.
655 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
656 of incremental info GOT entry.
657 (Incremental_got_plt_reader::get_got_desc): Remove.
658 (Incremental_got_plt_reader::get_got_symndx): New function.
659 (Incremental_got_plt_reader::get_got_input_index): New function.
660 (Sized_incremental_binary::Sized_incremental_binary): Remove
661 file_status_; add input_objects_.
662 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
663 (Sized_incremental_binary::set_file_is_unchanged): Remove.
664 (Sized_incremental_binary::file_is_unchanged): Remove.
665 (Sized_incremental_binary::set_input_object): New function.
666 (Sized_incremental_binary::input_object): New function.
667 (Sized_incremental_binary::file_status_): Remove.
668 (Sized_incremental_binary::input_objects_): New data member.
669 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
671 (Sized_relobj_incr::invalid_address): Move to base class.
672 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
674 (Sized_relobj_incr::do_output_section_offset): Likewise.
675 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
676 (Sized_relobj_incr::section_offsets_): Likewise.
677 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
679 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
680 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
681 with accessor function.
682 (Sized_relobj_file::do_layout): Likewise.
683 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
684 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
685 (Sized_relobj_file::compute_final_local_value): Replace refs to
686 section_offsets_ with accessor function.
687 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
688 * object.h (Relobj::Relobj): Initialize new data members.
689 (Relobj::add_dyn_reloc): New function.
690 (Relobj::first_dyn_reloc): New function.
691 (Relobj::dyn_reloc_count): New function.
692 (Relobj::first_dyn_reloc_): New data member.
693 (Relobj::dyn_reloc_count_): New data member.
694 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
696 (Sized_relobj::Address): New typedef.
697 (Sized_relobj::invalid_address): Move here from child class.
698 (Sized_relobj::Sized_relobj): Initialize new data members.
699 (Sized_relobj::sized_relobj): New function.
700 (Sized_relobj::is_output_section_offset_invalid): Move here from
702 (Sized_relobj::get_output_section_offset): Likewise.
703 (Sized_relobj::local_has_got_offset): Likewise.
704 (Sized_relobj::local_got_offset): Likewise.
705 (Sized_relobj::set_local_got_offset): Likewise.
706 (Sized_relobj::do_for_all_local_got_entries): Likewise.
707 (Sized_relobj::clear_got_offsets): New function.
708 (Sized_relobj::section_offsets): Move here from child class.
709 (Sized_relobj::do_output_section_offset): Likewise.
710 (Sized_relobj::do_set_section_offset): Likewise.
711 (Sized_relobj::Local_got_offsets): Likewise.
712 (Sized_relobj::local_got_offsets_): Likewise.
713 (Sized_relobj::section_offsets_): Likewise.
714 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
716 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
718 (Sized_relobj_file::sized_relobj): New function
719 (Sized_relobj_file::local_has_got_offset): Move to base class.
720 (Sized_relobj_file::local_got_offset): Likewise.
721 (Sized_relobj_file::set_local_got_offset): Likewise.
722 (Sized_relobj_file::get_output_section_offset): Likewise.
723 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
724 (Sized_relobj_file::do_output_section_offset): Likewise.
725 (Sized_relobj_file::do_set_section_offset): Likewise.
726 (Sized_relobj_file::Local_got_offsets): Likewise.
727 (Sized_relobj_file::local_got_offsets_): Likewise.
728 (Sized_relobj_file::section_offsets_): Likewise.
729 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
731 (set_needs_dynsym_index): Convert relobj to derived class pointer.
732 (Output_reloc::get_symbol_index): Likewise.
733 (Output_reloc::local_section_offset): Likewise.
734 (Output_reloc::get_address): Likewise.
735 (Output_reloc::symbol_value): Likewise.
736 (Output_data_got::reserve_slot): Move to class definition.
737 (Output_data_got::reserve_local): New function.
738 (Output_data_got::reserve_slot_for_global): Remove.
739 (Output_data_got::reserve_global): New function.
740 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
741 (all constructors, two instantiations).
742 (Output_reloc::get_relobj): New function (two instantiations).
743 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
744 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
745 (Output_data_reloc::add_global): Adjust type of relobj.
746 (Output_data_reloc::add_global_relative): Likewise.
747 (Output_data_reloc::add_symbolless_global_addend): Likewise.
748 (Output_data_reloc::add_local): Likewise.
749 (Output_data_reloc::add_local_relative): Likewise.
750 (Output_data_reloc::add_symbolless_local_addend): Likewise.
751 (Output_data_reloc::add_local_section): Likewise.
752 (Output_data_reloc::add_output_section): Likewise.
753 (Output_data_reloc::add_absolute): Likewise.
754 (Output_data_reloc::add_target_specific): Likewise.
755 (Output_data_got::reserve_slot): Move definition here.
756 (Output_data_got::reserve_local): New function.
757 (Output_data_got::reserve_global): New function.
758 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
759 section_offsets_ with accessor function.
760 (Sized_relobj_file::write_sections): Likewise.
761 (Sized_relobj_file::do_relocate_sections): Likewise.
762 * target.h (Sized_target::reserve_local_got_entry): New function.
763 (Sized_target::reserve_global_got_entry): New function.
764 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
765 (Target_x86_64::reserve_global_got_entry): New function.
766 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
768 2011-05-23 Cary Coutant <ccoutant@google.com>
770 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
771 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
772 bit when checking got_type.
773 * incremental.cc (Sized_incremental_binary::setup_readers):
774 Store symbol table and string table locations; initialize bit vector
775 of file status flags.
776 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
778 (Sized_incremental_binary::do_process_got_plt): New function.
779 (Sized_incremental_binary::get_symtab_view): Use stored locations.
780 (Output_section_incremental_inputs::set_final_data_size): Record
781 file index for each input file.
782 (Output_section_incremental_inputs::write_got_plt): Store file index
783 instead of input entry offset for each GOT entry.
785 (Incremental_input_entry::Incremental_input_entry): Initialize new
787 (Incremental_input_entry::set_offset): Store file index.
788 (Incremental_input_entry::get_file_index): New function.
789 (Incremental_input_entry::file_index_): New data member.
790 (Incremental_binary::process_got_plt): New function.
791 (Incremental_binary::do_process_got_plt): New function.
792 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
794 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
795 (Sized_incremental_binary::set_file_is_unchanged): New function.
796 (Sized_incremental_binary::file_is_unchanged): New function.
797 (Sized_incremental_binary::do_process_got_plt): New function.
798 (Sized_incremental_binary::file_status_): New data member.
799 (Sized_incremental_binary::main_symtab_loc_): New data member.
800 (Sized_incremental_binary::main_strtab_loc_): New data member.
801 * output.cc (Output_data_got::Got_entry::write): Add case
803 (Output_data_got::add_global): Call add_got_entry.
804 (Output_data_got::add_global_plt): Likewise.
805 (Output_data_got::add_global_with_rel): Likewise.
806 (Output_data_got::add_global_with_rela): Likewise.
807 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
808 (Output_data_got::add_global_pair_with_rela): Likewise.
809 (Output_data_got::add_local): Call add_got_entry.
810 (Output_data_got::add_local_plt): Likewise.
811 (Output_data_got::add_local_with_rel): Likewise.
812 (Output_data_got::add_local_with_rela): Likewise.
813 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
814 (Output_data_got::add_local_pair_with_rela): Likewise.
815 (Output_data_got::reserve_slot): New function.
816 (Output_data_got::reserve_slot_for_global): New function.
817 (Output_data_got::add_got_entry): New function.
818 (Output_data_got::add_got_entry_pair): New function.
819 (Output_section::add_output_section_data): Edit FIXME.
821 (Output_section_data_build::Output_section_data_build): New
822 constructor with size parameter.
823 (Output_data_space::Output_data_space): Likewise.
824 (Output_data_got::Output_data_got): Initialize new data member; new
825 constructor with size parameter.
826 (Output_data_got::add_constant): Call add_got_entry.
827 (Output_data_got::reserve_slot): New function.
828 (Output_data_got::reserve_slot_for_global): New function.
829 (class Output_data_got::Got_entry): Add RESERVED_CODE.
830 (Output_data_got::add_got_entry): New function.
831 (Output_data_got::add_got_entry_pair): New function.
832 (Output_data_got::free_list_): New data member.
833 * target.h (Sized_target::init_got_plt_for_update): New function.
834 (Sized_target::register_global_plt_entry): New function.
835 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
836 Initialize new data member; call init; add constructor with PLT count.
837 (Output_data_plt_x86_64::init): New function.
838 (Output_data_plt_x86_64::add_relocation): New function.
839 (Output_data_plt_x86_64::reserve_slot): New function.
840 (Output_data_plt_x86_64::free_list_): New data member.
841 (Target_x86_64::init_got_plt_for_update): New function.
842 (Target_x86_64::register_global_plt_entry): New function.
843 (Output_data_plt_x86_64::add_entry): Allocate from free list for
845 (Output_data_plt_x86_64::add_relocation): New function.
846 * testsuite/object_unittest.cc (Object_test): Set default options.
848 2011-05-16 Ian Lance Taylor <iant@google.com>
850 * options.h (class General_options): Make -i a synonym for -r.
852 2011-05-16 Ian Lance Taylor <iant@google.com>
854 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
856 2011-05-10 Cary Coutant <ccoutant@google.com>
858 * object.cc (Sized_relobj::do_count_local_symbols): Check for
861 2011-05-06 Ian Lance Taylor <iant@google.com>
863 * layout.cc (Layout::layout): If the output section flags change,
866 2011-04-25 Cary Coutant <ccoutant@google.com>
868 * incremental-dump.cc (dump_incremental_inputs): Print local
869 symbol info for each input file.
871 (Output_section_incremental_inputs::set_final_data_size): Add local
872 symbol info to input file entries in incremental info.
873 (Output_section_incremental_inputs::write_info_blocks): Likewise.
874 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
875 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
876 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
878 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
879 (Sized_incr_relobj::do_relocate): Write the local symbols.
880 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
881 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
882 Adjust size of input file header.
883 (Incremental_inputs_reader::get_local_symbol_offset): New function.
884 (Incremental_inputs_reader::get_local_symbol_count): New function.
885 (Incremental_inputs_reader::get_input_section): Adjust size of input
887 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
888 (Sized_incr_relobj::This): New typedef.
889 (Sized_incr_relobj::sym_size): New const data member.
890 (Sized_incr_relobj::Local_symbol): New struct.
891 (Sized_incr_relobj::do_output_local_symbol_count): New function.
892 (Sized_incr_relobj::do_local_symbol_offset): New function.
893 (Sized_incr_relobj::local_symbol_count_): New data member.
894 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
895 (Sized_incr_relobj::local_symbol_index_): New data member.
896 (Sized_incr_relobj::local_symbol_offset_): New data member.
897 (Sized_incr_relobj::local_dynsym_offset_): New data member.
898 (Sized_incr_relobj::local_symbols_): New data member.
899 * object.h (Relobj::output_local_symbol_count): New function.
900 (Relobj::local_symbol_offset): New function.
901 (Relobj::do_output_local_symbol_count): New function.
902 (Relobj::do_local_symbol_offset): New function.
903 (Sized_relobj::do_output_local_symbol_count): New function.
904 (Sized_relobj::do_local_symbol_offset): New function.
906 2011-04-22 Vladimir Simonov <sv@sw.ru>
908 * descriptors.cc (set_close_on_exec): New function.
909 (Descriptors::open): Use set_close_on_exec.
910 * output.cc (S_ISLNK): Define if not defined.
912 2011-04-22 Cary Coutant <ccoutant@google.com>
914 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
916 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
917 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
918 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
920 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
921 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
922 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
924 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
926 (Incremental_binary::apply_incremental_relocs): New function.
927 (Incremental_binary::do_apply_incremental_relocs): New function.
928 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
930 (Sized_incremental_binary::add_global_symbol): New function.
931 (Sized_incremental_binary::global_symbol): New function.
932 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
933 (Sized_incremental_binary::symbol_map_): New data member.
934 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
935 * target.h (Sized_target::apply_relocation): New function.
936 * target-reloc.h (apply_relocation): New function.
937 * x86_64.cc (Target_x86_64::apply_relocation): New function.
939 2011-04-22 Doug Kwan <dougkwan@google.com>
941 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
942 flag of a SHT_ARM_EXIDX section.
943 * testsuite/Makefile.am (arm_exidx_test): New test rules.
944 * testsuite/Makefile.in: Regenerate.
945 * testsuite/arm_exidx_test.s: New file.
946 * testsuite/arm_exidx_test.sh: Same.
948 2011-04-20 Cary Coutant <ccoutant@google.com>
951 * archive.h (Incremental_archive_entry::Archive_member):
952 Initialize arg_serial_ (second constructor).
954 2011-04-17 Ian Lance Taylor <iant@google.com>
956 * object.cc (Relocate_info::location): Simplify location string.
957 * errors.cc (Errors::error_at_location): Don't print program
959 (Errors::warning_at_location): Likewise.
960 (Errors::undefined_symbol): Likewise.
961 * testsuite/debug_msg.sh: Update accordingly.
963 2011-04-14 Cary Coutant <ccoutant@google.com>
965 * gold/layout.cc (Layout::symtab_section_offset): New function.
966 * gold/layout.h (Layout::symtab_section_offset): New function.
967 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
969 2011-04-12 Ian Lance Taylor <iant@google.com>
971 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
973 * output.h (class Output_file): Add map_is_allocated_ field.
974 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
975 not available, provide stubs. If mremap is not available, #define
977 (MREMAP_MAYMOVE): Define if not defined.
978 (Output_file::Output_file): Initialize map_is_allocated_.
979 (Output_file::resize): Check map_is_allocated_.
980 (Output_file::map_anonymous): If mmap fails, use malloc.
981 (Output_file::unmap): Don't do anything for an anonymous map.
982 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
983 is not available, provide stubs.
984 (File_read::View::~View): Use free rather than delete[].
985 (File_read::make_view): Use malloc rather than new[]. If mmap
987 (File_read::find_or_make_view): Use malloc rather than new[].
988 * gold.h: Remove HAVE_REMAP code.
989 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
990 exists. Rename mremap to gold_mremap. If mmap is not available
992 * configure, config.in: Rebuild.
994 2011-04-11 Ian Lance Taylor <iant@google.com>
996 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
997 initialize local variable v.
999 2011-04-11 Cary Coutant <ccoutant@google.com>
1001 * archive.cc (Archive::include_member): Adjust call to
1003 (Add_archive_symbols::run): Track argument serial numbers.
1004 (Lib_group::include_member): Likewise.
1005 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
1006 * archive.h (Incremental_archive_entry::Archive_member):
1007 Initialize arg_serial_.
1008 (Archive_member::arg_serial_): New data member.
1009 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
1010 (Sized_dynobj::do_add_symbols): Track symbols when doing an
1012 (Sized_dynobj::do_for_all_local_got_entries): New function.
1013 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
1015 * fileread.cc (get_mtime): New function.
1016 * fileread.h (get_mtime): New function.
1017 * gold.cc (queue_initial_tasks): Check for incremental update.
1018 (process_incremental_input): New function.
1019 (queue_middle_tasks): Don't force valid target for incremental
1021 * incremental-dump.cc (find_input_containing_global): Adjust
1022 size of symbol info entry.
1023 (dump_incremental_inputs): Dump argument serial number and
1024 in_system_directory flag; bias shndx by 1; print symbol names
1025 when dumping per-file symbol lists; use new symbol info readers.
1027 (Output_section_incremental_inputs:update_data_size): New function.
1028 (Sized_incremental_binary::setup_readers): Setup input readers
1029 for each input file; build maps for files added from libraries
1031 (Sized_incremental_binary::check_input_args): New function.
1032 (Sized_incremental_binary::do_check_inputs): Build map of argument
1033 serial numbers to input arguments.
1034 (Sized_incremental_binary::do_file_has_changed): Rename
1035 do_file_is_unchanged to this; compare file modification times.
1036 (Sized_incremental_binary::do_init_layout): New function.
1037 (Sized_incremental_binary::do_reserve_layout): New function.
1038 (Sized_incremental_binary::do_get_input_reader): Remove.
1039 (Sized_incremental_binary::get_symtab_view): New function.
1040 (Incremental_checker::can_incrementally_link_output_file): Remove.
1041 (Incremental_inputs::report_command_line): Exclude --debug options.
1042 (Incremental_inputs::report_archive_begin): Add parameter; track
1043 argument serial numbers; don't put input file entry for archive
1044 before archive members.
1045 (Incremental_inputs::report_archive_end): Put input file entry
1046 for archive after archive members.
1047 (Incremental_inputs::report_object): Add parameter; track argument
1048 serial numbers and in_system_directory flag.
1049 (Incremental_inputs::report_script): Add parameter; track argument
1051 (Output_section_incremental_inputs::set_final_data_size): Adjust
1052 size of symbol info entry; check for forwarding symbols.
1053 (Output_section_incremental_inputs::write_input_files): Write
1054 in_system_directory flag and argument serial number.
1055 (Output_section_incremental_inputs::write_info_blocks): Map section
1056 indices between incremental info and original input file; store
1057 input section index for each symbol.
1058 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
1059 change operator() to visit().
1060 (class Global_got_offset_visitor): Likewise.
1061 (class Global_symbol_visitor_got_plt):
1062 (Output_section_incremental_inputs::write_got_plt): Use new visitor
1064 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
1065 (Sized_incr_relobj::do_read_symbols): New function.
1066 (Sized_incr_relobj::do_layout): New function.
1067 (Sized_incr_relobj::do_layout_deferred_sections): New function.
1068 (Sized_incr_relobj::do_add_symbols): New function.
1069 (Sized_incr_relobj::do_should_include_member): New function.
1070 (Sized_incr_relobj::do_for_all_global_symbols): New function.
1071 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
1072 (Sized_incr_relobj::do_section_size): New function.
1073 (Sized_incr_relobj::do_section_name): New function.
1074 (Sized_incr_relobj::do_section_contents): New function.
1075 (Sized_incr_relobj::do_section_flags): New function.
1076 (Sized_incr_relobj::do_section_entsize): New function.
1077 (Sized_incr_relobj::do_section_address): New function.
1078 (Sized_incr_relobj::do_section_type): New function.
1079 (Sized_incr_relobj::do_section_link): New function.
1080 (Sized_incr_relobj::do_section_info): New function.
1081 (Sized_incr_relobj::do_section_addralign): New function.
1082 (Sized_incr_relobj::do_initialize_xindex): New function.
1083 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
1084 (Sized_incr_relobj::do_read_relocs): New function.
1085 (Sized_incr_relobj::do_gc_process_relocs): New function.
1086 (Sized_incr_relobj::do_scan_relocs): New function.
1087 (Sized_incr_relobj::do_count_local_symbols): New function.
1088 (Sized_incr_relobj::do_finalize_local_symbols): New function.
1089 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
1090 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
1091 (Sized_incr_relobj::do_relocate): New function.
1092 (Sized_incr_relobj::do_set_section_offset): New function.
1093 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
1094 (Sized_incr_dynobj::do_read_symbols): New function.
1095 (Sized_incr_dynobj::do_layout): New function.
1096 (Sized_incr_dynobj::do_add_symbols): New function.
1097 (Sized_incr_dynobj::do_should_include_member): New function.
1098 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
1099 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
1100 (Sized_incr_dynobj::do_section_size): New function.
1101 (Sized_incr_dynobj::do_section_name): New function.
1102 (Sized_incr_dynobj::do_section_contents): New function.
1103 (Sized_incr_dynobj::do_section_flags): New function.
1104 (Sized_incr_dynobj::do_section_entsize): New function.
1105 (Sized_incr_dynobj::do_section_address): New function.
1106 (Sized_incr_dynobj::do_section_type): New function.
1107 (Sized_incr_dynobj::do_section_link): New function.
1108 (Sized_incr_dynobj::do_section_info): New function.
1109 (Sized_incr_dynobj::do_section_addralign): New function.
1110 (Sized_incr_dynobj::do_initialize_xindex): New function.
1111 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
1112 (make_sized_incremental_object): New function.
1113 (Incremental_library::copy_unused_symbols): New function.
1114 (Incremental_library::do_for_all_unused_symbols): New function.
1115 * incremental.h (enum Incremental_input_flags): New type.
1116 (class Incremental_checker): Remove.
1117 (Incremental_input_entry::Incremental_input_entry): Add argument
1119 (Incremental_input_entry::arg_serial): New function.
1120 (Incremental_input_entry::set_is_in_system_directory): New function.
1121 (Incremental_input_entry::is_in_system_directory): New function.
1122 (Incremental_input_entry::arg_serial_): New data member.
1123 (Incremental_input_entry::is_in_system_directory_): New data member.
1124 (class Script_info): Move here from script.h.
1125 (Script_info::Script_info): Add filename parameter.
1126 (Script_info::filename): New function.
1127 (Script_info::filename_): New data member.
1128 (Incremental_script_entry::Incremental_script_entry): Add argument
1130 (Incremental_object_entry::Incremental_object_entry): Likewise.
1131 (Incremental_object_entry::add_input_section): Build list of input
1132 sections with map to original shndx.
1133 (Incremental_object_entry::get_input_section_index): New function.
1134 (Incremental_object_entry::shndx_): New data member.
1135 (Incremental_object_entry::name_key_): Rename; adjust all refs.
1136 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
1137 (Incremental_archive_entry::Incremental_archive_entry): Add argument
1139 (Incremental_inputs::report_archive_begin): Likewise.
1140 (Incremental_inputs::report_object): Likewise.
1141 (Incremental_inputs::report_script): Likewise.
1142 (class Incremental_global_symbol_reader): New class.
1143 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
1144 and store flags and input file type.
1145 (Incremental_input_entry_reader::arg_serial): New function.
1146 (Incremental_input_entry_reader::type): Extract type from flags.
1147 (Incremental_input_entry_reader::is_in_system_directory): New function.
1148 (Incremental_input_entry_reader::get_input_section_count): Call
1149 accessor function for type.
1150 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
1151 function for type; adjust size of global symbol entry.
1152 (Incremental_input_entry_reader::get_global_symbol_count): Call
1153 accessor function for type.
1154 (Incremental_input_entry_reader::get_object_count): Likewise.
1155 (Incremental_input_entry_reader::get_object_offset): Likewise.
1156 (Incremental_input_entry_reader::get_member_count): Likewise.
1157 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
1158 (Incremental_input_entry_reader::get_member_offset): Likewise.
1159 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
1160 (Incremental_input_entry_reader::Global_symbol_info): Remove.
1161 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
1162 (Incremental_input_entry_reader::get_global_symbol_reader): New
1164 (Incremental_input_entry_reader::get_output_symbol_index): New
1166 (Incremental_input_entry_reader::type_): Remove.
1167 (Incremental_input_entry_reader::flags_): New data member.
1168 (Incremental_inputs_reader::input_file_offset): New function.
1169 (Incremental_inputs_reader::input_file_index): New function.
1170 (Incremental_inputs_reader::input_file): Call input_file_offset.
1171 (Incremental_inputs_reader::input_file_at_offset): New function.
1172 (Incremental_relocs_reader::get_r_type): Reformat.
1173 (Incremental_relocs_reader::get_r_shndx): Reformat.
1174 (Incremental_relocs_reader::get_r_offset): Reformat.
1175 (Incremental_relocs_reader::data): New function.
1176 (Incremental_binary::Incremental_binary): Initialize new data members.
1177 (Incremental_binary::check_inputs): Add cmdline parameter.
1178 (Incremental_binary::file_is_unchanged): Remove.
1179 (Input_reader::arg_serial): New function.
1180 (Input_reader::get_unused_symbol_count): New function.
1181 (Input_reader::get_unused_symbol): New function.
1182 (Input_reader::do_arg_serial): New function.
1183 (Input_reader::do_get_unused_symbol_count): New function.
1184 (Input_reader::do_get_unused_symbol): New function.
1185 (Incremental_binary::input_file_count): New function.
1186 (Incremental_binary::get_input_reader): Change signature to use
1187 index instead of filename.
1188 (Incremental_binary::file_has_changed): New function.
1189 (Incremental_binary::get_input_argument): New function.
1190 (Incremental_binary::get_library): New function.
1191 (Incremental_binary::get_script_info): New function.
1192 (Incremental_binary::init_layout): New function.
1193 (Incremental_binary::reserve_layout): New function.
1194 (Incremental_binary::output_file): New function.
1195 (Incremental_binary::do_check_inputs): New function.
1196 (Incremental_binary::do_file_is_unchanged): Remove.
1197 (Incremental_binary::do_file_has_changed): New function.
1198 (Incremental_binary::do_init_layout): New function.
1199 (Incremental_binary::do_reserve_layout): New function.
1200 (Incremental_binary::do_input_file_count): New function.
1201 (Incremental_binary::do_get_input_reader): Change signature.
1202 (Incremental_binary::input_args_map_): New data member.
1203 (Incremental_binary::library_map_): New data member.
1204 (Incremental_binary::script_map_): New data member.
1205 (Sized_incremental_binary::Sized_incremental_binary): Initialize
1207 (Sized_incremental_binary::output_section): New function.
1208 (Sized_incremental_binary::inputs_reader): Add const.
1209 (Sized_incremental_binary::symtab_reader): Add const.
1210 (Sized_incremental_binary::relocs_reader): Add const.
1211 (Sized_incremental_binary::got_plt_reader): Add const.
1212 (Sized_incremental_binary::get_symtab_view): New function.
1213 (Sized_incremental_binary::Inputs_reader): New typedef.
1214 (Sized_incremental_binary::Input_entry_reader): New typedef.
1215 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
1216 (Sized_incremental_binary::do_file_is_unchanged): Remove.
1217 (Sized_incremental_binary::do_file_has_changed): New function.
1218 (Sized_incremental_binary::do_init_layout): New function.
1219 (Sized_incremental_binary::do_reserve_layout): New function.
1220 (Sized_input_reader::Inputs_reader): Remove.
1221 (Sized_input_reader::Input_entry_reader): Remove.
1222 (Sized_input_reader::do_arg_serial): New function.
1223 (Sized_input_reader::do_get_unused_symbol_count): New function.
1224 (Sized_input_reader::do_get_unused_symbol): New function.
1225 (Sized_incremental_binary::do_input_file_count): New function.
1226 (Sized_incremental_binary::do_get_input_reader): Change signature;
1227 use index instead of filename.
1228 (Sized_incremental_binary::section_map_): New data member.
1229 (Sized_incremental_binary::input_entry_readers_): New data member.
1230 (class Sized_incr_relobj): New class.
1231 (class Sized_incr_dynobj): New class.
1232 (make_sized_incremental_object): New function.
1233 (class Incremental_library): New class.
1234 * layout.cc (Free_list::num_lists): New static data member.
1235 (Free_list::num_nodes): New static data member.
1236 (Free_list::num_removes): New static data member.
1237 (Free_list::num_remove_visits): New static data member.
1238 (Free_list::num_allocates): New static data member.
1239 (Free_list::num_allocate_visits): New static data member.
1240 (Free_list::init): New function.
1241 (Free_list::remove): New function.
1242 (Free_list::allocate): New function.
1243 (Free_list::dump): New function.
1244 (Free_list::print_stats): New function.
1245 (Layout_task_runner::run): Resize output file for incremental updates.
1246 (Layout::Layout): Initialize new data members.
1247 (Layout::set_incremental_base): New function.
1248 (Layout::init_fixed_output_section): New function.
1249 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
1250 incremental updates.
1251 (Layout::create_gold_note): Do not create gold note section for
1252 incremental updates.
1253 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
1254 for incremental updates.
1255 (Layout::set_section_offsets): For incremental updates, allocate space
1257 (Layout::create_symtab_sections): Layout with offsets relative to
1258 start of section; for incremental updates, allocate space from free
1260 (Layout::create_shdrs): For incremental updates, allocate space from
1262 (Layout::finish_dynamic_section): For incremental updates, do not
1263 check --as-needed (fixed in subsequent patch).
1264 * layout.h (class Free_list): New class.
1265 (Layout::set_incremental_base): New function.
1266 (Layout::incremental_base): New function.
1267 (Layout::init_fixed_output_section): New function.
1268 (Layout::allocate): New function.
1269 (Layout::incremental_base_): New data member.
1270 (Layout::free_list_): New data member.
1271 * main.cc (main): Print Free_list statistics.
1272 * object.cc (Relobj::finalize_incremental_relocs): Add
1273 clear_counts parameter; clear counts only when clear_counts is set.
1274 (Sized_relobj::Sized_relobj): Initialize new base class.
1275 (Sized_relobj::do_layout): Don't report special sections.
1276 (Sized_relobj::do_for_all_local_got_entries): New function.
1277 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
1278 symtab_off to all symbol table offsets.
1279 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
1280 * object.h (class Got_offset_list): Move to top of file.
1281 (Object::Object): Allow case where input_file == NULL.
1282 (Object::~Object): Likewise.
1283 (Object::input_file): Assert that input_file != NULL.
1284 (Object::lock): Allow case where input_file == NULL.
1285 (Object::unlock): Likewise.
1286 (Object::is_locked): Likewise.
1287 (Object::token): Likewise.
1288 (Object::release): Likewise.
1289 (Object::is_incremental): New function.
1290 (Object::get_mtime): New function.
1291 (Object::for_all_local_got_entries): New function.
1292 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
1293 (Object::set_is_in_system_directory): New function.
1294 (Object::is_in_system_directory): New function.
1295 (Object::do_is_incremental): New function.
1296 (Object::do_get_mtime): New function.
1297 (Object::do_for_all_local_got_entries): New function.
1298 (Object::is_in_system_directory_): New data member.
1299 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
1300 (class Sized_relobj_base): New class.
1301 (class Sized_relobj): Derive from Sized_relobj_base.
1302 (class Sized_relobj::Symbols): Redeclare from base class.
1303 (class Sized_relobj::local_got_offset_list): Remove.
1304 (class Sized_relobj::Output_sections): Redeclare from base class.
1305 (class Sized_relobj::do_for_all_local_got_entries): New function.
1306 (class Sized_relobj::write_local_symbols): Add offset parameter.
1307 (class Sized_relobj::local_symbol_offset_): Update comment.
1308 (class Sized_relobj::local_dynsym_offset_): Update comment.
1309 * options.cc (Input_arguments::add_file): Remove const.
1310 * options.h (Input_file_argument::Input_file_argument):
1311 Initialize arg_serial_ (all constructors).
1312 (Input_file_argument::set_arg_serial): New function.
1313 (Input_file_argument::arg_serial): New function.
1314 (Input_file_argument::arg_serial_): New data member.
1315 (Input_arguments::Input_arguments): Initialize file_count_.
1316 (Input_arguments::add_file): Remove const.
1317 (Input_arguments::number_of_input_files): New function.
1318 (Input_arguments::file_count_): New data member.
1319 (Command_line::number_of_input_files): Call
1320 Input_arguments::number_of_input_files.
1321 * output.cc (Output_segment_headers::Output_segment_headers):
1323 (Output_section::Input_section::current_data_size): New function.
1324 (Output_section::Output_section): Initialize new data members.
1325 (Output_section::add_input_section): Don't do merge sections for
1326 an incremental link; allocate space from free list for an
1328 (Output_section::add_output_section_data): Allocate space from
1329 free list for an incremental update.
1330 (Output_section::update_data_size): New function.
1331 (Output_section::set_fixed_layout): New function.
1332 (Output_section::reserve): New function.
1333 (Output_segment::set_section_addresses): Remove const.
1334 (Output_segment::set_section_list_addresses): Remove const; allocate
1335 space from free list for an incremental update.
1336 (Output_segment::set_offset): Adjust size of RELRO segment for an
1338 * output.h (Output_data::current_data_size): Move here from
1340 (Output_data::pre_finalize_data_size): New function.
1341 (Output_data::update_data_size): New function.
1342 (Output_section_headers::update_data_size): new function.
1343 (Output_section_data_build::current_data_size): Move to Output_data.
1344 (Output_data_strtab::update_data_size): New function.
1345 (Output_section::current_data_size): Move to Output_data.
1346 (Output_section::set_fixed_layout): New function.
1347 (Output_section::has_fixed_layout): New function.
1348 (Output_section::reserve): New function.
1349 (Output_section::update_data_size): New function.
1350 (Output_section::has_fixed_layout_): New data member.
1351 (Output_section::free_list_): New data member.
1352 (Output_segment::set_section_addresses): Remove const.
1353 (Output_segment::set_section_list_addresses): Remove const.
1354 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
1356 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
1358 * readsyms.cc (Read_symbols::do_read_symbols): Add library
1359 parameter when calling Add_symbols constructor; store argument
1360 serial number for members of a lib group.
1361 (Add_symbols::locks): Allow case where token == NULL.
1362 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
1363 (Read_member::~Read_member): New function.
1364 (Read_member::is_runnable): New function.
1365 (Read_member::locks): New function.
1366 (Read_member::run): New function.
1367 (Check_script::~Check_script): New function.
1368 (Check_script::is_runnable): New function.
1369 (Check_script::locks): New function.
1370 (Check_script::run): New function.
1371 (Check_library::~Check_library): New function.
1372 (Check_library::is_runnable): New function.
1373 (Check_library::locks): New function.
1374 (Check_library::run): New function.
1375 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
1376 (Add_symbols::library_): New data member.
1377 (class Read_member): New class.
1378 (class Check_script): New class.
1379 (class Check_library): New class.
1380 * reloc.cc (Read_relocs::is_runnable): Allow case where
1382 (Read_relocs::locks): Likewise.
1383 (Scan_relocs::locks): Likewise.
1384 (Relocate_task::locks): Likewise.
1385 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
1387 (Sized_relobj::incremental_relocs_scan): Fix comment.
1388 (Sized_relobj::do_relocate): Pass output file offset to
1389 write_local_symbols.
1390 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
1391 from class declaration.
1392 * script.cc (read_input_script): Allocate Script_info; pass
1393 argument serial number to report_script.
1394 * script.h (class Script_info): Move to incremental.h.
1395 * symtab.cc (Symbol_table::add_from_incrobj): New function.
1396 * symtab.h (Symbol_table::add_from_incrobj): New function.
1397 (Symbol_table::set_file_offset): New function.
1399 2011-04-05 Cary Coutant <ccoutant@google.com>
1401 * incremental-dump.cc (dump_incremental_inputs): Change signature
1402 to take a Sized_incremental_binary; change caller. Use readers
1403 in Sized_incremental_binary.
1405 (Sized_incremental_binary::find_incremental_inputs_sections):
1406 Rename do_find_incremental_inputs_sections to this.
1407 (Sized_incremental_binary::setup_readers): New function.
1408 (Sized_incremental_binary::do_check_inputs): Check
1409 has_incremental_info_ flag; move setup code to setup_readers;
1411 (Sized_incremental_binary::do_file_is_unchanged): New function.
1412 (Sized_incremental_binary::do_get_input_reader): New function.
1413 * incremental.h (class Incremental_binary): Move to end of file.
1414 (Incremental_binary::file_is_unchanged): New function.
1415 (Incremental_binary::do_file_is_unchanged): New function.
1416 (Incremental_binary::Input_reader): New class.
1417 (Incremental_binary::get_input_reader): New function.
1418 (class Sized_incremental_binary): Move to end of file.
1419 (Sized_incremental_binary::Sized_incremental_binary): Setup the
1420 input section reader classes.
1421 (Sized_incremental_binary::has_incremental_info): New function.
1422 (Sized_incremental_binary::inputs_reader): New function.
1423 (Sized_incremental_binary::symtab_reader): New function.
1424 (Sized_incremental_binary::relocs_reader): New function.
1425 (Sized_incremental_binary::got_plt_reader): New function.
1426 (Sized_incremental_binary::do_file_is_unchanged): New function.
1427 (Sized_incremental_binary::Sized_input_reader): New class.
1428 (Sized_incremental_binary::get_input_reader): New function.
1429 (Sized_incremental_binary::find_incremental_inputs_sections):
1430 Rename do_find_incremental_inputs_sections to this.
1431 (Sized_incremental_binary::setup_readers): New function.
1432 (Sized_incremental_binary::has_incremental_info_): New data member.
1433 (Sized_incremental_binary::inputs_reader_): New data member.
1434 (Sized_incremental_binary::symtab_reader_): New data member.
1435 (Sized_incremental_binary::relocs_reader_): New data member.
1436 (Sized_incremental_binary::got_plt_reader_): New data member.
1437 (Sized_incremental_binary::current_input_file_): New data member.
1439 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
1442 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
1445 2011-03-30 Cary Coutant <ccoutant@google.com>
1447 * archive.cc (Archive::include_member): Adjust call to report_object.
1448 (Add_archive_symbols::run): Add script_info to call to
1449 report_archive_begin.
1450 (Lib_group::include_member): Adjust call to report_object.
1451 (Add_lib_group_symbols::run): Adjust call to report_object.
1452 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
1453 blocks. Add object count for script input files.
1454 * incremental.cc (Incremental_inputs::report_archive_begin): Add
1455 script_info parameter; change all callers.
1456 (Incremental_inputs::report_object): Add script_info parameter;
1458 (Incremental_inputs::report_script): Store backpointer to
1459 incremental info entry.
1460 (Output_section_incremental_inputs::set_final_data_size): Record
1461 additional information for scripts.
1462 (Output_section_incremental_inputs::write_info_blocks): Likewise.
1463 * incremental.h (Incremental_script_entry::add_object): New function.
1464 (Incremental_script_entry::get_object_count): New function.
1465 (Incremental_script_entry::get_object): New function.
1466 (Incremental_script_entry::objects_): New data member; adjust
1468 (Incremental_inputs::report_archive_begin): Add script_info parameter.
1469 (Incremental_inputs::report_object): Add script_info parameter.
1470 (Incremental_inputs_reader::get_object_count): New function.
1471 (Incremental_inputs_reader::get_object_offset): New function.
1472 * options.cc (Input_arguments::add_file): Return reference to
1474 * options.h (Input_argument::set_script_info): New function.
1475 (Input_argument::script_info): New function.
1476 (Input_argument::script_info_): New data member; adjust all
1478 (Input_file_group::add_file): Return reference to new input argument.
1479 (Input_file_lib::add_file): Likewise.
1480 (Input_arguments::add_file): Likewise.
1481 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
1482 * script.cc (Parser_closure::Parser_closure): Add script_info
1483 parameter; adjust all callers.
1484 (Parser_closure::script_info): New function.
1485 (Parser_closure::script_info_): New data member.
1486 (read_input_script): Report scripts earlier to incremental info.
1487 (script_add_file): Set script_info in Input_argument.
1488 (script_add_library): Likewise.
1489 * script.h (Script_options::Script_info): Rewrite class.
1491 2011-03-29 Cary Coutant <ccoutant@google.com>
1493 * archive.cc (Library_base::should_include_member): Move
1494 method here from class Archive.
1495 (Archive::Archive): Initialize base class.
1496 (Archive::should_include_member): Move to base class.
1497 (Archive::do_for_all_unused_symbols): New function.
1498 (Add_archive_symbols::run): Remove redundant access to
1500 (Lib_group::Lib_group): Initialize base class.
1501 (Lib_group::do_filename): New function.
1502 (Lib_group::include_member): Pass pointer to Lib_group to
1504 (Lib_group::do_for_all_unused_symbols): New function.
1505 (Add_lib_group_symbols::run): Report archive information for
1507 * archive.h (class Library_base): New base class.
1508 (class Archive): Derive from Library_base.
1509 (Archive::filename): Move to base class.
1510 (Archive::set_incremental_info): Likewise.
1511 (Archive::incremental_info): Likewise.
1512 (Archive::Should_include): Likewise.
1513 (Archive::should_include_member): Likewise.
1514 (Archive::Armap_entry): Remove.
1515 (Archive::Unused_symbol_iterator): Remove.
1516 (Archive::unused_symbols_begin): Remove.
1517 (Archive::unused_symbols_end): Remove.
1518 (Archive::do_filename): New function.
1519 (Archive::do_get_mtime): New function.
1520 (Archive::do_for_all_unused_symbols): New function.
1521 (Archive::task_): Move to base class.
1522 (Archive::incremental_info_): Likewise.
1523 (class Lib_group): Derive from Library_base.
1524 (Lib_group::do_filename): New function.
1525 (Lib_group::do_get_mtime): New function.
1526 (Lib_group::do_for_all_unused_symbols): New function.
1527 (Lib_group::task_): Move to base class.
1528 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
1530 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
1532 * incremental.cc (Incremental_inputs::report_archive_begin):
1533 Use Library_base; call library's get_mtime; add incremental inputs
1534 entry before members.
1535 (class Unused_symbol_visitor): New class.
1536 (Incremental_inputs::report_archive_end): Use Library_base; use
1537 visitor class to record unused symbols; don't add incremental inputs
1538 entry after members.
1539 (Incremental_inputs::report_object): Use Library_base.
1541 (Incremental_archive_entry::Incremental_archive_entry): Remove
1542 unused Archive parameter.
1543 (Incremental_inputs::report_archive_begin): Use Library_base.
1544 (Incremental_inputs::report_archive_end): Likewise.
1545 (Incremental_inputs::report_object): Likewise.
1546 * object.cc (Sized_relobj::do_for_all_global_symbols): New
1548 * object.h (Object::for_all_global_symbols): New function.
1549 (Object::do_for_all_global_symbols): New function.
1550 (Sized_relobj::do_for_all_global_symbols): New function.
1551 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
1553 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
1556 2011-03-27 Ian Lance Taylor <iant@google.com>
1558 * archive.cc (Archive::interpret_header): Return -1 if something
1559 goes wrong. Change callers accordingly.
1561 2011-03-25 Cary Coutant <ccoutant@google.com>
1563 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
1564 * testsuite/Makefile.in: Regenerate.
1566 2010-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
1568 * plugin.cc (get_view): New.
1569 (Plugin::load): Pass get_view to the plugin.
1570 (Plugin_manager::get_view): New.
1572 2011-03-21 Ian Lance Taylor <iant@google.com>
1574 * testsuite/final_layout.sh: Rewrite to not use dc.
1575 * testsuite/relro_test.sh: Fail if dc is not present.
1577 2011-03-21 Sriraman Tallam <tmsriram@google.com>
1579 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
1581 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
1582 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
1584 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
1585 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
1587 2011-03-14 Ian Lance Taylor <iant@google.com>
1589 * script-sections.cc (Sort_output_sections::script_compare):
1590 Rename from is_before, change return type.
1591 (Sort_output_sections::operator()): Adjust accordingly.
1593 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
1596 * testsuite/odr_violation2.cc: Add comment to make all error line
1597 numbers double digits.
1598 * testsuite/debug_msg.sh: Adjust expected errors.
1600 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
1602 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
1603 but mark earlier ones as non-canonical
1604 (offset_to_iterator): Update search target and example
1605 (do_addr2line): Return extra lines in a vector*
1606 (format_file_lineno): Extract from do_addr2line
1607 (one_addr2line): Add vector* out-param
1608 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
1609 when a lineno entry appeared last for its instruction
1610 (Dwarf_line_info): Add vector* out-param
1611 * object.cc (Relocate_info): Pass NULL for the vector* out-param
1612 * symtab.cc (Odr_violation_compare): Include the lineno in the
1614 (linenos_from_loc): New. Combine the canonical line for an
1615 address with its other lines.
1616 (True_if_intersect): New. Helper functor to make
1617 std::set_intersection a query.
1618 (detect_odr_violations): Compare sets of lines instead of just
1619 one line for each function. This became less deterministic, but
1620 has fewer false positives.
1621 * symtab.h: Declarations.
1622 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
1623 mix an optimized and non-optimized object in the same binary
1624 (odr_violation2.so): Same.
1625 * testsuite/Makefile.in: Regenerate from Makefile.am.
1626 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
1627 * testsuite/debug_msg.sh: Update line numbers and add
1629 * testsuite/odr_violation1.cc: Use OdrDerived, in a
1630 non-optimized context.
1631 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
1632 isn't inlined, and use OdrDerived in an optimized context.
1633 * testsuite/odr_header1.h: Defines OdrDerived, where
1634 optimization will change the
1635 first-instruction-in-the-destructor's file and line number.
1636 * testsuite/odr_header2.h: Defines OdrBase.
1638 2011-03-09 Ian Lance Taylor <iant@google.com>
1640 * fileread.cc (File_read::clear_views): Don't delete the whole
1643 2011-03-08 Ian Lance Taylor <iant@google.com>
1646 * fileread.cc: #include <climits>.
1647 (GOLD_IOV_MAX): Define.
1648 (File_read::read_multiple): Limit number of entries by iov_max.
1649 * fileread.h (class File_read): Always set max_readv_entries to
1652 2011-03-07 Ian Lance Taylor <iant@google.com>
1655 * options.h (class General_options): Add -dy and -dn.
1657 2011-03-02 Cary Coutant <ccoutant@google.com>
1659 * testsuite/script_test_9.t: Add TLS segment.
1661 2011-03-02 Simon Baldwin <simonb@google.com>
1663 * configure.ac: Add check for gnu_indirect_function support in
1664 the toolchain building binutils.
1665 * configure: Rebuild.
1667 2010-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
1669 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
1670 plugin only symbols.
1671 (Symbol_table::sized_finalize_symbol) Mark symbol only present
1672 in plugin files as not needed in the symbol table.
1674 2011-02-11 Sriraman Tallam <tmsriram@google.com>
1676 * output.cc (Output_section::add_input_section): Delay fill
1677 generation for section ordering.
1679 2011-02-09 Ian Lance Taylor <iant@google.com>
1682 * object.h (class Sized_relobj): Remove clear_local_symbols.
1683 * reloc.cc (Sized_relobj::do_relocate): Don't call
1684 clear_local_symbols.
1686 2010-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
1688 * plugin.cc (is_visible_from_outside): Return true for symbols
1691 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
1693 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
1696 2011-02-02 Sriraman Tallam <tmsriram@google.com>
1698 * icf.h (is_section_foldable_candidate): Change type of parameter
1700 * icf.cc (Icf::find_identical_sections): Change type of local variable
1701 section_name to be std::string.
1702 (is_function_ctor_or_dtor): Change type of parameter to std::string.
1704 2011-01-25 Ian Lance Taylor <iant@google.com>
1706 * script.cc (script_add_extern): Rewrite to use
1707 add_symbol_reference.
1709 2011-01-25 Doug Kwan <dougkwan@google.com>
1711 * icf.cc (get_section_contents): Always lock section's object.
1713 2011-01-24 Ian Lance Taylor <iant@google.com>
1715 * options.h (class General_options): Accept
1716 --no-detect-odr-violations.
1718 2011-01-24 Ian Lance Taylor <iant@google.com>
1720 * version.cc (version_string): Bump to 1.11.
1722 2011-01-24 Ian Lance Taylor <iant@google.com>
1724 * plugin.cc (class Plugin_rescan): Define new class.
1725 (Plugin_manager::claim_file): Set any_claimed_.
1726 (Plugin_manager::save_archive): New function.
1727 (Plugin_manager::save_input_group): New function.
1728 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
1730 (Plugin_manager::new_undefined_symbol): New function.
1731 (Plugin_manager::rescan): New function.
1732 (Plugin_manager::rescannable_defines): New function.
1733 (Plugin_manager::add_input_file): Set any_added_.
1734 * plugin.h (class Plugin_manager): define new fields rescannable_,
1735 undefined_symbols_, any_claimed_, and any_added_. Declare
1736 Plugin_rescan as friend. Declare new functions.
1737 (Plugin_manager::Rescannable): Define type.
1738 (Plugin_manager::Rescannable_list): Define type.
1739 (Plugin_manager::Undefined_symbol_list): Define type.
1740 (Plugin_manager::Plugin_manager): Initialize new fields.
1741 * archive.cc (Archive::defines_symbol): New function.
1742 (Add_archive_symbols::run): Pass archive to plugins if any.
1743 * archive.h (class Archive): Declare defines_symbol.
1744 * readsyms.cc (Input_group::~Input_group): New function.
1745 (Finish_group::run): Pass input_group to plugins if any.
1746 * readsyms.h (class Input_group): Declare destructor.
1747 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
1750 2011-01-10 Ian Lance Taylor <iant@google.com>
1752 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
1754 (Layout::set_segment_offsets): Reset increase_relro before calling
1755 set_section_addresses a second time.
1757 2011-01-04 Cary Coutant <ccoutant@google.com>
1759 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
1760 sections before NOBITS sections.
1762 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
1764 * version.cc (print_version): Update copyright to 2011.
1766 2010-12-23 Cary Coutant <ccoutant@google.com>
1768 * output.h (Output_data_reloc::add_output_section): Pass OD instead
1769 of OS to this->add. Add OD parameter to second form of the function.
1771 2010-12-20 Ian Lance Taylor <iant@google.com>
1773 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
1774 second of two consecutive entries with same offset.
1776 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1778 * testsuite/Makefile.am (ifuncmain2static_LDADD)
1779 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
1780 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
1781 to avoid unneeded links against $(LDADD).
1782 * testsuite/Makefile.in: Regenerate.
1784 2010-12-15 Ian Lance Taylor <iant@google.com>
1787 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
1788 for R_X86_64_32 and R_X86_64_PC32.
1789 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
1790 ver_matching_def_pic.o.
1791 (ver_matching_def_pic.o): New target.
1793 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1795 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
1796 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
1797 Move definition before File_read::View member definitions.
1798 (File_read::View::~View): Initialize and hold lock before
1799 updating current_mapped_bytes.
1801 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1803 * dwarf_reader.cc: Remove outdated comment.
1804 * gold-threads.cc: Fix typo in error message.
1805 * archive.cc: Fix typos in comments.
1806 * archive.h: Likewise.
1807 * arm-reloc-property.cc: Likewise.
1808 * arm-reloc-property.h: Likewise.
1809 * arm-reloc.def: Likewise.
1811 * attributes.h: Likewise.
1812 * cref.cc: Likewise.
1813 * ehframe.cc: Likewise.
1814 * fileread.h: Likewise.
1816 * i386.cc: Likewise.
1818 * incremental.h: Likewise.
1819 * int_encoding.cc: Likewise.
1820 * layout.h: Likewise.
1821 * main.cc: Likewise.
1822 * merge.h: Likewise.
1823 * object.cc: Likewise.
1824 * object.h: Likewise.
1825 * options.cc: Likewise.
1826 * readsyms.cc: Likewise.
1827 * reduced_debug_output.cc: Likewise.
1828 * reloc.cc: Likewise.
1829 * script-sections.cc: Likewise.
1830 * sparc.cc: Likewise.
1831 * symtab.h: Likewise.
1832 * target-reloc.h: Likewise.
1833 * target.cc: Likewise.
1834 * target.h: Likewise.
1835 * timer.cc: Likewise.
1836 * timer.h: Likewise.
1837 * x86_64.cc: Likewise.
1839 2010-12-09 Cary Coutant <ccoutant@google.com>
1841 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
1843 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
1844 parameter; change all callers.
1845 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
1846 * options.h (warn_execstack): New option.
1848 2010-12-07 Doug Kwan <dougkwan@google.com>
1850 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
1851 like function call relocations.
1853 2010-12-07 Ian Lance Taylor <iant@google.com>
1855 * archive.cc (Archive::get_elf_object_for_member): Permit
1856 punconfigured to be NULL.
1857 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
1858 (Archive::include_member): Pass NULL to get_elf_object_for_member
1859 if we searched for the archive and this is the first included
1862 2010-12-01 Ian Lance Taylor <iant@google.com>
1864 * dwarf_reader.h (class Sized_dwarf_line_info): Add
1865 track_relocs_type_ field.
1866 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1867 Set track_relocs_type_.
1868 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
1869 contents when using RELA relocs.
1870 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
1872 * reloc.cc (Track_relocs::next_addend): New function.
1873 * reloc.h (class Track_relocs): Declare next_addend.
1875 2010-12-01 Ian Lance Taylor <iant@google.com>
1877 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
1880 2010-12-01 Ian Lance Taylor <iant@google.com>
1882 * README: Update compilers known to work and fail.
1884 2010-11-23 Matthias Klose <doko@ubuntu.com>
1886 * configure.in: For --enable-gold, handle value `default' instead of
1887 `both*'. Always install ld as ld.bfd, install as ld if gold is
1889 * configure: Regenerate.
1891 2010-11-18 Doug Kwan <dougkwan@google.com>
1893 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
1894 and right_alignment to be zero. Store result alignment only if it is
1895 greater than existing alignment.
1897 2010-11-16 Cary Coutant <ccoutant@google.com>
1900 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1901 Check for ".zdebug_line".
1903 2010-11-16 Doug Kwan <dougkwan@google.com>
1904 Cary Coutant <ccoutant@google.com>
1906 * output.h (Output_segment::set_section_addresses): Pass increase_relro
1907 by reference; adjust all callers.
1908 * output.cc (Output_segment::set_section_addresses): Adjust references
1909 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
1911 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
1912 end at page boundary.
1914 2010-11-16 Cary Coutant <ccoutant@google.com>
1917 * layout.cc (Layout::choose_output_section): Transform names of
1918 compressed sections even when using a script with a SECTIONS clause.
1919 (Layout::output_section_name): Remove code to transform
1920 compressed debug section names.
1921 * output.cc (Output_section::add_input_section): Use uncompressed
1922 section size when tracking input sections.
1924 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
1926 * symtab.h (Symbol::NON_PIC_REF): Remove.
1927 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
1928 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
1929 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
1930 (Symbol::use_plt_offset): Take a flags argument and pass it
1931 directly to needs_dynamic_reloc. Restrict check for undefined
1932 weak symbols to function calls.
1933 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
1934 (Target_arm::Scan::global): Use it.
1935 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
1936 (Target_arm::Relocate::relocate): Likewise.
1937 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
1938 parameter with an r_type parameter. Use get_reference_flags
1940 (Target_arm::Relocate::relocate): Update accordingly.
1941 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
1942 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
1943 (Target_i386::Scan::global): Likewise.
1944 (Target_i386::Relocate::relocate): Likewise.
1945 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
1946 parameter with an r_type parameter. Use get_reference_flags
1948 (Target_i386::Relocate::relocate): Update accordingly.
1949 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
1950 (Target_powerpc::Scan::global): Use it.
1951 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
1952 (Target_powerpc::Relocate::relocate): Likewise.
1953 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
1954 (Target_sparc::Scan::global): Use it.
1955 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
1956 (Target_sparc::Relocate::relocate): Likewise.
1957 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
1958 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
1959 (Target_x86_64::Scan::global): Likewise.
1960 (Target_x86_64::Relocate::relocate): Likewise.
1962 2010-11-08 Doug Kwan <dougkwan@google.com>
1963 Cary Coutant <ccoutant@google.com>
1965 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
1966 (Arm_exidx_merge_section::section_contents_): New data member.
1967 (Arm_input_section::Arm_input_section): Initialize original_contents_.
1968 (Arm_input_section::~Arm_input_section): De-allocate memory.
1969 (Arm_input_section::original_contents_): New data member.
1970 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
1971 in parameters instead of calling Object::section_contents without
1973 (Arm_output_section::group_section): New parameter TASK. Pass it
1974 to callees that need locking objects.
1975 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
1976 to lock EXIDX input sections. Fix a formatting issue. Call
1977 Arm_exidx_merged_section::build_contents to create merged section
1979 (Arm_output_section::create_stub_group): New parameter TASK. Use it
1980 to lock object of stub table owner.
1981 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
1982 TEXT_SIZE to initialize data member TEXT_SIZE_.
1983 (Arm_exidx_input_section::addralign): Fix typo in comment.
1984 (Arm_exidx_input_section::text_size): New method.
1985 (Target_arm::do_relax): New parameter TASK. Pass it to callees
1986 that require locking objects. Lock objects before scanning for stubs
1987 and updating local symbols.
1988 (Arm_input_section<big_endian>::init): Copy contents of original
1990 (Arm_input_section<big_endian>::do_write): Use saved contents of
1991 original input section instead of calling Object::section_contents
1993 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
1994 size without calling Object::section_size().
1995 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
1996 for size. Allocate a buffer for merged EXIDX entries.
1997 (Arm_exidx_merged_section::build_contents): New method.
1998 (Arm_exidx_merged_section::do_write): Move merge section contents
1999 building code to Arm_exidx_merged_section::build_contetns. Write
2000 out contetns in buffer instead of building it on the fly.
2001 (Arm_relobj::make_exidx_input_section): Also pass text section size
2002 to Arm_exidx_input_section constructor.
2003 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
2004 (Arm_dynobj::do_read_symbols): Fix memory leak.
2005 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
2006 * target.h: (class Task): Add forward declaration.
2007 (Target::relax): Add new parameter TASK and pass it to
2009 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
2011 2010-11-05 Cary Coutant <ccoutant@google.com>
2014 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
2015 object when reading from the file.
2016 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
2018 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
2019 when reading section contents.
2020 (get_section_contents): Likewise.
2021 (icf::find_identical_sections): Likewise.
2022 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
2023 object when reading from the file.
2024 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
2025 the object when doing deferred section layout.
2027 2010-11-03 Nick Clifton <nickc@redhat.com>
2030 * script.h (class Symbol_assignment: name): New member. Returns
2031 the name of the symbol.
2032 * scrfipt.cc (Script_options::is_pending_assignment): New member.
2033 Returns true if the given symbol name is on the list of
2034 assignments wating to be processed.
2035 * archive.cc (should_incldue_member): If the symbol is undefined,
2036 check to see if it is on the list of symbols pending assignment.
2038 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
2040 * script-sections.cc (Script_sections::find_memory_region): Check
2041 for a NULL output section pointer.
2043 2010-10-29 Doug Kwan <dougkwan@google.com>
2045 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
2046 Output_section::add_relaxed_input_section.
2047 * output.cc (Output_section::add_relaxed_input_section): Add new
2048 arguments LAYOUT and NAME. Set section order index.
2049 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
2050 Copy section order index.
2051 * output.h (Output_section::add_relaxed_input_section): Add new
2052 arguments LAYOUT and NAME.
2054 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2056 * testsuite/Makefile.am: Move gcctestdir/ld rule to
2057 NATIVE_OR_CROSS_LINKER.
2058 * testsuite/Makefile.in: Regenerate.
2060 2010-10-20 Doug Kwan <dougkwan@google.com>
2062 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
2063 without SHF_LINK_ORDER flags.
2064 * layout.cc (Layout::choose_output_section): Do not filter
2065 SHF_LINK_ORDER flag in a relocatable link.
2067 2010-10-17 Cary Coutant <ccoutant@google.com>
2069 * output.h (Output_segment::set_section_addresses): Change function
2070 signature. Update all callers.
2071 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
2073 (Output_segment::set_section_addresses): Align after last TLS
2074 section. Add padding before last relro section instead of after.
2076 2010-10-17 Doug Kwan <dougkwan@google.com>
2078 * gold/arm.cc (Target_arm::got_section): Use correct order and set
2079 GOT output section to be writable.
2081 2010-10-14 Cary Coutant <ccoutant@google.com>
2083 * debug.h (DEBUG_INCREMENTAL): New flag.
2084 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
2085 * gold.cc (queue_initial_tasks): Check parameters for incremental link
2087 * incremental.cc (report_command_line): Ignore all forms of
2089 * layout.cc (Layout::Layout): Check parameters for incremental link
2091 * options.cc (General_options::parse_incremental): New function.
2092 (General_options::parse_no_incremental): New function.
2093 (General_options::parse_incremental_full): New function.
2094 (General_options::parse_incremental_update): New function.
2095 (General_options::incremental_mode_): New data member.
2096 (General_options::finalize): Check incremental_mode_.
2097 * options.h (General_options): Update help text for --incremental.
2098 Add --no-incremental, --incremental-full, --incremental-update.
2099 (General_options::Incremental_mode): New enum type.
2100 (General_options::incremental_mode): New function.
2101 (General_options::incremental_mode_): New data member.
2102 * parameters.cc (Parameters::incremental_mode_): New data member.
2103 (Parameters::set_options): Set incremental_mode_.
2104 (Parameters::set_incremental_full): New function.
2105 (Parameters::incremental): New function.
2106 (Parameters::incremental_update): New function.
2107 (set_parameters_incremental_full): New function.
2108 * parameters.h (Parameters::set_incremental_full): New function.
2109 (Parameters::incremental): New function.
2110 (Parameters::incremental_update): New function.
2111 (Parameters::incremental_mode_): New data member.
2112 (set_parameters_incremental_full): New function.
2113 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
2114 incremental link mode.
2115 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
2116 (Sized_relobj::do_relocate_sections): Likewise.
2117 * testsuite/Makefile.am (incremental_test): Use --incremental-full
2119 * testsuite/Makefile.in: Regenerate.
2120 * testsuite/incremental_test.sh: Filter all forms of --incremental.
2122 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2124 * script-sections.h (class Script_sections): Make
2125 Sections_elements typedef public.
2126 * script-sections.cc (class Sort_output_sections): Add elements_
2127 field. Add constructor which sets it; change all callers.
2128 (Sort_output_sections::is_before): New function.
2129 (Sort_output_sections::operator()): Call is_before.
2130 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
2132 * testsuite/script_test_10.sh: New test. Test script section
2134 * testsuite/script_test_10.t: Likewise.
2135 * testsuite/script_test_10.s: Likewise.
2136 * testsuite/Makefile.am: Wrap the cross linker tests and the
2137 common tests into NATIVE_OR_CROSS_LINKER.
2138 (check_SCRIPTS): Add script_test_10.sh.
2139 (check_DATA): Add script_test_10.stdout.
2140 (script_test_10.o, script_test_10): New targets.
2141 (script_test_10.stdout): New target.
2142 * configure, testsuite/Makefile.in: Regenerate.
2144 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2146 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
2147 error for the deprecated relocations.
2148 (Target_arm::Scan::global): Likewise.
2149 (Target_arm::Relocate::relocate): Likewise.
2151 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
2153 * fileread.cc (Input_file::find_file): Initialize *found_name
2154 and *namep when using the fallback search for case 4.
2156 2010-10-11 Cary Coutant <ccoutant@google.com>
2158 * options.h (class General_options): Redefine -z lazy as an alias for
2159 the negation of -z now.
2161 2010-10-11 Ian Lance Taylor <iant@google.com>
2163 * resolve.cc (symbol_to_bits): Report the value of the unsupported
2166 2010-10-06 Nick Clifton <nickc@redhat.com>
2168 * script-sections.cc(class Memory_region): Remove
2169 current_lma_offset_ field. Rename current_vma_offset_ to
2170 current_offset_. Add last_section_ field.
2171 (Memory_region::get_current_vma_address): Rename to
2172 get_current_address.
2173 (Memory_region::get_current_lma_address): Delete.
2174 (Memory_region::increment_vma_offset): Rename to
2176 (Memory_region::increment_lma_offset): Delete.
2177 (Memory_region::attributes_compatible): New method. Returns
2178 true if the provided section is compatible with the region.
2179 (Memory_region::get_last_section): New method. Returns the last
2180 section to use the region.
2181 (Memory_region::set_last_section): New method. Stores the last
2182 section to use the region.
2183 (Script_sections::block_in_region): New method. Returns true if
2184 a block of memory is contained within a region.
2185 (Script_sections::find_memory_region): New method. Locates a
2186 memory region to be used to set a VMA or LMA address.
2187 (Output_section_definition::set_section_addresses): Add code to
2188 check for addresses set by memory regions.
2189 (Output_segment::set_section_addresses): Remove memory region
2191 (Script_sections::create_segment): Add a warning if a header
2192 segment is created outside of any region.
2193 * script-sections.h (class Script_sections): Add prototypes for
2194 find_memory_region and block_in_region methods.
2195 * testsuite/memory_test.s: Use .long instead of .word.
2196 * testsuite/memory_test.t: Add some more output sections.
2197 * testsuite/memory_test.sh: Update expected output.
2199 2010-10-02 Doug Kwan <dougkwan@google.com>
2201 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
2202 defintion to symtab.h
2203 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
2204 declaration to defintion.
2206 2010-10-01 Nick Clifton <nickc@redhat.com>
2208 * expression.cc (eval): Replace dummy argument with NULL.
2209 (eval_maybe_dot): Check for a NULL result section pointer.
2210 (Symbol_expression::value): Likewise.
2211 (Dot_expression::value): Likewise.
2212 (BINARY_EXPRESSION): Likewise.
2213 (Max_expression::value): Likewise.
2214 (Min_expression::value): Likewise.
2215 (Absolute_expression::value): Likewise.
2216 (Addr_expression::value_from_output_section): Likewise.
2217 (Loaddddr_expression::value_from_output_section): Likewise.
2218 (Segment_start_expression::value): Likewise.
2219 * script-sections.cc
2220 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
2222 (Sections_elememt_dot_assignment::set_section_addresses):
2224 (Output_data_expression::do_write_to_buffer): Likewise.
2225 (Output_section_definition::finalize_symbols): Likewise.
2226 (Output_section_definition::set_section_addresses): Likewise.
2228 2010-09-30 Doug Kwan <dougkwan@google.com>
2230 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
2232 2010-09-28 Sriraman Tallam <tmsriram@google.com>
2234 * target.h (Target::can_icf_inline_merge_sections): New virtual
2236 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
2238 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
2240 * icf.cc (get_section_contents): Inline merge sections only when
2243 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2245 * configure: Regenerate.
2247 2010-09-17 Ian Lance Taylor <iant@google.com>
2249 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
2250 * testsuite/Makefile.am (memory_test.o): New target.
2251 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
2253 * testsuite/Makefile.in: Rebuild.
2255 2010-09-17 Doug Kwan <dougkwan@google.com>
2257 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
2258 defintion if relocation uses GOT entries of the symbol.
2259 * testsuite/icf_safe_test.sh: Fix test.
2260 * testsuite/icf_safe_so_test.sh: Fix test.
2262 2010-09-16 Cary Coutant <ccoutant@google.com>
2264 * script_sections.cc (class Memory_region): Remove "NULL" from
2265 vector initializations.
2267 2010-09-15 Cary Coutant <ccoutant@google.com>
2269 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
2270 Resolve forwarding symbols.
2272 2010-09-15 Doug Kwan <dougkwan@google.com>
2274 * gold/testsuite/script_test_3.t: Add ARM special sections.
2275 * gold/testsuite/script_test_4.t: Same.
2276 * gold/testsuite/script_test_5.t: Same.
2277 * gold/testsuite/script_test_6.t: Same.
2278 * gold/testsuite/script_test_7.t: Same.
2279 * gold/testsuite/script_test_7.t: Same.
2280 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
2282 2010-09-14 Cary Coutant <ccoutant@google.com>
2284 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
2285 (Target_x86_64::Relocate::relocate_tls): Replace check for
2286 saw_tls_block_reloc_ with test for executable section.
2288 2010-09-12 Cary Coutant <ccoutant@google.com>
2290 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
2291 position-independent executables to shared libraries need dynamic
2293 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
2294 position-independent executables.
2295 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
2296 * testsuite/Makefile.in: Regenerate.
2298 2010-09-10 Nick Clifton <nickc@redhat.com>
2301 * testsuite/memory_test.t: Discard any sections that are not
2304 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
2307 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
2308 "This::" to work around a bug in gcc 4.2.
2310 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
2312 2010-09-09 Rafael Espindola <espindola@google.com>
2314 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
2315 sections with different PF_X flags in the same segment.
2316 (Layout::find_first_load_seg): Search all segments to find the first
2318 * options.h (rosegment): New.
2320 2010-09-08 Rafael Espindola <espindola@google.com>
2322 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
2324 2010-09-08 Doug Kwan <dougkwan@google.com>
2326 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
2327 (Arm_relobj::do_relocate_sections): Add new parameter for output
2328 file to match the parent.
2329 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
2330 of local symbols instead of input values. Update code to track
2331 changes in gold::relocate_section.
2332 * object.cc (Sized_relobj::compute_final_local_value): New methods.
2333 (Sized_relobj::compute_final_local_value_internal): New methods.
2334 (Sized_relobj::do_finalize_local_symbols): Move code from loop
2335 body into private version of Sized_relobj::compute_final_local_value.
2336 Call the inline method.
2337 * object.h (Symbol_value::Symbol_value): Define destructor. Free
2338 merged symbol value if there is one.
2339 (Symbol_value::has_output_value): New method defintiion.
2340 (Sized_relobj::Compute_final_local_value_status): New enum type.
2341 (Sized_relobj::compute_final_local_value): New methods.
2342 (Sized_relobj::compute_final_local_value_internal): New methods.
2343 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
2344 and arm_cortex_a8.sh.
2345 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
2346 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
2348 * Makefile.in: Regenerate.
2349 * testsuite/arm_bl_out_of_range.s: Update test.
2350 * testsuite/thumb_bl_out_of_range.s: Ditto.
2351 * testsuite/thumb_blx_out_of_range.s: Ditto.
2352 * testsuite/arm_branch_out_of_range.sh: New file.
2353 * testsuite/arm_cortex_a8.sh: Ditto.
2354 * testsuite/arm_cortex_a8_b.s: Ditto.
2355 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
2356 * testsuite/arm_cortex_a8_b_local.s: Ditto.
2357 * testsuite/arm_cortex_a8_bl.s: Ditto.
2358 * testsuite/arm_cortex_a8_blx.s: Ditto.
2359 * testsuite/arm_cortex_a8_local.s: Ditto.
2360 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
2361 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
2363 2010-09-08 Rafael Espindola <espindola@google.com>
2365 * Makefile.am (memory_test.stdout): Run readelf with -W.
2366 * Makefile.in: Regenerate.
2367 * testsuite/memory_test.sh: Make the regexps accept both 32 and
2370 2010-09-08 Rafael Espindola <espindola@google.com>
2372 * script-sections.cc (Script_sections::add_memory_region): Convert
2373 field precision to int.
2374 * script.cc (script_set_section_region, script_set_section_region):
2375 Convert field precision to int.
2377 2010-09-08 Rafael Espindola <espindola@google.com>
2379 * arm.cc (do_finalize_sections): Create the __exidx_start and
2380 __exdix_end symbols even when the section is missing.
2382 2010-09-08 Nick Clifton <nickc@redhat.com>
2384 * README: Remove claim that MEMORY is not supported.
2385 * expression.cc (script_exp_function_origin)
2386 (script_exp_function_length): Move from here to ...
2387 * script.cc: ... here.
2388 (script_set_section_region, script_add_memory)
2389 (script_parse_memory_attr, script_include_directive): New
2391 * script-sections.cc
2392 (class Memory_region): New class.
2393 (class Output_section_definition): Add set_memory_region,
2394 set_section_vma, set_section_lma and get_section_name methods.
2395 (class Script_Sections): Add add_memory_region,
2396 find_memory_region, find_memory_region_origin,
2397 find_memory_region_length and set_memory_region methods.
2398 Have set_section_addresses method walk the list of set memory
2400 Extend the print methos to display memory regions.
2401 * script-sections.h: Add prototypes for new methods.
2402 Add enum for MEMORY region attributes.
2403 * yyscript.y: Add support for parsing MEMORY regions.
2404 * script-c.h: Add prototypes for new functions.
2405 * testsuite/Makefile.am: Add test of MEMORY region functionality.
2406 * testsuite/Makefile.in: Regenerate.
2407 * testsuite/memory_test.sh: New script.
2408 * testsuite/memory_test.s: New assembler source file.
2409 * testsuite/memory_test.t: New linker script.
2411 2010-08-27 Doug Kwan <dougkwan@google.com>
2413 * gold/resolve.cc (Symbol_table::should_override): Let a weak
2414 reference override an existing dynamic weak reference.
2415 * testsuite/Makefile.am: Add new test dyn_weak_ref.
2416 * testsuite/Makefile.in: Regenerate.
2417 * testsuite/dyn_weak_ref.sh: New file.
2418 * testsuite/dyn_weak_ref_1.c: Ditto.
2419 * testsuite/dyn_weak_ref_2.c: Ditto.
2421 2010-08-27 Ian Lance Taylor <iant@google.com>
2423 * incremental.h (class Incremental_input_entry): Add virtual
2426 2010-08-27 Ian Lance Taylor <iant@google.com>
2428 * testsuite/start_lib_test_3.c: Mark t3 as used.
2430 2010-08-27 Nick Clifton <nickc@redhat.com>
2432 * options.cc (version_script): Fix small typo in previous
2435 2010-08-25 Nick Clifton <nickc@redhat.com>
2437 * archive.cc: Formatting fixes: Remove whitespace between
2438 typename and following asterisk. Remove whitespace between
2439 function name and opening parenthesis.
2440 * archive.h: Likewise.
2442 * attributes.cc: Likewise.
2443 * attributes.h: Likewise.
2444 * common.cc: Likewise.
2445 * copy-relocs.cc: Likewise.
2446 * dirsearch.h: Likewise.
2447 * dynobj.cc: Likewise.
2448 * ehframe.cc: Likewise.
2449 * ehframe.h: Likewise.
2450 * expression.cc: Likewise.
2451 * fileread.cc: Likewise.
2452 * fileread.h: Likewise.
2454 * gold-threads.cc: Likewise.
2455 * gold.cc: Likewise.
2456 * i386.cc: Likewise.
2458 * incremental-dump.cc: Likewise.
2459 * incremental.cc: Likewise.
2460 * layout.cc: Likewise.
2461 * layout.h: Likewise.
2462 * main.cc: Likewise.
2463 * merge.cc: Likewise.
2464 * merge.h: Likewise.
2465 * object.cc: Likewise.
2466 * object.h: Likewise.
2467 * options.cc: Likewise.
2468 * options.h: Likewise.
2469 * output.cc: Likewise.
2470 * output.h: Likewise.
2471 * plugin.cc: Likewise.
2472 * plugin.h: Likewise.
2473 * powerpc.cc: Likewise.
2474 * reloc.cc: Likewise.
2475 * script-c.h: Likewise.
2476 * script-sections.cc: Likewise.
2477 * script.cc: Likewise.
2478 * stringpool.cc: Likewise.
2479 * symtab.cc: Likewise.
2480 * symtab.h: Likewise.
2481 * target.cc: Likewise.
2482 * timer.cc: Likewise.
2483 * timer.h: Likewise.
2484 * version.cc: Likewise.
2485 * x86_64.cc: Likewise.
2487 2010-08-24 Nick Clifton <nickc@redhat.com>
2490 * layout.cc (segment_precedes): Sort segments by their physical
2491 addresses, if they have been set.
2493 2010-08-23 Cary Coutant <ccoutant@google.com>
2495 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
2497 (Lib_group::include_member): Unlock object after deleting its
2499 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
2502 2010-08-19 Neil Vachharajani <nvachhar@google.com>
2503 Cary Coutant <ccoutant@google.com>
2505 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
2506 constructor, and set_blocker.
2507 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
2509 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
2510 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
2511 * testsuite/Makefile.am (start_lib_test): New test case.
2512 * testsuite/Makefile.in: Regenerate.
2513 * testsuite/start_lib_test_main.c: New file.
2514 * testsuite/start_lib_test_1.c: New file.
2515 * testsuite/start_lib_test_2.c: New file.
2516 * testsuite/start_lib_test_3.c: New file.
2518 2010-08-19 Ian Lance Taylor <iant@google.com>
2520 * Makefile.in: Rebuild with automake 1.11.1.
2521 * aclocal.m4: Likewise.
2522 * testsuite/Makefile.in: Likewise.
2524 2010-08-19 Ian Lance Taylor <iant@google.com>
2527 * i386.cc (class Output_data_plt_i386): Update declarations.
2528 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
2529 local_ifuncs_ fields.
2530 (Target_i386::do_plt_section_for_global): New function.
2531 (Target_i386::do_plt_section_for_local): New function.
2532 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
2533 parameter; change all callers. Initialize global_ifuncs_ and
2534 local_ifuncs_. If doing a static link define __rel_iplt_start and
2536 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
2537 (Output_data_plt_i386::add_local_ifunc_entry): New function.
2538 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
2540 (Target_i386::make_plt_section): New function, broken out of
2541 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
2542 (Target_i386::make_plt_entry): Call make_plt_section.
2543 (Target_i386::make_local_ifunc_plt_entry): New function.
2544 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
2545 (Target_i386::Scan::local): Handle IFUNC symbols. Add
2546 R_386_IRELATIVE to switch.
2547 (Target_i386::Scan::global): Likewise.
2548 (Target_i386::Relocate::relocate): Likewise.
2549 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
2551 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
2552 (Target_x86_64::do_plt_section_for_global): New function.
2553 (Target_x86_64::do_plt_section_for_local): New function.
2554 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
2555 parameter; change all callers. If doing a static link define
2556 __rela_iplt_start and __rela_iplt_end.
2557 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
2558 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
2559 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
2561 (Target_x86_64::make_local_ifunc_plt_entry): New function.
2562 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
2564 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
2565 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
2566 R_X86_64_IRELATIVE to switch.
2567 (Target_x86_64::Scan::global): Likewise.
2568 (Target_x86_64::Relocate::relocate): Likewise.
2569 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
2571 * target.h (class Target): Add plt_section_for_global and
2572 plt_section_for_local functions. Add do_plt_section_for_global
2573 and do_plt_section_for_local virtual functions.
2574 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
2575 clarifying comments.
2576 (Symbol::use_plt_offset): Handle IFUNC symbol.
2577 * object.cc (Sized_relobj::Sized_relobj): Initialize
2579 (Sized_relobj::local_has_plt_offset): New function.
2580 (Sized_relobj::local_plt_offset): New function.
2581 (Sized_relobj::set_local_plt_offset): New function.
2582 (Sized_relobj::do_count): Handle IFUNC symbol.
2583 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
2584 a bit away from input_shndx_ field. Add set_is_func_symbol and
2585 is_ifunc_symbol functions.
2586 (class Sized_relobj): Update declarations. Remove Tls_got_entry
2587 and Local_tls_got_offsets. Define Local_plt_offsets. Add
2588 local_plt_offsets_ field.
2589 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
2590 * output.h (class Output_section_data): Add non-const
2591 output_section function.
2592 (class Output_data_got): Update declarations.
2593 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
2594 Add use_plt_offset parameter to global and local constructors.
2595 Change all callers. Change local_sym_index_ field to 31 bits.
2596 Change GSYM_CODE and CONSTANT_CODE accordingly.
2597 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
2598 doing a static link don't set sh_link field.
2599 (Output_data_got::Got_entry::write): Use PLT offset if
2601 (Output_data_got::add_global_plt): New function.
2602 (Output_data_got::add_local_plt): New function.
2603 * target-reloc.h (relocate_section): Handle IFUNC symbol.
2604 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
2605 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
2606 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
2607 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
2609 * testsuite/ifunc-sel.h: New file.
2610 * testsuite/ifuncmain1.c: New file.
2611 * testsuite/ifuncmain1vis.c: New file.
2612 * testsuite/ifuncmod1.c: New file.
2613 * testsuite/ifuncdep2.c: New file.
2614 * testsuite/ifuncmain2.c: New file.
2615 * testsuite/ifuncmain3.c: New file.
2616 * testsuite/ifuncmod3.c: New file.
2617 * testsuite/ifuncmain4.c: New file.
2618 * testsuite/ifuncmain5.c: New file.
2619 * testsuite/ifuncmod5.c: New file.
2620 * testsuite/ifuncmain6pie.c: New file.
2621 * testsuite/ifuncmod6.c: New file.
2622 * testsuite/ifuncmain7.c: New file.
2623 * configure, testsuite/Makefile.in: Rebuild.
2625 2010-08-18 Ian Lance Taylor <iant@google.com>
2628 (Output_section_incremental_inputs::write_input_files): Add cast
2629 to avoid signed/unsigned comparison warning.
2630 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2632 2010-08-12 Cary Coutant <ccoutant@google.com>
2634 * common.cc (Sort_commons::operator()): Remove unnecessary code.
2636 2010-08-13 Ian Lance Taylor <iant@google.com>
2638 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
2640 2010-08-12 Cary Coutant <ccoutant@google.com>
2641 Doug Kwan <dougkwan@google.com>
2643 * resolve.cc (Symbol_table::should_override): When a weak dynamic
2644 defintion overrides non-weak undef, remember that the original undef
2646 * symtab.cc (Symbol_table::sized_write_global): For undef without
2647 an original weak binding, set binding to global in output.
2648 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
2649 * testsuite/Makefile.in: Regenerate.
2650 * testsuite/strong_ref_weak_def.sh: New file.
2651 * testsuite/strong_ref_weak_def_1.c: Ditto.
2652 * testsuite/strong_ref_weak_def_2.c: Ditto.
2654 2010-08-12 Cary Coutant <ccoutant@google.com>
2656 * testsuite/incremental_test.sh: Rewrite.
2657 * testsuite/incremental_test_1.c: Rewrite.
2658 * testsuite/incremental_test_2.c: Rewrite.
2660 2010-08-12 Cary Coutant <ccoutant@google.com>
2662 * arm.cc (Target_arm::got_size): Add const.
2663 (Target_arm::got_entry_count): New function.
2664 (Target_arm::plt_entry_count): New function.
2665 (Target_arm::first_plt_entry_offset): New function.
2666 (Target_arm::plt_entry_size): New function.
2667 (Output_data_plt_arm::entry_count): New function.
2668 (Output_data_plt_arm::first_plt_entry_offset): New function.
2669 (Output_data_plt_arm::get_plt_entry_size): New function.
2670 * i386.cc (Target_i386::got_size): Add const.
2671 (Target_i386::got_entry_count): New function.
2672 (Target_i386::plt_entry_count): New function.
2673 (Target_i386::first_plt_entry_offset): New function.
2674 (Target_i386::plt_entry_size): New function.
2675 (Output_data_plt_i386::entry_count): New function.
2676 (Output_data_plt_i386::first_plt_entry_offset): New function.
2677 (Output_data_plt_i386::get_plt_entry_size): New function.
2678 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
2679 find_incremental_inputs_sections. Dump incremental_got_plt section.
2680 * incremental.cc: Include target.h.
2681 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
2682 parameter. Adjust all callers. Find incremental_got_plt section.
2683 (Incremental_inputs::create_data_sections): Create incremental_got_plt
2685 (Output_section_incremental_inputs::set_final_data_size): Calculate
2686 size of incremental_got_plt section.
2687 (Output_section_incremental_inputs::do_write): Write the
2688 incremental_got_plt section.
2689 (Got_plt_view_info): New struct.
2690 (Local_got_offset_visitor): New class.
2691 (Global_got_offset_visitor): New class.
2692 (Global_symbol_visitor_got_plt): New class.
2693 (Output_section_incremental_inputs::write_got_plt): New function.
2694 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
2695 Add parameter. Adjust all callers.
2696 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2697 (Incremental_inputs::got_plt_section): New function.
2698 (Incremental_inputs::got_plt_section_): New data member.
2699 (Incremental_got_plt_reader): New class.
2700 * layout.cc (Layout::create_incremental_info_sections): Add the
2701 incremental_got_plt section.
2702 * object.h (Got_offset_list::get_list): New function.
2703 (Got offset_list::for_all_got_offsets): New function.
2704 (Sized_relobj::local_got_offset_list): New function.
2705 * powerpc.cc (Target_powerpc::got_size): Add const.
2706 (Target_powerpc::got_entry_count): New function.
2707 (Target_powerpc::plt_entry_count): New function.
2708 (Target_powerpc::first_plt_entry_offset): New function.
2709 (Target_powerpc::plt_entry_size): New function.
2710 (Output_data_plt_powerpc::entry_count): New function.
2711 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
2712 (Output_data_plt_powerpc::get_plt_entry_size): New function.
2713 * sparc.cc (Target_sparc::got_size): Add const.
2714 (Target_sparc::got_entry_count): New function.
2715 (Target_sparc::plt_entry_count): New function.
2716 (Target_sparc::first_plt_entry_offset): New function.
2717 (Target_sparc::plt_entry_size): New function.
2718 (Output_data_plt_sparc::entry_count): New function.
2719 (Output_data_plt_sparc::first_plt_entry_offset): New function.
2720 (Output_data_plt_sparc::get_plt_entry_size): New function.
2721 * symtab.h (Symbol::got_offset_list): New function.
2722 (Symbol_table::for_all_symbols): New function.
2723 * target.h (Sized_target::got_entry_count): New function.
2724 (Sized_target::plt_entry_count): New function.
2725 (Sized_target::plt_entry_size): New function.
2726 * x86_64.cc (Target_x86_64::got_size): Add const.
2727 (Target_x86_64::got_entry_count): New function.
2728 (Target_x86_64::plt_entry_count): New function.
2729 (Target_x86_64::first_plt_entry_offset): New function.
2730 (Target_x86_64::plt_entry_size): New function.
2731 (Output_data_plt_x86_64::entry_count): New function.
2732 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
2733 (Output_data_plt_x86_64::get_plt_entry_size): New function.
2735 2010-08-12 Cary Coutant <ccoutant@google.com>
2737 * archive.cc: Include incremental.h.
2738 (Archive::Archive): Initialize incremental_info_.
2739 (Archive::include_member): Record archive members in incremental info.
2740 (Add_archive_symbols::run): Record begin and end of an archive in
2742 (Lib_group::include_member): Record objects in incremental info.
2743 * archive.h (Incremental_archive_entry): Forward declaration.
2744 (Archive::set_incremental_info): New member function.
2745 (Archive::incremental_info): New member function.
2746 (Archive::Unused_symbol_iterator): New class.
2747 (Archive::unused_symbols_begin): New member function.
2748 (Archive::unused_symbols_end): New member function.
2749 (Archive::incremental_info_): New data member.
2750 * incremental-dump.cc (find_input_containing_global): New function.
2751 (dump_incremental_inputs): Dump new incremental info sections.
2752 * incremental.cc: Include symtab.h.
2753 (Output_section_incremental_inputs): New class.
2754 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
2755 new incremental info sections.
2756 (Sized_incremental_binary::do_check_inputs): Likewise.
2757 (Incremental_inputs::report_archive): Remove.
2758 (Incremental_inputs::report_archive_begin): New function.
2759 (Incremental_inputs::report_archive_end): New function.
2760 (Incremental_inputs::report_object): New function.
2761 (Incremental_inputs::finalize_inputs): Remove.
2762 (Incremental_inputs::report_input_section): New function.
2763 (Incremental_inputs::report_script): Rewrite.
2764 (Incremental_inputs::finalize): Do nothing but finalize string table.
2765 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2766 (Incremental_inputs::sized_create_inputs_section_data): Remove.
2767 (Incremental_inputs::create_data_sections): New function.
2768 (Incremental_inputs::relocs_entsize): New function.
2769 (Output_section_incremental_inputs::set_final_data_size): New function.
2770 (Output_section_incremental_inputs::do_write): New function.
2771 (Output_section_incremental_inputs::write_header): New function.
2772 (Output_section_incremental_inputs::write_input_files): New function.
2773 (Output_section_incremental_inputs::write_info_blocks): New function.
2774 (Output_section_incremental_inputs::write_symtab): New function.
2775 * incremental.h (Incremental_script_entry): Forward declaration.
2776 (Incremental_object_entry): Forward declaration.
2777 (Incremental_archive_entry): Forward declaration.
2778 (Incremental_inputs): Forward declaration.
2779 (Incremental_inputs_header_data): Remove.
2780 (Incremental_inputs_header): Remove.
2781 (Incremental_inputs_header_write): Remove.
2782 (Incremental_inputs_entry_data): Remove.
2783 (Incremental_inputs_entry): Remove.
2784 (Incremental_inputs_entry_write): Remove.
2785 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
2786 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
2787 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2788 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
2790 (Incremental_input_entry): New class.
2791 (Incremental_script_entry): New class.
2792 (Incremental_object_entry): New class.
2793 (Incremental_archive_entry): New class.
2794 (Incremental_inputs::Incremental_inputs): Initialize new data members.
2795 (Incremental_inputs::report_inputs): Remove.
2796 (Incremental_inputs::report_archive): Remove.
2797 (Incremental_inputs::report_archive_begin): New function.
2798 (Incremental_inputs::report_archive_end): New function.
2799 (Incremental_inputs::report_object): Change prototype.
2800 (Incremental_inputs::report_input_section): New function.
2801 (Incremental_inputs::report_script): Change prototype.
2802 (Incremental_inputs::get_reloc_count): New function.
2803 (Incremental_inputs::set_reloc_count): New function.
2804 (Incremental_inputs::create_data_sections): New function.
2805 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2806 (Incremental_inputs::inputs_section): New function.
2807 (Incremental_inputs::symtab_section): New function.
2808 (Incremental_inputs::relocs_section): New function.
2809 (Incremental_inputs::get_stringpool): Add const.
2810 (Incremental_inputs::command_line): Add const.
2811 (Incremental_inputs::inputs): Remove.
2812 (Incremental_inputs::command_line_key): New function.
2813 (Incremental_inputs::input_file_count): New function.
2814 (Incremental_inputs::input_files): New function.
2815 (Incremental_inputs::relocs_entsize): New function.
2816 (Incremental_inputs::sized_create_inputs_section_data): Remove.
2817 (Incremental_inputs::finalize_inputs): Remove.
2818 (Incremental_inputs::Input_info): Remove.
2819 (Incremental_inputs::lock_): Remove.
2820 (Incremental_inputs::inputs_): Change type.
2821 (Incremental_inputs::inputs_map_): Remove.
2822 (Incremental_inputs::current_object_entry_): New data member.
2823 (Incremental_inputs::inputs_section_): New data member.
2824 (Incremental_inputs::symtab_section_): New data member.
2825 (Incremental_inputs::relocs_section_): New data member.
2826 (Incremental_inputs::reloc_count_): New data member.
2827 (Incremental_inputs_reader): New class.
2828 (Incremental_symtab_reader): New class.
2829 (Incremental_relocs_reader): New class.
2830 * layout.cc (Layout::finalize): Move finalization of incremental info
2831 and creation of incremental info sections to follow finalization of
2832 symbol table. Set offsets for postprocessing sections.
2833 (Layout::create_incremental_info_sections): Call
2834 Incremental_inputs::create_data_sections. Add incremental symtab
2835 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
2836 sections to layout after input sections.
2837 * layout.h (struct Timespec): Forward declaration.
2838 (Layout::incremental_inputs): Add const.
2839 (Layout::create_incremental_info_sections): Add parameter.
2840 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
2841 * object.cc: Include incremental.h.
2842 (Relobj::finalize_incremental_relocs): New function.
2843 (Sized_relobj::do_layout): Record input sections in incremental info.
2844 * object.h (Object::output_section): New function.
2845 (Object::output_section_offset): Moved from Relobj.
2846 (Object::get_incremental_reloc_base): New function.
2847 (Object::get_incremental_reloc_count): New function.
2848 (Object::do_output_section): New function.
2849 (Object::do_output_section_offset): Moved from Relobj.
2850 (Object::do_get_incremental_reloc_base): New function.
2851 (Object::do_get_incremental_reloc_count): New function.
2852 (Object::Object): Initialize new data members.
2853 (Relobj::output_section): Renamed do_output_section and moved to
2855 (Relobj::output_section_offset): Moved to Object.
2856 (Relobj::do_get_incremental_reloc_base): New function.
2857 (Relobj::do_get_incremental_reloc_count): New function.
2858 (Relobj::allocate_incremental_reloc_counts): New function.
2859 (Relobj::count_incremental_reloc): New function.
2860 (Relobj::finalize_incremental_relocs): New function.
2861 (Relobj::next_incremental_reloc_index): New function.
2862 (Relobj::reloc_counts_): New data member.
2863 (Relobj::reloc_bases_): New data member.
2864 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
2865 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
2866 (Sized_relobj::incremental_relocs_scan): New function.
2867 (Sized_relobj::incremental_relocs_scan_reltype): New function.
2868 (Sized_relobj::incremental_relocs_write): New function.
2869 (Sized_relobj::incremental_relocs_write_reltype): New function.
2870 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
2872 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
2873 archives and object files elsewhere.
2874 (Add_symbols::run): Report object files here.
2875 (Finish_group::run): Report end of archive at end of group.
2876 * reloc.cc: Include layout.h, incremental.h.
2877 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
2878 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
2879 (Sized_relobj::incremental_relocs_scan): New function.
2880 (Sized_relobj::incremental_relocs_scan_reltype): New function.
2881 (Sized_relobj::do_relocate_sections): Write incremental relocations.
2882 (Sized_relobj::incremental_relocs_write): New function.
2883 (Sized_relobj::incremental_relocs_write_reltype): New function.
2884 * script.cc (read_input_script): Rewrite test for incremental link.
2885 Change call to Incremental_inputs::report_script.
2886 * symtab.h (Symbol_table::first_global_index): New function.
2887 (Symbol_table::output_count): New function.
2889 2010-08-12 Doug Kwan <dougkwan@google.com>
2891 * arm.cc (Target_arm::merge_object_attributes): Check command line
2892 options --no-wchar-size-warning and --no-enum-size-warning.
2893 * options.h (General_options): Add ld-compatible options
2894 --no-enum-size-warning and --no-wchar-size-warning.
2896 2010-08-04 Ian Lance Taylor <iant@google.com>
2898 * x86_64.cc (Target_x86_64::Scan::local): Use
2899 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
2900 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
2901 (Target_x86_64::Scan::global): Likewise.
2902 (Target_x86_64::Relocate::relocate): Likewise.
2903 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
2906 2010-08-03 Cary Coutant <ccoutant@google.com>
2908 * merge.cc (Output_merge_string::do_add_input_section): Count strings
2909 to reserve space in merged_strings vector. Keep total input size
2911 (Output_merge_string::do_print_merge_stats): Print total input size.
2912 * merge.h (Output_merge_string): Add input_size_ field.
2913 * stringpool.cc (Stringpool_template::string_length): Move
2914 implementations out of Stringpool_template class and place in
2916 * stringpool.h (string_length): Move out of Stringpool_template.
2918 2010-08-03 Ian Lance Taylor <iant@google.com>
2921 * layout.cc (relaxation_loop_body): If address of load segment is
2922 set, adjust address to include headers if possible.
2924 2010-08-03 Ian Lance Taylor <iant@google.com>
2926 * version.cc (version_string): Bump to 1.10.
2928 2010-08-03 Ian Lance Taylor <iant@google.com>
2931 * layout.h (enum Output_section_order): Define.
2932 (class Layout): Update declarations.
2933 * layout.cc (Layout::get_output_section): Add order parameter.
2934 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
2935 is_first_non_relro parameters. Change all callers.
2936 (Layout::choose_output_section): Likewise.
2937 (Layout::add_output_section_data): Likewise.
2938 (Layout::make_output_section): Likewise. Set order.
2939 (Layout::default_section_order): New function.
2940 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
2941 * output.cc (Output_section::Output_section): Initialize order_.
2942 Don't initialize deleted fields.
2943 (Output_segment::Output_segment): Don't initialize deleted
2945 (Output_segment::add_output_section_to_load): New function
2946 replacing add_output_section. Change all callers to call this or
2947 add_output_section_to_nonload.
2948 (Output_segment::add_output_section_to_nonload): New function.
2949 (Output_segment::remove_output_section): Rewrite.
2950 (Output_segment::add_initial_output_data): Likewise.
2951 (Output_segment::has_any_data_sections): Likewise.
2952 (Output_segment::is_first_section_relro): Likewise.
2953 (Output_segment::maximum_alignment): Likewise.
2954 (Output_segment::has_dynamic_reloc): New function replacing
2955 dynamic_reloc_count. Change all callers.
2956 (Output_segment::has_dynamic_reloc_list): New function replacing
2957 dynamic_reloc_count_list. Change all callers.
2958 (Output_segment::set_section_addresses): Rewrite.
2959 (Output_segment::set_offset): Rewrite.
2960 (Output_segment::find_first_and_last_list): Remove.
2961 (Output_segment::set_tls_offsets): Rewrite.
2962 (Output_segment::first_section_load_address): Likewise.
2963 (Output_segment::output_section_count): Likewise.
2964 (Output_segment::section_with_lowest_load_address): Likewise.
2965 (Output_segment::write_section_headers): Likewise.
2966 (Output_segment::print_sections_to_map): Likewise.
2967 * output.h (class Output_data): Remove dynamic_reloc_count_
2968 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
2969 (Output_data::add_dynamic_reloc): Rewrite.
2970 (Output_data::has_dynamic_reloc): New function.
2971 (Output_data::dynamic_reloc_count): Remove.
2972 (class Output_section): Add order_ field. Remvoe is_relro_local_,
2973 is_last_relro_, is_first_non_relro_, is_interp_,
2974 is_dynamic_linker_section_ fields. Add order and set_order
2975 functions. Remove is_relro_local, set_is_relro_local,
2976 is_last_relro, set_is_last_relro, is_first_non_relro,
2977 set_is_first_non_relro functions, is_interp, set_is_interp,
2978 is_dynamic_linker_section, and set_is_dynamic_linker_section
2980 (class Output_segment): Change Output_data_list from std::list to
2981 std:;vector. Add output_lists_ field. Remove output_data_ and
2982 output_bss_ fields. Update declarations.
2984 2010-08-02 Ian Lance Taylor <iant@google.com>
2986 * arm.cc (Target_arm::gc_process_relocs): Use typename.
2987 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
2988 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
2990 2010-08-02 Ian Lance Taylor <iant@google.com>
2993 * script.cc (Script_options::Script_options): Initialize
2994 symbol_definitions_ and symbol_references_.
2995 (Script_options::add_symbol_assignment): Update
2996 symbol_definitions_ and symbol_references_.
2997 (Script_options::add_symbol_reference): New function.
2998 (script_symbol): New function.
2999 * script.h (class Script_options): Add symbol_definitions_ and
3000 symbol_references_ fields.
3001 (Script_options::referenced_const_iterator): New type.
3002 (Script_options::referenced_begin): New function.
3003 (Script_options::referenced_end): New function.
3004 (Script_options::is_referenced): New function.
3005 (Script_options::any_unreferenced): New function.
3006 * script-c.h (script_symbol): Declare.
3007 * yyscript.y (exp): Call script_symbol.
3008 * symtab.cc: Include "script.h".
3009 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
3010 Change all callers. Check symbols referenced by scripts.
3011 (Symbol_table::add_undefined_symbols_from_command_line): Add
3012 layout parameter. Change all callers.
3013 (Symbol_table::do_add_undefined_symbols_from_command_line):
3014 Likewise. Break out loop body. Check symbols referenced by
3016 (Symbol_table::add_undefined_symbol_from_command_line): New
3017 function broken out of
3018 do_add_undefined_symbols_from_command_line.
3019 * symtab.h (class Symbol_table): Update declarations.
3020 * archive.cc: Include "layout.h".
3021 (Archive::should_include_member): Add layout parameter. Change
3022 all callers. Check for symbol mentioned in expression.
3023 * archive.h (class Archive): Update declaration.
3024 * object.cc (Sized_relobj::do_should_include_member): Add layout
3026 * object.h (Object::should_include_member): Add layout parameter.
3028 (Object::do_should_include_member): Add layout parameter.
3029 (class Sized_relobj): Update declaration.
3030 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
3032 * dynobj.h (class Sized_dynobj): Update declaration.
3033 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
3035 * plugin.h (class Sized_pluginobj): Update declaration.
3037 2010-08-02 Ian Lance Taylor <iant@google.com>
3040 * output.cc (Output_segment::set_offset): Search for the first and
3041 last sections rather than assuming that the list is in order.
3042 (Output_segment::find_first_and_last_list): New function.
3043 * output.h (class Output_segment): Update declarations.
3044 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
3045 (relro_strip_test_SOURCES): New variable.
3046 (relro_strip_test_DEPENDENCIES): New variable.
3047 (relro_strip_test_LDFLAGS): New variable.
3048 (relro_strip_test_LDADD): New variable.
3049 (relro_strip_test.so): New target.
3051 2010-08-02 Ian Lance Taylor <iant@google.com>
3053 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
3054 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
3055 (Target_i386::got_tlsdesc_section): New function.
3056 (Target_i386::got_section): Create space for GOT entries for
3057 TLSDESC relocations.
3058 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
3060 (Target_i386::Scan::global): Likewise.
3061 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
3063 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
3064 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
3065 (Target_x86_64::got_tlsdesc_section): New function.
3066 (Target_x86_64::got_section): Create space for GOT entries for
3067 TLSDESC relocations.
3068 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
3070 (Target_x86_64::Scan::global): Likewise.
3071 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
3074 2010-08-02 Ian Lance Taylor <iant@google.com>
3076 * testsuite/final_layout.sh: Use dc to convert from hex to
3079 2010-07-29 Sriraman Tallam <tmsriram@google.com>
3081 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
3082 paramter to the call to gold::gc_process_relocs.
3083 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
3084 paramter to the call to gold::gc_process_relocs.
3085 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
3086 parameter to the call to gold::gc_process_relocs.
3087 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
3088 template parameter to the call to gold::gc_process_relocs.
3089 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
3090 paramter to the call to gold::gc_process_relocs.
3091 * gc.h (get_embedded_addend_size): New function.
3092 (gc_process_relocs): Save the size of the reloc for use by ICF.
3093 * icf.cc (get_section_contents): Get the addend from the text section
3094 for SHT_REL relocation sections.
3095 * icf.h (Icf::Reloc_addend_size_info): New typedef.
3096 (Icf::Reloc_info): Add new member reloc_addend_size_info.
3097 * int_encoding.h (read_from_pointer): New overloaded function.
3098 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
3099 * testsuite/icf_sht_rel_addend_test.sh: New file.
3100 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
3101 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
3103 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3105 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
3106 * Makefile.in: Regenerate.
3107 * testsuite/Makefile.in: Regenerate.
3109 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
3111 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
3112 * gold/testsuite/debug_msg.cc: Likewise.
3113 * gold/testsuite/odr_violation1.cc
3114 * gold/testsuite/odr_violation2.cc
3116 2010-07-21 Cary Coutant <ccoutant@google.com>
3118 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
3119 string, and length fields.
3120 (Output_merge_string::Merged_strings_list): New type.
3121 (Output_merge_string::Merged_strings_lists): New typedef.
3122 (Output_merge_string): Replace merged_strings_ with
3123 merged_strings_lists_.
3124 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
3125 Merged_strings_list per input object and section. Don't store pointer
3126 to the string. Don't store length with each merged string entry.
3127 (Output_merge_string::finalize_merged_data): Loop over list of merged
3128 strings lists. Recompute length of each merged string.
3130 2010-07-15 Cary Coutant <ccoutant@google.com>
3132 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
3135 2010-07-14 Ian Lance Taylor <iant@google.com>
3137 * descriptors.cc (Descriptors::open): Report correct name in error
3140 2010-07-13 Doug Kwan <dougkwan@google.com>
3142 * arm.cc (Arm_input_section::Arm_input_section): For a
3143 SHT_ARM_EXIDX section, always keeps the input sections.
3144 (Arm_input_section::set_exidx_section_link): New method.
3145 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
3146 has_errors_ to false.
3147 (Arm_exidx_input_section::has_errors,
3148 Arm_exidx_input_section::set_has_errors): New methods.
3149 (Arm_exidx_input_section::has_errors_): New data member.
3150 (Arm_relobj::get_exidx_shndx_list): New method.
3151 (Arm_output_section::append_text_sections_to_list): Do not skip
3152 section without SHF_EXECINSTR.
3153 (Arm_output_section::fix_exidx_coverage): Skip input sections with
3155 (Arm_relobj::make_exidx_input_section): Add new parameter for text
3156 section header. Make error messages more verbose. Check for
3157 a non-executable section linked to an EXIDX section.
3158 (Arm_relobj::do_read_symbols): Remove error checking, which has been
3159 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
3160 check that there is no deferred EXIDX section if we exit early.
3161 Instead of not making an EXIDX section in case of an error, make one
3162 and set the has_errors flag of it.
3163 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
3164 in a relocatable link.
3165 (Target_arm::do_relax): Look for the EXIDX output section instead of
3166 assuming that it is called .ARM.exidx.
3167 (Target_arm::fix_exidx_coverage): Add a new parameter for input
3168 section list. Do not check for SHF_EXECINSTR section flags but
3169 skip any input section with errors.
3170 * output.cc (Output_section::Output_section): Initialize
3171 always_keeps_input_sections_ to false.
3172 (Output_section::add_input_section): Check for
3173 always_keeps_input_sections_.
3174 * output.h (Output_section::always_keeps_input_sections,
3175 Output_section::set_always_keeps_input_sections): New methods.
3176 (Output_section::always_keeps_input_sections): New data member.
3178 2010-07-13 Rafael Espindola <espindola@google.com>
3180 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
3181 * fileread.h (Input_file): Add try_extra_search_path and find_file.
3183 2010-07-13 Philip Herron <herron.philip@googlemail.com>
3184 Ian Lance Taylor <iant@google.com>
3186 * output.h (Output_section_lookup_maps::add_merge_section):
3187 Correct check of whether value was inserted.
3188 (Output_section_lookup_maps::add_merge_input_section): Likewise.
3189 (Output_section_lookup_maps::add_relaxed_input_section):
3191 * arm.cc (Target_arm::got_section): Remove used local os.
3192 * i386.cc (Target_i386::got_section): Likewise.
3193 * x86_64.cc (Target_x86_64::got_section): Likewise.
3194 * sparc.cc (Target_sparc::got_section): Likewise.
3195 (Target_sparc::relocate): Remove unused local have_got_offset.
3196 * powerpc.cc (Target_powerpc::relocate): Likewise.
3198 2010-07-13 Ian Lance Taylor <iant@google.com>
3200 * compressed_output.cc (zlib_decompress): Fix signature in
3203 * archive.cc (Archive::include_member): Unlock an external member
3204 of a thin archive. Don't bother to delete an object we know is
3207 2010-07-12 Cary Coutant <ccoutant@google.com>
3209 * compressed_output.cc (zlib_decompress): New function.
3210 (get_uncompressed_size): New function.
3211 (decompress_input_section): New function.
3212 * compressed_output.h (get_uncompressed_size): New function.
3213 (decompress_input_section): New function.
3214 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
3215 Handle compressed debug sections.
3216 * layout.cc (is_compressed_debug_section): New function.
3217 (Layout::output_section_name): Map compressed section names to
3219 * layout.h (is_compressed_debug_section): New function.
3220 (is_debug_info_section): Recognize compressed debug sections.
3221 * merge.cc: Include compressed_output.h.
3222 (Output_merge_data::do_add_input_section): Handle compressed
3224 (Output_merge_string::do_add_input_section): Handle compressed
3226 * object.cc: Include compressed_output.h.
3227 (Sized_relobj::Sized_relobj): Initialize new data members.
3228 (build_compressed_section_map): New function.
3229 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
3230 * object.h (Object::section_is_compressed): New method.
3231 (Object::do_section_is_compressed): New method.
3232 (Sized_relobj::Compressed_section_map): New type.
3233 (Sized_relobj::do_section_is_compressed): New method.
3234 (Sized_relobj::compressed_sections_): New data member.
3235 * output.cc (Output_section::add_input_section): Handle compressed
3237 * reloc.cc: Include compressed_output.h.
3238 (Sized_relobj::write_sections): Handle compressed debug sections.
3240 2010-07-08 Cary Coutant <ccoutant@google.com>
3242 * resolve.cc (Symbol_table::resolve): Remember whether undef was
3243 weak when resolving to a dynamic def.
3244 (Symbol_table::should_override): Add adjust_dyndef flag; set it
3245 for weak undef/dynamic def cases. Adjust callers.
3246 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
3247 undef_binding_weak_.
3248 (Symbol_table::sized_write_globals): Adjust symbol binding.
3249 (Symbol_table::sized_write_symbol): Add binding parameter.
3250 * symtab.h (Symbol::set_undef_binding): New method.
3251 (Symbol::is_undef_binding_weak): New method.
3252 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
3253 (Symbol_table::should_override): Add new parameter.
3254 (Symbol_table::sized_write_symbol): Add new parameter.
3256 * testsuite/weak_undef_file1.cc: Add new test case.
3257 * testsuite/weak_undef_file2.cc: Fix header comment.
3258 * testsuite/weak_undef_test.cc: Add new test case.
3260 2010-06-29 Doug Kwan <dougkwan@google.com>
3262 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
3263 Initialize USE_SYMBOL_.
3264 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
3266 (Arm_reloc_property::uses_symbol_): New data member declaration.
3267 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
3268 uses symbol value and symbol is undefined but not weakly undefined.
3270 2010-06-28 Rafael Espindola <espindola@google.com>
3272 * plugin.cc (Plugin::load): Use dlerror.
3274 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
3276 * symtab.cc (detect_odr_violations): When reporting an ODR
3277 violation, report an object where the symbol is defined.
3279 2010-06-25 Doug Kwan <dougkwan@google.com>
3281 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
3282 (Target_arm::section_may_have_icf_unsafe_pointers): New method
3284 (Target_arm::Scan::local_reloc_may_be_function_pointer,
3285 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
3286 target hook to detect function points.
3287 (Target_arm::Scan::possible_function_pointer_reloc): New method.
3288 * icf.h (Icf::check_section_for_function_pointers): Change type of
3289 parameter SECTION_NAME to const reference to std::string. Use
3290 target hook to determine if section may have unsafe pointers.
3291 * target.h (Target::section_may_have_icf_unsafe_pointers): New
3294 2010-06-21 Rafael Espindola <espindola@google.com>
3296 * fileread.cc (Input_file::find_fie): New
3297 (Input_file::open): Use Input_file::find_fie.
3298 * fileread.h (Input_file::find_fie): New
3299 * plugin.cc (set_extra_library_path): New.
3300 (Plugin::load): Add set_extra_library_path to the transfer vector.
3301 (Plugin_manager::set_extra_library_path): New.
3302 (Plugin_manager::add_input_file): Use the extra search path if set.
3303 (set_extra_library_path(): New.
3304 * plugin.h (Plugin_manager): Add set_extra_library_path and
3307 2010-06-19 Cary Coutant <ccoutant@google.com>
3309 * layout.cc (gdb_sections): Add .debug_types.
3310 (lines_only_debug_sections): Likewise.
3312 2010-06-18 Rafael Espindola <espindola@google.com>
3314 * plugin.cc (add_input_file,add_input_library)
3315 (Plugin_manager::add_input_file): Make filename arguments const.
3316 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
3319 2010-06-16 Doug Kwan <dougkwan@google.com>
3321 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
3322 .ARM.attributes section if we have not merged any input
3323 attributes sections.
3325 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3327 * arm.cc: Allow combining objects with no EABI version
3330 2010-06-15 Rafael Espindola <espindola@google.com>
3332 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
3334 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3336 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
3337 (struct iovec): Correct !HAVE_READV definition.
3339 2010-06-10 Cary Coutant <ccoutant@google.com>
3341 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
3342 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
3344 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
3347 * symtab.h (Symbol::is_placeholder): New member function.
3348 * target-reloc.h (relocate_section): Check for placeholder symbols.
3350 * testsuite/Makefile.am (plugin_test_8): New test.
3351 (plugin_test_9): New test.
3352 * testsuite/Makefile.in: Regenerate.
3354 2010-06-09 Nick Clifton <nickc@redhat.com>
3356 * yyscript.y (input_list_element): Allow strings prefixed with
3357 the '-' character. Treat these as libraries.
3358 * script.cc (script_add_library): New function. Adds a library
3359 specified by "-l<name>" found in an input script.
3360 * script-c.h: Add prototype for script_add_library.
3362 2010-06-07 Doug Kwan <dougkwan@google.com>
3364 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
3365 Restrict stub-group size to be within long conditional branch
3366 range when working around cortex-A8 erratum.
3368 2010-06-07 Damien Diederen <dd@crosstwine.com>
3370 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
3373 2010-06-03 Sriraman Tallam <tmsriram@google.com>
3377 (Output_section::Input_section_sort_entry::compare_section_ordering):
3378 Change to return non-zero correctly.
3379 (Output_section::Input_section_sort_section_order_index_compare
3380 ::operator()): Change to fix ambiguity in comparisons.
3382 2010-06-01 Sriraman Tallam <tmsriram@google.com>
3384 * gold.h (is_wildcard_string): New function.
3385 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
3386 (Layout::layout_eh_frame): Ditto.
3387 (Layout::find_section_order_index): New method.
3388 (Layout::read_layout_from_file): New method.
3389 * layout.h (Layout::find_section_order_index): New method.
3390 (Layout::read_layout_from_file): New method.
3391 (Layout::input_section_position_): New private member.
3392 (Layout::input_section_glob_): New private member.
3393 * main.cc (main): Call read_layout_from_file here.
3394 * options.h (--section-ordering-file): New option.
3395 * output.cc (Output_section::input_section_order_specified_): New
3397 (Output_section::Output_section): Initialize new member.
3398 (Output_section::add_input_section): Add new parameter.
3399 Keep input sections when --section-ordering-file is used.
3400 (Output_section::set_final_data_size): Sort input sections when
3401 section ordering file is specified.
3402 (Output_section::Input_section_sort_entry): Add new parameter.
3404 (Output_section::Input_section_sort_entry::compare_section_ordering):
3406 (Output_section::Input_section_sort_compare::operator()): Change to
3407 consider section_order_index.
3408 (Output_section::Input_section_sort_init_fini_compare::operator()):
3409 Change to consider section_order_index.
3410 (Output_section::Input_section_sort_section_order_index_compare
3411 ::operator()): New method.
3412 (Output_section::sort_attached_input_sections): Change to sort
3413 according to section order when specified.
3414 (Output_section::add_input_section<32, true>): Add new parameter.
3415 (Output_section::add_input_section<64, true>): Add new parameter.
3416 (Output_section::add_input_section<32, false>): Add new parameter.
3417 (Output_section::add_input_section<64, false>): Add new parameter.
3418 * output.h (Output_section::add_input_section): Add new parameter.
3419 (Output_section::input_section_order_specified): New
3421 (Output_section::set_input_section_order_specified): New method.
3422 (Input_section::Input_section): Initialize section_order_index_.
3423 (Input_section::section_order_index): New method.
3424 (Input_section::set_section_order_index): New method.
3425 (Input_section::section_order_index_): New member.
3426 (Input_section::Input_section_sort_section_order_index_compare): New
3428 (Output_section::input_section_order_specified_): New member.
3429 * script-sections.cc (is_wildcard_string): Delete and move modified
3431 (Output_section_element_input::Output_section_element_input): Modify
3432 call to is_wildcard_string.
3433 (Output_section_element_input::Input_section_pattern
3434 ::Input_section_pattern): Ditto.
3435 (Output_section_element_input::Output_section_element_input): Ditto.
3436 * testsuite/Makefile.am (final_layout): New test case.
3437 * testsuite/Makefile.in: Regenerate.
3438 * testsuite/final_layout.cc: New file.
3439 * testsuite/final_layout.sh: New file.
3441 2010-06-01 Rafael Espindola <espindola@google.com>
3443 * plugin.cc (Plugin::load): Pass the output name to the plugin.
3445 2010-06-01 Rafael Espindola <espindola@google.com>
3447 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
3448 visibility of symbols.
3450 2010-05-27 Doug Kwan <dougkwan@google.com>
3452 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
3453 from start of output section instead of address for a local symbol
3454 in a merged or relaxed section when doing a relocatable link.
3456 2010-05-26 Rafael Espindola <espindola@google.com>
3459 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
3460 adding sections the garbage collector removed.
3461 * gold/testsuite/Makefile.am: Add test.
3462 * gold/testsuite/Makefile.in: Regenerate.
3463 * gold/testsuite/plugin_test_7.sh: New.
3464 * gold/testsuite/plugin_test_7_1.c: New.
3465 * gold/testsuite/plugin_test_7_2.c: New.
3467 2010-05-26 Rafael Espindola <espindola@google.com>
3469 * script-sections.cc (Output_section_definition::set_section_addresses):
3470 Check for --section-start.
3472 2010-05-26 Doug Kwan <dougkwan@google.com>
3474 * arm.cc (Arm_scan_relocatable_relocs): New class.
3475 (Target_arm::relocate_special_relocatable): New method.
3476 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
3477 (Arm_relocate_functions::thumb_branch_common): Same.
3478 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
3479 instead of Default_scan_relocatable_relocs.
3480 * target-reloc.h (relocate_for_relocatable): Let target handle
3481 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
3482 * target.h (Sized_target::relocate_special_relocatable): New method.
3484 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3486 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
3488 2010-05-23 Doug Kwan <dougkwan@google.com>
3490 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
3492 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
3493 with a direct branch, not a conditional branch, to a stub.
3494 * merge.cc (Output_merge_base::record_input_section): New method
3496 (Output_merge_data::do_add_input_section): Record input section if
3497 keeps-input-sections flag is set.
3498 (Output_merge_string::do_add_input_section): Ditto.
3499 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
3500 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
3502 (Output_merge_base::keeps_input_sections,
3503 Output_merge_base::set_keeps_input_sections,
3504 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
3506 (Output_merge_base::Input_sections): New type declaration.
3507 (Output_merge_base::input_sections_begin,
3508 Output_merge_base::input_sections_end,
3509 Output_merge_base::do_set_keeps_input_sections): New method definitions.
3510 (Output_merge_base::bool keeps_input_sections_,
3511 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
3512 Output_merge_base::input_sections_): New data members.
3513 (Output_merge_data::do_set_keeps_input_sections): New method
3515 (Output_merge_string::do_set_keeps_input_sections): Ditto.
3516 * output.cc (Output_section::Input_section::relobj): Move method
3517 defintion from class declaration to here and handle merge sections.
3518 (Output_section::Input_section::shndx): Ditto.
3519 (Output_section::Output_section): Remove initializations of removed
3520 data members and initialize new data member LOOKUP_MAPS_.
3521 (Output_section::add_input_section): Set keeps-input-sections flag
3522 for a newly created merge output section as appropriate. Adjust code
3523 to use Output_section_lookup_maps class.
3524 (Output_section::add_relaxed_input_section): Adjst code for lookup
3525 maps code refactoring.
3526 (Output_section::add_merge_input_section): Add a new parameter
3527 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
3528 class. If adding input section to a newly created merge output
3529 section fails, remove the new merge section.
3530 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
3531 Adjust code for use of the Output_section_lookup_maps class.
3532 (Output_section::find_merge_section): Ditto.
3533 (Output_section::build_lookup_maps): New method defintion.
3534 (Output_section::find_relaxed_input_section): Adjust code to use
3535 Output_section_lookup_maps class.
3536 (Output_section::get_input_sections): Export merge sections. Adjust
3537 code to use Output_section_lookup_maps class.
3538 (Output_section:::add_script_input_section): Adjust code to use
3539 Output_section_lookup_maps class. Update lookup maps for merge
3541 (Output_section::discard_states): Use Output_section_lookup_maps.
3542 (Output_section::restore_states): Same.
3543 * output.h (Merge_section_properties): Move class defintion out of
3545 (Output_section_lookup_maps): New class.
3546 (Output_section::Input_section::is_merge_section): New method
3548 (Output_section::Input_section::relobj): Move defintion out of class
3549 defintion. Declare method only.
3550 (Output_section::Input_section::shndx): Ditto.
3551 (Output_section::Input_section::output_merge_base): New method defintion.
3552 (Output_section::Input_section::u2_.pomb): New union field.
3553 (Output_section::Merge_section_by_properties_map,
3554 Output_section::Output_section_data_by_input_section_map,
3555 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
3557 (Output_section::add_merge_input_section): Add new parameter
3558 KEEPS_INPUT_SECTIONS.
3559 (Output_section::build_lookup_maps): New method declaration.
3560 (Output_section::merge_section_map_,
3561 Output_section::merge_section_by_properties_map_,
3562 Output_section::relaxed_input_section_map_,
3563 Output_section::is_relaxed_input_section_map_valid_): Remove data
3565 (Output_section::lookup_maps_): New data member.
3567 2010-05-21 Doug Kwan <dougkwan@google.com>
3570 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
3571 avoid a compilation error.
3573 2010-05-19 Rafael Espindola <espindola@google.com>
3575 * script-sections.cc (Output_section_definition::allocate_to_segment):
3576 Update the phdrs_list even when the output section is NULL.
3577 * testsuite/Makefile.am: Add test.
3578 * testsuite/Makefile.in: Regenerate.
3579 * testsuite/script_test_9.cc: New.
3580 * testsuite/script_test_9.sh: New.
3581 * testsuite/script_test_9.t: New.
3583 2010-05-19 Doug Kwan <dougkwan@google.com>
3585 * arm.cc (Arm_input_section::original_size): New method.
3586 (Arm_input_section::do_addralign): Add a cast.
3587 (Arm_input_section::do_output_offset): Remove static cast.
3588 (Arm_input_section::original_addralign,
3589 Arm_input_section::original_size_): Change type to uint32_t.
3590 (Arm_input_section::init): Add safe casts for section alignment
3592 (Arm_input_section::set_final_data_size): Do not set address and
3593 offset of stub table.
3594 (Arm_output_section::fix_exidx_coverage): Change use of of
3595 Output_section::Simple_input_section to that of
3596 Output_section::Input_section.
3597 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
3598 except for the first pass.
3599 * output.cc (Output_section::get_input_sections): Change type of
3600 input_sections to std::list<Input_section>.
3601 (Output_section::add_script_input_section): Rename from
3602 Output_section::add_simple_input_section. Change type of SIS
3603 parameter from Simple_input_section to Input_section.
3604 * output.h (Output_section::Simple_input_section): Remove class.
3605 (Output_section::Input_section): Change class visibility to public.
3606 (Output_section::Input_section::addralign): Use stored alignments
3607 for special input sections if set.
3608 (Output_section::Input_section::set_addralign): New method.
3609 (Output_section::get_input_sections): Change parameter type from
3610 list of Simple_input_section to list of Input_section.
3611 (Output_section::add_script_input_section): Rename from
3612 Output_section::add_simple_input_section. Change first parameter's
3613 type from Simple_input_section to Input_section and remove the
3614 second and third parameters.
3615 * script-sections.cc (Input_section::Input_section_list): Change
3616 type to list of Output_section::Input_section/
3617 (Input_section_info::Input_section_info): Change parameter type of
3618 INPUT_SECTION to Output_section::Input_section.
3619 (Input_section_info::input_section): Change return type.
3620 (Input_section_info::input_section_): Change type to
3621 Output_section::Input_section.
3622 (Output_section_element_input::set_section_addresses): Adjust code
3623 to use Output_section::Input_section instead of
3624 Output_section::Simple_input_section. Adjust code for renaming
3625 of Output_section::add_simple_input_section.
3626 (Orphan_output_section::set_section_addresses): Ditto.
3628 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3630 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
3631 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
3633 2010-05-18 Rafael Espindola <espindola@google.com>
3635 * options.cc (General_options::finalize): Handle -nostdlib.
3636 * options.h (nostdlib): New option.
3637 * script.cc (script_add_search_dir): Handle -nostdlib.
3639 2010-05-12 Doug Kwan <dougkwan@google.com>
3641 * arm.cc (Target_arm::do_finalize_sections): Create an empty
3642 attributes section only if there no attributes section after merging.
3643 (Target_arm::merge_object_attributes): Move value of
3644 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
3645 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
3646 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
3647 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
3648 and arm_attr_merge_7.stdout.
3649 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
3650 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
3651 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
3652 arm_attr_merge_7b.o): New rules.
3653 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
3655 * testsuite/Makefile.in: Regenerate.
3656 * testsuite/arm_attr_merge.sh: New file.
3657 * testsuite/arm_attr_merge_[67][ab].s: Same.
3659 2010-05-05 Nick Clifton <nickc@redhat.com>
3661 * po/es.po: Updated Spanish translation.
3663 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
3665 * Makefile.am (install-exec-local): Properly install gold as
3666 default cross linker.
3667 * Makefile.in: Regenerated.
3669 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
3670 Nick Clifton <nickc@redhat.com>
3672 * configure.ac (install_as_default): Define and set to false
3673 unless --enable-gold or --enable-gold=both/gold has been
3675 * configure: Regenerate.
3677 * Makefile.am (install-exec-local): Install the executable as
3678 'ld.gold'. If install_as_default is true then also install it as
3680 * Makefile.in: Regenerated.
3682 2010-04-24 Ian Lance Taylor <iant@google.com>
3684 * layout.cc (Layout::layout_reloc): In relocatable link don't
3685 combine reloc sections for grouped sections.
3687 2010-04-23 Sriraman Tallam <tmsriram@google.com>
3689 * gc.h (gc_process_relocs): Pass information on relocs pointing to
3690 sections that are not ordinary to icf.
3691 * icf.cc (get_section_contents): Handle relocation pointing to section
3692 with no object or shndx information.
3693 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
3694 * testsuite/Makefile.in: Regenerate.
3695 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
3696 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
3698 2010-04-22 Ian Lance Taylor <iant@google.com>
3700 * expression.cc (Expression::Expression_eval_info): Add
3701 result_alignment_pointer field.
3702 (Expression::eval_with_dot): Add result_alignment_pointer
3703 parameter. Change all callers.
3704 (Expression::eval_maybe_dot): Likewise.
3705 (class Binary_expression): Add alignment_pointer parameter to
3706 left_value and right_value. Change all callers.
3707 (BINARY_EXPRESSION): Set result alignment.
3708 (class Trinary_expression): Add alignment_pointer parameter to
3709 arg2_value and arg3_value. Change all callers.
3710 (Trinary_cond::value): Set result alignment.
3711 (Max_expression::value, Min_expression::value): Likewise.
3712 (Align_expression::value): Likewise.
3713 * script-sections.cc (class Sections_element): Add dot_alignment
3714 parameter to set_section_addresses virtual function. Update
3716 (class Output_section_element): Likewise.
3717 (Script_sections::create_segments): Add dot_alignment parameter.
3719 (Script_sections::create_segments_from_phdrs_clause): Likewise.
3720 (Script_sections::set_phdrs_clause_addresses): Likewise.
3721 * script-sections.h: Update declarations.
3722 * script.h: Update declarations.
3723 * output.h (Output_segment::set_minimum_p_align): Don't decrease
3725 * testsuite/script_test_3.t: Set large alignment.
3726 * testsuite/script_test_3.sh: Make sure that at least one LOAD
3727 segment has expected alignment.
3729 2010-04-22 Nick Clifton <nickc@redhat.com>
3731 * po/gold.pot: Updated by the Translation project.
3732 * po/vi.po: Updated Vietnamese translation.
3734 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
3736 * testsuite/Makefile.am (check_PROGRAMS): Add
3737 icf_virtual_function_folding_test.
3738 * testsuite/Makefile.in: Regenerated.
3740 2010-04-15 Andrew Haley <aph@redhat.com>
3742 * options.h (merge_exidx_entries): New option.
3743 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
3744 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
3745 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
3746 (Target_arm::merge_exidx_entries): New function.
3747 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
3748 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
3749 to Arm_exidx_fixup constructor.
3750 Add new arg, merge_exidx_entries.
3751 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
3752 Arm_output_section::fix_exidx_coverage.
3754 2010-04-18 Sriraman Tallam <tmsriram@google.com>
3756 * icf.cc (get_section_contents): Check for preemptible functions.
3757 Ignore addend when appropriate.
3758 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
3760 (add_from_relobj): Check for section folded.
3761 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
3762 * symtab.h (should_add_dynsym_entry): Add new parameter.
3763 * target-reloc.h (scan_relocs): Check for section folded.
3764 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
3765 Check reloc types for function pointers in shared objects.
3766 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
3768 (icf_preemptible_functions_test): New test case.
3769 (icf_string_merge_test): New test case.
3770 * testsuite.Makefile.in: Regenerate.
3771 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
3772 bar_glob. Refactor code.
3773 * testsuite/icf_preemptible_functions_test.cc: New file.
3774 * testsuite/icf_preemptible_functions_test.sh: New file.
3775 * testsuite/icf_string_merge_test.cc: New file.
3776 * testsuite/icf_string_merge_test.sh: New file.
3777 * testsuite/icf_virtual_function_folding_test.cc: New file.
3778 * testsuite/icf_virtual_function_folding_test.sh: New file.
3780 2010-04-14 Doug Kwan <dougkwan@google.com>
3782 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
3783 for local symbol recounting if we remove a section due to ICF.
3784 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
3785 there are no regular objects in input.
3787 2010-04-13 Doug Kwan <dougkwan@google.com>
3789 * arm.cc (Arm_input_section::set_final_data_size): Compute
3790 accurate final data size instead of using current data size.
3792 2010-04-09 Doug Kwan <dougkwan@google.com>
3794 * layout.cc (Layout::choose_output_section): Handle script section
3796 (Layout::make_output_section_for_script): Add section type parameter.
3797 Handle script section types.
3798 * layout.h (Layout::make_output_section_for_script): Add section
3800 * output.cc (Output_section::Output_section): Initialize data member
3802 (Output_section::do_reset_address_and_file_offset): Do not set address
3803 to 0 if section is a NOLOAD section.
3804 * output.h (Output_section::is_noload): New method.
3805 (Output_section::set_is_noload): Ditto.
3806 (Output_section::is_noload_): New data member.
3807 * script-c.h (Script_section_type): New enum type.
3808 (struct Parser_output_section_header): Add new file section_type.
3809 * script-sections.cc (Sections_element::output_section_name): Add
3810 parameter for returning script section type.
3811 (Output_section_definition::output_section_name): Ditto.
3812 (Output_section_definition::section_type)P; New method.
3813 (Output_section_definiton::script_section_type_name): Ditto.
3814 (Output_section_definition::script_section_type_): New data member.
3815 (Output_section_definition::Output_section_definition): Initialize
3816 data member Output_section_definition::script_section_type_.
3817 (Output_section_definition::create_sections): Pass script section type
3818 to Layout::make_output_section_for_script.
3819 (Output_section_definition::output_section_name): Return script
3820 section type to caller.
3821 (Output_section_definition::set_section_address): Do not advance
3822 dot value and load address if section type is NOLOAD. Set address
3823 of NOLOAD sections regardless of section flags.
3824 (Output_section_definition::print): Print section type if it is
3825 not SCRIPT_SECTION_TYPE_NONE.
3826 (Output_section_definition::section_type): New method.
3827 (Output_section_definition::script_section_type_name): Ditto.
3828 (Script_sections::output_section_name): Add new parameter
3829 PSECTION_TYPE for returning script section type. Pass it to
3830 section elements. Handle discard sections.
3831 (Sort_output_sections::operator()): Handle NOLOAD sections.
3832 * script-sections.h (Script_sections::Section_type): New enum type.
3833 (Script_sections::output_section_name): Add a new parameter for
3834 returning script section type.
3835 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
3837 * yyscript.y (union): Add new field SECTION_TYPE.
3838 (COPY, DSECT, INFO, NOLOAD): New tokens.
3839 (opt_address_and_section_type): Change type to output_section_header.
3840 (section_type): New non-terminal
3841 (section_header): Handle section type.
3842 (opt_address_and_section_type): Return section type value.
3844 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
3846 * testsuite/plugin_common_test_1.c (foo): Add prototype.
3847 * testsuite/plugin_common_test_2.c (foo): Likewise.
3849 2010-04-08 Doug Kwan <dougkwan@google.com>
3851 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
3853 * output.cc (Output_section::add_merge_input_section): Simplify
3854 code and return status of Output_merge_base::add_input_section.
3855 Update merge section map only if Output_merge_base::add_input_section
3858 2010-04-07 Doug Kwan <dougkwan@google.com>
3860 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
3861 if section is marked as containing instructions but has no mapping
3863 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
3864 correct section index.
3865 (Arm_relobj::find_linked_text_section): Ditto.
3867 2010-04-07 Cary Coutant <ccoutant@google.com>
3869 * archive.cc (include_member): Destroy Read_symbols_data object before
3871 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
3872 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
3873 (Read_symbols_data::~Read_symbols_data) New destructor.
3874 (Section_relocs::Section_relocs) New constructor.
3875 (Section_relocs::~Section_relocs) New destructor.
3876 (Read_relocs_data::Read_relocs_data) New constructor.
3877 (Read_relocs_data::~Read_relocs_data) New destructor.
3878 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
3879 pointers to NULL after deleting.
3881 2010-04-07 Doug Kwan <dougkwan@google.com>
3883 * arm.cc: Replace "endianity" with "endianness" in comments.
3884 (Arm_exidx_cantunwind): Ditto.
3885 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
3886 (Arm_relobj::merge_flags_and_attributes): New method.
3887 (Arm_relobj::merge_flags_and_attributes_): New data member.
3888 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
3889 (Arm_relobj::scan_sections_for_stubs): Ditto.
3890 (Arm_relobj::do_read_symbols): Check to see if we really want to
3891 merge processor-specific flags and attributes. Exit early if
3892 an object is empty except for section names and the undefined symbol.
3893 (Target_arm::do_finalize_sections): Move check for ELF format to
3894 Arm_relobj::do_read_symbols. Merge processor specific flags and
3895 attributes from a regular object only when we have determined that
3896 it is aapropriate. Do not create an .ARM.attributes section in
3897 output if there is no regular input object.
3898 (Target_arm::merge_processor_specific_flags): Check
3899 --warn-mismatch before printing any error.
3900 (Target_arm::merge_object_attributes): Ditto.
3901 * gold.cc (queue_middle_tasks): Handle the case in which there is
3902 no regular object in input.
3903 * options.cc (General_options::parse_EB): New method.
3904 (General_options::parse_EL): Same.
3905 (General_options::General_options): Initialize endianness_.
3906 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
3908 (General_options::Endianness): New enum.
3909 (General_options::endianness): New method.
3910 (General_options::endianness_): New data member.
3911 * parameters.cc (Parameters::set_options): Check target endianness.
3912 (Parameters::set_target_once): Ditto.
3913 (Parameters::check_target_endianness): New method.
3914 (parameters_force_valid_target): If either -EL or -EB is specified,
3915 use it to define endianness of default target.
3916 * parameters.h (Parameters::check_target_endianness): New method
3918 * target.h (class Target): Change "endianity" to "endianness"
3921 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3923 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
3924 * configure: Regenerate.
3925 * Makefile.in: Regenerate.
3926 * testsuite/Makefile.in: Regenerate.
3928 2010-04-06 Cary Coutant <ccoutant@google.com>
3931 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
3932 prevailing definitions of common symbols.
3933 * testsuite/plugin_test_6.sh: New test case.
3934 * testsuite/plugin_common_test_1.c: New test case.
3935 * testsuite/plugin_common_test_2.c: New test case.
3936 * testsuite/Makefile.am (plugin_test_6): New test case.
3937 * testsuite/Makefile.in: Regenerate.
3939 2010-04-06 Nick Clifton <nickc@redhat.com>
3941 * po/vi.po: New Vietnamese translation.
3943 2010-03-30 Doug Kwan <dougkwan@google.com>
3945 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
3947 2010-03-25 Doug Kwan <dougkwan@google.com>
3949 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
3950 to avoid a conversion warning on a 32-bit host.
3952 2010-03-24 Ian Lance Taylor <iant@google.com>
3954 * testsuite/script_test_3.t: Add a TLS segment.
3955 * testsuite/Makefile.am (check_PROGRAMS): Add
3956 tls_phdrs_script_test.
3957 (tls_phdrs_script_test_SOURCES): Define.
3958 (tls_phdrs_script_test_DEPENDENCIES): Define.
3959 (tls_phdrs_script_test_LDFLAGS): Define.
3960 (tls_phdrs_script_test_LDADD): Define.
3961 * testsuite/Makefile.in: Rebuild.
3963 2010-03-23 Cary Coutant <ccoutant@google.com>
3965 * fileread.cc (find_or_make_view): Fix comment.
3967 2010-03-23 Ian Lance Taylor <iant@google.com>
3969 * script-sections.cc (class Orphan_section_placement): Define
3970 PLACE_TLS and PLACE_TLS_BSS.
3971 (Orphan_section_placement::Orphan_section_placement): Initialize
3973 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
3974 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
3975 (tls_script_test_SOURCES): Define.
3976 (tls_script_test_DEPENDENCIES): Define.
3977 (tls_script_test_LDFLAGS): Define.
3978 (tls_script_test_LDADD): Define.
3979 * testsuite/Makefile.in: Rebuild.
3981 2010-03-22 Doug Kwan <dougkwan@google.com>
3983 * arm.cc (Arm_relocate_functions::abs8,
3984 Arm_relocate_functions::abs16): Use correct check for overflow
3985 specified in the ARM ELF specs.
3986 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
3987 target of a BLX instruction specially.
3988 (Reloc_stub::stub_type_for_reloc): Ditto.
3989 (Relocate::relocate): Use symbolic names instead of numeric relocation
3990 codes to report error.
3991 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
3993 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
3994 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
3995 thumb2_blx_out_of_range.stdout
3996 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
3997 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
3998 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
3999 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
4000 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
4001 thumb2_blx_in_range, thumb2_blx_in_range.o,
4002 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
4003 thumb2_blx_out_of_range.o): New rules.
4004 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
4005 thumb2_blx_in_range and thumb2_blx_out_of_range.
4006 * testsuite/Makefile.in: Regenerate.
4007 * arm_branch_in_range.sh: Add tests for THUMB BLX.
4008 * testsuite/thumb_blx_in_range.s: New file.
4009 * testsuite/thumb_blx_out_of_range.s: New file.
4011 2010-03-22 Rafael Espindola <espindola@google.com>
4013 * archive.cc (Should_include): Move to archive.h.
4014 (should_include_member): Make it a member of Archive.
4016 (Add_lib_group_symbols): New.
4017 * archive.h: Include options.h.
4018 (Archive_member): Moved from Archive.
4019 (Should_include): Moved from archive.cc.
4021 (Add_lib_group_symbols): New.
4022 * dynobj.cc (do_should_include_member): New.
4023 * dynobj.h (do_should_include_member): New.
4024 * gold.cc (queue_initial_tasks): Update call to queue.
4025 * main.cc (main): Print lib group stats.
4026 * object.cc (do_should_include_member): New.
4027 * object.h: Include archive.h.
4028 (Object::should_include_member): New.
4029 (Object::do_should_include_member): New.
4030 (Sized_relobj::do_should_include_member): New.
4031 * options.cc (General_options::parse_start_lib): New.
4032 (General_options::parse_end_lib): New.
4033 (Input_arguments::add_file): Handle lib groups.
4034 (Input_arguments::start_group): Check we are not in a lib.
4035 (Input_arguments::start_lib): New.
4036 (Input_arguments::end_lib): New.
4037 * options.h (General_options): Add start_lib and end_lib.
4038 (Input_argument::lib_): New.
4039 (Input_argument::lib): New.
4040 (Input_argument::is_lib): New.
4041 (Input_file_lib): New.
4042 (Input_arguments::in_lib_): New.
4043 (Input_arguments::in_lib): New.
4044 (Input_arguments::start_lib): New.
4045 (Input_arguments::end_lib_): New.
4046 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
4047 in unused members as preempted.
4048 (Sized_pluginobj::do_should_include_member): New.
4049 * plugin.h (Sized_pluginobj::do_should_include_member): New.
4050 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
4052 (Read_symbols::do_whole_lib_group): New.
4053 (Read_symbols::do_lib_group): New.
4054 (Read_symbols::do_read_symbols): Handle lib groups.
4055 (Read_symbols::get_name): Handle lib groups.
4056 * readsyms.h (Read_symbols): Add an archive member pointer.
4057 (Read_symbols::do_whole_lib_group): New.
4058 (Read_symbols::do_lib_group): New.
4059 (Read_symbols::member_): New.
4060 * script.cc (read_input_script): Update call to queue_soon.
4062 2010-03-19 Doug Kwan <dougkwan@google.com>
4064 * arm.cc (Stub_table::Stub_table): Initialize new data members
4065 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
4066 (Stub_table::add_reloc_stub): Assign stub offset and update
4067 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
4068 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
4070 (Stub_table::update_data_size_and_addralign): Use
4071 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
4072 instead of going over all reloc stubs.
4073 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
4074 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
4075 Stringpool_template::offset_ to size of Stringpool_char.
4076 (Stringpool_template::new_key_offset): Remove code to initialize
4077 Stringpool_template::offset_.
4078 * stringpool.h (Stringpool_template::set_no_zero_null): Set
4079 Stringpool_template::offset_ to zero.
4081 2010-03-15 Doug Kwan <dougkwan@google.com>
4083 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
4085 (Stringpool_template::new_key_offset): New method.
4086 (Stringpool_template::add_string): Assign offsets when adding new
4088 (Stringpool_template::set_string_offsets): Do not set string offsets
4089 when not optimizing.
4090 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
4092 (Chunked_vector::clear): Clear size_.
4093 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
4094 (Chunked_vector::size): Return size_.
4095 (Chunked_vector::push_back): Use size_ to find insert position.
4096 (Chunked_vector::size_): New data member.
4097 (Stringpool_template::set_no_zero_null): Assert string set is empty.
4098 (Stringpool_template::new_key_offset): New method declaration.
4099 (Stringpool_template::offset_): New data member.
4101 2010-03-15 Rafael Espindola <espindola@google.com>
4103 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
4104 Add_symbols' constructor.
4105 * readsyms.h (Add_symbols): Remove the input_group member.
4107 2010-03-10 Ian Lance Taylor <iant@google.com>
4109 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
4110 target to ask whether a reference to a symbol requires a stack
4112 * target.h (Target::is_call_to_non_split): New function.
4113 (Target::do_is_call_to_non_split): Declare virtual function.
4114 * target.cc: Include "symtab.h".
4115 (Target::do_is_call_to_non_split): New function.
4116 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
4118 2010-03-10 Cary Coutant <ccoutant@google.com>
4120 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
4121 (File_read::open[1]): Remove initial mapping of whole_file_view_.
4122 (File_read::open[2]): Add whole_file_view_ to list of views.
4123 (File_read::make_view): Remove test of whole_file_view_.
4124 (File_read::find_or_make_view): Create whole_file_view_ if
4126 (File_read::clear_views): Replace bool parameter with enum;
4127 adjust all callers. Don't delete views with permanent data;
4128 do delete cached views and views from archives if
4129 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
4130 if clearing the corresponding view.
4131 * fileread.h (File_read::Clear_views_mode): New enum.
4132 (File_read::View::is_permanent_view): New method.
4133 (File_read::clear_views): Replace bool parameter
4134 with enum; adjust all callers.
4135 * options.h (General_options): Change keep_files_mapped option;
4136 add map_whole_files.
4137 * readsyms.cc (Add_symbols::run): Delete sd_ object before
4139 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
4142 2010-03-10 David S. Miller <davem@davemloft.net>
4144 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
4146 2010-03-09 Sriraman Tallam <tmsriram@google.com>
4148 * icf.cc (get_section_contents): Add '@' marker after processing the
4151 2010-03-08 Doug Kwan <dougkwan@google.com>
4153 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
4154 due to a conversion warning.
4155 (Arm_relobj::update_output_local_symbol_count): Check for local
4156 symbol with unset output index.
4158 2010-03-05 Ian Lance Taylor <iant@google.com>
4160 * options.h (class General_options): Add --spare-dynamic-tags.
4161 * output.cc (Output_data_dynamic::set_final_data_size): Implement
4162 --spare-dynamic-tags.
4164 2010-03-05 Ian Lance Taylor <iant@google.com>
4166 * incremental.cc: Include "libiberty.h".
4168 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
4170 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
4171 function, is_info_ member.
4172 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
4173 (Versions::Versions): Update caller.
4174 (Versions::define_base_version): Likewise.
4175 (Versions::add_def): Likewise.
4177 2010-03-03 Sriraman Tallam <tmsriram@google.com>
4179 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
4180 (Scan::possible_function_pointer_reloc): New function.
4181 (Scan::local_reloc_may_be_function_pointer): Change to call
4182 possible_function_pointer_reloc.
4183 (Scan::global_reloc_may_be_function_pointer): Ditto.
4184 * icf.h (Icf::check_section_for_function_pointers): Change to reject
4185 relocations in ".data.rel.ro._ZTV" section.
4186 * testsuite/icf_safe_so_test.sh: Change to pass i386.
4187 * testsuite/icf_safe_so_test.cc: Ditto.
4188 * testsuite/icf_safe_test.cc: Ditto.
4189 * testsuite/icf_safe_test.sh: Ditto.
4191 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4192 Ian Lance Taylor <iant@google.com>
4194 * target-reloc.h (relocate_section): Check the symbol table index
4195 for -1U before setting the local symbol index.
4196 (scan_relocatable_relocs): If copying the relocation, record that
4197 the local symbol is required.
4198 * object.h (Symbol_value::is_output_symtab_index_set): New
4200 (Symbol_value::may_be_discarded_from_output_symtab): New
4202 (Symbol_value::has_output_symtab_entry): New function.
4203 (Symbol_value::needs_output_symtab_entry): Remove.
4204 (Symbol_value::output_symtab_index): Make sure the symbol index is
4206 (Symbol_value::set_output_symtab_index): Make sure the symbol
4207 index is not set. Make sure the new index is valid.
4208 (Symbol_value::set_must_have_output_symtab_entry): New function.
4209 (Symbol_value::has_output_dynsym_entry): New function.
4210 (Symbol_value::set_output_dynsym_index): Make sure the new index
4212 (Sized_relobj::set_must_have_output_symtab_entry): New function.
4213 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
4214 local symbol if permitted.
4215 (Sized_relobj::do_finalize_local_symbols): Call
4216 is_output_symtab_index_set rather than needs_output_symtab_entry.
4217 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
4218 rather than needs_output_symtab_entry. Call
4219 has_output_dynsym_entry rather than needs_output_dynsym_entry.
4220 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
4221 is_output_symtab_index_set rather than needs_output_symtab_entry.
4222 * testsuite/discard_locals_relocatable_test.c: New file.
4223 * testsuite/discard_locals_test.sh: Test -r.
4224 * testsuite/Makefile.am (check_DATA): Add
4225 discard_locals_relocatable_test1.syms,
4226 discard_local_relocatable_test2.syms.
4227 (MOSTLYCLEANFILES): Likewise. Also add
4228 discard_locals_relocatable_test1.lout and
4229 discard_locals_relocatable_test2.out.
4230 (discard_locals_relocatable_test1.syms): New target.
4231 (discard_locals_relocatable_test.o): New target.
4232 (discard_locals_relocatable_test1.out): New target.
4233 (discard_locals_relocatable_test2.syms): New target.
4234 (discard_locals_relocatable_test2.out): New target.
4235 (various): Add missing ../ld-new dependencies.
4236 * testsuite/Makefile.in: Rebuild.
4238 2010-03-03 Nick Clifton <nickc@redhat.com>
4240 * po/fi.po: New Finnish translation.
4242 2010-03-01 Doug Kwan <dougkwan@google.com>
4244 * layout.cc (Layout::Layout): Force section types of .init_array*,
4245 .preinit_array* and .fini_array* sections.
4246 * output.cc (Output_section::Input_section_sort_entry::has_priority):
4247 Fix check of return value of std::string::find.().
4248 (Output_section::Input_section_sort_compare::operator()): Remove
4249 comment about .init_array.
4250 (Output_section::Input_section_sort_init_fini_compare::operator()):
4252 (Output_section::sort_attached_input_sections): Handle .init_array
4253 and .fini_array specially.
4254 * output.h (Output_section::Inut_section_sort_compare): Update
4256 (Output_section::Input_section_sort_init_fini_compare): New struct.
4258 2010-02-26 Doug Kwan <dougkwan@google.com>
4260 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
4261 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
4262 * testsuite/debug_msg.sh: Avoid matching source line number for
4263 use of global variable undef_int.
4265 2010-02-26 Doug Kwan <dougkwan@google.com>
4267 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
4268 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
4269 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
4270 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
4271 * options.cc (General_options::General_options): Initialize member
4273 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
4274 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
4275 and rm_no_fix_v4bx.stdout
4276 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
4277 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
4278 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
4279 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
4280 and arm_no_fix_v4bx.
4281 * Makefile.in: Regenerate.
4282 * testsuite/arm_fix_v4bx.s: New file.
4283 * testsuite/arm_fix_v4bx.sh: Ditto.
4285 2010-02-24 Doug Kwan <dougkwan@google.com>
4287 * arm.cc (Target_arm::got_section): Make the .got section the first
4288 non RELRO section in the data segment.
4289 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
4290 suffixes of section names.
4292 2010-02-24 Doug Kwan <dougkwan@google.com>
4294 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
4295 flags and attributes merging if an input file is a binary file.
4296 * fileread.cc (Input_file::open): Record format of original file.
4297 * fileread.h (Input_file::Format): New enum type.
4298 (Input_file::Input_file): Initialize data member format_.
4299 (Input_file::format): New method definition.
4300 (Input_file::format_):: New data member.
4302 2010-02-24 Doug Kwan <dougkwan@google.com>
4304 * arm.cc (Arm_output_data_got): New class.
4305 (ARM_TCB_SIZE): New constant
4306 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
4307 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
4308 If user uses a script with a SECTIONS clause, issue only a warning
4309 for a misplaced EXIDX input section. Otherwise, issue an error.
4310 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
4312 (Target_arm::got_mode_index_entry): Handle static linking.
4313 (Target_arm::Scan::local): Ditto.
4314 (Target_arm::Scan::global): Ditto.
4315 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
4316 all incorrectly implemented relocations.
4317 (Target_arm::fix_exidx_coverage): Pass layout to
4318 Arm_output_section::fix_exidx_coverage.
4319 * layout.cc (Layout::section_name_mapping): Remove trailing dots
4320 from ".ARM.exidx." and ".ARM.extab.".
4322 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4324 * arm.cc (Target_arm::do_finalize_sections): Create attribute
4325 section if it does not already exist.
4326 * attributes.cc (Attributes_section_data::Attributes_section_data):
4327 Don't crash if size is zero.
4329 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4330 Ian Lance Taylor <iant@google.com>
4332 * gold.cc (queue_middle_tasks): If no input files were opened,
4334 * workqueue.h (Task_function::Task_function): Assert that there is
4337 2010-02-22 Doug Kwan <dougkwan@google.com>
4339 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
4340 * icf.cc (get_section_contents): Cast snprintf arguments to long long
4341 types to avoid warnings due to different uint64_t implementations
4344 2010-02-21 Doug Kwan <dougkwan@google.com>
4346 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
4347 handling of the maximum backward branch offset.
4348 (Arm_relocate_functions::thumb_branch_common): Ditto.
4349 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
4350 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
4351 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
4352 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
4353 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
4354 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
4355 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
4356 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
4357 thumb_bl_out_of_range thumb_bl_out_of_range.o,
4358 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
4359 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
4360 thumb2_bl_out_of_range.o): New rules.
4361 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
4362 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
4363 thumb2_bl_out_of_range
4364 * testsuite/Makefile.in: Regenerate.
4365 * testsuite/arm_bl_in_range.s: New file.
4366 * testsuite/arm_bl_out_of_range.s: Ditto.
4367 * testsuite/arm_branch_in_range.sh: Ditto.
4368 * testsuite/arm_branch_range.t: Ditto.
4369 * testsuite/thumb2_branch_range.t: Ditto.
4370 * testsuite/thumb_bl_in_range.s: Ditto.
4371 * testsuite/thumb_bl_out_of_range.s: Ditto.
4372 * testsuite/thumb_branch_range.t: Ditto.
4374 2010-02-20 Sriraman Tallam <tmsriram@google.com>
4376 * gc.h (gc_process_relocs): Change vectors to point to the new list.
4377 Add reloc offset information.
4378 * icf.cc (get_section_contents): Change iterators to point to the new
4379 vectors. Add reloc offset information to the contents.
4380 * icf.h (Icf::Sections_reachable_info): New typedef.
4381 (Icf::Sections_reachable_list): New typedef.
4382 (Icf::Offset_info): New typedef.
4383 (Icf::Reloc_info): New struct typedef.
4384 (Icf::Reloc_info_list): New typedef.
4385 (Icf::symbol_reloc_list): Delete method.
4386 (Icf::addend_reloc_list): Delete method.
4387 (Icf::section_reloc_list): Delete method.
4388 (Icf::reloc_info_list): New method.
4389 (Icf::reloc_info_list_): New member.
4391 2010-02-19 Doug Kwan <dougkwan@google.com>
4393 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
4394 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
4395 * arm.cc (Arm_relocation_functions): New forward declaration.
4396 (Target_arm::Target_arm): Initialize new data members
4397 got_mod_index_offset_ and tls_base_symbol_defined_.
4398 (Target_arm::Relocate::relocate_tls): New method.
4399 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
4400 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
4402 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
4403 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
4404 (Target_arm::got_mod_index_offset_,
4405 Target_arm::tls_base_symbol_defined_): New data members.
4406 (Target_arm::Scan::local, Target::Scan::global,
4407 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
4410 2010-02-18 Doug Kwan <dougkwan@google.com>
4412 * arm.cc (Arm_relobj::find_linked_text_section): New method.
4413 (Arm_relobj::make_exidx_input_section): Pass section index of linked
4414 text section as a parameter becuase some broken tools may not set
4415 the link in section header.
4416 (Target_arm::has_got_section): New method.
4417 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
4418 without any mapping symbol as data only. Remove warning.
4419 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
4420 link in its section header, try to discover the link by inspecting the
4421 REL31 relocation at the beginning of the section.
4422 (Target_arm::Scan::check_non_pic): Report name of offending relocation
4424 (Target_arm::Scan::global): Treat any reference to the symbol
4425 _GLOBAL_OFFSET_TABLE_ as a GOT access.
4427 2010-02-12 Sriraman Tallam <tmsriram@google.com>
4429 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
4430 (Scan::global_reloc_may_be_function_pointer): New function.
4431 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
4432 (Scan::global_reloc_may_be_function_pointer): New function.
4433 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
4434 (Scan::global_reloc_may_be_function_pointer): New function.
4435 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
4436 (Scan::global_reloc_may_be_function_pointer): New function.
4437 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
4438 (Scan::global_reloc_may_be_function_pointer): New function.
4439 (Scan::possible_function_pointer_reloc): New function.
4440 (Target_x86_64::can_check_for_function_pointers): New function.
4441 * gc.h (gc_process_relocs): Scan relocation types to determine if
4442 function pointers were taken for targets that support it.
4443 * icf.cc (Icf::find_identical_sections): Include functions for
4444 folding in safe ICF whose pointer is not taken.
4445 * icf.h (Secn_fptr_taken_set): New typedef.
4446 (fptr_section_id_): New member.
4447 (section_has_function_pointers): New function.
4448 (set_section_has_function_pointers): New function.
4449 (check_section_for_function_pointers): New function.
4450 * options.h: Fix comment for safe ICF option.
4451 * target.h (can_check_for_function_pointers): New function.
4452 * testsuite/Makefile.am: Add icf_safe_so_test test case.
4453 Modify icf_safe_test for X86-64.
4454 * testsuite/Makefile.in: Regenerate.
4455 * testsuite/icf_safe_so_test.cc: New file.
4456 * testsuite/icf_safe_so_test.sh: New file.
4457 * testsuite/icf_safe_test.cc (kept_func_3): New function.
4458 (main): Change to take pointer to function kept_func_3.
4459 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
4460 folding is done correctly for X86-64.
4462 2010-02-12 David S. Miller <davem@davemloft.net>
4464 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
4465 is_symbolless parameter.
4466 (Output_reloc<SHT_REL>::is_symbolless): New.
4467 (Output_reloc<SHT_REL>::is_symbolless_): New.
4468 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
4469 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
4470 (Output_reloc<SHT_RELA>::is_symbolless): New.
4471 (Output_data_reloc::add_global): Handle is_symbolless.
4472 (Output_data_reloc::add_global_relative): Likewise.
4473 (Output_data_reloc::add_local): Likewise.
4474 (Output_data_reloc::add_local_relative): Likewise.
4475 (Output_data_reloc::add_symbolless_global_addend): New.
4476 (Output_data_reloc::add_symbolless_local_addend): New.
4477 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
4479 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
4480 instead of ->is_relative_
4481 (Output_reloc::write): Likewise.
4482 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
4483 (Output_reloc::write_rel): Simplify.
4485 * sparc.cc (Target_sparc::Scan::local): Use
4486 ->add_symbolless_local_addend as needed.
4487 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
4488 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
4489 based upon relocation offset.
4491 2010-02-11 Doug Kwan <dougkwan@google.com>
4493 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
4494 (Target_arm::Scan::global): Ditto. Also remove a comment before the
4495 beginning of function.
4496 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
4497 and MOVT_ABS relocations. Those are non issued in scanning. Fix
4498 parameter is_32bit in calls to should_apply_static_reloc.
4499 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
4500 (check_DATA): Add arm_abs_global.stdout.
4501 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
4502 arm_abs_global.stdout): New rules.
4503 (MOSTLLYCLEANFILES): Add arm_abs_global
4504 * Makefile.in: Regenerate.
4505 * testsuite/arm_abs_global.s: New file.
4506 * testsuite/arm_abs_global.sh: Ditto.
4507 * testsuite/arm_abs_lib.s: Ditto.
4509 2010-02-11 Ian Lance Taylor <iant@google.com>
4511 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
4513 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
4514 Allocate_commons_task first.
4515 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
4516 task, rather than symtab_lock_.
4517 (Gc_process_relocs::~Gc_process_relocs): New function.
4518 (Gc_process_relocs::is_runnable): Check this_blocker_.
4519 (Gc_process_relocs::locks): Use next_blocker_ rather than
4521 (Scan_relocs::~Scan_relocs): New function.
4522 (Scan_relocs::is_runnable): Check this_blocker_ rather than
4524 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
4526 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
4527 fields. Add this_blocker_ and next_blocker_ fields. Adjust
4528 constructor accordingly.
4529 (class Gc_process_relocs): Likewise.
4530 (class Scan_relocs): Likewise.
4531 * common.h (class Allocate_commons_task): Remove symtab_lock_
4532 field, and corresponding constructor parameter.
4533 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
4535 (Allocate_commons_task::locks): Likewise.
4537 2010-02-11 Ian Lance Taylor <iant@google.com>
4539 * gold-threads.h (class Once): Define.
4540 (class Initialize_lock): Rewrite as child of Once.
4541 * gold-threads.cc (class Once_initialize): Define.
4542 (once_pointer_control): New static variable.
4543 (once_pointer, once_arg): New static variables.
4544 (c_run_once): New static function.
4545 (Once::Once, Once::run_once, Once::internal_run): New functions.
4546 (class Initialize_lock_once): Remove.
4547 (initialize_lock_control): Remove.
4548 (initialize_lock_pointer): Remove.
4549 (initialize_lock_once): Remove.
4550 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
4551 (Initialize_lock::initialize): Rewrite.
4552 (Initialize_lock::do_run_once): New function.
4553 * archive.cc (Archive::interpret_header): Only clear name if it is
4555 * fileread.cc: Include "gold-threads.h"
4556 (file_counts_lock): New static variable.
4557 (file_counts_initialize_lock): Likewise.
4558 (File_read::release): Only increment counts when using --stats.
4559 Use a lock around the increment.
4560 * parameters.cc (class Set_parameters_target_once): Define.
4561 (set_parameters_target_once): New static variable.
4562 (Parameters::Parameters): Move here from parameters.h.
4563 (Parameters::set_target): Rewrite.
4564 (Parameters::set_target_once): New function.
4565 (Parameters::clear_target): Move here and rewrite.
4566 * parameters.h (class Parameters): Update declarations. Add
4567 set_parameters_target_once_ field.
4568 (Parameters::Parameters): Move to parameters.cc.
4569 (Parameters::clear_target): Likewise.
4570 * readsyms.cc (Read_symbols::do_group): Create a Start_group
4572 (Start_group::~Start_group): New function.
4573 (Start_group::is_runnable): New function.
4574 (Start_group::locks, Start_group::run): New functions.
4575 (Finish_group::run): Change saw_undefined to size_t.
4576 * readsyms.h (class Start_group): Define.
4577 (class Finish_group): Change saw_undefined_ field to size_t.
4578 (Finish_group::Finish_group): Remove saw_undefined and
4579 this_blocker parameters. Change all callers.
4580 (Finish_group::set_saw_undefined): New function.
4581 (Finish_group::set_blocker): New function.
4582 * symtab.h (class Symbol_table): Change saw_undefined to return
4583 size_t. Change saw_undefined_ field to size_t.
4584 * target-select.cc (Set_target_once::do_run_once): New function.
4585 (Target_selector::Target_selector): Initialize set_target_once_
4586 field. Don't initialize lock_ and initialize_lock_ fields.
4587 (Target_selector::instantiate_target): Rewrite.
4588 (Target_selector::set_target): New function.
4589 * target-select.h (class Set_target_once): Define.
4590 (class Target_selector): Update declarations. Make
4591 Set_target_once a friend. Remove lock_ and initialize_lock_
4592 fields. Add set_target_once_ field.
4594 2010-02-10 Ian Lance Taylor <iant@google.com>
4596 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
4598 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
4599 (queue_middle_tasks): Add all blockers before queueing any tasks.
4600 (queue_final_tasks): Likewise.
4601 * token.h (Task_token::add_blockers): New function.
4602 * object.h (Input_objects::number_of_relobjs): New function.
4604 2010-02-10 Ian Lance Taylor <iant@google.com>
4606 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
4607 shared, not if not position independent.
4608 * x86_64.cc (Relocate::relocate_tls): Likewise.
4609 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
4610 (tls_pie_pic_test): New target.
4611 * testsuite/Makefile.in: Rebuild.
4613 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
4614 (tls_test_main_pie.o, tls_test_pie.o): New targets.
4615 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
4616 * testsuite/Makefile.in: Rebuild.
4618 2010-02-09 David S. Miller <davem@davemloft.net>
4620 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
4621 R_SPARC_RELATIVE using ->add_local_relative().
4622 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
4624 * output.h (Output_data_dynamic::add_section_size): New method
4625 that takes two Output_data objects.
4626 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
4627 entry param. Handle it in initializers.
4628 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
4629 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
4630 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
4632 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
4633 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
4634 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
4635 for dynrel_includes_plt.
4636 * i386.cc (Target_i386::do_finalize_sections): Likewise.
4637 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4638 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
4640 (Target_sparc::do_finalize_sections): Update to pass true for
4641 dynrel_includes_plt.
4642 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
4643 output before .rela.plt
4644 (Target_powerpc::do_finalize_sections): Update to pass true for
4645 dynrel_includes_plt when 32-bit.
4647 2010-02-08 Doug Kwan <dougkwan@google.com>
4649 * arm.cc (Arm_relobj::simple_input_section_output_address): New
4651 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
4652 Arm_relobj::scan_section_for_cortex_a8_stubs,
4653 Arm_relobj::do_relocation_section): Instead of calling
4654 Output_section::output_address, use faster
4655 Arm_relobj::simple_input_section_output_address.
4657 2010-02-08 David S. Miller <davem@davemloft.net>
4659 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
4660 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
4661 relocation helper function.
4663 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
4664 just like R_SPARC_GOT{10,13,22}.
4665 (Target_sparc::Scan::local): Likewise.
4666 (Target_sparc::Relocate:relocate): Likewise.
4668 2010-02-06 Ian Lance Taylor <iant@google.com>
4670 * configure.ac: Rewrite targetobjs duplicate removal code to use
4671 only shell constructs.
4672 * configure: Rebuild.
4674 2010-02-05 Doug Kwan <dougkwan@google.com>
4677 * arm.cc (Arm_relobj::section_is_scannable): New method.
4678 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
4679 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
4681 2010-02-04 Doug Kwan <dougkwan@google.com>
4684 * arm-reloc-property.cc (cstdio): Include.
4685 * configure.ac (targetobjs): Remove duplicates.
4686 * configure: Regenerate.
4687 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
4688 big and little endian version for a given address size.
4690 2010-02-03 Doug Kwan <dougkwan@google.com>
4692 * arm-reloc-property.cc
4693 (Arm_reloc_property_table::reloc_name_in_error_message): New method
4695 * arm-reloc-property.h
4696 (Arm_reloc_property_table::get_implemented_static_reloc_property):
4697 New method definition.
4698 (Arm_reloc_property_table::reloc_name_in_error_message): New method
4700 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
4702 (GOT_PREL): Change implemented to Y.
4703 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
4704 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
4705 (Arm_relocate_functions::movw_abs_nc): Remove method.
4706 (Arm_relocate_functions::movt_abs): Ditto.
4707 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
4708 (Arm_relocate_functions::thm_movt_abs): Ditto.
4709 (Arm_relocate_functions::movw_rel_nc): Ditto.
4710 (Arm_relocate_functions::movw_rel): Ditto.
4711 (Arm_relocate_functions::movt_rel): Ditto.
4712 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
4713 (Arm_relocate_functions:thm_movw_rel): Ditto.
4714 (Arm_relocate_functions:thm_movt_rel): Ditto.
4715 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
4716 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
4717 New method definitions.
4718 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
4719 (Arm_relocation_functions::arm_grp_ldr): Ditto.
4720 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
4721 (Arm_relocation_functions::arm_grp_ldc): Ditto.
4722 (Target_arm::Relocate::relocate): Check for non-static or
4723 unimplemented relocation code and exit early. Change calls to
4724 Target_arm::reloc_uses_thumb_bit and
4725 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
4726 instead. Refactor code to handle similar relocations to increase
4727 code sharing. Remove check for unsupported relocation code in switch
4729 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
4730 relocation property table to find out size. Change error message to
4731 print out the name of a relocation code instead of the numeric value.
4732 (Target_arm::scan_reloc_for_stub): Use relocation property table
4733 instead of calling Target_arm::reloc_uses_thumb_bit().
4735 2010-02-02 Doug Kwan <dougkwan@google.com>
4737 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
4738 types of relaxed input section.
4740 2010-02-02 Doug Kwan <dougkwan@google.com>
4742 * Makefile.am (HFILES): Add arm-reloc-property.h.
4744 (TARGETSOURCES): Add arm-reloc-property.cc
4745 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
4746 (libgold_a_SOURCES): $(DEFFILES)
4747 * Makefile.in: Regenerate.
4748 * arm-reloc-property.cc: New file.
4749 * arm-reloc-property.h: New file.
4750 * arm-reloc.def: New file.
4751 * arm.cc: Update comments.
4752 (arm-reloc-property.h): New included header.
4753 (arm_reloc_property_table): New global variable.
4754 (Target_arm::do_select_as_default_target): New method definition.
4755 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
4756 arm-reloc-property to targ_extra_obj.
4757 * parameters.cc (set_parameters_target): Call
4758 Target::select_as_default_target().
4759 * target.h (Target::select_as_default_target): New method definition.
4760 (Target::do_select_as_default_target): Same.
4762 2010-02-01 Doug Kwan <dougkwan@google.com>
4764 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
4765 first_output_text_section_.
4766 (Arm_exidx_fixup::first_output_text_section): New method definition.
4767 (Arm_exidx_fixup::first_output_text_section_): New data member.
4768 (Arm_exidx_fixup::process_exidx_section): Record the first text
4769 output section seen.
4770 (Arm_output_section::fix_exidx_coverage): Set correct linked section
4771 and entsize in output section header.
4773 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4775 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
4776 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
4777 (Arm_relocate_functions::thm_alu11): New Method.
4778 (Arm_relocate_functions::thm_pc8): New Method.
4779 (Arm_relocate_functions::thm_pc12): New Method.
4780 (Target_arm::Scan::local): Handle the relocations.
4781 (Target_arm::Scan::global): Likewise.
4782 (Target_arm::Relocate::relocate): Likewise.
4783 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
4785 2010-01-29 Doug Kwan <dougkwan@google.com>
4787 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
4788 of relocation types as ld.
4790 2010-01-29 Doug Kwan <dougkwan@google.com>
4792 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
4794 (Arm_relocate_functions::thumb_branch_common): Ditto.
4795 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
4796 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
4797 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
4798 Arm_relocate_functions::jump24): Remove.
4799 (Target_arm::Relocate::relocate): Adjust code to call
4800 Arm_relocation_functions::arm_branch_common and
4801 Arm_relocation_functions::thumb_branch_common instead of their removed
4802 wrappers. Merge switch-cases together to reduce source code size.
4804 2010-01-29 Doug Kwan <dougkwan@google.com>
4806 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
4807 output_local_symbol_count_needs_update_.
4808 (Arm_relobj::output_local_symbol_count_needs_update,
4809 Arm_relobj::set_output_local_symbol_count_needs_update,
4810 Arm_relobj::update_output_local_symbol_count): New methods.
4811 (Arm_relobj::output_local_symbol_count_needs_update_): New data
4813 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
4814 of pointed function as in a R_ARM_PREL31 relocation.
4815 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
4816 for output local symbol count updating.
4817 (Target_arm::do_relax): Update output local symbol counts in objects
4819 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
4821 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4823 * arm.cc: Added support for the ARM relocations:
4824 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
4825 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
4826 (Arm_relocate_functions::movw_rel_nc): Renamed (was
4828 (Arm_relocate_functions::movw_rel): New method.
4829 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
4830 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
4832 (Arm_relocate_functions::thm_movw_rel): New method.
4833 (Arm_relocate_functions::thm_movt_rel): Renamed (was
4835 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
4837 (Target_arm::Scan::global): Likewise.
4838 (Target_arm::Relocate::relocate): Likewise.
4839 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4842 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4844 * arm.cc: Added support for ARM group relocations.
4845 (Target_arm::reloc_needs_sym_origin): New method.
4846 (Arm_relocate_functions::calc_grp_kn): New method.
4847 (Arm_relocate_functions::calc_grp_residual): New method.
4848 (Arm_relocate_functions::calc_grp_gn): New method.
4849 (Arm_relocate_functions::arm_grp_alu): New Method.
4850 (Arm_relocate_functions::arm_grp_ldr): New Method.
4851 (Arm_relocate_functions::arm_grp_ldrs): New Method.
4852 (Arm_relocate_functions::arm_grp_ldc): New Method.
4853 (Target_arm::Scan::local): Handle the ARM group relocations.
4854 (Target_arm::Scan::global): Likewise.
4855 (Target_arm::Relocate::relocate): Likewise.
4856 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4859 2010-01-26 Doug Kwan <dougkwan@google.com>
4861 * arm.cc (set): Include.
4862 (class Arm_exidx_fixup): Change type of last_input_section_ to const
4864 (Arm_output_section::Text_section_list): New type.
4865 (Arm_output_section::append_text_sections_to_list): New method.
4866 (Arm_output_section::fix_exidx_coverage): Ditto.
4867 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
4868 (Arm_relobj::convert_input_section_to_relaxed_section): Use
4869 Relobj::set_section_offset() instead of
4870 Sized_relobj::invalidate_section_offset().
4871 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
4872 parameter for section headers. Ignore relocation sections for
4873 unallocated sections and EXIDX sections.
4874 (Target_arm::fix_exidx_coverage): New method.
4875 (Target_arm::output_section_address_less_than): New type.
4876 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
4877 linked text section instead of the EXIDX section.
4878 (Arm_output_section::create_stub_group): Add an assertion to check
4879 that this is not an EXIDX output section.
4880 (Arm_output_section::append_text_sections_to_list): New method.
4881 (Arm_output_section::fix_exidx_coverage): Ditto.
4882 (Arm_relobj::scan_sections_for_stubs): Adjust call to
4883 Arm_relobj::section_needs_reloc_stub_scanning.
4884 (Target_arm::do_relax): Fix EXIDX output section coverage in the
4886 (Target_arm::fix_exidx_coverage): New method.
4887 * object.h (Relobj::set_output_section): New method.
4888 (Sized_relobj::invalidate_section_offset): Remove method.
4889 (Sized_relobj::do_invalidate_section_offset): Remove method.
4890 (Sized_relobj::do_set_section_offset): Handle offset value -1.
4892 2010-01-25 Doug Kwan <dougkwan@google.com>
4894 * arm.cc (Arm_exidx_merged_section::do_output_offset):
4895 Fix warning due to signed and unsigned comparison on a 32-bit host.
4897 2010-01-22 Doug Kwan <dougkwan@google.com>
4899 * arm.cc (Target_arm::do_relax): Record an output section for section
4900 offset adjustment it contains any stub table that has changed.
4901 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
4902 offsets in an output section if necessary.
4903 * output.cc (Output_section::Output_section): Initialize
4904 section_offsets_need_adjustments_.
4905 (Output_section::add_input_section_for_script): Renamed to
4906 Output_section::add_simple_input_section.
4907 (Output_section::save_states): Add a comment.
4908 (Output_section::discard_states): New method defintion.
4909 (Output_section::adjust_section_offsets): Same.
4910 * output.h (Output_section::add_input_section_for_script): Renamed to
4911 Output_section::add_simple_input_section.
4912 (Output_section::discard_states): New method declaration.
4913 (Output_section::adjust_section_offsets): Same.
4914 (Output_section::section_offsets_need_adjustment,
4915 Output_section::set_section_offsets_need_adjustment): New method
4917 (Output_section::section_offsets_need_adjustment_): New data member.
4918 * script-sections.cc
4919 (Output_section_element_input::set_section_address): Adjust code for
4920 renaming of Output_section::add_input_section_for_script.
4921 (Orphan_output_section::set_section_address): Same.
4923 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4925 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
4926 Fix_v4bx enum values .
4927 * gold/options.h (General_options): New option definitions.
4928 (General_options::fix_v4bx): New method.
4929 (General_options::Fix_v4bx): New enum.
4930 * gold/options.cc (General_options::parse_fix_v4bx): New method.
4931 (General_options::parse_fix_v4bx_interworking): New method.
4933 2010-01-22 Doug Kwan <dougkwan@google.com>
4935 * arm.cc (Arm_exidx_fixup): New class.
4937 2010-01-21 Doug Kwan <dougkwan@google.com>
4939 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
4941 (Arm_exidx_section_offset_map): New type.
4943 2010-01-21 Doug Kwan <dougkwan@google.com>
4945 * arm.cc (Arm_exidx_input_section): New class.
4946 (Arm_relobj::exidx_input_section_by_link,
4947 Arm_relobj::exidx_input_section_by_shndx,
4948 Arm_relobj::make_exidx_input_section): New methods.
4949 (read_arm_attributes_section): Remove.
4950 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
4951 information about them.
4952 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
4955 2010-01-20 Doug Kwan <dougkwan@google.com>
4957 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
4958 Input_section_specifier to Section_id.
4959 (Target_arm::new_arm_input_section: Adjust code for change of key
4961 (Target_arm::find_arm_input_section): Ditto.
4962 * gc.h (object.h): Include for Section_id nand Section_id_hash.
4963 (Section_id): Remove.
4964 (Garbage_collection::Section_id_hash): Remove.
4965 * icf.h (object.h): Include for Section_id nand Section_id_hash.
4966 (Section_id): Remove.
4967 (Icf::Section_id_hash): Remove.
4968 * object.h (Section_id, Const_section_id, Section_id_hash,
4969 Const_section_id_hash): New type definitions.
4970 * output.cc (Output_section::add_relaxed_input_section): Change to
4971 use Const_section_id instead of Input_section_specifier as key type.
4972 (Output_section::add_merge_input_section): Ditto.
4973 (Output_section::build_relaxation_map): Change to use Section_id
4974 instead of Input_section_specifier as key type.
4975 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4977 (Output_section::convert_input_sections_to_relaxed_sections): Change
4978 to use Const_section_id instead of Input_section_specifier as key type.
4979 (Output_section::find_merge_section): Ditto.
4980 (Output_section::find_relaxed_input_section): Ditto.
4981 * output.h (Input_section_specifier): Remove class.
4982 (Output_section::Output_section_data_by_input_section_map): Change
4983 key type to Const_section_id.
4984 (Output_section::Output_relaxed_input_section_by_input_section_map):
4986 (Output_section::Relaxation_map): Change key type to Section_id.
4988 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4990 * gold/arm.cc: Added support for R_ARM_V4BX relocation
4991 (class Arm_v4bx_stub): New class.
4992 (DEF_STUBS): Updated definition to support v4_veneer_bx.
4993 (Stub_factory::make_arm_v4bx_stub): New method.
4994 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
4995 (Stub_table::empty): Handle v4bx stubs.
4996 (Stub_table::add_arm_v4bx_stub): New method.
4997 (Stub_table::find_arm_v4bx_stub): New method.
4998 (Arm_relocate_functions::v4bx): New method.
4999 (Target_arm::fix_v4bx): New method.
5000 (Target_arm::Target_arm): Handle R_ARM_V4BX.
5001 (Stub_table::relocate_stubs): Likewise.
5002 (Stub_table::do_write): Likewise.
5003 (Stub_table::update_data_size_and_addralign): Likewise.
5004 (Stub_table::finalize_stubs): Likewise.
5005 (Target_arm::Scan::local): Likewise.
5006 (Target_arm::Scan::global): Likewise.
5007 (Target_arm::do_finalize_sections): Likewise.
5008 (Target_arm::Relocate::relocate): Likewise.
5009 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5011 (Target_arm::scan_reloc_for_stub): Likewise.
5012 (Target_arm::scan_reloc_section_for_stubs): Likewise.
5014 2010-01-19 Ian Lance Taylor <iant@google.com>
5016 * output.cc (Output_section_headers::do_sized_write): Write large
5017 segment count to sh_info field.
5018 (Output_file_header::do_sized_write): For large segment count,
5019 write PN_XNUM to e_phnum field.
5021 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5023 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
5024 (Arm_relocate_functions::thm_jump8): New function.
5025 (Arm_relocate_functions::thm_jump11): New function.
5026 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
5028 (Target_arm::Scan::global): Likewise.
5029 (Target_arm::Relocate::relocate): Likewise.
5030 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5033 2010-01-14 Doug Kwan <dougkwan@google.com>
5035 * arm.cc (map, utility): Include headers.
5036 (Target_arm::apply_cortex_a8_workaround): New method.
5037 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
5038 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
5039 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
5040 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
5041 the --[no-]fix-cortex-a8 command line options.
5042 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
5043 (Target_arm::relocate_stub): Use addend in instruction template.
5044 * options.h (DEFINE_bool): Set the user-set flag.
5045 (General_options): Add --[no-]-fix-cortex options.
5046 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
5047 : Update fast look-up map after conversion.
5049 2010-01-14 Sriraman Tallam <tmsriram@google.com>
5051 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
5052 in the first pass of do_layout.
5054 2010-01-13 Doug Kwan <dougkwan@google.com>
5056 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
5057 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
5058 apparent compiler problem of not folding static constant integral
5059 data members of elfcpp::Elf_sizes<32>.
5061 2010-01-13 Doug Kwan <dougkwan@google.com>
5063 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
5064 Arm_relobj::section_needs_cortex_a8_stub_scanning,
5065 Arm_relobj::scan_section_for_cortex_a8_erratum,
5066 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
5067 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
5068 sections to scan for relocation stubs into a new method
5069 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
5070 relocation and Cortex-A8 stub scanning.
5071 (Target_arm::do_relax): Force stubs to be after stubbed sections
5072 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
5073 the beginning of a new relaxation pass. Update a comment.
5074 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
5076 2010-01-12 Ian Lance Taylor <iant@google.com>
5078 * target-reloc.h (visibility_error): New inline function.
5079 (relocate_section): Call visibility_error.
5080 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
5081 (MOSTLYCLEANFILES): Likewise.
5082 (protected_4_pic.o, protected_3.err): New targets.
5083 * testsuite/protected_4.cc: New file.
5085 2010-01-12 Doug Kwan <dougkwan@google.com>
5087 * arm.cc (Cortex_a8_reloc): New class.
5088 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
5089 and cortex_a8_relocs_info_.
5090 (Target_arm::fix_cortex_a8): New method definition.
5091 (Target_arm::Cortex_a8_relocs_info): New type.
5092 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
5093 New data member declarations.
5094 (Target_arm::scan_reloc_for_stub): Record information about
5095 relocations for THUMB branches that might be exempted from the
5096 Cortex-A8 workaround.
5097 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
5098 at the beginning of a relaxation pass.
5100 2010-01-12 Doug Kwan <dougkwan@google.com>
5102 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
5103 (Arm_relobj::Mapping_symbol_position,
5104 Arm_reloj::Mapping_symbol_position_less,
5105 Arm_relobj::Mapping_symbols_info): New types.
5106 (Target_arm::is_mapping_symbol_name): New method definition.
5107 (Arm_relobj::do_count_local_symbols): Save information about mapping
5110 2010-01-11 Doug Kwan <dougkwan@google.com>
5112 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
5113 Arm_relocate_functions::thumb32_branch_upper,
5114 Arm_relocate_functions::thumb32_branch_lower,
5115 Arm_relocate_functions::thumb32_cond_branch_offset,
5116 Arm_relocate_functions::thumb32_cond_branch_upper,
5117 Arm_relocate_functions::thumb32_cond_branch_lower,
5118 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
5119 branch offset encoding.
5120 (Arm_relocate_functions::thumb_branch_common): Use new branch
5121 offset encoding methods to avoid code duplication.
5122 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
5123 (Stub_addend_reader::operator()): Use new branch encoding method
5124 to avoid code duplication.
5126 2010-01-11 Doug Kwan <dougkwan@google.com>
5128 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
5129 (Target_arm::do_finalize_sections): Define special EXIDX section
5130 symbols only if referenced.
5131 * gc.h (Garbage_collection::add_reference): New method.
5132 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
5135 2010-01-11 Ian Lance Taylor <iant@google.com>
5137 * script.cc (Version_script_info::build_expression_list_lookup):
5138 Change complaing about duplicate wildcard match from error to
5141 * script.cc (class Lazy_demangler): Recreate--revert part of patch
5143 (Version_script_info::Version_script_info): Initialize globs_,
5144 default_version_, default_is_global_, and exact_. Don't
5145 initialize globals_ or locals_.
5146 (Version_script_info::build_lookup_tables): Build local symbols
5148 (Version_script_info::unquote): New function.
5149 (Version_script_info::add_exact_match): New function.
5150 (Version_script_info::build_expression_list_lookup): Remove lookup
5151 parameter. Add is_global parameter. Change all callers. Handle
5152 wildcard pattern specially. Unquote pattern. Call
5154 (Version_script_info::get_name_to_match): New function.
5155 (Version_script_info::get_symbol_version): New function.
5156 (Version_script_info::get_symbol_version_helper): Remove.
5157 (Version_script_info::check_unmatched_names): Call unquote.
5158 * script.h (class Version_script_info): Change get_symbol_version
5159 to be non-inline and add is_global parameter; change all callers.
5160 Rewrite symbol_is_local. Update declarations. Define struct
5161 Version_tree_match, Exact, Globs. Don't define struct Lookup.
5162 Remove globals_ and locals_ members. Add exact_, globs_,
5163 default_version_, is_global_.
5164 (Version_script_info::Glob): Remove pattern, add expression and
5165 is_global. Update constructor. Change all callers.
5166 * dynobj.cc (Versions::finalize): Mark the version symbol as the
5168 (Versions::symbol_section_contents): If a symbol is undefined, or
5169 defined in a dynamic object, set the version index to
5171 * symtab.cc (Symbol_table::add_from_relobj): Don't call
5173 (Symbol_table::add_from_pluginobj): Likewise.
5174 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
5176 2010-01-11 Doug Kwan <dougkwan@google.com>
5178 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
5179 (incremental_dump_LDADD): Add linking option for libintl.
5180 * Makefile.in: Regenerate.
5182 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
5185 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
5187 * testsuite/Makefile.in: Regenerated.
5189 2010-01-10 Doug Kwan <dougkwan@google.com>
5191 * options.h (DEFINE_var): Use parentheses around argument varname__
5192 in macro body to avoid any unintended subsequent substitutions.
5194 2010-01-10 Ian Lance Taylor <iant@google.com>
5196 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
5197 candidates before doing symbol resolution.
5199 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
5200 ODR candidates if only one is weak.
5202 2010-01-08 Ian Lance Taylor <iant@google.com>
5204 * script.cc (Version_script_info::build_expression_list_lookup):
5205 Don't warn about ambiguous version, just record the ambiguity.
5206 (Version_script_info::get_symbol_version_helper): Give error if
5207 version is ambiguous.
5209 2010-01-08 Doug Kwan <dougkwan@google.com>
5211 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
5212 prev_data_size_ and prev_addralign_. Remove initializer for
5213 deleted data member has_been_changed_.
5214 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
5215 to determine if the table is empty.
5216 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
5218 (Stub_table::add_reloc_stub): Define method in class definition
5219 instead of just declaring it there.
5220 (Stub_table::add_cortex_a8_stub): New method definition.
5221 (Stub_table::update_data_size_and_addralign): Ditto.
5222 (Stub_table::finalize_stubs): Ditto.
5223 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
5224 (Stub_table::do_addralign_): Return address alignment in the
5225 (Stub_table::do_reset_address_and_file_offset): Define method in
5226 class definition instead of declaring it there. Set current data
5227 size to be the data size of the previous pass.
5228 (Stub_table::set_final_data_size): Use current data size as the
5230 (Stub_table::relocate_stub): Change parameter type of stub from
5231 Reloc_stub pointer to Stub pointer.
5232 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
5233 (Stub_table::Cortex_a8_stub_list): New typedef.
5234 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
5235 Stub_table::prev_addralign_): New data member.
5236 (Arm_relobj::Arm_relobj): Initialize data member
5237 section_has_cortex_a8_workaround_.
5238 (Arm_relobj::section_has_cortex_a8_workaround,
5239 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
5241 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
5243 (Target_arm::relocate_stub): Change parameter type of stub from
5244 Reloc_stub pointer to Stub pointer.
5245 (Insn_template::size, Insn_template::alignment): Handle
5246 THUMB16_SPECIAL_TYPE.
5247 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
5248 Stub_table::update_data_size_and_addralign,
5249 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
5251 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
5252 (Stub_table::do_write): Ditto.
5253 (Target_arm::do_relax): Adjust code for changes in Stub_table.
5255 2010-01-08 Ian Lance Taylor <iant@google.com>
5258 * symtab.h (class Symbol): Remove fields is_target_special_ and
5259 has_plt_offset_. Add field is_defined_in_discarded_section_.
5260 (Symbol::is_defined_in_discarded_section): New function.
5261 (Symbol::set_is_defined_in_discarded_section): New function.
5262 (Symbol::has_plt_offset): Rewrite.
5263 (Symbol::set_plt_offset): Verify that new offset is not -1U.
5264 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
5265 Don't initialize is_target_special_ or has_plt_offset_.
5266 Initialize is_defined_in_discarded_section_.
5267 (Symbol_table::add_from_relobj): If appropriate, set
5268 is_defined_in_discarded_section.
5269 * resolve.cc (Symbol::override_base_with_special): Don't test
5270 is_target_special_. Change has_plt_offset_ to has_plt_offset().
5271 * target-reloc.h (relocate_section): Do special handling for
5272 symbols defined in discarded sections for global symbols as well
5275 2010-01-08 Ian Lance Taylor <iant@google.com>
5277 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
5278 the SHT_SYMTAB case.
5280 2010-01-08 Ian Lance Taylor <iant@google.com>
5282 * object.cc (Sized_relobj::do_layout): Don't get confused if
5283 layout_eh_frame returns NULL.
5285 2010-01-08 Ian Lance Taylor <iant@google.com>
5288 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
5289 dynamic symbol table, use the normal symbol table.
5290 (Sized_dynobj::do_read_symbols): Remove assertion about type of
5293 2010-01-08 Ian Lance Taylor <iant@google.com>
5296 * layout.cc (Layout::include_section): Remove .gnu_debuglink
5299 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
5301 * version.cc (print_version): Change to "Copyright 2010".
5303 2010-01-08 Ian Lance Taylor <iant@google.com>
5307 * i386.cc (class Target_i386): Change return type of plt_section
5309 (class Output_data_plt_i386): Add tls_desc_rel_ field.
5310 (Output_data_plt_i386::Output_data_plt_i386): Initialize
5311 tls_desc_rel_ field.
5312 (Output_data_plt_i386::rel_tls_desc): New function.
5313 (Target_i386::rel_tls_desc_section): New function.
5314 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
5315 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
5316 R_386_TLS_DESC reloc in rel_tls_desc_section.
5317 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
5318 Define struct Tlsdesc_info.
5319 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
5320 (Target_x86_64::do_reloc_symbol_index): New function.
5321 (Target_x86_64::add_tlsdesc_info): New function.
5322 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
5323 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
5325 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
5327 (Output_data_plt_x86_64::rela_tlsdesc): New function.
5328 (Target_x86_64::rela_tlsdesc_section): New function.
5329 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
5331 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
5332 (Target_x86_64::do_reloc_addend): New function.
5333 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
5334 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
5335 declarations. Define TARGET_CODE. Add arg field to u1_ union.
5336 (Output_reloc::type): New function.
5337 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
5338 (Output_reloc::is_target_specific): New function.
5339 (Output_reloc::target_arg): New function.
5340 (class Output_reloc) [SHT_RELA]: Add four new constructors for
5341 absolute relocs and target specific relocs.
5342 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
5343 add_target_specific.
5344 (class Output_data_reloc) [SHT_RELA]: Likewise.
5345 * output.cc (Output_reloc::Output_reloc): Add four new versions
5346 for absolute relocs and target specific relocs.
5347 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
5348 (Output_reloc::get_symbol_index): Likewise.
5349 (Output_reloc::local_section_offset): Check that local_sym_index_
5350 is not TARGET_CODE or 0.
5351 (Output_reloc::symbol_value): Likewise.
5352 (Output_reloc::write) [SHT_RELA]: Call target for target specific
5354 * target.h (class Target): Add reloc_symbol_index and reloc_addend
5355 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
5357 * layout.cc (add_target_dynamic_tags): Use output section for
5358 DT_PLTRELSZ and DT_JMPREL.
5360 2010-01-07 Ian Lance Taylor <iant@google.com>
5363 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
5365 (class Output_data_reloc_generic): Define.
5366 (class Output_data_reloc_base): Change base class to
5367 Output_data_reloc_generic. Change add() method to call
5368 bump_relative_reloc_count for a relative reloc. Remove
5370 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
5372 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
5373 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
5375 * layout.h (class Layout): Update declaration.
5377 2010-01-07 Ian Lance Taylor <iant@google.com>
5379 * output.h (class Output_data): Add const version of
5380 output_section and do_output_section.
5381 (class Output_section_data): Add const version of
5383 (class Output_section): Likewise.
5384 * layout.cc (Layout::add_target_dynamic_tags): New function.
5385 * layout.h (class Layout): Update declarations.
5386 * arm.cc (Target_arm::do_finalize_sections): Use
5387 add_target_dynamic_tags.
5388 * i386.cc (Target_i386::do_finalize_sections): Likewise.
5389 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
5390 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
5391 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5393 2010-01-07 Ian Lance Taylor <iant@google.com>
5396 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
5399 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
5400 Ian Lance Taylor <iant@google.com>
5403 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
5404 Xindex::read_symtab_xindex.
5406 2010-01-07 Doug Kwan <dougkwan@google.com>
5408 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
5409 (Insn_template::thumb16_bcond_insn): New method declaration.
5410 (Insn_template): Fix spelling.
5411 (Stub::thumb16_special): New method declaration.
5412 (Stub::do_write): Define virtual method which was previously pure
5414 (Stub::do_thumb16_special): New method declaration.
5415 (Stub::do_fixed_endian_write): New template member.
5416 (Reloc_stub::do_write): Remove.
5417 (Reloc_stub::do_fixed_endian_write): Remove.
5418 (Cortex_a8_stub): New class definition.
5419 (Stub_factory::make_cortex_a8_stub): New method definition.
5420 (Stub_factory::Stub_factory): Add missing static storage class
5421 qualifier for elf32_arm_stub_a8_veneer_blx.
5423 2010-01-07 Ian Lance Taylor <iant@google.com>
5426 * options.h (class General_options): Add --warn-unresolved-symbols
5427 and --error-unresolved-symbols.
5428 * errors.cc (Errors::undefined_symbol): Implement
5429 --warn-unresolved-symbols.
5431 * options.h (class General_options): Add -z text and -z textoff.
5432 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
5434 2010-01-06 Sriraman Tallam <tmsriram@google.com>
5436 * gc.h (Garbage_collection::Cident_section_map): New typedef.
5437 (Garbage_collection::cident_sections): New function.
5438 (Garbage_collection::add_cident_section): New function.
5439 (Garbage_collection::cident_sections_): New member.
5440 (gc_process_relocs): Add references to sections whose names are C
5442 * gold.h (cident_section_start_prefix): New constant.
5443 (cident_section_stop_prefix): New constant.
5444 (is_cident): New function.
5445 * layout.cc (Layout::define_section_symbols): Replace string constants
5446 with the newly defined constants.
5447 * object.cc (Sized_relobj::do_layout): Track sections whose names are
5449 * testsuite/Makefile.am: Add gc_orphan_section_test.
5450 * testsuite/Makefile.in: Regenerate.
5451 * testsuite/gc_orphan_section_test.cc: New file.
5452 * testsuite/gc_orphan_section_test.sh: New file.
5454 2010-01-06 Ian Lance Taylor <iant@google.com>
5457 * options.h (class General_options): Add --warn-shared-textrel.
5458 * layout.cc (Layout::finish_dynamic_section): Implement
5459 --warn-shared-textrel.
5462 * options.h (class General_options): Add --warn-multiple-gp.
5464 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5466 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
5467 $(THREADSLIB) and $(LIBDL).
5468 * Makefile.in: Rebuild.
5470 2010-01-06 Ian Lance Taylor <iant@google.com>
5473 * options.cc (General_options::parse_section_start): New function.
5474 (General_options::section_start): New function.
5475 (General_options::General_options): Initialize all members.
5476 * options.h: Include <map>
5477 (class General_options): Add --section-start. Add section_starts_
5479 * layout.cc (Layout::attach_allocated_section_to_segment): If
5480 --section-start was used, set the address of the segment. Remove
5481 local sort_sections.
5482 (Layout::relaxation_loop_body): If the address of the load segment
5483 has been set by --section-start, don't use it.
5484 * output.h (Output_segment::update_flags_for_output_section): New
5486 * output.cc (Output_segment::add_output_section): Call
5487 update_flags_for_output_section.
5489 2010-01-05 Ian Lance Taylor <iant@google.com>
5492 * options.h (class General_options): Add --undefined-version.
5493 * script.cc (struct Version_expression): Add was_matched_by_symbol
5495 (Version_script_info::matched_symbol): New function.
5496 (Version_script_info::get_symbol_version_helper): Call
5498 (Version_script_info::check_unmatched_names): New function.
5499 * script.h (class Version_script_info): Update declarations.
5500 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
5502 * options.h (class General_options): Use DEFINE_bool_alias for
5503 allow_multiple_definition.
5504 * resolve.cc (Symbol_table::should_override): Don't test
5505 allow_multiple_definition.
5508 * options.h (class General_options): Add --cref.
5509 * main.cc (main): Print cref table if --cref. Don't close mapfile
5510 until after printing cref table.
5511 * cref.cc: Include "symtab.h".
5512 (class Cref_inputs): Define Cref_table_compare and Cref_table.
5513 (Cref_table_compare::operator()): New function.
5514 (Cref_inputs::gather_cref): New function.
5515 (filecol): New static const.
5516 (Cref_inputs::print_cref): New function.
5517 (Cref::print_cref): New function.
5518 * cref.h: Include <cstdio>.
5519 (class Cref): Update declarations.
5520 * mapfile.h (Mapfile::file): New function.
5521 * object.h (class Object): Define Symbols. Declare virtual
5522 do_get_global_symbols.
5523 (Object::get_global_symbols): New function.
5524 * object.cc (Input_objects::add_object): Pass object to cref_ if
5526 (Input_objects::archive_start): Likewise.
5527 (Input_objects::archive_stop): Likewise.
5528 (Input_objects::print_cref): New function.
5529 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
5530 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
5532 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
5534 * plugin.h (class Sized_pluginobj): Update declarations.
5536 2010-01-05 Ian Lance Taylor <iant@google.com>
5538 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
5539 to is_default_version. Rename insdef to insdefault.
5540 (Symbol_table::add_from_relobj): Rename def to is_default_version
5541 and local to is_forced_local.
5542 (Symbol_table::add_from_pluginobj): Likewise.
5543 (Symbol_table::add_from_dynobj): Likewise.
5544 (Symbol_table::define_special_symbol): Rename insdef to
5547 2010-01-04 Ian Lance Taylor <iant@google.com>
5550 * options.h (class General_options): Add
5551 --allow-multiple-definition and -z muldefs.
5552 * resolve.cc (Symbol_table::should_override): Don't warn about a
5553 multiple symbol definition if --allow-multiple-definition or -z
5557 * options.h (class General_options): Add --add-needed and
5558 --copy-dt-needed-entries. Tweak --as-needed help entry.
5559 * object.cc (Input_objects::check_dynamic_dependencies): Give an
5560 error if --copy-dt-needed-entries aka --add-needed is used and
5561 would cause a change in behaviour.
5564 * options.h (class General_options): Add -G as a short version of
5565 --shared. Add no-op options -assert, -g, and -i.
5567 2010-01-04 Sriraman Tallam <tmsriram@google.com>
5569 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
5570 check for .text or .gnu.linkonce.t sections.
5571 * icf.cc (Icf::find_identical_sections): Ditto.
5572 Change the detection for mangled function name within the section
5574 * icf.h (is_section_foldable_candidate): New function.
5576 2009-12-30 Ian Lance Taylor <iant@google.com>
5579 * options.h (class General_options): Permit two dashes with
5580 --retain-symbols-file.
5582 2009-12-30 Ian Lance Taylor <iant@google.com>
5585 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
5586 don't put the file header and segment headers in the text
5590 * common.cc (Sort_commons::operator()): Stabilize sort when both
5592 (Symbol_table::do_allocate_commons_list): When allocating common
5593 symbols, skip a symbol which is no longer common.
5594 * symtab.h (Symbol::is_common): Test whether the symbol comes from
5595 an object before checking its type.
5596 * testsuite/common_test_2.c: New file.
5597 * testsuite/common_test_3.c: New file.
5598 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
5599 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
5600 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
5601 (common_test_2_pic.o, common_test_2.so): New targets.
5602 (common_test_3_pic.o, common_test_3.so): New targets.
5603 * testsuite/Makefile.in: Rebuild.
5606 * script.cc (read_input_script): If we see a new SECTIONS clause,
5607 and we have added an input section, give an error.
5608 * layout.h (class Layout): Add have_added_input_section function.
5609 Add have_added_input_section_ field.
5610 * layout.cc (Layout::Layout): Initialize
5611 have_added_input_section_.
5612 (Layout::layout): Set have_added_input_section_.
5613 (Layout::layout_eh_frame): Likewise.
5615 2009-12-30 Ian Lance Taylor <iant@google.com>
5618 * options.h (class General_options): Add --sort-common option.
5619 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
5620 * common.cc (Sort_common): Add sort_order parameter to
5621 constructor. Add sort_order_ field.
5622 (Sort_commons::operator): Check sort_order_.
5623 (Symbol_table::allocate_commons): Determine the sort order.
5624 (Symbol_table::do_allocate_commons): Add sort_order parameter.
5626 (Symbol_table::do_allocate_commons_list): Likewise.
5628 2009-12-30 Ian Lance Taylor <iant@google.com>
5631 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
5632 symbols from this object, don't change the visibility of an
5634 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
5636 2009-12-30 Ian Lance Taylor <iant@google.com>
5639 * script.h (class Version_script_info): Define Language enum.
5640 Update declarations. Define Glob, Exact, and Lookup types. Add
5641 new fields globals_, locals_, and is_finalized_.
5642 * script.cc: Various formatting fixes.
5643 (class Parser_closure): Change language_stack_ from a vector of
5644 std::string to one of Version_script_info::Language. Adjust all
5646 (class Lazy_demangler): Remove.
5647 (struct Version_expression): Change language from std::string to
5648 Version_script_info::Language.
5649 (Version_script_info::Version_script_info): New function.
5650 (Version_script_info::~Version_script_info): Don't call clear.
5651 (Version_script_info::finalize): New function.
5652 (Version_script_info::build_lookup_tables): New function.
5653 (Version_script_info::build_expression_list_lookup): New
5655 (Version_script_info::get_symbol_version_helper): Rewrite to use
5657 (Version_script_info::print_expression_list): Adjust to use
5658 Version_script_info::Language.
5659 (script_push_lex_into_version_mode): Check that the version script
5660 has not been finalized.
5661 (version_script_push_lang): Change language string to
5662 Version_script_info::Language.
5663 * options.cc (Command_line::version_script): New function.
5664 * options.h (class General_options): Add finalize_dynamic_list
5665 function. Change version_script from declaration to definition.
5666 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
5667 * testsuite/version_script.map: Remove duplicate def of foo.
5668 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
5670 * testsuite/Makefile.in: Rebuild.
5672 2009-12-30 Ian Lance Taylor <iant@google.com>
5675 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
5676 if the input symbol index is 0, make the output symbol index 0.
5678 2009-12-30 Ian Lance Taylor <iant@google.com>
5681 * options.h (class General_options): Add -x/--discard-all.
5682 * object.cc (Sized_relobj::do_count_local_symbols): Handle
5683 --discard-all. If the local symbol needs a dynamic entry, check
5684 that before handling --discard-locals.
5686 2009-12-30 Ian Lance Taylor <iant@google.com>
5689 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
5691 (Output_segment::add_output_section): Don't change the flags if
5695 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
5696 GNU hash table if they need a dynamic value. Otherwise, don't add
5697 them if they are defined in a dynamic object or are forced local.
5699 2009-12-29 Ian Lance Taylor <iant@google.com>
5702 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
5703 .gnu.hash table for a 32-bit target.
5706 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
5707 regular and a dynamic object only needs a dynamic symbol table
5708 entry if it is externally visible.
5711 * i386.cc (class Target_i386): Initialize global_offset_table_ in
5712 constructor. Add global_offset_table_ field.
5713 (Target_i386::got_section): Set global_offset_table_.
5714 (Target_i386::do_finalize_sections): Set global_offset_table_
5716 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
5717 in constructor. Add global_offset_table_ field.
5718 (Target_x86_64::got_section): Set global_offset_table_.
5719 (Target_x86_64::do_finalize_sections): Set global_offset_table_
5722 * layout.cc (Layout::Layout): Initialize increase_relro_.
5723 (Layout::get_output_section): Add is_relro, is_last_relro, and
5724 is_first_non_relro parameters. Change all callers.
5725 (Layout::choose_output_section): Likewise.
5726 (Layout::add_output_section_data): Likewise.
5727 (Layout::make_output_section): Likewise.
5728 (Layout::set_segment_offsets): Clear increase_relro when using a
5730 * layout.h (class Layout): Add increase_relro method. Add
5731 increase_relro_ field. Update declarations.
5732 * output.cc (Output_section::Output_section): Initialize
5733 is_last_relro_ and is_first_non_relro_.
5734 (Output_segment::add_output_section): Group relro sections is
5735 do_sort is true. Handle is_last_relro and is_first_non_relro.
5736 (Output_segment::maximum_alignment): Remove relro handling.
5737 (Output_segment::set_section_addresses): Add increase_relro
5738 parameter. Change all callers. Add initial alignment to align
5739 relro sections on separate page. Remove old relro handling.
5740 (Output_segment::set_section_list_addresses): Remove in_relro
5741 parameter. Change all callers.
5742 (Output_segment::set_offset): Add increase parameter. Change all
5743 callers. Remove old relro handling.
5744 * output.h (class Output_section): Add new methods: is_last_relro,
5745 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
5746 Add is_last_relro_ and is_first_non_relro_ fields.
5747 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
5748 Create separate .got.plt section. Call increase_relro.
5749 * x86_64.cc (Target_x86_64::got_section): Likewise.
5750 * testsuite/relro_script_test.t: Add .got.plt.
5753 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
5754 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
5755 (Layout::finalize): Call set_dynamic_symbol_size.
5756 (Layout::set_dynamic_symbol_size): New function.
5757 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
5758 set_dynamic_symbol_size.
5761 * output.h (class Output_section): Add is_entsize_zero_ field.
5762 * output.cc (Output_section::Output_section): Initialize
5764 (Output_section::set_entsize): If two different entsizes are
5765 requested, force it to zero.
5766 (Output_section::add_input_section): Set flags for .debug_str
5767 before updating section flags. Set entsize.
5768 (Output_section::update_flags_for_input_section): Set SHF_MERGE
5769 and SHF_STRING if all input sections have those flags.
5771 2009-12-29 Rafael Espindola <espindola@google.com>
5773 * main.cc (main): Fix the sys time reporting.
5774 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
5777 2009-12-29 Sriraman Tallam <tmsriram@google.com>
5779 * options.cc (General_options::parse_version): Allow -v to exit
5780 without an error if there is nothing to link.
5782 2009-12-29 Ian Lance Taylor <iant@google.com>
5784 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
5785 using a version of gcc before 4.1.
5786 * configure: Rebuild.
5788 2009-12-28 Chris Demetriou <cgd@google.com>
5790 * attributes.cc (Output_attributes_section_data::do_write): Use
5791 std::vector::front rather than std::vector::data.
5793 2009-12-28 Ian Lance Taylor <iant@google.com>
5795 * symtab.h (class Symbol_table): Add enum Defined.
5796 * resolve.cc (Symbol_table::should_override): Add defined
5797 parameter. Change all callers. Test whether object is NULL
5798 before calling a method on it.
5799 (Symbol_table::report_resolve_problem): Add defined parameter.
5801 (Symbol_table::should_override_with_special): Likewise.
5802 * symtab.cc (Symbol_table::define_in_output_data): Add defined
5803 parameter. Change all callers.
5804 (Symbol_table::do_define_in_output_data): Likewise.
5805 (Symbol_table::define_in_output_segment): Likewise.
5806 (Symbol_table::do_define_in_output_segment): Likewise.
5807 (Symbol_table::define_as_constant): Likewise.
5808 (Symbol_table::do_define_as_constant): Likewise.
5809 * script.h (class Symbol_assignment): Add is_defsym parameter to
5810 constructor; change all callers.
5811 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
5812 parameter. Change all callers. Add is_defsym_ field.
5813 (class Parser_closure): Add parsing_defsym parameter to
5814 constructor; change all callers. Add parsing_defsym accessor
5815 function. Add parsing_defsym_ field.
5817 2009-12-28 Ian Lance Taylor <iant@google.com>
5819 * gold.cc (queue_middle_tasks): Fix formatting.
5820 * object.cc (Relobj::is_section_name_included): Likewise.
5822 2009-12-23 Ian Lance Taylor <iant@google.com>
5824 * i386.cc (Target_i386::do_calls_non_split): Recognize
5825 -fsplit-stack prologue for a function with a static chain.
5826 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
5827 -fsplit-stack prologue when using %r11.
5829 2009-12-21 Sriraman Tallam <tmsriram@google.com>
5831 * options.cc (General_options::parse_version): Make -v continue and do
5832 the link like GNU ld does.
5834 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
5836 * Makefile.am (CCFILES): Add timer.cc.
5837 (HFILES): Add timer.h.
5838 * configure.ac: Check for sysconf and times.
5839 * main.cc: include timer.h.
5840 (main): Use Timer instead of get_run_time.
5843 * workqueue.cc: include timer.h.
5844 (Workqueue::find_and_run_task):
5845 Report user, sys and wall time.
5846 * Makefile.in: Regenerate.
5847 * config.in: Regenerate.
5848 * configure: Regenerate.
5850 2009-12-16 Doug Kwan <dougkwan@google.com>
5852 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
5854 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
5855 relaxed input sections.
5856 * output.cc (Output_section::find_relaxed_input_section): Change
5857 return type to Output_relaxed_input_section pointer. Adjust code
5858 for new type of relaxed_input_section_map_.
5859 * output.h (Output_section::find_relaxed_input_section): Change
5860 return type to Output_relaxed_input_section pointer.
5861 (Output_section::Output_relaxed_input_section_by_input_section_map):
5863 (Output_section::relaxed_input_section_map_): Change type to
5864 Output_section::Output_relaxed_input_section_by_input_section_map.
5865 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
5868 2009-12-15 Ian Lance Taylor <iant@google.com>
5870 * layout.cc (Layout::create_shstrtab): Only write out after input
5871 sections if we are compressing debug sections.
5873 2009-12-15 Ian Lance Taylor <iant@google.com>
5875 * archive.cc (Archive::add_symbols): Only look up a symbol without
5876 a version if there is, in fact, a version.
5878 2009-12-14 Ian Lance Taylor <iant@google.com>
5880 Revert -Wshadow changes, all changes from:
5881 2009-12-11 Doug Kwan <dougkwan@google.com>
5882 2009-12-11 Nick Clifton <nickc@redhat.com>
5883 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
5885 2009-12-11 Doug Kwan <dougkwan@google.com>
5887 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
5889 * attributes.cc (Object_attribute::size): Ditto.
5890 (Attributes_section_data::size): Ditto.
5891 (Attributes_section_data::Attributes_section_data): Ditto.
5892 (Output_attributes_section_data::do_write): Ditto.
5893 * attributes.h (Object_attribute::set_type): Ditto.
5894 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
5896 2009-12-11 Nick Clifton <nickc@redhat.com>
5898 * archive.cc: Fix shadowed variable warnings.
5900 * compressed_output.cc: Likewise.
5901 * compressed_output.h: Likewise.
5902 * configure: Likewise.
5903 * dwarf_reader.cc: Likewise.
5904 * dynobj.cc: Likewise.
5905 * dynobj.h: Likewise.
5906 * ehframe.cc: Likewise.
5907 * ehframe.h: Likewise.
5908 * errors.cc: Likewise.
5909 * expression.cc: Likewise.
5910 * fileread.cc: Likewise.
5911 * fileread.h: Likewise.
5912 * freebsd.h: Likewise.
5913 * i386.cc: Likewise.
5915 * incremental.h: Likewise.
5916 * layout.cc: Likewise.
5917 * layout.h: Likewise.
5918 * mapfile.cc: Likewise.
5919 * merge.cc: Likewise.
5920 * merge.h: Likewise.
5921 * object.cc: Likewise.
5922 * object.h: Likewise.
5923 * options.h: Likewise.
5924 * output.cc: Likewise.
5925 * output.h: Likewise.
5926 * parameters.cc: Likewise.
5927 * plugin.cc: Likewise.
5928 * powerpc.cc: Likewise.
5929 * reduced_debug_output.cc: Likewise.
5930 * reduced_debug_output.h: Likewise.
5931 * reloc.cc: Likewise.
5932 * reloc.h: Likewise.
5933 * resolve.cc: Likewise.
5934 * script-sections.cc: Likewise.
5935 * script.cc: Likewise.
5936 * script.h: Likewise.
5937 * sparc.cc: Likewise.
5938 * symtab.cc: Likewise.
5939 * symtab.h: Likewise.
5940 * target-select.cc: Likewise.
5941 * target-select.h: Likewise.
5942 * token.h: Likewise.
5943 * workqueue.cc: Likewise.
5944 * workqueue.h: Likewise.
5945 * x86_64.cc: Likewise.
5947 2009-12-10 Doug Kwan <dougkwan@google.com>
5949 * arm.cc (attributes.h): New include.
5950 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
5951 (Arm_relobj::~Arm_relobj): Delete object pointed by
5952 attributes_section_data_.
5953 (Arm_relobj::attributes_section_data): New method definition.
5954 (Arm_relobj::attributes_section_data_): New data member declaration.
5955 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
5956 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
5957 attributes_section_data_.
5958 (Arm_dynobj::attributes_section_data): New method definition.
5959 (Arm_dynobj::attributes_section_data_): New data member declaration.
5960 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
5961 initialization value of may_use_blx_ to false.
5962 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
5963 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
5964 object attributes to compute results instead of hard-coding.
5965 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
5966 Target_arm::get_secondary_compatible_arch,
5967 Target_arm::set_secondary_compatible_arch
5968 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5969 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
5970 New method declarations.
5971 (Target_arm::get_aeabi_object_attribute): New method definition.
5972 (Target_arm::attributes_section_data_): New data member declaration.
5973 (read_arm_attributes_section): New template definition.
5974 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
5975 (Arm_dynobj::do_read_symbols): Ditto.
5976 (Target_arm::do_finalize_sections): Merge attributes sections from
5977 input. Check for BLX use after attributes section merging.
5978 Fix __exidx_start and __exidx_end visibility. Create an
5979 .ARM.attributes section if necessary.
5980 (Target_arm::get_secondary_compatible_arch,
5981 Target_arm::set_secondary_compatible_arch,
5982 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5983 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
5984 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
5985 New method definitions.
5987 2009-12-09 Ian Lance Taylor <iant@google.com>
5989 * plugin.cc (Plugin::load): Don't cast from void* to a function
5992 2009-12-09 Ian Lance Taylor <iant@google.com>
5994 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
5997 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
5999 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
6000 Replace two_file_shared_1.so with two_file_shared_2.so.
6001 * testsuite/Makefile.in: Regenerated.
6003 2009-12-08 Doug Kwan <dougkwan@google.com>
6005 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
6006 (HFILES): Add attributes.h and int_encoding.h.
6007 * Makefile.in: Regenerate.
6008 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
6009 function definitions to int_encoding.cc
6010 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
6011 prototypes to int_encoding.h
6012 * reduced_debug_output.cc (int_encoding.h): New include.
6013 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
6014 function definitions to int_encoding.cc
6015 (insert_into_vector, read_from_pointer): Move template definitions to
6017 * attributes.cc: New file.
6018 * attributes.h: New file.
6019 * int_encoding.cc: New file.
6020 * int_encoding.h: New file.
6022 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
6025 * incremental-dump.cc (dump_incremental_inputs): New.
6026 (main): Use dump_incremental_inputs.
6028 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
6031 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
6032 checking elfcpp::STT_FUNC.
6033 (Target_i386::Relocate::relocate): Likewise.
6034 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
6036 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
6037 symbols from shared libraries into normal FUNC symbols.
6039 * symtab.h (Symbol): Add is_func and use it.
6041 2009-12-05 Doug Kwan <dougkwan@google.com>
6043 * arm.cc (Target_arm::arm_info): Initialize new fields
6044 attributes_section and attributes_vendor.
6045 * i386.cc (Target_i386::i386_info): Same.
6046 * object.cc (Sized_relobj::do_layout): Skip attribute section.
6047 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
6048 fields attributes_section and attributes_vendor.
6049 * sparc.cc (Target_sparc::sparc_info): Same.
6050 * target.h (Target::attributes_section, Target::attributes_vendor,
6051 Target::is_attributes_section, Target::attribute_arg_type,
6052 Target::attributes_order): New method definitions.
6053 (Target::Target_info::attributes_section,
6054 Target::Target_info::attributes_vendor): New fields.
6055 (Target::do_attribute_arg_type, Target::do_attributes_order): New
6056 virtual method definitions.
6057 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
6058 attributes_section and attributes_vendor.
6059 * testsuite/testfile.cc (Target_test::test_target_info): Same.
6061 2009-12-05 Doug Kwan <dougkwan@google.com>
6063 * arm.cc: Update comments about interworking and stub generation.
6064 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
6065 considered as non-PIC.
6066 (Arm_relocate_functions::base_abs): Fix formatting.
6067 (Arm_relocate_functions::got_prel): Fix comment. Change interface
6068 of function to use GOT entry address instead of offset.
6069 (Target_arm::Scan::global): Issue an error if a symbol would need a
6070 PLT does not get one because it is untyped. Remove code to create
6071 dynamic symbols for relative branches.
6072 (Target_arm::Relocate::relocate: Use 0 instead of false since function
6073 takes unsigned integer instead of boolean.
6075 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
6077 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
6078 (two_file_test_LDADD): Likewise.
6079 (common_test_1_LDADD): Likewise.
6080 (exception_test_LDADD) Likewise.
6081 (weak_test_LDADD): Likewise.
6082 (many_sections_test_LDADD): Likewise.
6083 (initpri1_LDADD): Likewise.
6084 (script_test_1_LDADD): Likewise.
6085 (script_test_2_LDADD): Likewise.
6086 (justsyms_LDADD): Likewise.
6087 (binary_test_LDADD): Likewise.
6088 (large_LDADD): Likewise.
6089 * testsuite/Makefile.in: Regenerated.
6091 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
6093 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
6094 (Symbol_table::override_with_special): Likewise.
6095 (Symbol_table::add_from_object): Likewise.
6097 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
6099 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
6100 Don't set the data_offset twice.
6102 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
6104 * testsuite/Makefile.in: Regenerate.
6106 2009-12-03 Doug Kwan <dougkwan@google.com>
6108 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
6109 (Target_arm::do_finalize_sections): Add parameter for symbol table
6110 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
6111 * i386.cc (Target_i386::do_finalize_sections): Add an additional
6112 parameter for symbol table pointer.
6113 * layout.cc (Layout::finalize): Call Target::finalize_sections with
6114 an additional parameter for a pointer to symbol table.
6115 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
6116 parameter for a symbol table pointer.
6117 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
6118 * target.h (Target::finalize_sections, Target::do_finalize_sections):
6120 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
6121 parameter for a symbol table pointer.
6123 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
6125 * incremental.cc (Incremental_inputs_header)
6126 (Incremental_inputs_header_write, Incremental_inputs_entry)
6127 (Incremental_inputs_entry_write): Move ...
6128 * incremental.h (Incremental_inputs_header)
6129 (Incremental_inputs_header_write, Incremental_inputs_entry)
6130 (Incremental_inputs_entry_write): here.
6132 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
6134 * incremental.cc (make_sized_incremental_binary): Set the target.
6135 Error if it is incompatible.
6136 * output.h (Output_file): Add filename method.
6138 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
6140 * incremental.cc (Incremental_inputs_entry): Remove unused argument
6141 from the get_* methods.
6143 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
6145 * incremental-dump.cc (main): Check that the offeset of a script is 0.
6146 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
6147 Write 0 for the data_offset of scripts.
6149 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
6151 * testsuite/Makefile.am: Add the incremental_test.sh test.
6152 * testsuite/incremental_test.sh: New.
6153 * testsuite/incremental_test_1.c: New.
6154 * testsuite/incremental_test_2.c: New.
6156 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
6158 * incremental-dump.cc (main): Fix typos.
6160 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
6163 * incremental-dump.cc (main): Use llu to print 64 bit values.
6165 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
6166 H.J. Lu <hongjiu.lu@intel.com>
6168 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
6170 (incremental_dump_LDADD): Likewise.
6171 * Makefile.in: Regenerated.
6173 2009-11-25 Doug Kwan <dougkwan@google.com>
6177 2009-11-25 Doug Kwan <dougkwan@google.com>
6179 * arm.cc (Target_arm::Target_arm): Move method definition
6180 outside of class definition. Add code to handle
6181 --target1-rel, --target1-abs and --target2= options.
6182 (Target_arm::get_reloc_reloc_type): Change method to be
6183 non-static and const.
6184 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
6185 New data member declaration.
6186 (Target_arm::Scan::local, Target_arm::Scan::global,
6187 Target_arm::Relocate::relocate,
6188 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6189 Adjust call to Target_arm::get_real_reloc_type.
6190 (Target_arm::get_real_reloc_type): Use command line options
6191 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
6192 * options.h (--target1-rel, --target1-abs, --target2): New
6195 2009-11-25 Doug Kwan <dougkwan@google.com>
6197 * arm.cc (Target_arm::Target_arm): Move method definition outside of
6198 class definition. Add code to handle --target1-rel, --target1-abs
6199 and --target2= options.
6200 (Target_arm::get_reloc_reloc_type): Change method to be non-static
6202 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
6204 (Target_arm::Scan::local, Target_arm::Scan::global,
6205 Target_arm::Relocate::relocate,
6206 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
6207 call to Target_arm::get_real_reloc_type.
6208 (Target_arm::get_real_reloc_type): Use command line options to
6209 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
6210 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
6213 2009-11-25 Doug Kwan <dougkwan@google.com>
6215 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
6216 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
6217 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
6219 (Arm_relocate_functions::thm_call): Replace body with a call to
6220 Arm_relocate_functions::thumb_branch_common.
6221 (Arm_relocate_functions::thm_jump24,
6222 Arm_relocate_functions::thm_xpc22): New method definitions.
6223 (Arm_relocate_functions::thumb_branch_common): New method definition.
6224 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
6226 (Target_arm::Relocate::relocate): Adjust call to thm_call.
6227 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
6229 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
6231 * Makefile.am: Build incremental-dump
6232 * Makefile.in: Regenerate.
6233 * incremental-dump.cc: New.
6234 * incremental.cc (Incremental_inputs_header_data,
6235 Incremental_inputs_entry_data): Move to incremental.h
6236 * incremental.h: (Incremental_inputs_header_data,
6237 Incremental_inputs_entry_data): Move from incremental.cc
6239 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
6241 * incremental.cc (Incremental_inputs_header,
6242 Incremental_inputs_header_write, Incremental_inputs_entry,
6243 Incremental_inputs_entry_write): Add a typedef with the data type.
6245 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
6247 * incremental.cc (Incremental_inputs_header,
6248 Incremental_inputs_header_write, Incremental_inputs_entry,
6249 Incremental_inputs_entry_write): Update comment about which
6250 type has the filed descriptions.
6252 2009-11-15 Doug Kwan <dougkwan@google.com>
6254 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
6255 (Arm_relocate_functions::arm_branch_common): Change method defintion
6256 in class definition to a method declaration and update list of formal
6258 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
6259 Arm_relocation_functions::jump24): Adjust call to
6260 Arm_relocate_functions::arm_branch_common. Update list of formal
6262 (Arm_relocate_functions::xpc25): New method definition.
6263 (Arm_relocate_functions::arm_branch_common): Move method defintion
6264 out from class definition. Use stubs for mode-switching and extending
6266 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
6267 specially. Change code to enable use of stubs in ARM branches.
6269 2009-11-10 Doug Kwan <dougkwan@google.com>
6271 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
6272 in method declaration.
6273 (Target_arm::relocate_stub): New method declaration.
6274 (Target_arm::default_target): Change to return a pointer instead of
6276 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
6277 Target_arm::default_target.
6278 (Arm_Relobj::do_relocate_sections): Remove options paramater in
6280 (Target_arm::relocate_section): Adjust view.
6281 (Target_arm::relocate_stub): New method definition.
6283 2009-11-10 Doug Kwan <dougkwan@google.com>
6285 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
6287 * incremental.cc (open_incremental_binary): Initialized local
6288 variables to avoid warnings.
6289 * object.cc (make_elf_object): Ditto.
6290 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
6293 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
6296 * testsuite/plugin_test.c: Include "config.h".
6298 2009-11-09 Doug Kwan <dougkwan@google.com>
6300 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
6301 (arm_symbol_value): Remove.
6302 (Arm_relocate_functions::arm_branch_common,
6303 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
6304 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
6305 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
6306 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
6307 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
6308 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
6309 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
6310 Arm_relocate_functions::thm_mobw_abs_nc,
6311 Arm_relocate_functions::thm_mov_abs,
6312 Arm_relocate_functions::movw_prel_nc,
6313 Arm_relocate_functions::thm_movt_abs,
6314 Arm_relocate_functions::movt_prel,
6315 Arm_relocate_functions::thm_movw_prel_nc,
6316 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
6317 (Target_arm::Relocate::relocate): Only decompose address into two
6318 parts if relocation type uses the thumb-bit and pass the actual
6319 bit instead of a flag indicating that the thumb-bit is used. Adjust
6320 calls to methods in Arm_relocate_functions for this change.
6322 2009-11-08 Ian Lance Taylor <iant@google.com>
6325 * reloc.cc: Instantiate
6326 Sized_relobj::initialize_input_to_output_maps and
6327 Sized_relobj:free_input_to_output_maps.
6329 2009-11-06 Ian Lance Taylor <iant@google.com>
6332 * defstd.cc (in_segment): Set only_if_ref true for "end".
6334 2009-11-06 Doug Kwan <dougkwan@google.com>
6336 * arm.cc (class Reloc_stub): Correct a comment.
6337 (Target_arm::Target_arm): Initialize arm_input_section_map_.
6338 (Target_arm::scan_section_for_stubs): New method declaration.
6339 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
6340 Change methods from private to protected.
6341 (Target_arm::do_may_relax): New method definition.
6342 (Target_arm::do_relax, Target_arm::group_sections,
6343 Target_arm::scan_reloc_for_stub,
6344 Target_arm::scan_reloc_section_for_stubs): New method declarations.
6345 (Target_arm::arm_input_section_map_): New data member declaration.
6346 (Target_arm::scan_reloc_for_stub,
6347 Target_arm::scan_reloc_section_for_stubs,
6348 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
6349 Target_arm::do_relax): New method definitions.
6351 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
6353 * configure.ac: Check for (struct stat)::st_mtim
6354 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
6355 * config.in: Regenerate.
6356 * configure: Regenerate.
6358 2009-11-05 Ian Lance Taylor <iant@google.com>
6361 * output.cc (Output_segment::add_output_section): Add missing
6364 2009-11-04 Ian Lance Taylor <iant@google.com>
6367 * object.h (class Object): Add is_needed and set_is_needed
6368 methods. Add is_needed_ field. Make bool fields into bitfields.
6369 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
6370 defined in a dynamic object and referenced by a regular object,
6371 set is_needed for the dynamic object.
6372 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
6373 if the file is marked with as_needed and it is not needed.
6375 2009-11-04 Ian Lance Taylor <iant@google.com>
6378 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
6379 tags if data is discarded by linker script.
6380 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6381 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6382 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6383 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6385 2009-11-04 Ian Lance Taylor <iant@google.com>
6387 * layout.cc (Layout::get_output_section): Add is_interp and
6388 is_dynamic_linker_section parameters. Change all callers.
6389 (Layout::choose_output_section): Likewise.
6390 (Layout::make_output_section): Likewise.
6391 (Layout::add_output_section_data): Add is_dynamic_linker_section
6392 parameter. Change all callers.
6393 * layout.h (class Layout): Update declarations.
6394 * output.h (class Output_section): Add is_interp, set_is_interp,
6395 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
6396 Add is_interp_, is_dynamic_linker_section_ fields. Change
6397 generate_code_fills_at_write_ to a bitfield.
6398 * output.cc (Output_section::Output_sections): Initialize new
6400 (Output_segment::add_output_section): Add do_sort parameter.
6403 2009-11-03 Ian Lance Taylor <iant@google.com>
6406 * options.h (class General_options): Add --warn-common.
6407 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
6408 merging two common symbols.
6409 (Symbol_table::should_override): Handle --warn-common when merging
6410 a common symbol with a defined symbol. Use report_resolve_problem
6411 for multiple definitions.
6412 (Symbol_table::report_resolve_problem): New function.
6413 * symtab.h (class Symbol_table): Declare report_resolve_problem.
6415 2009-11-03 Doug Kwan <dougkwan@google.com>
6417 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
6419 (Target_arm::stub_factory): New method definition.
6420 (Target_arm::new_arm_input_section,
6421 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
6422 Target_arm::reloc_uses_thumb_bit): New method declarations.
6423 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
6424 New type definitions.
6425 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
6426 member declarations.
6427 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
6428 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
6429 New method definitions.
6431 2009-11-03 Ian Lance Taylor <iant@google.com>
6433 * options.h (class General_options): Add --warn_constructors.
6435 2009-11-03 Ian Lance Taylor <iant@google.com>
6438 * defstd.cc (in_section): Add entries for __rel_iplt_start,
6439 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
6441 2009-11-03 Ian Lance Taylor <iant@google.com>
6444 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
6445 --msgid-bugs-address.
6446 (install-pdf): New target.
6447 (install-data_yes): Look up one directory to find mkinstalldirs.
6449 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
6451 * po/Make-in (.po.gmo): Don't generate .gmo files in source
6454 2009-10-30 Doug Kwan <dougkwan@google.com>
6456 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
6458 2009-10-30 Doug Kwan <dougkwan@google.com>
6460 * arm.cc (Stub_addend_reader): New struct template definition
6461 and partial specializations.
6462 (Stub_addend_reader::operator()): New method definition for a
6463 partially specialized template.
6465 2009-10-30 Doug Kwan <dougkwan@google.com>
6467 * arm.cc (Arm_relobj::processor_specific_flags): New method
6469 (Arm_relobj::do_read_symbols): New method declaration.
6470 (Arm_relobj::processor_specific_flags_): New data member declaration.
6471 (Arm_dynobj): New class definition.
6472 (Target_arm::do_finalize_sections): Add input_objects parameter.
6473 (Target_arm::do_adjust_elf_header): New method declaration.
6474 (Target_arm::are_eabi_versions_compatible,
6475 (Target_arm::merge_processor_specific_flags): New method declaration.
6476 (Target_arm::do_make_elf_object): New overloaded method definitions
6478 (Arm_relobj::do_read_symbols): New method definition.
6479 (Arm_dynobj::do_read_symbols): Ditto.
6480 (Target_arm::do_finalize_sections): Add input_objects parameters.
6481 Merge processor-specific flags from all input objects.
6482 (Target_arm::are_eabi_versions_compatible,
6483 Target_arm::merge_processor_specific_flags,
6484 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
6485 New method definitions.
6486 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
6487 Input_objects pointer type parameter.
6488 * layout.cc (Layout::finalize): Pass input objects to target's.
6489 finalize_sections function.
6490 * output.cc (Output_file_header::do_sized_write): Set ELF file
6491 header's processor-specific flags.
6492 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
6493 Input_objects pointer type parameter.
6494 * sparc.cc (Target_sparc::do_finalize_sections): Same.
6495 * target.h (Input_objects): New forward class declaration.
6496 (Target::processor_specific_flags,
6497 Target::are_processor_specific_flags_sect): New method definitions.
6498 (Target::finalize_sections): Add input_objects parameter.
6499 (Target::Target): Initialize processor_specific_flags_ and
6500 are_processor_specific_flags_set_.
6501 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
6503 (Target::set_processor_specific_flags): New method definition.
6504 (Target::processor_specific_flags_,
6505 Target::are_processor_specific_flags_set_): New data member
6507 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
6508 Input_objects pointer type parameter.
6510 2009-10-30 Doug Kwan <dougkwan@google.com>
6512 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
6514 2009-10-28 Ian Lance Taylor <iant@google.com>
6516 * object.h (class Relobj): Drop options parameter from
6517 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
6518 do_scan_relocs, do_relocate. Change all callers.
6519 (class Sized_relobj): Drop options parameters from
6520 do_gc_process_relocs, do_scan_relocs, do_relocate,
6521 do_relocate_sections, relocate_sections, emit_relocs_scan,
6522 emit_relocs_scan_reltype. Change all callers.
6523 (struct Relocate_info): Remove options field and all references to
6525 * reloc.h (class Read_relocs): Remove options constructor
6526 parameter and options_ field. Change all callers.
6527 (class Gc_process_relocs, class Scan_relocs): Likewise.
6528 (class Relocate_task): Likewise.
6529 * target-reloc.h (scan_relocs): Remove options parameter. Change
6531 (scan_relocatable_relocs): Likewise.
6532 * target.h (class Sized_target): Remove options parameter from
6533 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
6535 * gc.h (gc_process_relocs): Remove options parameter. Change all
6537 * arm.cc: Update functions to remove options parameters.
6538 * i386.cc: Likewise.
6539 * powerpc.cc: Likewise.
6540 * sparc.cc: Likewise.
6541 * x86_64.cc: Likewise.
6542 * testsuite/testfile.cc: Likewise.
6544 2009-10-28 Doug Kwan <dougkwan@google.com>
6546 * arm.cc (Arm_relobj): New class definition.
6547 (Arm_relobj::scan_sections_for_stubs,
6548 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
6549 New method definitions.
6551 2009-10-28 Cary Coutant <ccoutant@google.com>
6553 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
6554 (Plugin::cleanup_done_): New member.
6555 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
6556 (Plugin_manager::cleanup_done_): Remove.
6557 (Plugin_manager::add_input_file): Edit error message.
6558 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
6559 (Plugin_manager::cleanup): Remove use of cleanup_done_.
6561 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
6563 * fileread.cc: (File_read::View::~View): Use the new
6564 data_ownership_ filed.
6565 (File_read::~File_read): Dispose the new whole_file_view_.
6566 (File_read::open): Mmap the whole file if needed.
6567 (File_read::open): Use whole_file_view_ instead of contents_.
6568 (File_read::find_view): Use whole_file_view_ if applicable.
6569 (File_read::do_read): Use whole_file_view_ instead of contents_.
6570 (File_read::make_view): Use whole_file_view_ instead of contents_,
6571 update File_read::View::View call.
6572 (File_read::find_or_make_view): Update File_read::View::View
6574 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
6576 (File_read::View::Data_ownership): New enum.
6577 (File_read::View::View): Replace bool mapped_ with Data_ownership
6579 (File_read::View::mapped_): Remove (replaced by data_ownership_).
6580 (File_read::View::data_ownership_): New field.
6581 (File_read::contents_): Remove (replaced by whole_file_view_).
6582 (File_read::whole_file_view_): New field.
6583 * options.h (class General_options): Add --keep-files-mapped.
6585 2009-10-27 Cary Coutant <ccoutant@google.com>
6587 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
6588 * testsuite/Makefile.am (plugin_test_5): New test case.
6589 * testsuite/Makefile.in: Regenerate.
6591 2009-10-25 Doug Kwan <dougkwan@google.com>
6593 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
6594 from private to protected to allow access by child class.
6595 (Sized_relobj::do_relocate_sections): New method declaration.
6596 (Sized_relobj::relocate_sections): Virtualize.
6597 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
6598 Sized_relobj::relocate_sections. Instantiate template explicitly
6599 for different target sizes and endianity.
6601 2009-10-24 Doug Kwan <dougkwan@google.com>
6603 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
6604 (Arm_input_section::as_arm_input_section): New method.
6605 (Arm_output_section): New class definition.
6606 (Arm_output_section::create_stub_group,
6607 Arm_output_section::group_sections): New method definitions.
6609 2009-10-22 Doug Kwan <dougkwan@google.com>
6611 * arm.cc (Arm_input_section): New class definition.
6612 (Arm_input_section::init, Arm_input_section:do_write,
6613 Arm_input_section::set_final_data_size,
6614 Arm_input_section::do_reset_address_and_file_offset): New method
6617 2009-10-21 Doug Kwan <dougkwan@google.com>
6619 * arm.cc (Stub_table, Arm_input_section): New forward class
6621 (Stub_table): New class defintion.
6622 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
6623 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
6624 New method definition.
6626 2009-10-21 Doug Kwan <dougkwan@google.com>
6628 * arm.cc: Update copyright comments.
6629 (Target_arm): New forward class template declaration.
6630 (Arm_address): New type.
6631 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
6632 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
6633 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
6635 (Insn_template): Same.
6636 (DEF_STUBS): New macro.
6637 (Stub_type): New enum type.
6638 (Stub_template): New class definition.
6641 (Stub_factory): Same.
6642 (Target_arm::Target_arm): Initialize may_use_blx_ and
6643 should_force_pic_veneer_.
6644 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
6645 Target_arm::should_force_pic_veneer,
6646 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
6647 Target_arm::using_thumb_only, Target_arm:;default_target): New
6649 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
6650 New data member declarations.
6651 (Insn_template::size, Insn_template::alignment): New method defintions.
6652 (Stub_template::Stub_template): New method definition.
6653 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
6654 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
6655 (Stub_factory::Stub_factory): New method definition.
6656 * gold.h (string_hash): New template.
6657 * output.h (Input_section_specifier::hash_value): Use
6659 (Input_section_specifier::string_hash): Remove.
6660 * stringpool.cc (Stringpool_template::string_hash): Use
6663 2009-10-20 Doug Kwan <dougkwan@google.com>
6665 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
6666 symbols of relaxed input sections.
6667 * output.h (Output_section::find_relaxed_input_section): Make
6670 2009-10-16 Doug Kwan <dougkwan@google.com>
6672 * dynobj.cc (Versions::Versions): Initialize version_script_.
6673 Only insert base version symbol definition for a shared object
6674 if version script defines any version versions.
6675 (Versions::define_base_version): New method definition.
6676 (Versions::add_def): Check that base version is not needed.
6677 (Versions::add_need): Define base version lazily.
6678 * dynobj.h (Versions::define_base_version): New method declaration.
6679 (Versions::needs_base_version_): New data member declaration.
6680 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
6681 (check_DATA): Add no_version_test.stdout.
6682 (libno_version_test.so, no_version_test.o no_version_test.stdout):
6684 * testsuite/Makefile.in: Regenerate.
6685 * testsuite/no_version_test.c: New file.
6686 * testsuite/no_version_test.sh: Ditto.
6688 2009-10-16 Doug Kwan <dougkwan@google.com>
6690 * expression.cc (class Segment_start_expression): New class definition.
6691 (Segment_start_expression::value): New method definition.
6692 (script_exp_function_segment_start): Return a new
6693 Segment_start_expression.
6694 * gold/script-c.h (script_saw_segment_start_expression): New function
6696 * script-sections.cc (Script_sections::Script_sections): Initialize
6697 SAW_SEGMENT_START_EXPRESSION_ to false.
6698 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
6699 and -Tbbs options to specify section addresses if given in
6700 command line and no SEGMENT_START expression is seen in a script.
6701 * script-sections.h (Script_sections::saw_segment_start_expression,
6702 Script_sections::set_saw_segment_start_expression): New method
6704 (Script_sections::saw_segment_start_expression_): New data member
6706 * script.cc (script_saw_segment_start_expression): New function.
6707 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
6708 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
6709 script_test_7.sh and script_test_8.sh.
6710 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
6711 script_test_8.stdout.
6712 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
6713 (script_test_6, script_test_6.stdout, script_test_7,
6714 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
6715 * Makefile.in: Regenerate.
6716 * testsuite/script_test_6.sh: New file.
6717 * testsuite/script_test_6.t: Same.
6718 * testsuite/script_test_7.sh: Same.
6719 * testsuite/script_test_7.t: Same.
6720 * testsuite/script_test_8.sh: Same.
6722 2009-10-16 Doug Kwan <dougkwan@google.com>
6724 * output.cc (Output_segment::set_section_list_address): Cast
6725 expressions to unsigned long long type to avoid format warnings.
6727 2009-10-15 Ian Lance Taylor <iant@google.com>
6729 * script.cc (Script_options::add_symbol_assignment): Always add a
6730 dot assignment to script_sections_.
6731 * script-sections.cc (Script_sections::add_dot_assignment):
6732 Initialize if necessary.
6734 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
6735 program headers with no load segment if there is a linker script.
6737 * layout.cc (Layout::set_segment_offsets): Align the file offset
6738 to the segment aligment for -N or -n with no load segment.
6739 * output.cc (Output_segment::add_output_section): Don't crash if
6740 the first section is a TLS section.
6741 (Output_segment::set_section_list_addresses): Print an error
6742 message if the address moves backward in a linker script.
6743 * script-sections.cc
6744 (Output_section_element_input::set_section_addresses): Don't
6745 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
6746 (Orphan_output_section::set_section_addresses): Likewise.
6748 2009-10-15 Doug Kwan <dougkwan@google.com>
6750 * layout.cc (Layout::finish_dynamic_section): Generate tags
6751 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
6752 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
6753 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
6755 2009-10-14 Ian Lance Taylor <iant@google.com>
6757 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
6759 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
6760 data_shdr fields of relinfo.
6761 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
6762 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
6763 R_386_TLS_LDO_32, adjust based on section flags.
6764 (Target_i386::Relocate::fix_up_ldo): Remove.
6766 2009-10-13 Ian Lance Taylor <iant@google.com>
6768 Add support for -pie.
6769 * options.h (class General_options): Add -pie and
6771 (General_options::output_is_position_independent): Test -pie.
6772 (General_options::output_is_executable): Return true if not shared
6773 and not relocatable.
6774 (General_options::output_is_pie): Remove.
6775 * options.cc (General_options::finalize): Reject incompatible uses
6777 * gold.cc (queue_middle_tasks): A -pie link is not static.
6778 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
6779 * symtab.cc (Symbol::final_value_is_known): Return false if
6780 output_is_position_independent.
6781 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
6782 output_is_position_independent.
6783 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
6784 output_is_position_independent.
6785 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
6786 output_is_position_independent.
6787 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
6789 (basic_pie_test.o, basic_pie_test): New targets.
6790 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
6791 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
6792 (two_file_pie_test): New target.
6793 * testsuite/Makefile.in: Rebuild.
6794 * README: Remove note saying that -pie is not supported.
6796 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
6798 * options.h (class General_options): Add -init and -fini.
6799 * layout.cc (Layout::finish_dynamic_section): Emit
6800 given init and fini functions.
6802 2009-10-13 Sriraman Tallam <tmsriram@google.com>
6804 * gc.h (gc_process_relocs): Check if icf is enabled using new
6806 * gold.cc (queue_initial_tasks): Likewise.
6807 (queue_middle_tasks): Likewise.
6808 * object.cc (do_layout): Likewise.
6809 * symtab.cc (is_section_folded): Likewise.
6810 * main.cc (main): Likewise.
6811 * reloc.cc (Read_relocs::run): Likewise.
6812 (Sized_relobj::do_scan_relocs): Likewise.
6813 * icf.cc (is_function_ctor_or_dtor): New function.
6814 (Icf::find_identical_sections): Check if function is ctor or dtor when
6816 * options.h (General_options::icf): Change option to be an enum.
6817 (Icf_status): New enum.
6818 (icf_enabled): New method.
6819 (icf_safe_folding): New method.
6820 (set_icf_status): New method.
6821 (icf_status_): New variable.
6822 * (options.cc) (General_options::finalize): Set icf_status_.
6823 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
6824 icf_test and icf_keep_unique_test to use the --icf enum flag.
6825 * testsuite/icf_safe_test.sh: New file.
6826 * testsuite/icf_safe_test.cc: New file.
6828 2009-10-12 Sriraman Tallam <tmsriram@google.com>
6830 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
6831 includes to gc.h and icf.h.
6832 * arm.cc: Include gc.h.
6833 * gold.cc: Likewise.
6834 * i386.cc: Likewise.
6835 * powerpc.cc: Likewise.
6836 * sparc.cc: Likewise.
6837 * x86_64.cc: Likewise.
6838 * gc.h: Include icf.h.
6840 2009-10-11 Ian Lance Taylor <iant@google.com>
6842 * plugin.cc: Include "gold.h" before other header files.
6844 2009-10-10 Chris Demetriou <cgd@google.com>
6846 * options.h (Input_file_argument::Input_file_type): New enum.
6847 (Input_file_argument::is_lib_): Replace with...
6848 (Input_file_argument::type_): New member.
6849 (Input_file_argument::Input_file_argument): Take Input_file_type
6850 'type' rather than boolean 'is_lib' as second argument.
6851 (Input_file_argument::is_lib): Use type_.
6852 (Input_file_argument::is_searched_file): New function.
6853 (Input_file_argument::may_need_search): Handle is_searched_file.
6854 * options.cc (General_options::parse_library): Support -l:filename.
6855 (General_options::parse_just_symbols): Update for Input_file_argument
6857 (Command_line::process): Likewise.
6858 * archive.cc (Archive::get_file_and_offset): Likewise.
6859 * plugin.cc (Plugin_manager::release_input_file): Likewise.
6860 * script.cc (read_script_file, script_add_file): Likewise.
6861 * fileread.cc (Input_file::Input_file): Likewise.
6862 (Input_file::will_search_for): Handle is_searched_file.
6863 (Input_file::open): Likewise.
6864 * readsyms.cc (Read_symbols::get_name): Likewise.
6865 * testsuite/Makefile.am (searched_file_test): New test.
6866 * testsuite/Makefile.in: Regenerate.
6867 * testsuite/searched_file_test.cc: New file.
6868 * testsuite/searched_file_test_lib.cc: New file.
6870 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6871 Ian Lance Taylor <iant@google.com>
6873 * descriptor.cc: Include <cstdio> and "binary-io.h".
6874 (Descriptors::open): Open the files in binary mode always.
6875 * script.cc (Lex::get_token): Treat \r as whitespace.
6877 2009-10-09 Ian Lance Taylor <iant@google.com>
6879 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
6881 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6882 Ian Lance Taylor <iant@google.com>
6884 * configure.ac: Check for readv function also.
6885 * fileread.cc (readv): Define if not HAVE_READV.
6886 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
6888 * config.in: Regenerate.
6889 * configure: Regenerate.
6891 2009-10-09 Doug Kwan <dougkwan@google.com>
6893 * layout.cc (Layout::make_output_section): Call target hook to make
6894 ordinary output section.
6895 (Layout::finalize): Adjust parameter list of call the
6896 Target::may_relax().
6897 * layout.h (class Layout::section_list): New method.
6898 * merge.h (Output_merge_base::entsize): Change visibility to public.
6899 (Output_merge_base::is_string, Output_merge_base::do_is_string):
6901 (Output_merge_string::do_is_string): New method.
6902 * object.cc (Sized_relobj::do_setup): renamed from
6903 Sized_relobj::set_up.
6904 * object.h (Sized_relobj::adjust_shndx,
6905 Sized_relobj::initializ_input_to_output_maps,
6906 Sized_relobj::free_input_to_output_maps): Change visibilities to
6908 (Sized_relobj::setup): Virtualize.
6909 (Sized_relobj::do_setup): New method declaration.
6910 (Sized_relobj::invalidate_section_offset,
6911 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
6912 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
6913 * options.cc (parse_int): New function.
6914 * options.h (parse_int): New declaration.
6915 (DEFINE_int): New macro.
6916 (stub_group_size): New option.
6917 * output.cc (Output_section::Output_section): Initialize memebers
6918 merge_section_map_, merge_section_by_properties_map_,
6919 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
6920 (Output_section::add_input_section): Handled deferred code-fill
6921 generation and remove an old comment.
6922 (Output_section::add_relaxed_input_section): New method definition.
6923 (Output_section::add_merge_input_section): Use merge section by
6924 properties map to speed to search. Update merge section maps
6926 (Output_section::build_relaxation_map): New method definition.
6927 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6929 (Output_section::relax_input_section): Renamed to
6930 Output_section::convert_input_sections_to_relaxed_sections and change
6931 interface to take a vector of pointers to relaxed sections.
6932 (Output_section::find_merge_section,
6933 Output_section::find_relaxed_input_section): New method definitions.
6934 (Output_section::is_input_address_mapped,
6935 Output_section::output_offset, Output_section::output_address):
6936 Use output section data maps to speed up searching.
6937 (Output_section::find_starting_output_address): Add comments.
6938 (Output_section::do_write,
6939 Output_section::write_to_postprocessing_buffer): Do code-fill
6940 generation as appropriate.
6941 (Output_section::get_input_sections): Invalidate relaxed input section
6943 (Output_section::restore_states): Adjust type of checkpoint .
6944 Invalidate relaxed input section map.
6945 * output.h (Output_merge_base): New class declaration.
6946 (Input_section_specifier): New class defintion.
6947 (class Output_relaxed_input_section) Change base class to
6948 Output_section_data_build.
6949 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
6950 base class initializer.
6951 (Output_section::add_relaxed_input_section): New method declaration.
6952 (Output_section::Input_section): Change visibility to protected.
6953 (Output_section::Input_section::relobj,
6954 Output_section::Input_section::shndx): Handle relaxed input sections.
6955 Output_section::input_sections) Change visibility to protected. Also
6956 define overload to return a non-const pointer.
6957 (Output_section::Merge_section_properties): New class defintion.
6958 (Output_section::Merge_section_by_properties_map,
6959 Output_section::Output_section_data_by_input_section_map,
6960 Output_section::Relaxation_map): New types.
6961 (Output_section::relax_input_section): Rename method to
6962 Output_section::convert_input_sections_to_relaxed_sections and change
6963 interface to take a vector of relaxed section pointers.
6964 (Output_section::find_merge_section,
6965 Output_section::find_relaxed_input_section,
6966 Output_section::build_relaxation_map,
6967 Output_section::convert_input_sections_in_list_to_relaxed_sections):
6968 New method declarations.
6969 (Output_section::merge_section_map_
6970 Output_section::merge_section_by_properties_map_,
6971 Output_section::relaxed_input_section_map_,
6972 Output_section::is_relaxed_input_section_map_valid_,
6973 Output_section::generate_code_fills_at_write_): New data members.
6974 * script-sections.cc
6975 (Output_section_element_input::set_section_addresses): Call
6976 current_data_size and addralign methods of relaxed input sections.
6977 (Orphan_output_section::set_section_addresses): Call current_data_size
6978 and addralign methods of relaxed input sections.
6979 * symtab.cc (Symbol_table::compute_final_value): Extract template
6980 from the body of Symbol_table::sized_finalize_symbol.
6981 (Symbol_table::sized_finalized_symbol): Call
6982 Symbol_table::compute_final_value.
6983 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
6984 (Symbol_table::compute_final_value): New templated method declaration.
6985 * target.cc (Target::do_make_output_section): New method defintion.
6986 * target.h (Target::make_output_section): New method declaration.
6987 (Target::relax): Add more parameters for input objects, symbol table
6988 and layout. Adjust call to do_relax.
6989 (Target::do_make_output_section): New method declaration.
6990 (Target::do_relax): Add parameters for input objects, symbol table
6993 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6995 * pread.c: Include stdio.h.
6997 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6999 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
7002 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7004 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7005 Change read_shndx type to unsigned int.
7006 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
7008 (Sized_dwarf_line_info::read_line_mappings): Likewise.
7009 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
7010 Change read_shndx type to unsigned int.
7011 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
7013 (Sized_dwarf_line_info::read_line_mappings): Likewise.
7014 * layout.cc (Layout::create_symtab_sections): Cast the result of
7015 local_symcount * symsize to off_t in the gold_assert.
7017 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7019 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
7020 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
7022 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
7023 (Arm_relocate_functions::thm_abs5): New function.
7024 (Arm_relocate_functions::abs12): New function.
7025 (Arm_relocate_functions::abs16): New function.
7026 (Arm_relocate_functions::base_abs): New function.
7027 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
7028 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
7029 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
7031 (Scan::global): Likewise.
7032 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
7033 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
7034 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
7035 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
7038 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7040 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
7041 (Arm_relocate_functions::movt_prel): New function.
7042 (Arm_relocate_functions::thm_movw_prel_nc): New function.
7043 (Arm_relocate_functions::thm_movt_prel): New function.
7044 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
7045 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
7046 (Scan::global, Relocate::relocate): Likewise.
7047 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7049 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
7051 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
7052 Incremental_checker.
7053 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
7055 (class Incremental_inputs_header): New class.
7056 (Incremental_inputs_header_writer): Edit comment.
7057 (Incremental_inputs_entry): New class.
7058 (Incremental_inputs_entry_writer): Edit comment.
7059 (Sized_incremental_binary::do_find_incremental_inputs_section):
7060 Add *strtab_shndx parameter, fill it.
7061 (Sized_incremental_binary::do_check_inputs): New method.
7062 (Incremental_checker::can_incrementally_link_output_file): Use
7063 Sized_incremental_binary::check_inputs.
7064 (Incremental_inputs::report_command_line): Save command line in
7067 (Incremental_binary::find_incremental_inputs_section): New
7069 (Incremental_binary::do_find_incremental_inputs_section): Add
7070 strtab_shndx parameter.
7071 (Incremental_binary::do_check_inputs): New pure virtual method.
7072 (Sized_incremental_binary::do_check_inputs): Declare.
7073 (Incremental_checker::Incremental_checker): Add incremental_inputs
7074 parameter, use it to initialize incremental_inputs_.
7075 (Incremental_checker::incremental_inputs_): New field.
7076 (Incremental_checker::command_line): New method.
7077 (Incremental_checker::inputs): New method.
7078 (Incremental_checker::command_line_): New field.
7080 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
7082 * incremental.cc: Include <cstdarg> and "target-select.h".
7083 (vexplain_no_incremental): New function.
7084 (explain_no_incremental): New function.
7085 (Incremental_binary::error): New method.
7086 (Sized_incremental_binary::do_find_incremental_inputs_section): New
7088 (make_sized_incremental_binary): New function.
7089 (open_incremental_binary): New function.
7090 (can_incrementally_link_file): Add checks if output is ELF and has
7092 * incremental.h: Include "elfcpp_file.h" and "output.h".
7093 (Incremental_binary): New class.
7094 (Sized_incremental_binary): New class.
7095 (open_incremental_binary): Declare.
7096 * object.cc (is_elf_object): Use
7097 elfcpp::Elf_recognizer::is_elf_file.
7098 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
7099 * output.h (Output_file::filesize): New method.
7101 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7103 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
7105 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
7106 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
7108 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
7110 (Arm_relocate_functions::movw_abs_nc): New function.
7111 (Arm_relocate_functions::movt_abs): New function.
7112 (Arm_relocate_functions::thm_movw_abs_nc): New function.
7113 (Arm_relocate_functions::thm_movt_abs): New function.
7114 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
7115 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
7116 (Scan::global): Likewise.
7117 (Relocate::relocate): Likewise.
7118 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7120 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7122 * arm.cc (Arm_relocate_functions::got_prel) New function.
7123 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
7124 (Relocate::relocate): Likewise.
7125 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7127 2009-10-06 Ian Lance Taylor <iant@google.com>
7129 * options.h (class General_options): Define
7130 split_stack_adjust_size parameter.
7131 * object.h (class Object): Add uses_split_stack_ and
7132 has_no_split_stack_ fields. Add uses_split_stack and
7133 has_no_split_stack accessor functions. Declare
7134 handle_split_stack_section.
7135 (class Reloc_symbol_changes): Define.
7136 (class Sized_relobj): Define Function_offsets. Declare
7137 split_stack_adjust, split_stack_adjust_reltype, and
7139 * object.cc (Object::handle_split_stack_section): New function.
7140 (Sized_relobj::do_layout): Call handle_split_stack_section.
7141 * dynobj.cc (Sized_dynobj::do_layout): Call
7142 handle_split_stack_section.
7143 * reloc.cc (Sized_relobj::relocate_sections): Call
7144 split_stack_adjust for executable sections in split_stack
7145 objects. Pass reloc_map to relocate_section.
7146 (Sized_relobj::split_stack_adjust): New function.
7147 (Sized_relobj::split_stack_adjust_reltype): New function.
7148 (Sized_relobj::find_functions): New function.
7149 * target-reloc.h: Include "object.h".
7150 (relocate_section): Add reloc_symbol_changes parameter. Change
7152 * target.h (class Target): Add calls_non_split method. Declare
7153 do_calls_non_split virtual method. Declare match_view and
7155 * target.cc: Include "elfcpp.h".
7156 (Target::do_calls_non_split): New function.
7157 (Target::match_view): New function.
7158 (Target::set_view_to_nop): New function.
7159 * gold.cc (queue_middle_tasks): Give an error if mixing
7160 split-stack and non-split-stack objects with -r.
7161 * i386.cc (Target_i386::relocate_section): Add
7162 reloc_symbol_changes parameter.
7163 (Target_i386::do_calls_non_split): New function.
7164 * x86_64.cc (Target_x86_64::relocate_section): Add
7165 reloc_symbol_changes parameter.
7166 (Target_x86_64::do_calls_non_split): New function.
7167 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
7169 * powerpc.cc (Target_powerpc::relocate_section): Add
7170 reloc_symbol_changes parameter.
7171 * sparc.cc (Target_sparc::relocate_section): Add
7172 reloc_symbol_changes parameter.
7173 * configure.ac: Call AM_CONDITIONAL for the default target.
7174 * configure: Rebuild.
7175 * testsuite/Makefile.am (TEST_AS): New variable.
7176 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
7177 (check_DATA): Add split_i386 and split_x86_64 files.
7178 (SPLIT_DEFSYMS): Define.
7179 (split_i386_[1234n].o): New targets.
7180 (split_i386_[124]): New targets.
7181 (split_i386_[1234r].stdout): New targets.
7182 (split_x86_64_[1234n].o): New targets.
7183 (split_x86_64_[124]): New targets.
7184 (split_x86_64_[1234r].stdout): New targets.
7185 (MOSTLYCLEANFILES): Add new executables.
7186 * testsuite/split_i386.sh: New file.
7187 * testsuite/split_x86_64.sh: New file.
7188 * testsuite/split_i386_1.s: New file.
7189 * testsuite/split_i386_2.s: New file.
7190 * testsuite/split_i386_3.s: New file.
7191 * testsuite/split_i386_4.s: New file.
7192 * testsuite/split_i386_n.s: New file.
7193 * testsuite/split_x86_64_1.s: New file.
7194 * testsuite/split_x86_64_2.s: New file.
7195 * testsuite/split_x86_64_3.s: New file.
7196 * testsuite/split_x86_64_4.s: New file.
7197 * testsuite/split_x86_64_n.s: New file.
7198 * testsuite/testfile.cc (Target_test): Update relocation_section
7200 * testsuite/Makefile.in: Rebuild.
7202 2009-10-06 Ian Lance Taylor <iant@google.com>
7204 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
7205 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
7206 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
7207 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
7208 the address on ldo_addrs_.
7209 (Target_i386::Relocate::fix_up_ldo): New function.
7211 2009-10-06 Rafael Espindola <espindola@google.com>
7213 * plugin.cc (add_input_library): New.
7214 (Plugin::load): Add add_input_library to tv.
7215 (Plugin_manager::add_input_file): Add the is_lib argument.
7216 (add_input_file): Update call to Plugin_manager::add_input_file.
7217 (add_input_library): New.
7218 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
7220 2009-09-30 Doug Kwan <dougkwan@google.com>
7222 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
7223 symbol and call Symbol::may_need_copy_reloc to determine if
7224 a copy reloc is needed.
7225 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
7226 nocopyreloc is given in command line.
7227 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
7228 given in command line.
7229 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
7230 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
7231 of the removed Target_i386::may_need_copy_reloc.
7232 * options.h (copyreloc): New option with default value false.
7233 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
7234 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
7235 instead of the removed Target_powerpc::may_need_copy_reloc.
7236 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
7237 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
7238 instead of the removed Target_sparc::may_need_copy_reloc.
7239 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
7240 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
7241 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
7242 instead of the removed Target_x86_64::may_need_copy_reloc.
7244 2009-09-30 Ian Lance Taylor <iant@google.com>
7246 * object.h (class Object): Remove target_ field, and target,
7247 sized_target, and set_target methods.
7248 (Object::sized_target): Remove.
7249 (class Sized_relobj): Update declarations. Remove sized_target.
7250 * object.cc (Sized_relobj::setup): Remove target parameter.
7252 (Input_objects::add_object): Don't do anything with the target.
7253 (make_elf_sized_object): Add punconfigured parameter. Change all
7254 callers. Set or test parameter target.
7255 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
7257 * parameters.cc (Parameters::set_target): Change parameter type to
7259 (Parameters::default_target): Remove.
7260 (set_parameters_target): Change parameter type to be non-const.
7261 (parameters_force_valid_target): New function.
7262 (parameters_clear_target): New function.
7263 * parameters.h (class Parameters): Update declarations. Remove
7264 default_target method. Add sized_target and clear_target
7265 methods. Change target_ to be non-const.
7266 (set_parameters_target): Update declaration.
7267 (parameters_force_valid_target): Declare.
7268 (parameters_clear_target): Declare.
7269 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
7270 as NULL if we aren't searching.
7271 (Add_symbols::run): Don't check for compatible target.
7272 * fileread.cc (Input_file::open_binary): Call
7273 parameters_force_valid_target.
7274 * gold.cc (queue_middle_tasks): Likewise.
7275 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
7276 set_target on object.
7277 * dynobj.h (class Sized_dynobj): Update declarations.
7278 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
7279 make_elf_object returns NULL.
7280 (Archive::include_member): Don't check whether object target is
7282 * output.cc (Output_section::add_input_section): Get target from
7284 (Output_section::relax_input_section): Likewise.
7285 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
7287 (Sized_relobj::do_scan_relocs): Likewise.
7288 (Sized_relobj::relocate_sections): Likewise.
7289 * resolve.cc (Symbol_table::resolve): Likewise.
7290 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
7291 parameter. Change all callers.
7292 (Symbol_table::add_from_object): Get target from parameters.
7293 (Symbol_table::add_from_relobj): Don't check object target.
7294 (Symbol_table::add_from_dynobj): Likewise.
7295 (Symbol_table::define_special_symbol): Get target from
7297 * symtab.h (class Symbol_table): Update declaration.
7298 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
7299 parameter. Change all callers. Clear parameter target.
7300 (Binary_test): Test target here.
7301 * testsuite/object_unittest.cc (gold_testsuite): Remove
7302 target_test_pointer parameter. Change all callers.
7303 (Object_test): Test target here.
7305 2009-09-26 Ian Lance Taylor <iant@google.com>
7307 * testsuite/initpri1.c: Don't try to use constructor priorities if
7308 compiling with gcc before 4.3.
7310 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
7312 * testsuite/retain_symbols_file_test.sh (check_present): Change
7313 output file name to retain_symbols_file_test.stdout.
7314 (check_absent): Likewise.
7316 2009-09-18 Craig Silverstein <csilvers@google.com>
7318 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
7319 * options.cc: Include <cerrno> and <fstream>.
7320 (General_options::finalize): Parse -retain-symbols-file tag.
7321 * options.h: New flag.
7322 (General_options): New method should_retain_symbol, new
7323 variable symbols_to_retain.
7324 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
7325 should_retain_symbol map.
7326 * testsuite/Makefile.am (retain_symbols_file_test): New test.
7327 * testsuite/Makefile.in: Regenerate.
7328 * testsuite/retain_symbols_file_test.sh: New file.
7330 2009-09-18 Nick Clifton <nickc@redhat.com>
7332 * po/es.po: Updated Spanish translation.
7334 2009-09-17 Doug Kwan <dougkwan@google.com>
7336 * debug.h (DEBUG_RELAXATION): New constant.
7337 (DEBUG_ALL): Add DEBUG_RELAXATION.
7338 (debug_string_to_enum): Add relaxation debug option.
7340 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
7341 Layout::Relaxation_debug_check::read_sections,
7342 Layout::Relaxation_debug_check::read_sections): New method definitions.
7343 (Layout::Layout): Initialize data members
7344 record_output_section_data_from_scrips_,
7345 script_output_section_data_list_ and relaxation_debug_check_.
7346 (Layout::save_segments, Layout::restore_segments,
7347 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7348 Layout::relaxation_loop_body): New method definitions.
7349 (Layout::finalize): Support relaxation. Move section layout code to
7350 Layout::relaxation_loop_body.
7351 (Layout::set_asection_address_from_script): Move code for orphan
7352 section placement out.
7353 (Layout::place_orphan_sections_in_script): New method definition.
7354 * layout.h (Output_segment_headers, Output_file_header):
7355 New forward class declarations.
7356 (Layout::~Layout): Define.
7357 (Layout::new_output_section_data_from_script): New method definition.
7358 (Layout::place_orphan_sections_in_script): New method declaration.
7359 (Layout::Segment_states): New type declaration.
7360 (Layout::save_segments, Layout::restore_segments,
7361 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7362 Layout::relaxation_loop_body): New method declarations.
7363 (Layout::Output_section_data_list): New type declaration.
7364 (Layout::Relaxation_debug_check): New class definition.
7365 (Layout::record_output_section_data_from_script_,
7366 Layout::script_output_section_data_list_, Layout::segment_states_,
7367 Layout::relaxation_debug_check_): New data members.
7368 * output.cc: (Output_section_headers::do_size): New method definition.
7369 (Output_section_headers::Output_section_headers): Move size
7370 computation to Output_section_headers::do_size.
7371 (Output_segment_headers::do_size): New method definition.
7372 (Output_file_header::Output_file_header): Move size computation to
7373 Output_file_header::do_size and call it.
7374 (Output_file_header::do_size): New method definition.
7375 (Output_data_group::Output_data_group): Adjust call to
7376 Output_section_data.
7377 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
7378 (Output_symtab_xindex::do_write): Add array bound check.
7379 (Output_section::Input_section::print_to_mapfile): Handle
7380 RELAXED_INPUT_SECTION_CODE.
7381 (Output_section::Output_section): Initialize data member checkpoint_.
7382 (Output_section::~Output_section): Delete checkpoint object pointed
7384 (Output_section::add_input_section): Always add an Input_section if
7386 (Output_section::add_merge_input_section): Add assert.
7387 (Output_section::relax_input_section): New method definition.
7388 (Output_section::set_final_data_size): Set load address to zero for
7389 an unallocated section.
7390 (Output_section::do_address_and_file_offset_have_reset_values):
7391 New method definition.
7392 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
7393 Handle relaxed input section.
7394 (Output_section::sort_attached_input_sections): Checkpoint input
7395 section list lazily.
7396 (Output_section::get_input_sections): Change type of input_sections to
7397 list of Simple_input_section pointers. Checkpoint input section list
7398 lazily. Also handle relaxed input sections.
7399 (Output_section::add_input_section_for_script): Take a reference to
7400 a Simple_input_section object instead of Relobj pointer and section
7401 index as parameter. Handle relaxed input sections.
7402 (Output_section::save_states, Output_section::restore_states): New
7404 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
7405 (Output_data::is_data_size_fixed): New method definition.
7406 (Output_data::reset_addresss_and_file_offset): Do not reset data size
7408 (Output_data::address_and_file_offset_have_reset_values): New method
7410 (Output_data::do_address_and_file_offset_have_reset_values): New method
7412 (Output_data::set_data_size): Check that data size is not fixed.
7413 (Output_data::fix_data_size): New method definition.
7414 (Output_data::is_data_size_fixed_): New data member.
7415 (Output_section_headers::set_final_data_size): New method definition.
7416 (Output_section_headers::do_size): New method declaration.
7417 (Output_segment_headers::set_final_data_size): New method definition.
7418 (Output_segment_headers::do_size): New method declaration.
7419 (Output_file_header::set_final_data_size)::New method definition.
7420 (Output_file_header::do_size)::New method declaration.
7421 (Output_section_data::Output_section_data): Add new parameter
7422 is_data_size_fixed and use it to fix data size.
7423 (Output_data_const::Output_data_const): Adjust call to base class
7424 constructor and fix data size.
7425 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
7426 base class constructor and fix data size.
7427 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
7428 base class constructor and fix data size.
7429 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
7430 class constructor and fix data size.
7431 (Output_data_group::set_final_data_size): New method definition.
7432 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
7433 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
7434 class constructor and fix data size.
7435 (Output_relaxed_input_section): New class definition.
7436 (Output_section::Simple_input_section): New class definition.
7437 (Output_section::get_input_sections): Adjust parameter list.
7438 (Output_section::add_input_section_for_script): Same.
7439 (Output_section::save_states, Output_section::restore_states,
7440 Output_section::do_address_and_file_offset_have_reset_values,
7441 (Output_section::Input_section::Input_section): Handle
7442 RELAXED_INPUT_SECTION_CODE. Add new overload for
7443 Output_relaxed_input_section.
7444 (Output_section::Input_section::is_input_section,
7445 Output_section::Input_section::set_output_section): Handle relaxed
7447 (Output_section::Input_section::is_relaxed_input_section,
7448 Output_section::Input_section::output_section_data,
7449 Output_section::Input_section::relaxed_input_section): New method
7451 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
7453 (Output_section::Input_section::u1_): Update comments.
7454 (Output_section::Input_section::u2_): Add new union member poris.
7455 (Output_section::Checkpoint_output_section): New classs definition.
7456 (Output_section::relax_input_section): New method declaration.
7457 (Output_section::checkpoint_): New data member.
7458 (Output_segment): Update comments.
7459 (Output_segment::Output_segment): Un-privatize copy constructor.
7460 (Output_segment::operator=): Un-privatize.
7461 * script-sections.cc (Output_section_element::Input_section_list):
7462 Change element type to Output_section::Simple_input_section.
7463 (Output_section_element_dot_assignment::set_section_addresses):
7464 Register output section data for relaxation clean up.
7465 (Output_data_exression::Output_data_expression): Adjust call to base
7466 constructor to fix data size.
7467 (Output_section_element_data::set_section_addresses): Register
7468 Output_data_expression object for relaxation clean up.
7469 (struct Input_section_info): Replace Relobj pointer and section index
7470 pair with Output_section::Simple_input_section and Convert struct to a
7472 (Input_section_sorter::operator()): Adjust access to
7473 Input_section_info data member to use accessors.
7474 (Output_section_element_input::set_section_addresses): Use layout
7475 parameter. Adjust code to use Output_section::Simple_input_section
7476 and Input_secction_info classes. Register filler for relaxation
7478 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
7479 and section index pair with Output_section::Simple_input_section
7480 class. Adjust code accordingly.
7481 (Phdrs_element::release_segment): New method definition.
7482 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
7484 (Script_sections::release_segments): New method definition.
7485 * gold/script-sections.h (Script_sections::release_segments): New
7487 * gold/target.h (Target::may_relax, Target::relax,
7488 Target::do_may_relax, Target::do_relax): New method definitions.
7490 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7492 * arm.cc (has_signed_unsigned_overflow): New function.
7493 (Arm_relocate_functions::abs8): New function.
7494 (Target_arm::Scan::local): Handle R_ARM_ABS8.
7495 (Target_arm::Scan::global): Likewise.
7496 (Target_arm::relocate::relocate): Likewise.
7497 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7500 2009-09-16 Cary Coutant <ccoutant@google.com>
7502 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
7503 * testsuite/Makefile.in: Regenerate.
7505 2009-09-11 Nick Clifton <nickc@redhat.com>
7507 * po/gold.pot: Updated by the Translation project.
7509 2009-09-08 Cary Coutant <ccoutant@google.com>
7511 * output.cc (Output_file::open): Add execute permission to empty file.
7512 * testsuite/Makefile.am (permission_test): New test.
7513 * testsuite/Makefile.in: Regenerate.
7515 2009-09-02 Ian Lance Taylor <iant@google.com>
7517 * output.cc (Output_file::resize): Call map_no_anonymous rather
7520 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
7522 * gold.cc: Include "incremental.h".
7523 (queue_initial_tasks): Call Incremental_checker methods.
7524 * incremental.cc: Include "output.h".
7525 (Incremental_checker::can_incrementally_link_output_file): New
7527 * incremental.h (Incremental_checker): New class.
7529 * output.cc (Output_file::open_for_modification): New method.
7530 (Output_file::map_anonymous): Changed return type to bool. Record
7532 (Output_file::map_no_anonymous): New method, broken out of map.
7533 (Output_file::map): Use map_no_anonymous and map_anonymous.
7534 * output.h (class Output_file): Update declarations.
7536 2009-08-24 Cary Coutant <ccoutant@google.com>
7538 * options.h (Command_line::Pre_options): New class.
7539 (Command_line::pre_options): New member.
7540 * options.cc (gold::options::ready_to_register): New variable.
7541 (One_option::register_option): Do nothing if not registering options.
7542 Assert if same short option registered twice.
7543 (General_options::General_options): Turn off option registration when
7545 (Command_line::Pre_options::Pre_options): New constructor.
7547 2009-08-24 Cary Coutant <ccoutant@google.com>
7549 * options.h (General_options::no_keep_memory): Remove incorrect
7552 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7554 * Makefile.am (am__skiplex, am__skipyacc): New.
7555 * Makefile.in: Regenerate.
7557 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7559 * Makefile.am (AM_CPPFLAGS): Renamed from ...
7560 (INCLUDES): ... this.
7561 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
7562 (AM_CPPFLAGS): Renamed from ...
7563 (INCLUDE): ... this.
7564 * Makefile.in, testsuite/Makefile.in: Regenerate.
7566 * Makefile.in: Regenerate.
7567 * aclocal.m4: Likewise.
7568 * config.in: Likewise.
7569 * configure: Likewise.
7570 * testsuite/Makefile.in: Likewise.
7572 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7573 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7574 * Makefile.in: Regenerate.
7575 * testsuite/Makefile.in: Regenerate.
7577 2009-08-19 Cary Coutant <ccoutant@google.com>
7579 * resolve.cc (Symbol_table::resolve): Don't complain about defined
7580 symbols in shared libraries overridden by hidden or internal symbols
7581 in the main program.
7583 2009-08-19 Chris Demetriou <cgd@google.com>
7585 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
7586 checking source file names in error messages.
7588 2009-08-18 Doug Kwan <dougkwan@google.com>
7590 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
7591 an elcpp::Ehdr as parameter. Adjust call to set_target.
7592 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
7593 an elfcpp::Ehdr as parameter.
7594 * object.cc (Object::set_target): Remove the version that looks up
7595 a target and sets it.
7596 (Sized_relobj::setup): Take a Target object instead of
7597 an elfcpp::Ehdr as parameter. Adjust call to set_target.
7598 (make_elf_sized_object): Find target and ask target to
7600 * object.h: (Object::set_target): Remove the version that looks up
7601 a target and sets it.
7602 (Sized_relobj::setup): Take a Target object instead of
7603 an elfcpp:Ehdr as parameter.
7604 * target.cc: Include dynobj.h.
7605 (Target::do_make_elf_object_implementation): New.
7606 (Target::do_make_elf_object): New.
7607 * target.h (Target::make_elf_object): New template declaration.
7608 (Target::do_make_elf_object): New method declarations.
7609 (Target::do_make_elf_object_implementation): New template declaration.
7611 2009-08-14 Ian Lance Taylor <iant@google.com>
7613 * gold.h (FUNCTION_NAME): Define.
7614 (gold_unreachable): Use FUNCTION_NAME.
7616 2009-08-12 Sriraman Tallam <tmsriram@google.com>
7618 * icf.cc (Icf::find_identical_sections): Issue a warning when a
7619 symbol in the --keep-unique list is not found.
7621 2009-08-12 Sriraman Tallam <tmsriram@google.com>
7623 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
7624 been maked as --keep-unique.
7625 (Icf::unfold_section): New function.
7626 * icf.h (Icf::unfold_section): New function.
7627 * options.h (General_options::keep_unique): New option.
7628 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
7629 * testsuite/Makefile.in: Regenerate.
7630 * testsuite/icf_keep_unique_test.sh: New file.
7631 * testsuite/icf_keep_unique_test.cc: New file.
7633 2009-08-12 Cary Coutant <ccoutant@google.com>
7636 * resolve.cc (Symbol_table::resolve): Check for references from
7637 dynamic objects to hidden and internal symbols.
7638 * testsuite/Makefile.am (hidden_test.sh): New test.
7639 * testsuite/Makefile.in: Regenerate.
7640 * testsuite/hidden_test.sh: New script.
7641 * testsuite/hidden_test_1.c: New test source.
7642 * testsuite/hidden_test_main.c: New test source.
7644 2009-08-11 Doug Kwan <dougkwan@google.com>
7646 * arm.cc: Update comments.
7647 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
7648 segment to locate the .ARM.exidx section if present.
7650 2009-08-09 Doug Kwan <dougkwan@google.com>
7652 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
7655 2009-08-07 Sriraman Tallam <tmsriram@google.com>
7656 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
7659 2009-08-06 Sriraman Tallam <tmsriram@google.com>
7661 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
7662 valid tls_segment only for non-debug-section relocations.
7663 * testsuite/Makefile.am: Add gc_tls_test.
7664 * testsuite/Makefile.in: Regenerate.
7665 * testsuite/gc_tls_test.cc: New file.
7666 * testsuite/gc_tls_test.sh: New file.
7668 2009-08-05 Sriraman Tallam <tmsriram@google.com>
7672 * Makefile.am (CCFILES): Add icf.cc.
7674 * Makefile.in: Regenerate.
7675 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
7676 * gc.h (gc_process_relocs): Populate lists used by icf to contain
7677 section, symbol and addend information for the relocs.
7678 * gold.cc (queue_middle_tasks): Call identical code folding.
7679 * gold.h: Add defines for multimap.
7680 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
7681 to the call of finalize_local_symbols.
7682 * main.cc (main): Create object of class Icf.
7683 * object.cc (Sized_relobj::do_layout): Allow this function to be
7684 called twice during icf.
7685 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
7686 to sections marked as identical by icf.
7687 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
7689 (Sized_relobj::do_section_entsize): New function.
7690 * object.h (Object::section_entsize): New function.
7691 (Object::do_section_entsize): New pure virtual function.
7692 (Relobj::finalize_local_symbols): Add new parameter.
7693 (Relobj::do_section_entsize): New function.
7694 * options.h (General_options::icf): New option.
7695 (General_options::icf_iterations): New option.
7696 (General_options::print_icf_sections): New option.
7697 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
7698 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
7699 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
7701 * symtab.cc (Symbol_table::is_section_folded): New function.
7702 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
7703 to sections marked as identical by icf.
7704 * symtab.h (Symbol_table::set_icf): New function.
7705 (Symbol_table::icf): New function.
7706 (Symbol_table::is_section_folded): New function.
7707 (Symbol_table::icf_): New data member.
7708 * target-reloc.h (relocate_section): Ignore sections folded by icf.
7709 * testsuite/Makefile.am: Add commands to build icf_test.
7710 * testsuite/Makefile.in: Regenerate.
7711 * testsuite/icf_test.sh: New file.
7712 * testsuite/icf_test.cc: New file.
7714 2009-07-24 Chris Demetriou <cgd@google.com>
7716 * layout.cc (is_compressible_debug_section): Fix incorrect
7717 comment about compressed section names.
7719 2009-07-20 Ian Lance Taylor <ian@airs.com>
7722 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
7724 2009-07-16 Ian Lance Taylor <iant@google.com>
7727 * layout.h: #include <map>.
7728 (class Kept_section): Change from struct to class. Add accessors
7729 and setters. Add section size to Comdat_group mapping. Change
7730 Comdat_group to std::map. Add is_comdat_ field. Add
7731 linkonce_size field in union.
7732 (class Layout): Update declaration of find_or_add_kept_section.
7733 Don't declare find_kept_object.
7734 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
7735 parameter. Add object, shndx, is_comdat, and is_group_name
7736 parameters. Change all callers. Adjust for new Kept_section.
7737 (Layout::find_kept_object): Remove.
7738 * object.cc (Sized_relobj::include_section_group): Update use of
7739 Kept_section. Rename secnum to shndx. Only record
7740 Kept_comdat_section if sections are the same size.
7741 (Sized_relobj::include_linkonce_section): Update use of
7742 Kept_section. Only record Kept_comdat_section if sections are the
7743 same size. Set size of linkonce section.
7744 (Sized_relobj::map_to_kept_section): Update call to
7745 get_kept_comdat_section.
7746 * object.h (class Sized_relobj): Rename fields in
7747 Kept_comdat_section to drop trailing underscores; change object
7748 field to Relobj*. Change Kept_comdat_section_table to store
7749 struct rather than pointer.
7750 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
7751 Add kept_object and kept_shndx parameters. Change all callers.
7752 (Sized_relobj::get_kept_comdat_section): Change return type to
7753 bool. Add kept_object and kept_shndx parameters. Change all
7755 * plugin.cc (Pluginobj::include_comdat_group): Update call to
7756 Layout::find_or_add_kept_section.
7758 2009-07-09 Ian Lance Taylor <iant@google.com>
7760 * merge.cc (Object_merge_map::initialize_input_to_output_map):
7761 Reserve space in the hash table.
7763 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
7765 * fileread.cc (File_read::get_mtime): New method.
7766 * fileread.h (Timespec): New structure.
7767 (File_read::get_mtime): New method.
7768 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
7769 Renamed from timestamp_nsec.
7770 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
7772 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
7774 (Incremental_inputs::report_archive): Save mtime; style fix.
7775 (Incremental_inputs::report_obejct): Save mtime; style fix.
7776 (Incremental_inputs::report_script): Save mtime; style fix.
7777 (Incremental_inputs::finalize_inputs): Style fix.
7778 (Incremental_inputs::finalize): Style fix.
7779 (Incremental_inputs::create_input_section_data): Store inputs
7781 * incremental.h (Incremental_inputs::report_script): Add mtime
7783 (Incremental_inputs::Input_info::Input_info): Intialize only one
7785 (Incremental_inputs::Input_info::archive): Move to nameless
7787 (Incremental_inputs::Input_info::obejct): Move to nameless union.
7788 (Incremental_inputs::Input_info::script): Move to nameless union.
7789 (Incremental_inputs::mtime): New field.
7790 * script.cc (read_input_script): Pass file mtime to
7792 * script.h (Script_info::inputs): Style fix.
7794 2009-07-01 Ian Lance Taylor <ian@airs.com>
7796 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
7799 2009-06-24 Ian Lance Taylor <iant@google.com>
7802 * layout.cc (Layout::choose_output_section): If we find an
7803 existing section, update the flags.
7804 (Layout::create_notes): New function, broken out of
7806 (Layout::finalize): Don't create note sections.
7807 (Layout::create_note): Don't crash if linker script discards
7809 (Layout::create_gold_note): Likewise.
7810 (Layout::create_build_id): Likewise. Don't set
7811 after_input_sections on the section.
7812 (Layout::create_executable_stack_info): Remove target parameter.
7814 * layout.h (class Layout): Declare create_notes. Update
7815 declaration of create_executable_stack_info.
7816 * gold.cc (queue_middle_tasks): Call create_notes.
7817 * output.cc (Output_section::update_flags_for_input_section): Move
7818 here from output.h. If SHF_ALLOC flag is newly set, mark address
7820 * output.h (Output_data::mark_address_invalid): New function.
7821 (class Output_section): Only declare, not define,
7822 update_flags_for_input_section. Remove set_flags.
7824 2009-06-24 Ian Lance Taylor <iant@google.com>
7826 * script-sections.cc (Output_section_definition::
7827 set_section_addresses): Rename shadowing local load_address to
7830 2009-06-24 Ian Lance Taylor <iant@google.com>
7833 * reloc.cc (relocate_sections): Skip empty relocation sections.
7835 2009-06-23 Ian Lance Taylor <iant@google.com>
7838 * layout.cc (Layout::create_note): Use choose_output_section
7839 rather than make_output_section.
7841 2009-06-23 Ian Lance Taylor <iant@google.com>
7844 * options.cc (General_options::parse_V): Set printed_version_.
7845 (General_options::General_options): Initialize printed_version_.
7846 * options.h (class General_options): Add printed_version_ field.
7847 * gold.cc (queue_initial_tasks): If there are no input files,
7848 don't give a fatal error if we printed the version information.
7849 (queue_middle_tasks): If using -r with a shared object, give a
7850 fatal error rather than an ordinary error.
7852 2009-06-23 Ian Lance Taylor <iant@google.com>
7855 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
7856 (Layout::make_output_section): Set have_stabstr_section_ if we see
7857 a .stab*str section.
7858 (Layout::finalize): Call link_stabs_sections.
7859 (Layout::link_stabs_sections): New file.
7860 * layout.h (class Layout): Add have_stabstr_section_ field.
7861 Declare link_stabs_sections.
7863 2009-06-23 Doug Kwan <dougkwan@google.com>
7865 * Makefile.am (libgold_a_LIBADD): New.
7866 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
7867 * Makefile.in: Regenerate.
7868 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
7869 * configure: Regenerate.
7870 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
7871 * fileread.cc: Include sys/state.h
7872 * gold.h: Declare memmem and strndup if found missing.
7873 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
7875 2009-06-23 Ian Lance Taylor <iant@google.com>
7877 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
7878 * configure: Rebuild.
7880 2009-06-23 Ian Lance Taylor <iant@google.com>
7883 * object.cc (Object::section_contents): Don't try to get a view if
7884 the section has length zero.
7885 (Object::handle_gnu_warning_section): If the section is empty, use
7886 the name of the section as the warning.
7888 2009-06-23 Ian Lance Taylor <iant@google.com>
7891 * stringpool.h (class Stringpool_template): Add optimize_ field.
7892 (Stringpool_template::set_optimize): New function.
7893 * stringpool.cc (Stringpool_template::Stringpool_template):
7894 Initialize optimize_ field.
7895 (Stringpool_template::set_string_offsets): Test local optimize
7896 fild rather than parameter.
7897 * layout.cc (Layout::Layout): Call set_optimize on the section
7900 2009-06-22 Ian Lance Taylor <iant@google.com>
7903 * yyscript.y: Parse TARGET.
7904 * script.cc (script_set_target): New function.
7905 * script-c.h (script_set_target): Declare.
7906 * options.cc (General_options::string_to_object_format): Rename
7907 from string_to_object_format in anonymous namespace. Change
7909 * options.h (class General_options): Declare
7910 string_to_object_format.
7912 2009-06-22 Ian Lance Taylor <iant@google.com>
7914 * script-sections.cc (Script_sections::create_segments): Don't put
7915 program headers in a PT_LOAD segment if -n or -N.
7917 2009-06-22 Ian Lance Taylor <iant@google.com>
7920 * options.h (class General_options): Add -z lazy and -z now. Sort
7921 -z options into alphabetical order.
7922 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
7924 2009-06-21 Ian Lance Taylor <iant@google.com>
7926 * layout.cc (Layout::make_output_section): Call
7927 Target::new_output_section.
7928 (Layout::attach_allocated_section_to_segment): Put large section
7929 sections in a separate load segment with the large segment flag
7931 (Layout::segment_precedes): Sort large data segments after other
7933 (align_file_offset): New static function.
7934 (Layout::set_segment_offsets): Use align_file_offset.
7935 * output.h (class Output_section): Add is_small_section_ and
7936 is_large_section_ fields.
7937 (Output_section::is_small_section): New function.
7938 (Output_section::set_is_small_section): New function.
7939 (Output_section::is_large_section): New function.
7940 (Output_section::set_is_large_section): New function.
7941 (Output_section::is_large_data_section): New function.
7942 (class Output_segment): Add is_large_data_segment_ field.
7943 (Output_segment::is_large_data_segment): New function.
7944 (Output_segment::set_is_large_data_segment): New function.
7945 * output.cc (Output_section::Output_section): Initialize new
7947 (Output_segment::Output_segment): Likewise.
7948 (Output_segment::add_output_section): Add assertion that large
7949 data sections always go in large data segments. Force small data
7950 sections to the end of the list of data sections. Force small BSS
7951 sections to the start of the list of BSS sections. For large BSS
7952 sections to the end of the list of BSS sections.
7953 * symtab.h (class Symbol): Declare is_common_shndx.
7954 (Symbol::is_defined): Check Symbol::is_common_shndx.
7955 (Symbol::is_common): Likewise.
7956 (class Symbol_table): Define enum Commons_section_type. Update
7957 declarations. Add small_commons_ and large_commons_ fields.
7958 * symtab.cc (Symbol::is_common_shndx): New function.
7959 (Symbol_table::Symbol_table): Initialize new fields.
7960 (Symbol_table::add_from_object): Put small and large common
7961 symbols in the right list.
7962 (Symbol_table::sized_finalized_symbol): Check
7963 Symbol::is_common_shndx.
7964 (Symbol_table::sized_write_globals): Likewise.
7965 * common.cc (Symbol_table::do_allocate_commons): Allocate new
7966 common symbol lists. Don't call do_allocate_commons_list if the
7968 (Symbol_table::do_allocate_commons_list): Remove is_tls
7969 parameter. Add comons_section_type parameter. Change all
7970 callers. Handle small and large common symbols.
7971 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
7972 Symbol::is_common_shndx.
7973 * resolve.cc (symbol_to_bits): Likewise.
7974 * target.h (Target::small_common_shndx): New function.
7975 (Target::small_common_section_flags): New function.
7976 (Target::large_common_shndx): New function.
7977 (Target::large_common_section_flags): New function.
7978 (Target::new_output_section): New function.
7979 (Target::Target_info): Add small_common_shndx, large_common_shndx,
7980 small_common_section_flags, and large_common_section_flags
7982 (Target::do_new_output_section): New virtual function.
7983 * arm.cc (Target_arm::arm_info): Initialize new fields.
7984 * i386.cc (Target_i386::i386_info): Likewise.
7985 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
7987 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
7988 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
7989 (Target_x86_64::do_new_output_section): New function.
7990 * configure.ac: Define conditional MCMODEL_MEDIUM.
7991 * testsuite/Makefile.am (check_PROGRAMS): Add large.
7992 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
7993 (large_LDFLAGS): Define.
7994 * testsuite/large.c: New file.
7995 * testsuite/testfile.cc (Target_test::test_target_info):
7996 Initialize new fields.
7997 * configure, testsuite/Makefile.in: Rebuild.
7999 2009-06-05 Doug Kwan <dougkwan@google.com>
8001 * Makefile.am (CCFILES): Add target.cc.
8002 * Makefile.in: Regenerate.
8003 * i386.cc (class Target_i386): Define new virtual method to
8004 override do_is_local_label_name in parent.
8005 * object.cc (Sized_relobj::do_count_local_symbols): Discard
8006 local symbols if --discard-locals or -X is given.
8007 * options.h (class General_options): Declare new options
8008 '--discard-locals' and '-X' for discarding locals.
8009 * target.h (class Target): Define new methods is_local_label_name.
8010 Declare new virtual method do_is_local_label_name.
8011 * target.cc: New file.
8012 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
8013 (check_SCRIPTS): Add discard_locals_test.sh.
8014 (check_DATA): Add discard_local_tests.syms.
8015 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
8016 (discard_local_tests.syms, discard_locals_test.o): New make rules.
8017 * testsuite/Makefile.in: Regenerate.
8018 * testsuite/discard_locals_test.c: New file.
8019 * testsuite/discard_locals_test.sh: Same.
8021 2009-06-05 Doug Kwan <dougkwan@google.com>
8023 * object.cc (Sized_relobj::Sized_relobj): Initialize
8024 discarded_eh_frame_shndx_ to -1U.
8025 (Sized_relobj::do_layout): Record index of a discard .eh_frame
8027 (Sized_relobj::do_count_local_symbols): Skip local symbols in
8028 a discarded .eh_frame section.
8029 (Sized_relobj::do_finalize_local_symbols): Ditto.
8030 * object.h (class Sized_relobj): Declare new member
8031 discarded_eh_frame_shndx_.
8032 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
8033 (local_labels_test.o, local_labels_test): New rules.
8034 * testsuite/Makefile.in: Regenerate.
8036 2009-06-04 Doug Kwan <dougkwan@google.com>
8038 * layout.cc (Layout::section_name_mapping): Add mapping for
8039 special ARM sections.
8041 2009-06-03 Doug Kwan <dougkwan@google.com>
8043 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
8044 (utils::has_overflow): Same.
8046 2009-06-03 Ian Lance Taylor <iant@google.com>
8048 * layout.cc (Layout::section_name_mapping): New array, replacing
8049 Layout::linkonce_mapping.
8050 (Layout::section_name_mapping_count): New variable, replacing
8051 Layout::linkonce_mapping_count.
8052 (Layout::linkonce_output_name): Remove.
8053 (Layout::output_section_name): Rewrite.
8054 * layout.h (class Layout): Rename Linkonce_mapping to
8055 Section_name_mapping, linkonce_mapping to section_name_mapping,
8056 linkonce_mapping_count to section_name_mapping_count. Don't
8057 declare linkonce_output_name.
8059 2009-06-03 Doug Kwan <dougkwan@google.com>
8061 * gold/arm.cc (namespace utils): New.
8062 (Target_arm::reloc_is_non_pic): Define new method.
8063 (class Arm_relocate_functions): New.
8064 (Target_arm::Relocate::relocate): Handle relocation types used by
8067 2009-06-03 Ian Lance Taylor <iant@google.com>
8069 * arm.cc (Target_arm::scan::global): Use || instead of |.
8071 2009-06-02 Doug Kwan <dougkwan@google.com>
8073 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
8074 issued_non_pic_error_.
8075 (class Target_arm::Scan): Declare new method check_non_pic.
8076 Define new method symbol_needs_plt_entry.
8077 Declare new data member issued_non_pic_error_.
8078 (class Target_arm::Relocate): Declare new method
8079 should_apply_static_reloc.
8080 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
8081 (Target_arm::Scan::check_non_pic): Define new method.
8082 (Target_arm::Scan::local): Handle a small subset of reloc types used
8084 (Target_arm::Scan::local): Same.
8085 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
8087 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
8089 * incremental.cc (Incremental_inputs::report_command_line): Filter
8090 out --incremental-* options.
8092 2009-05-29 Doug Kwan <dougkwan@google.com>
8094 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
8096 (class Target_arm): Update comment.
8097 (Target_arm::Target_arm): Initialize new data members GOT_,
8098 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
8099 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
8100 and Target_arm::rel_dyn_section.
8101 Declare new_enum Target_arm::Got_type.
8102 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
8104 Update commments for member do_dynsym_value.
8105 (Target_arm::got_size, Target_arm::plt_section,
8106 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
8107 new methods inside class defintion.
8108 (Target_arm::got_section): Define new method.
8109 (Target_arm::rel_dyn_section): Same.
8110 (Output_data_plt_arm): New template class.
8111 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
8112 (Output_data_plt_arm:do_adjust_output_section): Define new method.
8113 (Output_data_plt_arm::add_entry): Same.
8114 (Output_data_plt_arm::first_plt_entry): Define new
8115 static data member for PLT instruction template.
8116 (Output_data_plt_arm::plt_entry): Same.
8117 (Output_data_plt_arm::do_write): Define new method.
8118 (Target_arm::make_plt_entry): Same.
8119 (Target_arm::do_finalize_sections): Same.
8120 (Target_arm::do_dynsym_value): Same.
8122 2009-05-28 Doug Kwan <dougkwan@google.com>
8124 * Makefile.am (TARGETSOURCES): Add arm.cc.
8125 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
8126 * Makefile.in: Regenerate.
8128 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
8130 2009-05-26 Doug Kwan <dougkwan@google.com>
8132 * options.cc (General_options::parse_exclude_libs). Fix a comment.
8133 (General_options::check_excluded_libs): Strip off directories in
8134 archive name before matching like GNU ld does.
8135 * testsuite/Makefile.am (MOSTLYCLEANFILES,
8136 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
8137 (exclude_libs_test_LDFLAGS): Add linker option
8138 -Wl,--exclude-libs,libexclude_libs_test_3
8139 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
8140 an explicit archive without using -l.
8141 (alt/libexclude_libs_test_3.a): New make rule.
8142 * testsuite/Makefile.in: Regenerate.
8143 * testsuite/exclude_libs_test.c : Declare lib3_default().
8145 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
8146 * exclude_libs_test_3.c: New file.
8148 2009-05-26 Nick Clifton <nickc@redhat.com>
8150 * po/id.po: New Indonesian translation.
8151 * po/gold.pot: Updated template file.
8153 2009-05-22 Sriraman Tallam <tmsriram@google.com>
8155 * testsuite/Makefile.am: Add -ffunction-sections to compile
8156 gc_comdat_test files. Add -Wl,--gc-sections to build
8158 * testsuite/Makefile.in: Regenerate.
8159 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
8161 2009-05-21 Sriraman Tallam <tmsriram@google.com>
8163 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
8164 kept comdat section was garbage collected.
8165 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
8166 * testsuite/Makefile.in: Regenerate.
8167 * testsuite/gc_comdat_test.sh: New file.
8168 * testsuite/gc_comdat_test_1.cc: New file.
8169 * testsuite/gc_comdat_test_2.cc: New file.
8171 2009-05-19 Doug Kwan <dougkwan@google.com>
8173 * archive.cc (Archive::Archive): Move constructor from archive.h
8174 to here. Initialize no_export_.
8175 (Archive::get_elf_object_for_member): Set no_export flag of object.
8176 * archive.h (Archive::Archive): Move constructor body to
8178 (Archive::no_export): New method.
8179 (Archive::no_export_): New field.
8180 * object.h (Object::Object): Initialize no_export_ to false.
8181 (Object::no_export, Object::set_no_export): New methods.
8182 (Object::no_export_): New field.
8183 * options.cc (General_options::parse_exclude_libs): New method.
8184 (General_options::check_excluded_libs) Same.
8185 * options.h (exclude_libs): New option.
8186 (General_options::check_excluded_libs): New method declaration.
8187 (General_options::excluded_libs_): New field.
8188 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
8189 default or protected visibility if an object has no-export flag set.
8190 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
8191 (check_SCRIPTS): Add exclude_libs_test.sh.
8192 (check_DATA): Add exclude_libs_test.syms.
8193 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
8194 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
8195 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
8196 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
8197 (exclude_libs_test.syms, libexclude_libs_test_1.a,
8198 libexclude_libs_test_2.a): New rules.
8199 * testsuite/Makefile.in: Regenerate.
8200 * testsuite/exclude_libs_test.c: New file.
8201 * testsuite/exclude_libs_test.sh: Ditto.
8202 * testsuite/exclude_libs_test_1.c: Ditto.
8203 * testsuite/exclude_libs_test_2.c: Ditto.
8205 2009-05-15 Ian Lance Taylor <iant@google.com>
8207 * configure.ac: Check for declarations for cases where libiberty.h
8208 checks HAVE_DECL_xxx.
8209 * configure, config.in: Rebuild.
8211 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
8213 * gold.h (Incremental_argument_list): Remove (invalid) forward
8215 * incremental.cc (Incremental_inputs::report_achive): New method.
8216 (Incremental_inputs::report_object): New method.
8217 (Incremental_inputs::report_script): New method.
8218 (Incremental_inputs::finalize_inputs): New method.
8219 (Incremental_inputs::finalize): Call finalize_inputs().
8220 (Incremental_inputs::sized_create_incremental_inputs_section_data):
8221 Create inputs entries.
8222 * incremental.h (Incremental_input_type): New enum.
8223 (Incremental_inputs::Incremental_input): Initialize new fields.
8224 (Incremental_inputs::report_inputs): New method.
8225 (Incremental_inputs::report_achive): New method.
8226 (Incremental_inputs::report_object): New method.
8227 (Incremental_inputs::report_script): New method.
8228 (Incremental_inputs::finalize_inputs): New method.
8229 (Incremental_inputs::Input_info): New struct.
8230 (Incremental_inputs::Input_info_map): New typedef.
8231 (Incremental_inputs::lock_): New field.
8232 (Incremental_inputs::Inputs_): New field.
8233 (Incremental_inputs::Inputs_map): New field.
8234 * main.cc (main): Call Incremental_input::report_inputs.
8235 * options.h (Input_argument_list): Typedef moved from
8237 (Input_file_group::Files): Remove, use ::Input_argument_list.
8238 (Input_file_group::Input_argument_list): Remove, use
8239 ::Input_argument_list.
8240 * plugin.cc (Plugin_manager::add_input_file): Add error in
8242 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
8244 * script.cc (read_input_script): Call
8245 Incremental_input::report_script.
8246 * script.h (Script_info): New class.
8248 2009-04-27 Ian Lance Taylor <iant@google.com>
8250 * x86_64.cc (do_adjust_output_section): Set entsize to
8253 2009-04-23 Elliott Hughes <enh@google.com>
8255 * output.cc (Output_file::close): After short writes, continue
8256 writing from the correct offset in the buffer being written.
8258 2009-04-23 Chris Demetriou <cgd@google.com>
8260 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
8261 * configure: Regenerate.
8262 * config.in: Regenerate.
8263 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
8264 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
8266 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
8268 * incremental.cc (Incremental_inputs_header_data): Renamed from
8269 Incremental_input_header_data.
8270 (Incremental_inputs_header_data::data_size): New field.
8271 (Incremental_inputs_header_data::put_input_file_count): Renamed
8272 from input_file_count.
8273 (Incremental_inputs_header_data::put_command_line_offset): Renamed
8274 from command_line_offset.
8275 (Incremental_inputs_header_data::put_reserved): Renamed from
8277 (Incremental_inputs_entry_data): Renamed from
8278 Incremental_input_entry_data.
8279 (Incremental_inputs_entry_data::data_size): New field.
8280 (Incremental_inputs::report_command_line): New method.
8281 (Incremental_inputs::finalize): New method.
8282 (Incremental_inputs::create_incremental_inputs_data): New method.
8283 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
8284 * incremental.h: New file.
8285 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
8286 (Layout::finalize): Create incremental inputs section in
8288 (Layout::create_incremental_info_sections): New method.
8289 * layout.h (Layout::incremental_inputs): New method.
8290 (Layout::create_incremental_info_sections): New method.
8291 (Layout::incremental_inputs_): New field.
8292 * main.cc (main): Notify Incremental_input of the command line.
8294 2009-04-01 Ian Lance Taylor <iant@google.com>
8295 Mikolaj Zalewski <mikolajz@google.com>
8297 * gold.h (reserve_unordered_map): Define, three versions, one for
8298 each version of Unordered_map.
8299 * layout.cc (Layout::Layout): Remove options parameter. Add
8300 number_of_input_files parameter. Don't initialize options_.
8301 Initialize number_of_input_files_ and resized_signatures_. Move
8302 sections_are_attached_.
8303 (Layout::layout_group): Reserve space for group_signatures_.
8304 (Layout::find_or_add_kept_section): Change name parameter to be a
8305 reference. Resize signatures_ map when it gets large enough.
8306 (Layout::layout_eh_frame): Use parameters->options() instead of
8308 (Layout::make_output_section): Likewise.
8309 (Layout::attach_allocated_section_to_segment): Likewise.
8310 (Layout::finalize, Layout::create_executable_stack): Likewise.
8311 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
8312 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
8313 * layout.h (class Layout): Update declarations. Remove options_
8314 field. Add number_of_input_files_ and resized_signatures_
8315 fields. Move sections_are_attached_ field.
8316 * main.cc (main): Pass number of input files to Layout
8317 constructor. Don't pass options.
8319 2009-03-30 Ian Lance Taylor <iant@google.com>
8321 * ffsll.c (ffsll): Correct implementation.
8323 2009-03-27 Ian Lance Taylor <iant@google.com>
8325 * ffsll.c: New file.
8326 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
8327 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
8328 * ftruncate.c (ftruncate): Declare before definition.
8329 * mremap.c (mremap): Likewise.
8330 * pread.c (pread): Likewise.
8331 * configure, Makefile.in, config.in: Rebuild.
8333 * mremap.c: New file.
8334 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
8335 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
8336 (mremap): Declare if HAVE_MREMAP is not defined.
8337 * configure, Makefile.in, config.in: Rebuild.
8339 2009-03-27 Cary Coutant <ccoutant@google.com>
8341 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
8342 position independent.
8343 * sparc.cc (Target_sparc::check_non_pic): Likewise.
8344 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
8346 2009-03-24 Cary Coutant <ccoutant@google.com>
8348 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
8350 (needs_dynamic_reloc): Likewise.
8352 2009-03-24 Ian Lance Taylor <iant@google.com>
8354 * yyscript.y (file_cmd): Recognize EXTERN.
8355 (extern_name_list, extern_name_list_body): New nonterminals.
8356 * script.cc (script_add_extern): Define.
8357 * script-c.h (script_add_extern): Declare.
8359 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
8361 * object.cc (is_elf_object): Define.
8362 * object.h (is_elf_object): Declare.
8363 * archive.cc (Archive::get_elf_object_for_member): Call
8365 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
8367 2009-03-24 Elliott Hughes <enh@google.com>
8369 * output.cc (Output_file::map_anonymous): Define.
8370 (Output_file::map): Use map_anonymous. If the regular mmap fails,
8371 try an anonymous one. Report the size if the mmap fails.
8372 * output.h (class Output_file): Declare map_anonymous.
8374 2009-03-24 Ian Lance Taylor <iant@google.com>
8376 * target-select.cc (instantiate_target): Don't acquire the lock if
8377 the instantiated_target_ field has already been set.
8379 2009-03-23 Ian Lance Taylor <iant@google.com>
8381 * gold-threads.h (class Initialize_lock): Define.
8382 * gold-threads.cc (class Initialize_lock_once): Define.
8383 (initialize_lock_control): New static variable.
8384 (initialize_lock_pointer): New static variable.
8385 (initialize_lock_once): New static function.
8386 (Initialize_lock::Initialize_lock): Define.
8387 (Initialize_lock::initialize): Define.
8388 * target-select.h: Include "gold-threads.h".
8389 (class Target_selector): Add lock_ and initialize_lock_ fields.
8390 Don't define instantiate_target, just declare it.
8391 * target-select.cc (Target_selector::Target_selector): Initialize
8393 (Target_selector::instantiate_target): Define.
8394 * descriptors.h: Include "gold-threads.h".
8395 (class Descriptors): Add initialize_lock_ field.
8396 * descriptors.cc (Descriptors::Descriptors): Initialize new
8398 (Descriptors::open): Use initialize_lock_ field
8399 * errors.h (class Errors): Add initialize_lock_ field.
8400 * errors.cc (Errors::Errors): Initialize new field.
8401 (Errors::initialize_lock): Use initialize_lock_ field.
8402 * powerpc.cc (class Target_selector_powerpc): Remove
8403 instantiated_target_ field. In do_recognize call
8404 instantiate_target rather than do_instantiate_target. In
8405 do_instantiate_target just allocate a new target.
8406 * sparc.cc (class Target_selector_sparc): Likewise.
8408 * freebsd.h: New file.
8409 * i386.cc: Include "freebsd.h".
8410 (Target_i386): Derive from Target_freebsd rather than
8412 (Target_selector_i386): Derive from Target_selector_freebsd rather
8413 than Target_selector.
8414 * x86_64.cc: Include "freebsd.h".
8415 (Target_x86_64): Derive from Target_freebsd rather than
8417 (Target_selector_x86_64): Derive from Target_selector_freebsd
8418 rather than Target_selector.
8419 * target.h (class Target): Add adjust_elf_header and
8420 do_adjust_elf_header.
8421 * output.cc (Output_file_header:: do_sized_write): Call target
8422 adjust_elf_header routine.
8423 * configure.tgt: Set targ_osabi.
8424 * configure.ac: Define GOLD_DEFAULT_OSABI.
8425 * parameters.cc (Parameters::default_target): Pass
8426 GOLD_DEFAULT_OSABI to select_target.
8427 * target-select.h (class Target_selector): Make instantiate_target
8428 protected rather than private.
8429 * Makefile.am (HFILES): Add freebsd.h.
8430 * configure, Makefile.in, config.in: Rebuild.
8432 * merge.cc (do_add_input_section): Correct pend value. Change
8433 message about last entry not being null terminated from error to
8436 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
8438 * incremental.cc: New file.
8439 * Makefile.am (CCFILES): Add incremental.cc.
8440 * Makefile.in: Rebuild.
8442 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
8444 * layout.cc (Layout::output_section_name): Preserve names
8445 of '.note.' sections.
8447 2009-03-19 Ian Lance Taylor <iant@google.com>
8449 * descriptors.cc (Descriptors::open): Check that the options are
8450 valid before using them.
8452 2009-03-18 Ian Lance Taylor <iant@google.com>
8454 * script-sections.h: Include <list>.
8455 (class Script_sections): Change Sections_elements from std::vector
8456 to std::list. Typedef public Elements_iterator. Add
8457 orphan_section_placement_, data_segment_align_start_, and
8458 saw_data_segment_align_ fields. Remove data_segment_align_index_
8460 * script-sections.cc (class Orphan_section_placement): New class.
8461 (class Sections_element): Add virtual functions is_relro and
8462 orphan_section_init. Remove virtual function place_orphan_here.
8463 (class Output_section_definition): Add is_relro and
8464 orphan_section_init. Remove place_orphan_here.
8465 (class Orphan_output_section): Likewise.
8466 (Script_sections::Script_sections): Update for field changes.
8467 (Script_sections::data_segment_align): Set saw_data_segment_align_
8468 and data_segment_align_start_, not data_segment_align_index.
8469 (Script_sections::data_segment_relro_end): Check
8470 saw_data_segment_align_. Use data_segment_align_start_ rather
8471 than data_segment_align_index_.
8472 (Script_sections::place_orphan): Rewrite to use
8473 Orphan_section_placement.
8475 2009-03-17 Ian Lance Taylor <iant@google.com>
8477 * archive.cc (Archive::add_symbols): Check for a version attached
8478 to the symbol name in the archive map.
8479 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
8480 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
8481 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
8482 (ver_test_11.a): New target.
8483 * testsuite/Makefile.in: Rebuild.
8485 * configure.ac: Check for chsize and posix_fallocate. Replace
8487 * ftruncate.c: New file, from gnulib.
8488 * output.cc (posix_fallocate): Define dummy version if not
8489 HAVE_POSIX_FALLOCATE.
8490 (Output_file::map): Call posix_fallocate rather than lseek and
8492 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
8493 * configure, Makefile.in, config.in: Rebuild.
8495 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
8497 * layout.h (Layout::create_note): Add section_name parameter.
8498 * layout.cc (Layout::create_note): Likewise.
8499 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
8501 2009-03-17 Ian Lance Taylor <iant@google.com>
8503 * descriptors.cc: Include "options.h".
8504 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
8505 (Descriptors::open): Always use O_CLOEXEC when opening a new
8506 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
8507 then set FD_CLOEXEC.
8509 * sparc.cc (class Target_sparc): Add has_got_section.
8510 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
8511 make sure we have a GOT section.
8513 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
8514 (Target_sparc::Scan::local): Likewise.
8515 (Target_sparc::Scan::global): Likewise.
8516 (Target_sparc::Relocate::relocate): Likewise.
8517 (Target_sparc::Relocate::relocate_tls): Likewise.
8519 * symtab.cc (Symbol_table::define_default_version): New function,
8520 broken out of add_from_object.
8521 (Symbol_table::add_from_object): Call define_default_version.
8522 (Symbol_table::define_special_symbol): Add resolve_oldsym
8523 parameter. Change all callers. If the version for a symbol comes
8524 from a version script, resolve it with the symbol with the same
8525 name with no version. Also add the symbol without a version if
8527 (do_define_in_output_data): If resolving with oldsym, don't delete
8529 (do_define_in_output_segment): Likewise.
8530 (do_define_as_constant): Likewise.
8531 * symtab.h (class Symbol_table): Update declarations.
8533 2009-03-13 Ian Lance Taylor <iant@google.com>
8535 * readsyms.cc (Read_symbols::incompatible_warning): New function.
8536 (Read_symbols::requeue): New function.
8537 (Read_symbols::do_read_symbols): If make_elf_object fails because
8538 the target type is not configured, and the file was searched for,
8539 issue a warning and retry with the next directory.
8540 (Add_symbols::run): If the file has an incompatible format, and
8541 it was searched for, requeue the Read_symbols task. On error,
8543 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
8544 dirindex parameter to constructor. Change all callers. Declare
8545 incompatible_warning and requeue.
8546 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
8547 input_argument_ and input_group_ fields. Add them to
8548 constructor. Change all callers.
8549 (class Read_script): Add dirindex_ field. Add it to constructor.
8551 * archive.cc (Archive::setup): Remove input_objects parameter.
8553 (Archive::get_file_and_offset): Likewise.
8554 (Archive::read_all_symbols): Likewise.
8555 (Archive::read_symbols): Likewise.
8556 (Archive::get_elf_object_for_member): Remove input_objects
8557 parameter. Add punconfigured parameter. Change all callers.
8558 (Archive::add_symbols): Change return type to bool. Check return
8559 value of include_member.
8560 (Archive::include_all_members): Likewise.
8561 (Archive::include_member): Change return type to bool. Return
8562 false if first included object has incompatible target. Set
8563 included_member_ field.
8564 (Add_archive_symbols::run): If add_symbols returns false, requeue
8566 * archive.h (class Archive): Add included_member_ field.
8567 Initialize it in constructor. Add input_file and searched_for
8568 methods. Update declarations.
8569 (class Add_archive_symbols): Add dirpath_, dirindex_, and
8570 input_argument_ fields. Add them to constructor. Change all
8572 * script.cc: Include "target-select.h".
8573 (class Parser_closure): Add skip_on_incompatible_target_ and
8574 found_incompatible_target_ fields. Add
8575 skip_on_incompatible_target parameter to constructor. Change all
8576 callers. Add methods skip_on_incompatible_target,
8577 clear_skip_on_incompatible_target, found_incompatible_target, and
8578 set_found_incompatible_target.
8579 (read_input_script): Add dirindex parameter. Change all callers.
8580 If parser finds an incompatible target, requeue Read_symbols
8582 (script_set_symbol): Clear skip_on_incompatible_target in
8584 (script_add_assertion, script_parse_option): Likewise.
8585 (script_start_sections, script_add_phdr): Likewise.
8586 (script_check_output_format): New function.
8587 * script.h (read_input_script): Update declaration.
8588 * script-c.h (script_check_output_format): Declare.
8589 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
8590 (ignore_cmd): Remove OUTPUT_FORMAT.
8591 * fileread.cc (Input_file::Input_file): Add explicit this.
8592 (Input_file::will_search_for): New function.
8593 (Input_file::open): Add pindex parameter. Change all callers.
8594 * fileread.h (class Input_file): Add input_file_argument method.
8595 Declare will_search_for. Update declarations.
8596 * object.cc (make_elf_object): Add punconfigured parameter.
8598 * object.h (class Object): Make input_file public. Add
8599 searched_for method.
8600 (make_elf_object): Update declaration.
8601 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
8603 * dirsearch.h (class Dirsearch): Update declaration.
8604 * options.h (class General_options): Add --warn-search-mismatch.
8605 * parameters.cc (Parameters::is_compatible_target): New function.
8606 * parameters.h (class Parameters): Declare is_compatible_target.
8607 * workqueue.cc (Workqueue::add_blocker): New function.
8608 * workqueue.h (class Workqueue): Declare add_blocker.
8610 * fileread.cc (Input_file::open): Remove options parameter.
8612 (Input_file::open_binary): Likewise.
8613 * script.cc (read_input_script): Likewise.
8614 * readsyms.h (class Read_symbols): Remove options_ field. Remove
8615 options parameter from constructor. Change all callers.
8616 (class Read_script): Likewise.
8617 * fileread.h (class Input_file): Update declarations.
8618 * script.h (read_input_script): Update declaration.
8620 2009-03-10 Nick Clifton <nickc@redhat.com>
8622 * po/es.po: New Spanish translation.
8624 2009-03-06 Cary Coutant <ccoutant@google.com>
8626 * options.cc (parse_short_option): Keep dash_z from registering itself.
8628 2009-03-03 Ian Lance Taylor <iant@google.com>
8631 * target-reloc.h (relocate_section): Pass output_section to
8633 * i386.cc (Target_i386::should_apply_static_reloc): Add
8634 output_section parameter. Change all callers.
8635 (Target_i386::Relocate::relocate): Add output_section parameter.
8636 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8637 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
8638 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
8639 * testsuite/two_file_shared.sh: New script.
8640 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
8641 (check_DATA): Add two_file_shared.dbg.
8642 (two_file_shared.dbg): New target.
8643 * testsuite/Makefile.in: Rebuild.
8645 2009-03-01 Ian Lance Taylor <iant@google.com>
8647 * configure.ac: Check for byteswap.h.
8648 * configure: Rebuild.
8649 * config.in: Rebuild.
8651 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
8653 * layout.cc (Layout::find_or_add_kept_section): New function.
8654 (Layout::add_comdat): Removed.
8655 * layout.h (struct Kept_section): Move out of class Layout.
8656 Remove trailing underscores from field names. Add group_sections
8657 field. Rename group_ field to is_group. Change all uses.
8658 (class Layout): Declare find_or_add_kept_section, not add_comdat.
8659 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
8660 comdat_groups_ field.
8661 (Sized_relobj::include_section_group): Use
8662 find_or_add_kept_section and Kept_section::group_sections.
8663 (Sized_relobj::include_linkonce_section): Likewise.
8664 * object.cc (class Sized_relobj): Don't define Comdat_group or
8665 Comdat_group_table. Remove find_comdat_group and
8666 add_comdat_group. Remove comdat_groups_ field.
8667 * plugin.cc (include_comdat_group): Use
8668 Layout::find_or_add_kept_section.
8670 2009-02-28 Ian Lance Taylor <iant@google.com>
8672 * README: --gc-sections and map files are now supported. Document
8673 some build requirements.
8676 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
8677 relocatable link set the value of the section symbol to zero.
8678 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
8679 relocatable link don't include the section address in the local
8682 2009-02-27 Ian Lance Taylor <iant@google.com>
8685 * options.h (class Search_directory): Add is_system_directory.
8686 (class General_options): Declare is_in_system_directory.
8687 * options.cc (get_relative_sysroot): Make static.
8688 (get_default_sysroot): Make static.
8689 (General_optoins::is_in_system_directory): New function.
8690 * fileread.cc (Input_file::is_in_system_directory): New function.
8691 * fileread.h (class Input_file): Declare is_in_system_directory.
8692 * object.h (class Object): Add is_in_system_directory.
8693 (class Input_objects): Remove system_library_directory_ field.
8694 * object.cc (Input_objects::add_object): Don't set
8695 system_library_directory_.
8696 (input_objects::found_in_system_library_directory): Remove.
8697 * symtab.cc (Symbol_table::write_globals): Remove input_objects
8698 parameter. Change all callers.
8699 (Symbol_table::sized_write_globals): Likewise.
8700 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
8701 Call Object::is_in_system_directory.
8702 * symtab.h (class Symbol_table): Update declarations.
8705 * descriptors.h (Open_descriptor): Add is_on_stack field.
8706 * descriptors.cc (Descriptors::open): If the descriptor is on the
8707 top of the stack, remove it. Initialize is_on_stack field.
8708 (Descriptors::release): Only add pod to stack if it is not on the
8710 (Descriptors::close_some_descriptor): Clear stack_next and
8714 * output.cc (Output_section::find_starting_output_address): Rename
8715 from starting_output_address; add PADDR parameter; change return
8717 * output.h (class Output_section): Declare
8718 find_starting_output_address instead of starting_output_address.
8719 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
8720 section symbol for which we can't find a merge section.
8723 * symtab.cc (Symbol_table::add_from_object): If the visibility is
8724 hidden or internal, force the symbol to be local.
8725 * resolve.cc (Symbol::override_visibility): Define.
8726 (Symbol::override_base): Use override_visibility.
8727 (Symbol_table::resolve): Likewise.
8728 (Symbol::override_base_with_special): Likewise.
8729 (Symbol_table::override_with_special): If the visibility is hidden
8730 or internal, force the symbol to be local.
8731 * symtab.h (class Symbol): Add set_visibility and
8732 override_visibility.
8733 * testsuite/ver_test_1.sh: New file.
8734 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
8735 (check_DATA): Add ver_test_1.syms.
8736 (ver_test_1.syms): New target.
8737 * testsuite/Makefile.in: Rebuild.
8739 2009-02-25 Cary Coutant <ccoutant@google.com>
8741 * layout.cc (Layout::choose_output_section): Don't rename sections
8742 when using a linker script that has a SECTIONS clause.
8743 * Makefile.in: Regenerate.
8745 * testsuite/Makefile.am (script_test_5.sh): New test case.
8746 * testsuite/Makefile.in: Regenerate.
8747 * testsuite/script_test_5.cc: New file.
8748 * testsuite/script_test_5.sh: New file.
8749 * testsuite/script_test_5.t: New file.
8751 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
8753 * archive.cc (Archive::include_member): Update calls to add_symbols.
8754 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
8755 the Layout argument.
8756 * dynobj.h (do_add_symbols): Add the Layout argument.
8757 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
8759 * object.h (Object::add_symbols): Add the Layout argument.
8760 (Object::do_add_symbols): Add the Layout argument.
8761 (Sized_relobj::do_add_symbols): Add the Layout argument.
8762 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
8763 Unify the two versions.
8764 (Add_plugin_symbols): Remove.
8765 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
8766 (Sized_pluginobj::do_add_symbols): Unify the two versions.
8767 (Add_plugin_symbols): Remove.
8768 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
8769 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
8770 (Add_symbols::run): Make it work with Pulginobj.
8772 2009-02-06 Ian Lance Taylor <iant@google.com>
8774 * object.cc (Sized_relobj::do_layout): Make info message start
8775 with lower case letter.
8777 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
8779 * binary.cc: Fix file comment.
8781 * options.h (enum Incremental_disposition): Define.
8782 (class General_options): Add new options: --incremental,
8783 --incremental_changed, --incremental_unchanged,
8784 --incremental_unknown. Add incremental_disposition_ and
8785 implicit_incremental_ fields.
8786 (General_options::incremental_disposition): New function.
8787 (class Position_dependent_options): Add incremental_disposition
8789 (Position_dependent_options::copy_from_options): Set incremental
8791 * options.cc (General_options::parse_incremental_changed): New
8793 (General_options::parse_incremental_unchanged): New function.
8794 (General_options::parse_incremental_unknown): New function.
8795 (General_options::General_options): Initialize new fields
8796 incremental_disposition_ and implicit_incremental_.
8797 (General_options::finalize): Check for uasge of --incremental-*
8798 without --incremental.
8800 2009-02-06 Chris Demetriou <cgd@google.com>
8802 * gold.h (gold_undefined_symbol): Change to take only a Symbol
8803 pointer and to report location as the file name associated with
8805 (gold_undefined_symbol_at_location): New function to replace the
8806 old gold_undefined_symbol functionality.
8807 * target-reloc.h (relocate_section): Update to use
8808 gold_undefined_symbol_at_location.
8809 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
8810 Call gold_undefined_symbol function rather than gold_error.
8811 * errors.h (Errors::undefined_symbol): Take location as a
8812 string, rather than calculating it from a relocation.
8813 * errors.cc (Errors::fatal): Print "fatal error:" before the
8815 (Errors::error, Errors::error_at_location): Print "error: "
8816 before the formatted message.
8817 (Errors::undefined_symbol): Take location as a string, rather
8818 than calculating it from a relocation.
8819 (gold_undefined_symbol_at_location): New function akin to
8820 old gold_undefined_symbol, calculates location from relocation.
8821 (gold_undefined_symbol): Change to take only a Symbol pointer
8822 and to report location as the file name associated with the symbol.
8823 * testsuite/debug_msg.sh: Update for changed error messages.
8824 * testsuite/undef_symbol.sh: Likewise.
8826 2009-02-04 Duncan Sands <baldrick@free.fr>
8829 * reduced_debug_output.h
8830 (Output_reduced_debug_abbrev_section::failed): Use format for
8832 (Output_reduced_debug_info_section::faild): Likewise.
8834 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
8836 * script.cc (Lazy_demangler): New class.
8837 (Version_script_info::get_symbol_version_helper): Demangle a
8840 2009-01-29 Cary Coutant <ccoutant@google.com>
8842 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
8844 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8846 2009-01-28 Ian Lance Taylor <iant@google.com>
8848 * version.cc (version_string): Bump to 1.9.
8850 * gold.h: Include <cstring> and <stdint.h>.
8851 * version.cc: Include <cstdio>.
8852 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
8854 * reduced_debug_output.cc (insert_into_vector): Rename from
8855 Insert_into_vector; change all callers. Use Swap_unaligned to
8856 avoid aliasing issue; remove union since it is unnecessary.
8858 2009-01-27 Sriraman Tallam <tmsriram@google.com>
8860 * Makefile.am (CCFILES): Add gc.cc.
8862 * Makefile.in: Regenerate.
8863 * gold.cc (Gc_runner): New class.
8864 (queue_initial_tasks): Call garbage collection related tasks
8865 when corresponding options are invoked.
8866 (queue_middle_gc_tasks): New function.
8867 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
8868 processed early before laying out sections during garbage collection.
8869 * gold.h (queue_middle_gc_tasks): New function.
8870 (is_prefix_of): Move from "layout.cc".
8871 * i386.cc (Target_i386::gc_process_relocs): New function.
8872 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
8873 * main.cc (main): Create object of class "Garbage_collection".
8874 * object.cc (Relobj::copy_symbols_data): New function.
8875 (Relobj::is_section_name_included): New function.
8876 (Sized_relobj::do_layout): Allow this function to be called twice
8877 during garbage collection and defer layout of section during the
8879 * object.h (Relobj::get_symbols_data): New function.
8880 (Relobj::is_section_name_included): New function.
8881 (Relobj::copy_symbols_data): New function.
8882 (Relobj::set_symbols_data): New function.
8883 (Relobj::get_relocs_data): New function.
8884 (Relobj::set_relocs_data): New function.
8885 (Relobj::is_output_section_offset_invalid): New pure virtual function.
8886 (Relobj::gc_process_relocs): New function.
8887 (Relobj::do_gc_process_relocs): New pure virtual function.
8888 (Relobj::sd_): New data member.
8889 (Sized_relobj::is_output_section_offset_invalid): New function.
8890 (Sized_relobj::do_gc_process_relocs): New function.
8891 * options.h (General_options::gc_sections): Modify to not be a no-op.
8892 (General_options::print_gc_sections): New option.
8893 * plugin.cc (Plugin_finish::run): Remove function call to
8894 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
8895 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
8896 * reloc.cc (Read_relocs::run): Add task to process relocs and
8897 determine unreferenced sections when doing garbage collection.
8898 (Gc_process_relocs): New class.
8899 (Sized_relobj::do_gc_process_relocs): New function.
8900 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
8901 sections that are garbage collected.
8902 * reloc.h (Gc_process_relocs): New class.
8903 * sparc.cc (Target_sparc::gc_process_relocs): New function.
8904 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
8905 symbols whose corresponding sections are garbage collected.
8906 (Symbol_table::Symbol_table): Add new parameter for the garbage
8908 (Symbol_table::gc_mark_undef_symbols): New function.
8909 (Symbol_table::gc_mark_symbol_for_shlib): New function.
8910 (Symbol_table::gc_mark_dyn_syms): New function.
8911 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
8913 (Symbol_table::add_from_object): Likewise.
8914 (Symbol_table::add_from_relobj): When building shared objects, do not
8915 treat externally visible symbols as garbage.
8916 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
8917 table information for static and relocatable links.
8918 * symtab.h (Symbol_table::set_gc): New function.
8919 (Symbol_table::gc): New function.
8920 (Symbol_table::gc_mark_undef_symbols): New function.
8921 (Symbol_table::gc_mark_symbol_for_shlib): New function.
8922 (Symbol_table::gc_mark_dyn_syms): New function.
8923 (Symbol_table::gc_): New data member.
8924 * target.h (Sized_target::gc_process_relocs): New pure virtual
8926 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
8927 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
8929 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
8931 * options.h (General_options::gc_sections): Define as a no-op for now.
8932 (General_options::no_keep_memory): Ditto.
8933 (General_options::Bshareable): Define.
8934 * options.cc (General_options::finalize): Honor -Bshareable.
8936 2009-01-20 Andreas Schwab <schwab@suse.de>
8938 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
8939 read the value in the contents, since we don't use it. Use the
8940 template endianness when writing.
8941 (Relocate::relocate): Use it for R_PPC_REL16_HA.
8943 2009-01-19 Andreas Schwab <schwab@suse.de>
8945 * configure.tgt (powerpc64-*): Fix targ_obj.
8947 2009-01-15 Ian Lance Taylor <iant@google.com>
8949 * object.cc (Sized_relobj::write_local_symbols): Don't write out
8950 local symbols when stripping all symbols.
8952 2009-01-14 Cary Coutant <ccoutant@google.com>
8954 * output.cc (Output_reloc): Add explicit instantiations.
8956 2009-01-14 Cary Coutant <ccoutant@google.com>
8958 * archive.cc (Archive::get_elf_object_for_member): Remove call
8959 to File_read::claim_for_plugin.
8960 * descriptors.cc (Descriptors::open): Remove reference to
8962 (Descriptors::claim_for_plugin): Remove.
8963 * descriptors.h (Descriptors::claim_for_plugin): Remove.
8964 (Descriptors::is_claimed): Remove.
8965 (claim_descriptor_for_plugin): Remove.
8966 * fileread.cc (File_read::claim_for_plugin): Remove.
8967 * fileread.h (File_read::claim_for_plugin): Remove.
8968 (File_read::descriptor): Reopen descriptor if necessary.
8969 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
8970 (Plugin_manager::all_symbols_read): Add task parameter. Change
8972 (Plugin_manager::get_input_file): New function.
8973 (Plugin_manager::release_input_file): New function.
8974 (Pluginobj::Pluginobj): Add filesize parameter and initialize
8975 corresponding data member.
8976 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
8977 and pass to base constructor. Change all callers.
8978 (get_input_file, release_input_file): New functions.
8979 (make_sized_plugin_object): Add filesize parameter. Change all callers.
8980 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
8981 (Plugin_manager::all_symbols_read): Add task parameter.
8982 (Plugin_manager::get_input_file): New function.
8983 (Plugin_manager::release_input_file): New function.
8984 (Plugin_manager::task_): New data member.
8985 (Pluginobj::Pluginobj): Add filesize parameter.
8986 (Pluginobj::filename): New function.
8987 (Pluginobj::descriptor): New function.
8988 (Pluginobj::filesize): New function.
8989 (Pluginobj::filesize_): New data member.
8990 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
8991 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
8992 File_read::claim_for_plugin; use Object::unlock to unlock the file.
8994 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
8995 with archive libraries.
8996 * testsuite/Makefile.in: Regenerate.
8997 * testsuite/plugin_test.c (struct sym_info): New type.
8998 (get_input_file, release_input_file): New static variables.
8999 (onload): Capture new transfer vector entries.
9000 (claim_file_hook): Stop reading at end of file according to filesize.
9001 Factor out parsing of readelf output into separate function.
9002 (all_symbols_read_hook): Exercise get_input_file and release_input_file
9003 APIs and get the source file name from the symbol table. Convert
9004 source file name to corresponding object file name. Print info
9005 message when adding new input files.
9006 (parse_readelf_line): New function.
9007 * testsuite/plugin_test_1.sh: Add checks for new info messages.
9008 * testsuite/plugin_test_2.sh: Likewise.
9009 * testsuite/plugin_test_3.sh: Likewise.
9010 * testsuite/plugin_test_4.sh: New test case.
9012 2009-01-07 Ian Lance Taylor <iant@google.com>
9014 * version.cc (version_string): Bump to 1.8.
9016 2008-12-23 Cary Coutant <ccoutant@google.com>
9018 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
9019 * plugin.cc (Plugin_manager::finish): Rename as
9020 layout_deferred_objects. Move cleanup to separate function.
9021 (Plugin_manager::cleanup): New function.
9022 (Plugin_finish::run): Call layout_deferred_objects and cleanup
9024 * plugin.h (Plugin_manager::finish): Rename as
9025 layout_deferred_objects.
9026 (Plugin_manager::cleanup): New function.
9027 (Plugin_manager::cleanup_done): New field.
9029 2008-12-23 Cary Coutant <ccoutant@google.com>
9031 * plugin.cc (is_visible_from_outside): New function.
9032 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
9033 so we don't return "IR only" status for exported symbols or -r links.
9035 * testsuite/Makefile.am (plugin_test_3): New test case.
9036 * testsuite/Makefile.in: Regenerate.
9037 * testsuite/plugin_test_3.sh: New file.
9039 2008-12-22 Cary Coutant <ccoutant@google.com>
9041 * object.cc (Sized_relobj::layout_section): New function.
9042 (Sized_relobj::do_layout): Defer layout of input sections until after
9043 plugin has provided replacement files.
9044 (Sized_relobj::do_layout_deferred_sections): New function.
9045 * object.h (Relobj::set_section_offset): Remove virtual keyword.
9046 (Relobj::layout_deferred_sections): New function.
9047 (Relobj::do_layout_deferred_sections): New function.
9048 (Sized_relobj::do_layout_deferred_sections): New function.
9049 (Sized_relobj::layout_section): New function.
9050 (Sized_relobj::Deferred_layout): New structure.
9051 (Sized_relobj::deferred_layout_): New field.
9052 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
9053 Change all callers. Layout deferred sections.
9054 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
9056 (Plugin_hook::run): Move code from do_plugin_hook inline.
9057 (Plugin_hook::do_plugin_hook): Remove.
9058 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
9059 (Plugin_manager::finish): Renamed, was cleanup.
9060 (Plugin_manager::should_defer_layout): New function.
9061 (Plugin_manager::add_deferred_layout_object): New function.
9062 (Plugin_manager::Deferred_layout_list): New type.
9063 (Plugin_manager::deferred_layout_objects_): New field.
9064 (Plugin_hook::do_plugin_hook): Remove.
9066 2008-12-17 Ian Lance Taylor <iant@google.com>
9068 * options.h (class General_options): Add --no case for
9071 2008-12-16 Cary Coutant <ccoutant@google.com>
9073 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
9075 (Plugin_manager::claim_file): Create plugin object even if
9076 plugin did not call the add_symbols callback.
9077 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
9078 asking for more symbols than were added.
9079 * testsuite/Makefile.am (plugin_test_1): Add test case with
9081 (empty.syms): New target.
9082 * testsuite/Makefile.in: Regenerate.
9083 * testsuite/plugin_test.c (claim_file_hook): Add new debug
9084 message. Don't call add_symbols if no globals.
9085 (all_symbols_read_hook): Don't provide replacement for empty
9088 2008-12-12 Ian Lance Taylor <iant@google.com>
9090 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
9091 r_type == 0 for a local symbol with r_sym == 0.
9092 (scan_relocatable_relocs): Pass r_sym to
9093 local_non_section_strategy.
9094 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
9097 * configure.ac: Update test for TLS descriptors: they are
9098 supported as of glibc 2.9.
9099 * configure: Rebuild.
9101 2008-12-11 Ian Lance Taylor <iant@google.com>
9104 * target-reloc.h (Default_scan_relocatable_relocs): For each
9105 function, map r_type == 0 to RELOC_DISCARD.
9107 2008-12-10 Cary Coutant <ccoutant@google.com>
9109 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
9110 object to override a kept COMDAT group from a plugin object.
9112 2008-12-09 Ian Lance Taylor <iant@google.com>
9115 * yyscript.y (file_cmd): Handle INPUT.
9117 * testsuite/initpri1.c: Change all declarations to be full
9118 prototypes by adding void, to avoid compiler warnings.
9120 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
9122 * options.cc (General_options::parse_plugin_opt): New.
9123 (General_options::add_plugin): The argument now is just the filename.
9124 (General_options::add_plugin_option): New.
9125 * options.h (plugin_opt): New.
9126 (add_plugin): Change argument name.
9127 (add_plugin_option): New.
9128 * plugin.cc (Plugin::load): Don't parse the plugin option.
9129 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
9130 (Plugin::add_option): New.
9131 (Plugin::args_): Change type.
9132 (Plugin::filename_): New.
9133 (Plugin_manager::add_plugin_option): New.
9134 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
9135 * testsuite/Makefile.in: Regenerate.
9137 2008-12-05 Cary Coutant <ccoutant@google.com>
9139 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
9140 Handle --strip-lto-sections option.
9141 * options.h (strip_lto_sections): New option.
9143 2008-12-01 Cary Coutant <ccoutant@google.com>
9145 * plugin.cc (ld_plugin_message): Change format parameter to const.
9146 Fix mismatch between new[] and delete.
9148 2008-11-14 Cary Coutant <ccoutant@google.com>
9150 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
9153 2008-11-05 Craig Silverstein <csilvers@google.com>
9155 * options.cc (General_options::parse_dynamic_list): New function.
9156 * options.h (General_options): New flags dynamic_list,
9157 dynamic_list_data, dynamic_list_cpp_new, and
9158 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
9159 (General_options::in_dynamic_list): New function.
9160 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
9161 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
9162 (Lex::can_continue_name): Likewise.
9164 (read_script_file): New parameter script_options.
9165 (read_dynamic_list): New function.
9166 (Script_options::define_dynamic_list): New function.
9167 (dynamic_list_keyword_parsecodes): New variable.
9168 (dynamic_list_keywords): New variable.
9169 * script.h (Script_options::define_dynamic_list): New function
9171 (read_dynamic_list): New function prototype.
9172 * symtab.cc (strprefix): New macro.
9173 (Symbol::should_add_dynsym_entry): Support dynamic_list,
9174 dynamic_list_data, dynamic_list_cpp_new, and
9175 dynamic_list_cpp_typeinfo.
9176 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
9177 (dynamic_list_expr): New rule.
9178 (dynamic_list_nodes): Likewise.
9179 (dynamic_list_node): Likewise.
9180 * testsuite/Makefile.am (dynamic_list): New test.
9181 * testsuite/Makefile.in: Regenerated.
9182 * testsuite/dynamic_list.t: New file.
9183 * testsuite/dynamic_list.sh: New file.
9185 2008-11-05 Craig Silverstein <csilvers@google.com>
9187 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
9188 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
9189 (t11_last): Likewise.
9190 * testsuite/ver_test_6.c (main): Likewise.
9192 2008-10-07 Cary Coutant <ccoutant@google.com>
9194 * options.c (General_options::finalize): Add check for -static and
9196 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
9199 2008-10-02 Cary Coutant <ccoutant@google.com>
9201 * plugin.cc (make_sized_plugin_object): Fix conditional
9202 compilation to work when not all targets are enabled.
9204 2008-09-29 Cary Coutant <ccoutant@google.com>
9206 * archive.cc (Archive::get_file_and_offset): Use filename instead
9207 of name to get library path.
9208 (Archive::include_member): Unlock external member of a thin archive.
9210 * testsuite/Makefile.am (TEST_AR): New variable.
9211 (thin_archive_test_1): New test.
9212 (thin_archive_test_2): New test.
9213 * testsuite/Makefile.in: Regenerate.
9214 * testsuite/thin_archive_main.cc: New file.
9215 * testsuite/thin_archive_test_1.cc: New file.
9216 * testsuite/thin_archive_test_2.cc: New file.
9217 * testsuite/thin_archive_test_3.cc: New file.
9218 * testsuite/thin_archive_test_4.cc: New file.
9220 2008-09-29 Cary Coutant <ccoutant@google.com>
9222 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
9223 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
9225 (Sized_relobj::do_finalize_local_symbols): Likewise.
9226 (Sized_relobj::map_to_kept_section): Likewise.
9227 * object.h (Sized_relobj::invalid_address): New constant.
9228 (Sized_relobj::do_output_section_offset): Check for invalid_address
9230 * output.cc (Output_reloc::local_section_offset): Use constant
9231 invalid_address instead of -1U.
9232 (Output_reloc::get_address): Likewise.
9233 (Output_section::output_address): Change -1U to -1ULL.
9234 * output.h (Output_reloc::invalid_address): New constant.
9235 * reloc.cc (Sized_relobj::write_sections): Use constant
9236 invalid_address instead of -1U.
9237 (Sized_relobj::relocate_sections): Likewise.
9238 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
9239 values for merge sections.
9240 * target-reloc.h (relocate_for_relocatable): Use constant
9241 invalid_address instead of -1U.
9243 2008-09-19 Cary Coutant <ccoutant@google.com>
9245 Add plugin functionality for link-time optimization (LTO).
9246 * configure.ac (plugins): Add --enable-plugins option.
9247 * configure: Regenerate.
9248 * config.in: Regenerate.
9249 * Makefile.am (LIBDL): New variable.
9250 (CCFILES): Add plugin.cc.
9251 (HFILES): Add plugin.h.
9252 (ldadd_var): Add LIBDL.
9253 * Makefile.in: Regenerate.
9255 * archive.cc: Include "plugin.h".
9256 (Archive::setup): Don't preread archive symbols when using a plugin.
9257 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
9258 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
9260 (Archive::include_member): Add symbols from plugin objects.
9261 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
9262 * descriptors.cc (Descriptors::open): Check for file descriptors
9263 abandoned by plugins.
9264 (Descriptors::claim_for_plugin): New function.
9265 * descriptors.h (Descriptors::claim_for_plugin): New function.
9266 (Open_descriptor::is_claimed): New field.
9267 (claim_descriptor_for_plugin): New function.
9268 * fileread.cc (File_read::claim_for_plugin): New function.
9269 * fileread.h (File_read::claim_for_plugin): New function.
9270 (File_read::descriptor): New function.
9271 * gold.cc: Include "plugin.h".
9272 (queue_initial_tasks): Add task to call plugin hooks for generating
9274 * main.cc: Include "plugin.h".
9275 (main): Load plugin libraries.
9276 * object.h (Pluginobj): Declare.
9277 (Object::pluginobj): New function.
9278 (Object::do_pluginobj): New function.
9279 (Object::set_target): New function.
9280 * options.cc: Include "plugin.h".
9281 (General_options::parse_plugin): New function.
9282 (General_options::General_options): Initialize plugins_ field.
9283 (General_options::add_plugin): New function.
9284 * options.h (Plugin_manager): Declare.
9285 (General_options): Add --plugin option.
9286 (General_options::has_plugins): New function.
9287 (General_options::plugins): New function.
9288 (General_options::add_plugin): New function.
9289 (General_options::plugins_): New field.
9290 * plugin.cc: New file.
9291 * plugin.h: New file.
9292 * readsyms.cc: Include "plugin.h".
9293 (Read_symbols::do_read_symbols): Check for archive before checking
9294 for ELF file. Call plugin hooks to claim files.
9295 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
9296 from a real object file; force override when processing replacement
9298 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
9299 (Symbol::init_base_object): Likewise.
9300 (Symbol::init_base_output_data): Likewise.
9301 (Symbol::init_base_output_segment): Likewise.
9302 (Symbol::init_base_constant): Likewise.
9303 (Symbol::init_base_undefined): Likewise.
9304 (Symbol::output_section): Assert that object is not a plugin.
9305 (Symbol_table::add_from_pluginobj): New function.
9306 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
9308 (Symbol_table::sized_write_globals): Likewise.
9309 (Symbol_table::add_from_pluginobj): Instantiate template.
9310 * symtab.h (Sized_pluginobj): Declare.
9311 (Symbol::in_real_elf): New function.
9312 (Symbol::set_in_real_elf): New function.
9313 (Symbol::in_real_elf_): New field.
9314 (Symbol_table::add_from_pluginobj): New function.
9316 * testsuite/Makefile.am (AM_CFLAGS): New variable.
9317 (LIBDL): New variable.
9319 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
9320 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
9321 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
9322 (MOSTLYCLEANFILES): Likewise.
9323 * testsuite/Makefile.in: Regenerate.
9324 * testsuite/plugin_test.c: New file.
9325 * testsuite/plugin_test_1.sh: New file.
9326 * testsuite/plugin_test_2.sh: New file.
9328 2008-09-16 Ian Lance Taylor <iant@google.com>
9330 * target-reloc.h (relocate_section): Check whether a symbol is
9331 defined by the ABI before reporting an undefined symbol error.
9332 * target.h (Target::is_defined_by_abi): Make parameter const.
9333 (Target::do_is_defined_by_abi): Likewise.
9334 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
9335 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
9336 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
9337 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
9338 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
9339 * testsuite/Makefile.in: Rebuild.
9341 * fileread.cc (make_view): Add casts to avoid warning.
9343 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
9345 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
9346 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
9348 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
9350 * options.h (General_options::output_is_executable): New.
9351 (General_options::output_is_pie): New.
9352 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
9353 for shared libraries.
9354 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
9356 2008-09-11 Chris Demetriou <cgd@google.com>
9358 * options.h (origin): New -z option.
9359 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
9360 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
9363 2008-09-05 Cary Coutant <ccoutant@google.com>
9365 * fileread.cc (File_read::make_view): Add check for attempt to map
9368 2008-09-05 Cary Coutant <ccoutant@google.com>
9370 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
9371 explicit instantiations.
9373 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
9376 * options.cc (General_options::finalize): Allow undefined symbols
9377 in shlibs if linking -shared.
9380 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
9381 symbols as not needing a dynsym entry.
9383 2008-08-20 Craig Silverstein <csilvers@google.com>
9385 * fileread.cc (File_read::open): Do not lock the file unless it
9386 was successfully opened.
9388 2008-08-14 Cary Coutant <ccoutant@google.com>
9390 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
9391 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
9392 * testsuite/tls_test.cc (struct int128): 128-bit struct
9393 for testing TLS relocs with non-zero addend.
9394 (v12): New TLS variable.
9396 (t_last): Add check for v12.
9397 * testsuite/tls_test.h (t12): New function.
9398 * testsuite/tls_test_main.cc (thread_routine): Call new test.
9400 2008-08-13 Ian Lance Taylor <iant@google.com>
9402 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
9403 set tls_segment_ or relro_segment_.
9404 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
9406 * output.h (Output_section::clear_is_relro): New function.
9407 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
9408 sections specially even when output_data_ is empty.
9409 (Output_segment::maximum_alignment): When first section is relro,
9410 only force alignment for PT_LOAD segments.
9411 * script.cc (script_data_segment_align): New function.
9412 (script_data_segment_relro_end): New function.
9413 * script-c.h (script_data_segment_align): Declare.
9414 (script_data_segment_relro_end): Declare.
9415 * script-sections.h (class Script_sections): Declare
9416 data_segment_align and data_segment_relro_end. Add fields
9417 segment_align_index_ and saw_relro_end_.
9418 * script-sections.cc (class Sections_element): Add set_is_relro
9419 virtual function. Add new bool* parameter to place_orphan_here.
9420 Add get_output_section virtual function.
9421 (class Output_section_definition): Add set_is_relro. Add new
9422 bool* parameter to place_orphan_here. Add get_output_section.
9423 Add is_relro_ field.
9424 (Output_section_definition::Output_section_definition): Initialize
9425 evaluated_address_, evaluated_load_address, evaluated_addralign_,
9426 and is_relro_ fields.
9427 (Output_section_definition::place_orphan_here): Add is_relro
9429 (Output_section_definition::set_section_addresses): Set relro for
9431 (Output_section_definition::alternate_constraint): Likewise.
9432 (class Orphan_output_section): Add new bool* parameter to
9433 place_orphan_here. Add get_output_section.
9434 (Orphan_output_section::place_orphan_here): Add is_relro
9436 (Script_sections::Script_sections): Initialize
9437 data_segment_align_index_ and saw_relro_end_.
9438 (Script_sections::data_segment_align): New function.
9439 (Script_sections::data_segment_relro_end): New function.
9440 (Script_sections::place_orphan): Set or clear is_relro.
9441 (Script_sections::set_section_addresses): Force alignment of first
9443 * yyscript.y (exp): Call script_data_segment_align and
9444 script_data_segment_relro_end.
9445 * testsuite/relro_script_test.t: New file.
9446 * testsuite/relro_test.cc (using_script): Declare.
9447 (t1, t2): Test using_script.
9448 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
9449 (relro_script_test_SOURCES): Define.
9450 (relro_script_test_DEPENDENCIES): Define.
9451 (relro_script_test_LDFLAGS): Define.
9452 (relro_script_test_LDADD): Define.
9453 (relro_script_test.so): New target.
9454 * testsuite/Makefile.in: Rebuild.
9456 2008-08-06 Cary Coutant <ccoutant@google.com>
9458 * archive.cc (Archive::total_archives, Archive::total_members)
9459 (Archive::total_members_loaded): New variables.
9460 (Archive::setup): Add parameter. Add option to preread
9462 (Archive::read_armap): Add counter.
9463 (Archive::get_file_and_offset): New function.
9464 (Archive::get_elf_object_for_member): New function.
9465 (Archive::read_all_symbols): New function.
9466 (Archive::read_symbols): New function.
9467 (Archive::add_symbols): Add counters.
9468 (Archive::include_all_members): Use armap to find members if it's
9470 (Archive::include_member): Skip reading symbols if already read.
9471 Factored code into Archive::get_file_and_offset and
9472 Archive::get_elf_object_for_member. Changed call to
9473 Mapfile::report_include_archive_member.
9474 (Archive::print_stats): New function.
9475 * archive.h: Declare Object and Read_symbols_data classes.
9476 (Archive::Archive): Add initializers for new members.
9477 (Archive::setup): Add parameter.
9478 (Archive::print_stats): New function.
9479 (Archive::total_archives, Archive::total_members)
9480 (Archive::total_members_loaded): New variables.
9481 (Archive::get_file_and_offset): New function.
9482 (Archive::get_elf_object_for_member): New function.
9483 (Archive::read_all_symbols): New function.
9484 (Archive::read_symbols): New function.
9485 (Archive::Archive_member): New class.
9486 (Archive::members_): New member.
9487 (Archive::num_members_): New member.
9488 * main.cc: Include archive.h.
9489 (main): Call Archive::print_stats.
9490 * mapfile.cc (Mapfile::report_include_archive_member): Delete
9491 archive parameter; member_name is now the fully-decorated name.
9492 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
9493 * options.h: (General_options): Add --preread-archive-symbols option.
9494 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
9497 2008-08-04 Ian Lance Taylor <iant@google.com>
9499 * symtab.h (Symbol::use_plt_offset): New function.
9500 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
9501 * powerpc.cc (Relocate::relocate): Likewise.
9502 * sparc.cc (Relocate::relocate): Likewise.
9503 * x86_64.cc (Relocate::relocate): Likewise.
9504 * testsuite/weak_plt.sh: New test.
9505 * testsuite/weak_plt_main.cc: New test.
9506 * testsuite/weak_plt_shared.cc: New test.
9507 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
9508 (check_PROGRAMS): Add weak_plt.
9509 (check_DATA): Add weak_plt_shared.so.
9510 (weak_plt_main_pic.o, weak_plt): New targets.
9511 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
9512 * testsuite/Makefile.in: Rebuild.
9514 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
9516 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
9517 * testsuite/Makefile.in: Rebuild.
9519 2008-08-04 Alan Modra <amodra@bigpond.net.au>
9521 * Makefile.am (POTFILES.in): Set LC_ALL=C.
9522 * Makefile.in: Regenerate.
9523 * po/POTFILES.in: Regenerate.
9525 2008-07-29 Ian Lance Taylor <iant@google.com>
9527 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
9528 symbols before other symbols.
9529 * testsuite/script_test_2.cc (test_addr): Declare.
9530 (test_addr_alias): Declare.
9531 (main): Check that test_addr and test_addr_alias have the right
9533 * testsuite/script_test_2.t: Define test_addr_alias and
9536 2008-07-24 Ian Lance Taylor <iant@google.com>
9539 * descriptors.cc: New file.
9540 * descriptors.h: New file.
9541 * gold-threads.h (class Hold_optional_lock): New class.
9542 * fileread.cc: Include "descriptors.h".
9543 (File_read::~File_read): Release descriptor rather than closing
9545 (File_read::open) [file]: Call open_descriptor rather than open.
9546 Set is_descriptor_opened_.
9547 (File_read::open) [memory]: Assert that descriptor is not open.
9548 (File_read::reopen_descriptor): New function.
9549 (File_read::release): Release descriptor.
9550 (File_read::do_read): Make non-const. Reopen descriptor.
9551 (File_read::read): Make non-const.
9552 (File_read::make_view): Reopen descriptor.
9553 (File_read::do_readv): Likewise.
9554 * fileread.h (class File_read): Add is_descriptor_opened_ field.
9555 Update declarations.
9556 * layout.cc: Include "descriptors.h".
9557 (Layout::create_build_id): Use open_descriptor rather than open.
9558 * output.cc: Include "descriptors.h".
9559 (Output_file::open): Use open_descriptor rather than open.
9560 * archive.cc (Archive::const_iterator): Change Archive to be
9562 (Archive::begin, Archive::end): Make non-const.
9563 (Archive::count_members): Likewise.
9564 * archive.h (class Archive): Update declarations.
9565 * object.h (Object::read): Make non-const.
9566 * Makefile.am (CCFILES): Add descriptors.cc.
9567 (HFILES): Add descriptors.h.
9568 * Makefile.in: Rebuild.
9571 * gold.h: Always include <clocale>. Add Solaris workarounds
9572 following code in binutils/sysdep.h.
9575 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
9576 this->eh_frame_hdr_ is NULL before using it.
9578 * dynobj.cc (Versions::Versions): Update comment.
9580 * dynobj.cc (Versions::Versions): If there is an soname, use it as
9581 the base version name.
9583 * stringpool.cc (Stringpool_template::add_with_length): Set key to
9584 array size plus one.
9585 (Stringpool_template::set_string_offsets): Subtract one from key
9586 before using it as an array index.
9587 (Stringpool_template::get_offset_with_length): Likewise.
9588 (Stringpool_template::write_to_buffer): Likewise.
9589 * stringpool.h (Stringpool_template::get_offset_from_key):
9592 2008-07-23 Ian Lance Taylor <iant@google.com>
9595 * object.h (Merged_symbol_value::value): Do our best to handle a
9599 * script.cc (Version_script_info::get_versions): Don't add empty
9600 version tag to return value.
9601 (Version_script_info::get_symbol_version_helper): Change return
9602 type to bool. Add pversion parameter. Change all callers.
9603 (script_register_vers_node): Don't require a non-NULL tag.
9604 * script.h (class Version_script_info): Update declarations.
9605 (Version_script_info::get_symbol_version): Change return type to
9606 bool. Add version parameter. Change all callers.
9607 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
9608 handling. Handle an empty version from a version script.
9609 (Symbol_table::define_special_symbol): Likewise.
9610 * testsuite/ver_test_10.script: New file.
9611 * testsuite/ver_test_10.sh: New file.
9612 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
9613 (check_DATA): Add ver_test_10.syms.
9614 (ver_test_10.syms, ver_test_10.so): New target.
9615 * testsuite/Makefile.in: Rebuild.
9617 2008-07-23 Simon Baldwin <simonb@google.com>
9619 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
9620 to zero for undefined symbols from dynamic libraries.
9622 2008-07-23 Ian Lance Taylor <iant@google.com>
9624 * symtab.cc (Symbol_table::resolve): Remove version parameter.
9626 * symtab.h (class Symbol_table): Update declaration.
9627 * testsuite/ver_test_9.cc: New file.
9628 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
9629 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
9630 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
9631 (ver_test_9.so, ver_test_9.o): New targets.
9632 * testsuite/Makefile.in: Rebuild.
9634 2008-07-22 Ian Lance Taylor <iant@google.com>
9636 * options.h (class General_options): Define --check-sections.
9637 * layout.cc (Layout::set_segment_offsets): Handle
9640 * options.h (class General_options): Define -n/--nmagic and
9642 * options.cc (General_options::finalize): For -n/--nmagic or
9643 -N/--omagic, set -static.
9644 * layout.cc (Layout::attach_allocated_section_to_segment): If
9645 -N/--omagic, don't put read-only and read-write sections in
9647 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
9648 finding a read-only segment.
9649 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
9650 don't set the minimum segment alignment to the common page size,
9651 and don't set the file offset to the address modulo the page size.
9652 * script-sections.cc (Script_sections::create_segments): If
9653 -n/--omagic, don't put read-only and read-write sections in
9656 * cref.cc: New file.
9658 * options.h (class General_options): Add --print-symbol-counts.
9659 * main.cc (main): Issue defined symbol report if requested.
9660 * archive.cc (Archive::interpret_header): Make into a const member
9662 (Archive::add_symbols): Call Input_objects::archive_start and
9664 (Archive::const_iterator): Define new class.
9665 (Archive::begin, Archive::end): New functions.
9666 (Archive::include_all_members): Rewrite to use iterator.
9667 (Archive::count_members): New function.
9668 * archive.h (class Archive): Update declarations.
9669 (Archive::filename): New function.
9670 * object.cc: Include "cref.h".
9671 (Sized_relobj::Sized_relobj): Initialize defined_count_.
9672 (Sized_relobj::do_get_global_symbol_counts): New function.
9673 (Input_objects::add_object): Add object to cross-referencer.
9674 (Input_objects::archive_start): New function.
9675 (Input_objects::archive_stop): New function.
9676 (Input_objects::print_symbol_counts): New function.
9677 * object.h: Declare Cref and Archive.
9678 (Object::get_global_symbol_counts): New function.
9679 (Object::do_get_global_symbol_counts): New pure virtual function.
9680 (class Sized_relobj): Add defined_count_ field. Update
9682 (class Input_objects): Add cref_ field. Update constructor.
9683 Update declarations.
9684 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
9686 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
9688 (Sized_dynobj::do_get_global_symbol_counts): New function.
9689 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
9690 defined_count_. Update declarations. Define Symbols typedef.
9691 * symtab.cc (Symbol_table::add_from_relobj): Add defined
9692 parameter. Change all callers.
9693 (Symbol_table::add_from_dynobj): Add sympointers and defined
9694 parameters. Change all callers.
9695 * symtab.h (class Symbol_table): Update declarations.
9696 * Makefile.am (CCFILES): Add cref.cc.
9697 (HFILES): Add cref.h.
9698 * Makefile.in: Rebuild.
9700 2008-07-22 Simon Baldwin <simonb@google.com>
9702 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
9703 to zero when writing undefined symbols.
9705 2008-07-22 Ian Lance Taylor <iant@google.com>
9707 * output.cc (Output_section::add_input_section): Don't try to
9708 merge empty merge sections.
9710 2008-07-21 Craig Silverstein <csilvers@google.com>
9712 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9713 Include symbol version in error message.
9715 2008-07-20 Chris Demetriou <cgd@google.com>
9717 * configure.ac (gold_cv_c_random_seed): New configured variable.
9718 (RANDOM_SEED_CFLAGS): New substituted variable.
9719 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
9720 * configure: Rebuild.
9721 * Makefile.in: Likewise.
9722 * testsuite/Makefile.in: Likewise.
9724 2008-07-18 Ian Lance Taylor <iant@google.com>
9726 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
9727 where we see NAME/NULL and NAME/VERSION as separate symbols.
9728 * testsuite/ver_test_main.cc (main): Call t4.
9729 (t4, t4_2a): Define.
9730 * testsuite/ver_test_2.cc (t4_2): Define.
9731 * testsuite/ver_test_2.script: Put t4_2a in VER2.
9732 * testsuite/ver_test_4.cc (t4_2a): Define.
9733 * testsuite/ver_test_4.script: Put t4_2a in VER2.
9734 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
9736 2008-07-17 Ian Lance Taylor <iant@google.com>
9738 * dynobj.cc (Versions::add_def): If we give an error about a
9739 missing version, go ahead and create the version anyhow.
9741 2008-07-10 Ian Lance Taylor <iant@google.com>
9743 Handle output sections with more than 0x7fffffff bytes.
9744 * object.h (class Relobj): Change map_to_output_ to
9745 output_sections_, and just keep a section pointer. Change all
9746 uses. Move comdat group support to Sized_relobj.
9747 (Relobj::is_section_specially_mapped): Remove.
9748 (Relobj::output_section): Remove poff parameter. Change all
9750 (Relobj::output_section_offset): New function.
9751 (Relobj::set_section_offset): Rewrite.
9752 (Relobj::map_to_output): Remove.
9753 (Relobj::output_sections): New function.
9754 (Relobj::do_output_section_offset): New pure virtual function.
9755 (Relobj::do_set_section_offset): Likewise.
9756 (class Sized_relobj): Add section_offsets_ field. Add comdat
9757 group support from Relobj. Update declarations.
9758 (Sized_relobj::get_output_section_offset): New function.
9759 (Sized_relobj::do_output_section_offset): New function.
9760 (Sized_relobj::do_set_section_offset): New function.
9761 * object.cc (Relobj::output_section_address): Remove.
9762 (Sized_relobj::Sized_relobj): Initialize new fields.
9763 (Sized_relobj::include_section_group): Cast find_kept_object to
9765 (Sized_relobj::include_linkonce_section): Likewise.
9766 (Sized_relobj::do_layout): Use separate arrays for output section
9768 (Sized_relobj::do_count_local_symbols): Change map_to_output to
9770 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
9771 output_sections and section_offsets.
9772 (Sized_relobj::write_local_symbols): Likewise.
9773 (map_to_kept_section): Compute output address directly.
9774 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
9775 output_sections and section_offsets.
9776 (Sized_relobj::write_sections): Likewise.
9777 (Sized_relobj::relocate_sections): Likewise.
9778 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
9779 * output.h (class Output_reloc): Update declarations. Change
9780 u2_.relobj to Sized_relobj*.
9781 (class Output_data_reloc): Change add functions to use
9783 * output.cc (Output_reloc::Output_reloc): Change relobj to
9785 (Output_reloc::local_section_offset): Change return type to
9786 Elf_Addr. Use get_output_section_offset.
9787 (Output_reloc::get_address): Likewise.
9788 (Output_section::is_input_address_mapped): Don't call
9789 is_section_specially_mapped.
9790 (Output_section::output_offset): Likewise.
9791 (Output_section::output_address): Likewise.
9792 (Output_section::starting_output_address): Likewise.
9793 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
9794 parameter to Sized_relobj*.
9795 (Copy_relocs::need_copy_reloc): Likewise.
9796 (Copy_relocs::save): Likewise.
9797 * copy-relocs.h (class Copy_relocs): Update declarations.
9798 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
9799 Sized_relobj*. Change relobj_ field to Sized_relobj*.
9800 * target-reloc.h (relocate_for_relocatable): Change
9801 offset_in_output_section type to Elf_Addr. Change code that uses
9803 * layout.cc (Layout::layout): Always set *off.
9804 * mapfile.cc (Mapfile::print_input_section): Use
9805 output_section_offset.
9806 * i386.cc (Target_i386::copy_reloc): Change object parameter to
9808 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
9809 * sparc.cc (Target_sparc::copy_reloc): Likewise.
9810 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
9812 2008-07-03 Ian Lance Taylor <iant@google.com>
9814 * layout.cc (Layout::include_section): Do not discard unrecognized
9815 SHT_STRTAB sections.
9817 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
9819 * script.cc (Lex::can_continue_name): Make '?' allowable in
9820 version-script names.
9821 * testsuite/version_script.map: Change glob pattern to use '?'
9823 2008-06-30 Manish Singh <yosh@gimp.org>
9826 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
9829 2008-06-30 Ian Lance Taylor <iant@google.com>
9833 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
9834 versions]: Don't try to read the value in the contents, since we
9835 don't use it. Use the template endianness when writing.
9837 2008-06-25 Cary Coutant <ccoutant@google.com>
9839 * fileread.cc (File_read::make_view): Assert on zero-length view.
9840 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
9841 symbol table when there are no symbols to read.
9843 2008-06-23 Craig Silverstein <csilvers@google.com>
9845 * version.cc (version_string): Bump to 1.7
9847 2008-06-18 Craig Silverstein <csilvers@google.com>
9849 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
9850 constant 0xFFFF to type Valtype.
9851 (Powerpc_relocate_functions::rel16_ha): Likewise.
9853 2008-06-17 Ian Lance Taylor <iant@google.com>
9855 * output.h (Output_section::Input_section): Initialize p2align_ to
9856 zero for Output_section_data constructors.
9857 (Output_section::Input_section::addralign): If not an input
9858 section, return the alignment of the Output_section_data.
9859 * testsuite/copy_test.cc: New file.
9860 * testsuite/copy_test_1.cc: New file.
9861 * testsuite/copy_test_2.cc: New file.
9862 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
9863 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
9864 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
9865 (copy_test_1_pic.o, copy_test_1.so): New targets.
9866 (copy_test_2_pic.o, copy_test_2.so): New targets.
9867 * testsuite/Makefile.in: Rebuild.
9869 * script-sections.cc (Script_sections::place_orphan): Initialize
9870 local variable exact.
9872 2008-06-13 David Edelsohn <edelsohn@gnu.org>
9874 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
9876 2008-06-12 David Edelsohn <edelsohn@gnu.org>
9877 David S. Miller <davem@davemloft.net>
9879 * powerpc.cc: New file.
9880 * Makefile.am (TARGETSOURCES): Add powerpc.cc
9881 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
9882 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
9883 * Makefile.in: Rebuild.
9885 2008-06-09 Ian Lance Taylor <iant@google.com>
9887 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
9889 (throwing, orig_terminate): New static variables.
9890 (terminate_handler): New static function.
9891 (t2): Set terminate handler.
9893 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
9896 * binary.cc (Binary_to_elf::sized_convert): Fix .data
9899 2008-05-30 Cary Coutant <ccoutant@google.com>
9901 * archive.cc (Archive::include_all_members) Correct to step
9902 over symbol table and extended name table in thin archives.
9904 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
9907 * target-reloc.h (relocate_for_relocatable): Fix new_offset
9910 2008-05-28 Caleb Howe <cshowe@google.com>
9912 * reduced_debug_output.cc: New file.
9913 * reduced_debug_output.h: New file.
9914 * options.h (class General_options): Add --strip-debug-non-line.
9915 * options.cc (General_options::finalize): Add strip_debug_non_line
9916 to the strip heirarchy.
9917 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
9919 * layout.cc: Include "reduced_debug_output.h".
9920 (Layout::Layout): Initialize new fields.
9921 (line_only_debug_sections): New static array.
9922 (is_lines_only_debug_sections): New static inline function.
9923 (Layout::include_section): Handle --strip-debug-non-line.
9924 (Layout::make_output_section): If --strip-debug-non-line, build
9925 new output sections for .debug_abbrev and .debug_info.
9926 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
9927 gold. Warn about possible overflow.
9928 (read_signed_LEB_128): Likewise.
9929 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
9930 (read_signed_LEB_128): Declare.
9931 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
9932 (HFILES): Add reduced_debug_output.h.
9933 * Makefile.in: Rebuild.
9935 2008-05-21 Ian Lance Taylor <iant@google.com>
9937 * mapfile.cc: New file.
9938 * mapfile.h: New file.
9939 * options.h (class General_options): Add -M/--print-map and -Map.
9940 * options.cc (General_options::finalize): Make -M equivalent to
9942 * main.cc: Include <cstdio> and "mapfile.h".
9943 (main): Open mapfile if requested.
9944 * gold.cc (class Middle_runner): Add mapfile_ field. Update
9945 constructor. Change caller.
9946 (queue_initial_tasks): Add mapfile parameter. Change caller.
9947 (queue_middle_tasks): Likewise.
9948 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
9950 * archive.cc: Include "mapfile.h".
9951 (Archive::add_symbols): Add mapfile parameter. Change all
9952 callers. Pass mapfile, symbol, and reason to include_member.
9953 (Archive::include_all_members): Add mapfile parameter. Change all
9955 (Archive::include_member): Add mapfile, sym, and why parameters.
9956 Change all callers. Report inclusion to map file.
9957 * archive.h: Include "fileread.h".
9958 (class Archive): Update declarations.
9959 (Archive::file): New const method.
9960 (class Add_archive_symbols): Add mapfile_ field. Update
9961 constructor. Change all callers.
9962 * readsyms.h (class Read_symbols): Likewise.
9963 (class Finish_group): Likewise.
9964 (class Read_script): Likewise.
9965 * common.cc: Include "mapfile.h".
9966 (Symbol_table::allocate_commons): Add mapfile parameter. Change
9968 (Symbol_table::do_allocate_commons): Likewise.
9969 (Symbol_table::do_allocate_commons_list): Likewise. Report common
9970 symbol allocation to mapfile.
9971 * common.h (class Allocate_commons_task): Add mapfile_ field.
9972 Update constructor. Change all callers.
9973 * symtab.h (class Symbol_table): Update declarations.
9974 * layout.cc: Include "mapfile.h".
9975 (Layout_task_runner::run): Print information to mapfile.
9976 (Layout::create_gold_note): Change Output_data_fixed_space to
9977 Output_data_zero_fill.
9978 (Layout::create_build_id): Likewise.
9979 (Layout::print_to_mapfile): New function.
9980 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
9981 constructor. Change caller.
9982 (class Layout): Declare print_to_mapfile.
9983 * output.cc (Output_section::Input_section::print_to_mapfile): New
9985 (Output_section::add_input_section): If producing a map, always
9986 add to input_sections_ list.
9987 (Output_section::do_print_to_mapfile): New function.
9988 (Output_segment::print_sections_to_mapfile): New function.
9989 (Output_segment::print_section_list_to_mapfile): New function.
9990 * output.h: Include "mapfile.h".
9991 (Output_data::print_to_mapfile): New function.
9992 (Output_data::do_print_to_mapfile): New virtual function.
9993 (Output_segment_headers::do_print_to_mapfile): New function.
9994 (Output_file_header::do_print_to_mapfile): New function.
9995 (Output_data_const::do_print_to_mapfile): New function.
9996 (class Output_data_const_buffer): Add map_name_ field. Update
9997 constructor. Change all callers. Add do_print_to_mapfile
9999 (class Output_data_fixed_space): Likewise.
10000 (class Output_data_space): Likewise.
10001 (class Output_data_zero_fill): New class.
10002 (Output_data_strtab::do_print_to_mapfile): New function.
10003 (Output_data_reloc_base::do_print_to_mapfile): New function.
10004 (Output_relocatable_relocs::do_print_to_mapfile): New function.
10005 (Output_data_group::do_print_to_mapfile): New function.
10006 (Output_data_got::do_print_to_mapfile): New function.
10007 (Output_data_dynamic::do_print_to_mapfile): New function.
10008 (Output_symtab_xindex::do_print_to_mapfile): New function.
10009 (class Output_section): Declare do_print_to_mapflie. Declare
10010 print_to_mapfile in Input_section.
10011 (class Output_segment): Declare new functions.
10012 * object.h (Sized_relobj::symbol_count): New function.
10013 * script-sections.cc
10014 (Output_section_element_dot_assignment::set_section_addresses):
10015 Change Output_data_fixed_space to Output_data_zero_fill.
10016 (Output_data_expression::do_print_to_mapfile): New function.
10017 * script.cc (read_input_script): Add mapfile parameter. Change
10019 * script.h (read_input_script): Update declaration.
10020 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
10021 (Eh_frame::do_print_to_mapfile): New function.
10022 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
10023 (Output_merge_string::do_print_to_mapfile): New function.
10024 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
10026 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
10028 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
10030 * Makefile.am (CCFILES): Add mapfile.cc.
10031 (HFILES): Add mapfile.h.
10032 * Makefile.in: Rebuild.
10034 2008-05-19 Ian Lance Taylor <iant@google.com>
10036 * options.h (class General_options): Add -z relro.
10037 * layout.cc (Layout::Layout): Initialize relro_segment_.
10038 (Layout::add_output_section_data): Return the output section.
10039 (Layout::make_output_section): Rcognize relro sections and mark
10040 them appropriately.
10041 (Layout::attach_allocated_section_to_segment): Put relro sections
10042 in a PT_GNU_RELRO segment.
10043 (Layout::create_initial_dynamic_sections): Mark the .dynamic
10045 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
10047 (Layout::linkonce_mapping): Map d.rel.ro.local to
10048 .data.rel.ro.local.
10049 (Layout::output_section_name): Us .data.rel.ro.local for any
10050 section which begins with that.
10051 * layout.h (class Layout): Update add_output_section_data
10052 declaration. Add relro_segment_ field.
10053 * output.cc (Output_section::Output_section): Initialize is_relro_
10054 and is_relro_local_ fields.
10055 (Output_segment::add_output_section): Group relro sections.
10056 (Output_segment::is_first_section_relro): New function.
10057 (Output_segment::maximum_alignment): If there is a relro section,
10058 align the segment to the common page size.
10059 (Output_segment::set_section_addresses): Track whether we are
10060 looking at relro sections. If the last section is a relro
10061 section, align to the common page size.
10062 (Output_segment::set_section_list_addresses): Add in_relro
10063 parameter. Change all callers. Align to the page size when
10064 moving from relro to non-relro section.
10065 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
10067 * output.h (class Output_section): Add is_relro_ and
10068 is_relro_local_ fields.
10069 (Output_section::is_relro): New function.
10070 (Output_section::set_is_relro): New function.
10071 (Output_section::is_relro_local): New function.
10072 (Output_section::set_is_relro_local): New function.
10073 (class Output_segment): Update declarations.
10074 * i386.cc (Target_i386::got_section): Mark .got section as relro.
10075 * sparc.cc (Target_sparc::got_section): Likewise.
10076 * x86_64.cc (Target_x86_64::got_section): Likewise.
10077 * testsuite/relro_test_main.cc: New file.
10078 * testsuite/relro_test.cc: New file.
10079 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
10080 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
10081 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
10082 (relro_test.so, relro_test_pic.o): New targets.
10083 * testsuite/Makefile.in: Rebuild.
10085 2008-05-16 Ian Lance Taylor <iant@google.com>
10087 * output.cc (Output_segment::add_output_section): Remove front
10089 * output.h (class Output_segment): Remove
10090 add_initial_output_section and overloaded add_output_section.
10091 Update declaration of remaining add_output_section.
10092 * layout.cc (Layout::create_interp): Call add_output_section
10093 rather than add_initial_output_section.
10094 (Layout::finish_dynamic_section): Likewise.
10096 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
10097 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
10098 know the dynamic type.
10099 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
10100 field. Initialize it in constructor.
10101 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
10102 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
10103 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
10106 * output.cc (Output_reloc::get_address): Change return type to
10108 * output.h (class Output_reloc): Update get_address declaration.
10109 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
10110 for section addresses.
10112 2008-05-09 Ian Lance Taylor <iant@google.com>
10115 * gold.cc (gold_nomem): Use return value of write.
10117 2008-05-08 Ian Lance Taylor <iant@google.com>
10119 * symtab.c (Symbol::init_base_output_data): Add version
10120 parameter. Change all callers.
10121 (Symbol::init_base_output_segment): Likewise.
10122 (Symbol::init_base_constant): Likewise.
10123 (Symbol::init_base_undefined): Likewise.
10124 (Sized_symbol::init_output_data): Likewise.
10125 (Sized_symbol::init_output_segment): Likewise.
10126 (Sized_symbol::init_constant): Likewise.
10127 (Sized_symbol::init_undefined): Likewise.
10128 (Symbol_table::do_define_in_output_data): If the new symbol has a
10129 version, mark it as the default.
10130 (Symbol_table::do_define_in_output_segment): Likewise.
10131 (Symbol_table::do_define_as_constant): Likewise.
10132 * symtab.h (class Symbol): Update declarations.
10133 (class Sized_symbol): Likewise.
10134 * resolve.cc (Symbol::override_version): New function.
10135 (Symbol::override_base): Call override_version.
10136 (Symbol::override_base_with_special): Likewise.
10137 * testsuite/ver_script_8.script: New file.
10138 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
10139 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
10140 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
10141 (ver_test_8_1.so, ver_test_8_2.so): New targets.
10143 2008-05-06 Ian Lance Taylor <iant@google.com>
10146 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
10148 (class General_options): Remove existing --undefined, and add
10149 --no-undefined instead. Add new --undefined as synonym for -u.
10150 * archive.cc (Archive::add_symbols): Check whether symbol was
10152 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
10153 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
10154 all uses. Add IS_UNDEFINED. Update declarations to split
10155 different versions of init_base. Declare init_base_undefined.
10156 (Symbol::is_defined): Handle IS_UNDEFINED.
10157 (Symbol::is_undefined): Likewise.
10158 (Symbol::is_weak_undefined): Call is_undefined.
10159 (Symbol::is_absolute): Handle IS_CONSTANT.
10160 (class Sized_symbol): Update declarations to split different
10161 versions of init. Declare init_undefined.
10162 (class Symbol_table): Declare new functions.
10163 * symtab.cc (Symbol::init_base_object): Rename from init_base.
10164 Change all callers.
10165 (Symbol::init_base_output_data): Likewise.
10166 (Symbol::init_base_output_segment): Likewise.
10167 (Symbol::init_base_constant): Likewise.
10168 (Symbol::init_base_undefined): New function.
10169 (Sized_symbol::init_object): Rename from init. Change all
10171 (Sized_symbol::init_output_data): Likewise.
10172 (Sized_symbol::init_output_segment): Likewise.
10173 (Sized_symbol::init_constant): Likewise.
10174 (Sized_symbol::init_undefined): New function.
10175 (Symbol_table::add_undefined_symbols_from_command_line): New
10177 (Symbol_table::do_add_undefined_symbols_from_command_line): New
10179 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
10180 (Symbol::output_section): Likewise.
10181 (Symbol::set_output_section): Likewise.
10182 (Symbol_table::sized_finalize_symbol): Likewise.
10183 (Symbol_table::sized_write_globals): Likewise.
10184 * resolve.cc (Symbol_table::should_override): Likewise.
10185 (Symbol::override_base_with_special): Likewise.
10187 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
10188 symbol, change it to have default visibility.
10189 * testsuite/protected_1.cc: New file.
10190 * testsuite/protected_2.cc: New file.
10191 * testsuite/protected_3.cc: New file.
10192 * testsuite/protected_main_1.cc: New file.
10193 * testsuite/protected_main_2.cc: New file.
10194 * testsuite/protected_main_3.cc: New file.
10195 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
10196 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
10197 (protected_1_LDFLAGS, protected_1_LDADD): Define.
10198 (protected_1.so): New target.
10199 (protected_1_pic.o, protected_2_pic.o): New targets.
10200 (protected_3_pic.o): New target.
10201 (check_PROGRAMS): Add protected_2.
10202 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
10203 (protected_2_LDFLAGS, protected_2_LDADD): Define.
10204 * testsuite/Makefile.in: Rebuild.
10206 * options.h (DEFINE_var): Add set_user_set_##varname__.
10207 (DEFINE_bool_alias): New macro.
10208 (class General_options): Define -Bstatic using DEFINE_bool_alias
10209 rather than DEFINE_special. Add --undefined as an alias for -z
10211 * options.cc (General_options::parse_Bstatic): Remove.
10213 * options.h (class General_options): Add --fatal-warnings.
10214 * main.cc (main): Implement --fatal-warnings.
10215 * errors.h (Errors::warning_count): New function.
10217 * options.h (class General_options): Add -Bsymbolic-functions.
10218 * symtab.h (Symbol::is_preemptible): Check for
10219 -Bsymbolic-functions.
10221 2008-05-05 Ian Lance Taylor <iant@google.com>
10223 * options.h (DEFINE_bool): For DASH_Z, create the negative option
10224 as noVARNAME rather than no-VARNAME.
10225 (class General_options): Add option -z combreloc.
10226 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
10228 (Output_reloc::sort_before) [SHT_REL]: New function.
10229 (Output_reloc::sort_before) [SHT_RELA]: New function.
10230 (class Output_data_reloc_base): Add sort_relocs_ field. Define
10231 Sort_relocs_comparison.
10232 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
10233 parameter. Change all callers.
10234 (Output_data_reloc::Output_data_reloc) [both versions]: Add
10235 sort_relocs parameter. Change all callers.
10236 * output.cc (Output_reloc::get_address): New function, broken out
10238 (Output_reloc::write_rel): Call it.
10239 (Output_reloc::compare): New function.
10240 (Output_data_reloc_base::do_write): Optionally sort relocs.
10242 * configure.ac: If targ_extra_obj is set, link it in.
10243 * configure.tgt: Initialize all variables.
10244 (x86_64*): Set targ_extra_obj and targ_extra_size.
10245 * configure: Rebuild.
10247 * object.cc (Sized_relobj::include_section_group): Adjust section
10248 indexes read from group data. Build vector to pass to
10250 * layout.cc (Layout::layout_group): Add flags and shndxes
10251 parameters. Remove contents parameter. Change caller. Update
10252 explicit instantiations.
10253 * layout.h (class Layout): Update layout_group declaration.
10254 * output.cc (Output_data_group::Output_data_group): Add flags and
10255 input_shndxes parameters. Remove contents parameter. Change
10257 (Output_data_group::do_write): Change input_sections_ to
10259 * output.h (class Output_data_group): Update constructor
10260 declaration. Rename input_sections_ to input_shndxes_.
10261 * testsuite/many_sections_test.cc: Add template.
10263 2008-04-30 Cary Coutant <ccoutant@google.com>
10265 * target-reloc.h (relocate_section): Fix dead-pointer bug.
10267 * layout.cc (Layout::include_section): Refactored check for debug
10269 (Layout::add_comdat): Add new parameters. Change type
10270 of signature parameter. Add object and shndx to signatures table.
10271 (Layout::find_kept_object): New function.
10272 * layout.h: Include <cstring>.
10273 (Layout::is_debug_info_section): New function.
10274 (Layout::add_comdat): Add new parameters.
10275 (Layout::find_kept_object): New function.
10276 (Layout::Kept_section): New struct.
10277 (Layout::Signatures): Change type of map range.
10278 * object.cc (Relobj::output_section_address): New function.
10279 (Sized_relobj::include_section_group): Add new parameters. Change
10280 calls to Layout::add_comdat. Change to build table of kept comdat
10281 groups and table mapping discarded sections to kept sections.
10282 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
10283 (Sized_relobj::do_layout): Change calls to include_section_group and
10284 include_linkonce_section.
10285 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
10286 value to zero when section is discarded.
10287 (Sized_relobj::map_to_kept_section): New function.
10288 * object.h (Relobj::output_section_address): New function.
10289 (Relobj::Comdat_group): New type.
10290 (Relobj::find_comdat_group): New function.
10291 (Relobj::Comdat_group_table): New type.
10292 (Relobj::Kept_comdat_section): New type.
10293 (Relobj::Kept_comdat_section_table): New type.
10294 (Relobj::add_comdat_group): New function.
10295 (Relobj::set_kept_comdat_section): New function.
10296 (Relobj::get_kept_comdat_section): New function.
10297 (Relobj::comdat_groups_): New field.
10298 (Relobj::kept_comdat_sections_): New field.
10299 (Symbol_value::input_value): Update comment.
10300 (Sized_relobj::map_to_kept_section) New function.
10301 (Sized_relobj::include_linkonce_section): Add new parameter.
10302 * target-reloc.h (Comdat_behavior): New type.
10303 (get_comdat_behavior): New function.
10304 (relocate_section): Add code to map a discarded section to the
10305 corresponding kept section when applying a relocation.
10307 2008-04-30 Craig Silverstein <csilvers@google.com>
10309 * dwarf_reader.cc (next_generation_count): New static var.
10310 (Addr2line_cache_entry): New struct.
10311 (addr2line_cache): New static var.
10312 (Dwarf_line_info::one_addr2line): Added caching.
10313 (Dwarf_line_info::clear_addr2line_cache): New function.
10314 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
10315 cache-size parameter.
10316 (Dwarf_line_info::one_addr2line_cache): New function.
10317 * symtab.cc (Symbol_table::detect_odr_violations): Pass
10318 new cache-size argument to one_addr2line(), and clear cache.
10320 2008-04-28 Cary Coutant <ccoutant@google.com>
10322 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
10323 R_386_PC8 relocations.
10325 2008-04-23 Ian Lance Taylor <iant@google.com>
10327 * object.cc (Sized_relobj::include_section_group): Check for
10328 invalid section group.
10330 * object.cc (make_elf_object): Correct test for 64-bit ELF file
10333 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
10334 than read for file header.
10335 * archive.cc (Archive::include_member): Likewise.
10337 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
10339 * aclocal.m4: Regenerate.
10340 * configure: Regenerate.
10342 2008-04-19 Ian Lance Taylor <iant@google.com>
10344 * version.cc (version_string): Bump to 1.6.
10346 * testsuite/Makefile.am (many_sections_r_test): New target.
10347 (many_sections_r_test_SOURCES): Remove.
10348 (many_sections_r_test_DEPENDENCIES): Remove.
10349 (many_sections_r_test_LDFLAGS): Remove.
10350 (many_sections_r_test_LDADD): Remove.
10352 * object.cc (Sized_relobj::do_add_symbols): Always pass
10353 local_symbol_count_ to add_from_relobj.
10355 * testsuite/Makefile.am (many_sections_check.h): Only check one in
10356 every thousand variables.
10357 * testsuite/Makefile.in: Rebuild.
10359 * object.cc (Xindex::initialize_symtab_xindex): New function.
10360 (Xindex::read_symtab_xindex): New function.
10361 (Xindex::sym_xindex_to_shndx): New function.
10362 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
10364 (Sized_relobj::do_initialize_xindex): New function.
10365 (Sized_relobj::do_read_symbols): Adjust section links.
10366 (Sized_relobj::symbol_section_and_value): Add is_ordinary
10367 parameter. Change all callers.
10368 (Sized_relobj::include_section_group): Adjust section links and
10369 symbol section indexes.
10370 (Sized_relobj::do_layout): Adjust section links.
10371 (Sized_relobj::do_count_local_symbols): Adjust section links and
10372 symbol section indexes.
10373 (Sized_relobj::do_finalize_local_symbols): Distinguish between
10374 ordinary and special symbols.
10375 (Sized_relobj::write_local_symbols): Add symtab_xindex and
10376 dynsym_xindex parameters. Change all callers. Adjust section
10377 links. Use SHN_XINDEX when needed.
10378 (Sized_relobj::get_symbol_location_info): Adjust section links.
10379 Don't get fooled by special symbols.
10380 * object.h (class Xindex): Define.
10381 (class Object): Add xindex_ parameter. Declare virtual functoin
10382 do_initialize_xindex.
10383 (Object::adjust_sym_shndx): New function.
10384 (Object::set_xindex): New protected function.
10385 (class Symbol_value): Add is_ordinary_shndx_ field.
10386 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
10387 (Symbol_value::value): Assert ordinary section.
10388 (Symbol_value::initialize_input_to_output_map): Likewise.
10389 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
10390 Change all callers.
10391 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
10393 (class Sized_relobj): Update declarations.
10394 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
10395 parameter. Change all callers.
10396 (Sized_relobj::adjust_shndx): New function.
10397 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
10399 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
10400 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
10401 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
10402 (Sized_dynobj::read_dynsym_section): Adjust section links.
10403 (Sized_dynobj::read_dynamic): Likewise.
10404 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
10406 (Sized_dynobj::do_initialize_xindex): New function.
10407 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
10408 do_initialize_xindex.
10409 (Sized_dynobj::adjust_shndx): New function.
10410 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
10411 dynsym_xindex_ fields.
10412 (Layout::finalize): Add a call to set_section_indexes before
10413 creating the symtab sections.
10414 (Layout::set_section_indexes): Don't do anything if the section
10415 already has a section index.
10416 (Layout::create_symtab_sections): Add shnum parameter. Change
10417 caller. Create .symtab_shndx section if needed.
10418 (Layout::create_shdrs): Add shstrtab_section parameter. Change
10420 (Layout::allocated_output_section_count): New function.
10421 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
10423 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
10424 fields. Update declarations.
10425 (Layout::symtab_xindex): New function.
10426 (Layout::dynsym_xindex): New function.
10427 (class Write_symbols_task): Add layout_ field.
10428 (Write_symbols_task::Write_symbols_task): Add layout parameter.
10430 * output.cc (Output_section_headers::Output_section_headers): Add
10431 shstrtab_section parameter. Change all callers.
10432 (Output_section_headers::do_sized_write): Store overflow values
10433 for section count and section string table section index in
10434 section header zero.
10435 (Output_file_header::do_sized_write): Check for overflow of
10436 section count and section string table section index.
10437 (Output_symtab_xindex::do_write): New function.
10438 (Output_symtab_xindex::endian_do_write): New function.
10439 * output.h (class Output_section_headers): Add shstrtab_section_.
10440 Update declarations.
10441 (class Output_symtab_xindex): Define.
10442 (Output_section::has_out_shndx): New function.
10443 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
10445 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
10446 Change all callers.
10447 (Sized_symbol::init): Likewise.
10448 (Symbol::output_section): Check for ordinary symbol.
10449 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
10450 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
10452 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
10453 Change all callers. Simplify handling of symbols from sections
10454 not included in the link.
10455 (Symbol_table::add_from_dynobj): Handle ordinary symbol
10457 (Weak_alias_sorter::operator()): Assert that symbols are
10459 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
10461 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
10462 parameters. Change all callers.
10463 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
10464 symbol distinction. Use SHN_XINDEX when needed.
10465 (Symbol_table::write_section_symbol): Add symtab_xindex
10466 parameter. Change all callers.
10467 (Symbol_table::sized_write_section_symbol): Likewise. Use
10468 SHN_XINDEX when needed.
10469 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
10471 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
10472 (Symbol::is_defined): Check is_ordinary.
10473 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
10474 (Symbol::is_absolute, Symbol::is_common): Likewise.
10475 (class Sized_symbol): Update declarations.
10476 (class Symbol_table): Update declarations.
10477 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
10478 parameters. Change all callers.
10479 (Sized_symbol::override): Likewise.
10480 (Symbol_table::override): Likewise.
10481 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
10482 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
10483 is_ordinary, and orig_st_shndx parameters. Change all callers.
10484 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
10485 to be in an ordinary section.
10486 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
10487 object and is_ordinary parameters. Change all callers.
10488 (Sized_dwarf_line_info::read_relocs): Add object parameter.
10489 Change all callers. Don't add undefined or non-ordinary symbols
10491 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
10492 Change all callers.
10493 * dwarf_reader.h (class Sized_dwarf_line_info): Update
10495 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
10496 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
10497 (Sized_relobj::relocate_sections): Likewise.
10498 * target-reloc.h (scan_relocs): Adjust section symbol index.
10499 (scan_relocatable_relocs): Likewise.
10500 * i386.cc (Scan::local): Check for ordinary symbols.
10501 * sparc.cc (Scan::local): Likewise.
10502 * x86_64.cc (Scan::local): Likewise.
10503 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
10504 to symbol_section_and_value.
10505 * testsuite/many_sections_test.cc: New file.
10506 * testsuite/Makefile.am (BUILT_SOURCES): Define.
10507 (check_PROGRAMS): Add many_sections_test.
10508 (many_sections_test_SOURCES): Define.
10509 (many_sections_test_DEPENDENCIES): Define.
10510 (many_sections_test_LDFLAGS): Define.
10511 (BUILT_SOURCES): Add many_sections_define.h.
10512 (many_sections_define.h): New target.
10513 (BUILT_SOURCES): Add many_sections_check.h.
10514 (many_sections_check.h): New target.
10515 (check_PROGRAMS): Add many_sections_r_test.
10516 (many_sections_r_test_SOURCES): Define.
10517 (many_sections_r_test_DEPENDENCIES): Define.
10518 (many_sections_r_test_LDFLAGS): Define.
10519 (many_sections_r_test_LDADD): Define.
10520 (many_sections_r_test.o): New target.
10521 * testsuite/Makefile.in: Rebuild.
10523 2008-04-17 Cary Coutant <ccoutant@google.com>
10525 * errors.cc (Errors::info): New function.
10526 (gold_info): New function.
10527 * errors.h (Errors::info): New function.
10528 * gold.h (gold_info): New function.
10529 * object.cc (Input_objects::add_object): Print trace output.
10530 * options.cc (options::parse_set): New function.
10531 (General_options::parse_wrap): Deleted.
10532 (General_options::General_options): Deleted initializer.
10533 * options.h (options::String_set): New typedef.
10534 (options::parse_set): New function.
10535 (DEFINE_set): New macro.
10536 (General_options::wrap): Changed to use DEFINE_set. Changed
10537 callers of any_wrap_symbols and is_wrap_symbol.
10538 (General_options::trace, General_options::trace_symbol):
10540 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
10541 (General_options::wrap_symbols_): Deleted.
10542 * symtab.cc (Symbol_table::add_from_object): Print trace output.
10544 2008-04-17 David S. Miller <davem@davemloft.net>
10546 * options.cc (General_options::parse_V): New function.
10547 * options.h: Add entries for -V and -Qy.
10549 2008-04-17 Ian Lance Taylor <iant@google.com>
10551 * common.cc (Symbol_table::allocate_commons): Remove options
10552 parameter. Change caller.
10553 (Symbol_table::do_allocate_commons): Remove options parameter.
10554 Change caller. Just call do_allocate_commons_list twice.
10555 (Symbol_table::do_allocate_commons_list): New function, broken out
10556 of do_allocate_commons.
10557 * common.h (class Allocate_commons_task): Remove options_ field.
10558 Update constructor.
10559 * symtab.cc (Symbol_table::Symbol_table): Initialize
10561 (Symbol_table::add_from_object): Put TLS common symbols on
10563 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
10564 which are IN_OUTPUT_DATA.
10565 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
10566 allocate_commons and do_allocate_commons declarations. Declare
10567 do_allocate_commons_list.
10568 * gold.cc (queue_middle_tasks): Update creation of
10569 Allocate_commons_task to not pass options.
10570 * testsuite/Makefile.am (INCLUDES): Add -I.. .
10571 (TLS_TEST_C_FLAGS): New variable.
10572 (tls_test_c_pic.o): New target.
10573 (tls_test_shared.so): Link in tls_test_c_pic.o.
10574 (tls_test_c_pic_ie.o): New target.
10575 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
10576 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
10577 (tls_test_c.o): New target.
10578 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
10579 (tls_pic_test_LDADD): Likewise.
10580 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
10581 (tls_shared_gd_to_ie_test_LDADD): Likewise.
10582 (tls_test_c_gnu2.o): New target.
10583 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
10585 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
10586 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
10587 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
10588 * testsuite/tls_test.cc: Include "config.h".
10589 (t_last): Call t11_last.
10590 * testsuite/tls_test.h (t11, t11_last): Declare.
10591 * testsuite/tls_test_c.c: New file.
10592 * testsuite/tls_test_main.cc (thread_routine): Call t11.
10593 * configure.ac: Check for OpenMP support.
10594 * configure, config.in, Makefile.in: Rebuild.
10595 * testsuite/Makefile.in: Rebuild.
10597 2008-04-16 Cary Coutant <ccoutant@google.com>
10599 * i386.cc (Target_i386::define_tls_base_symbol): New function.
10600 (Target_i386::tls_base_symbol_defined_): New field.
10601 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10602 (Target_i386::Scan::global): Likewise.
10603 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
10604 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
10605 (Target_x86_64::tls_base_symbol_defined_): New field.
10606 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10607 (Target_x86_64::Scan::global): Likewise.
10609 2008-04-16 Cary Coutant <ccoutant@google.com>
10611 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
10612 (Symbol::needs_plt_entry): Allow weak undefined symbols.
10613 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
10614 building shared libraries.
10615 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
10616 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
10617 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
10618 * testsuite/Makefile.in: Rebuild.
10619 * testsuite/weak_undef.h: New file.
10620 * testsuite/weak_undef_file1.cc: Add extra test cases.
10621 * testsuite/weak_undef_file2.cc: Likewise.
10622 * testsuite/weak_undef_test.cc: Likewise.
10624 2008-04-16 David S. Miller <davem@davemloft.net>
10626 * sparc.cc (Target_sparc::Scan): Change from struct to class.
10627 Add issued_non_pic_error_ field. Declare check_non_pic.
10628 (Target_sparc::Scan::check_non_pic): New function.
10629 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
10630 (Target_sparc::Scan::global): Likewise.
10632 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
10633 * configure: Rebuild.
10635 * options.h (DEFINE_enable): New macro.
10636 (new_dtags): New enable option.
10637 (initfirst, interpose, loadfltr, nodefaultlib,
10638 nodelete, nodlopen, nodump): New -z options.
10639 * layout.cc (Layout:finish_dynamic_section): If new
10640 dtags enabled, emit DT_RUNPATH. Also, emit a
10641 DT_FLAGS_1 containing any specified -z flags.
10643 2008-04-16 Ian Lance Taylor <iant@google.com>
10645 * copy-relocs.cc: New file.
10646 * copy-relocs.h: New file.
10647 * reloc.cc: Remove Copy_relocs code.
10648 * reloc.h: Likewise.
10649 * reloc-types.h (struct Reloc_types) [both versions]: Add
10650 get_reloc_addend_noerror.
10651 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
10652 variants of add_global which take an addend which must be zero.
10653 * i386.cc: Include "copy-relocs.h".
10654 (class Target_i386): Change type of copy_relocs_ to variable,
10655 update initializer.
10656 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
10657 Change all callers.
10658 (Target_i386::do_finalize_sections): Change handling of
10660 * sparc.cc: Include "copy-relocs.h".
10661 (class Target_sparc): Change type of copy_relocs_ to variable,
10662 update initializer.
10663 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
10664 Change all callers.
10665 (Target_sparc::do_finalize_sections): Change handling of
10667 * x86_64.cc: Include "copy-relocs.h".
10668 (class Target_x86_64): Change type of copy_relocs_ to variable,
10669 update initializer.
10670 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
10671 class. Change all callers.
10672 (Target_x86_64::do_finalize_sections): Change handling of
10674 * Makefile.am (CCFILES): Add copy-relocs.cc.
10675 (HFILES): Add copy-relocs.h.
10677 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
10679 * testsuite/script_test_4.sh: Permit leading zeroes.
10681 2008-04-15 Ian Lance Taylor <iant@google.com>
10683 * script-sections.cc (Script_sections::create_segments): Use
10684 header_size_adjustment even when there is enough room for the
10686 * testsuite/script_test_4.sh: New file.
10687 * testsuite/script_test_4.t: New file.
10688 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
10689 (check_DATA): Add script_test_4.stdout.
10690 (MOSTLYCLEANFILES): Likewise.
10691 (script_test_4): New target.
10692 (script_test_4.stdout): New target.
10693 * testsuite/Makefile.in: Rebuild.
10695 * sparc.cc: Add definitions for Output_data_plt_sparc class
10698 2008-04-14 David S. Miller <davem@davemloft.net>
10700 * sparc.cc: New file.
10701 * Makefile.am (TARGETSOURCES): Add sparc.cc
10702 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
10703 * configure.tgt: Document targ_extra_size and
10704 targ_extra_big_endian. Add entries for sparc-* and
10706 * configure.ac: Handle targ_extra_size and
10707 targ_extra_big_endian.
10708 * Makefile.in: Rebuild.
10709 * configure: Likewise.
10710 * po/POTFILES.in: Likewise.
10711 * po/gold.pot: Likewise.
10713 2008-04-14 Ian Lance Taylor <iant@google.com>
10715 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
10716 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
10717 in the name/type/flags to section mapping. Don't call
10718 allocate_output_section.
10719 (Layout::choose_output_section): Change parameter from adjust_name
10720 to is_input_section. Don't permit input sections after sections
10721 are attached to segments. Don't call allocate_output_section.
10722 (Layout::layout_eh_frame): Call update_flags_for_input_section,
10723 not write_enable_output_section.
10724 (Layout::make_output_section): Don't push to
10725 unattached_section_list_ nor call attach_to_segment. Call
10726 attach_section_to_segment if sections are attached.
10727 (Layout::attach_sections_to_segments): New function.
10728 (Layout::attach_section_to_segment): New function.
10729 (Layout::attach_allocated_section_to_segment): Rename from
10730 attach_to_segment. Remove flags parameter.
10731 (Layout::allocate_output_section): Remove function.
10732 (Layout::write_enable_output_section): Remove function.
10733 * layout.h (class Layout): Update for above changes. Add new
10734 field sections_are_attached_.
10735 * output.h (Output_section::update_flags_for_input_section): New
10737 * output.cc (Output_section::add_input_section): Call
10738 update_flags_for_input_section.
10739 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
10741 2008-04-11 Cary Coutant <ccoutant@google.com>
10743 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
10744 thought unnecessary.
10745 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
10747 2008-04-11 Ian Lance Taylor <iant@google.com>
10749 * output.h (class Output_section_data): Remove inline definition
10751 * output.cc (Output_section_data::set_addralign): New function.
10753 2008-04-11 Cary Coutant <ccoutant@google.com>
10755 Add support for TLS descriptors for i386 and x86_64.
10756 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
10757 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
10758 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
10760 (Target_i386::got_mod_index_entry): Remove unnecessary code.
10761 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
10762 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
10764 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
10765 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
10766 Fix problem with initial-exec relocations.
10767 (Target_i386::Relocate::relocate_tls): Likewise.
10768 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
10770 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
10771 support for section-plus-offset dynamic table entries.
10772 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
10773 (Output_data_dynamic::Dynamic_entry): Add support for
10774 section-plus-offset dynamic table entries.
10775 (Output_data_dynamic::Classification): Likewise.
10776 (Output_data_dynamic::classification_): Renamed offset_.
10777 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
10778 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
10779 (Target_x86_64::make_plt_section): New function.
10780 (Target_x86_64::reserve_tlsdesc_entries): New function.
10781 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
10782 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
10783 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
10784 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
10785 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
10786 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
10787 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
10788 add extra PLT entry for TLS descriptors.
10789 (Output_data_plt_x86_64::got_): New field.
10790 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
10791 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
10793 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
10795 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
10796 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
10797 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
10798 R_386_TLS_DESC_CALL relocations.
10799 (Target_x86_64::Scan::global): Likewise.
10800 (Target_x86_64::do_finalize_sections): Add dynamic table entries
10801 for TLS descriptors.
10802 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
10803 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
10804 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
10805 GD-to-IE relaxation.
10806 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
10807 and TLS_DESCRIPTORS.
10808 * Makefile.in: Rebuild.
10809 * configure: Rebuild.
10810 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
10811 (tls_test_shared2.so): New target.
10812 (tls_shared_gd_to_ie_test_SOURCES): New variable.
10813 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
10814 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
10815 (tls_shared_gd_to_ie_test_LDADD): New variable.
10816 (tls_shared_gnu2_gd_to_ie_test): New target.
10817 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
10819 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
10820 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
10821 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
10822 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
10823 (tls_shared_gnu2_test): New target.
10824 (tls_test_gnu2_shared.so): New target.
10825 (tls_shared_gnu2_test_SOURCES): New variable.
10826 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
10827 (tls_shared_gnu2_test_LDFLAGS): New variable.
10828 (tls_shared_gnu2_test_LDADD): New variable.
10829 * testsuite/Makefile.in: Rebuild.
10830 * testsuite/Makefile.
10832 2008-04-11 Ian Lance Taylor <iant@google.com>
10834 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
10836 * testsuite/Makefile.in: Rebuild.
10838 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
10840 * testsuite/script_test_2.cc (main): Adjust test.
10842 2008-04-11 David S. Miller <davem@davemloft.net>
10843 Ian Lance Taylor <iant@google.com>
10845 * options.h (General_options): Add entries for '-Y' and
10847 * options.cc (General_options:finalize): If -Y was used, add those
10848 entries to the library path instead of the default "/lib" and
10851 2008-04-11 David S. Miller <davem@davemloft.net>
10853 * testsuite/justsyms.t: Start at 0x100.
10854 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
10855 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
10857 * testsuite/script_test_2.cc: Adjust string and section length
10860 2008-04-09 Ian Lance Taylor <iant@google.com>
10863 * script-sections.cc (Sections_element::allocate_to_segment): Add
10865 (Output_section_definition::allocate_to_segment): Likewise.
10866 (Orphan_output_section::allocate_to_segment): Likewise.
10867 (Script_sections::attach_sections_using_phdrs_clause): Don't
10868 propagate non-PT_LOAD segments to orphan sections.
10869 * testsuite/Makefile.am (script_test_3.stdout): Generate using
10870 readelf rather than objdump.
10871 * testsuite/script_test_3.sh: Adjust accordingly. Test that
10872 .interp section and PT_INTERP segment are the same size.
10873 * testsuite/Makefile.in: Rebuild.
10875 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
10876 aliases for symbols defined in the same object.
10877 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
10878 (weak_alias_test_SOURCES): New variable.
10879 (weak_alias_test_DEPENDENCIES): New variable.
10880 (weak_alias_test_LDFLAGS): New variable.
10881 (weak_alias_test_LDADD): New variable.
10882 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
10883 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
10884 (weak_alias_test_3.o): New target.
10885 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
10886 * testsuite/weak_alias_test_main.cc: New file.
10887 * testsuite/weak_alias_test_1.cc: New file.
10888 * testsuite/weak_alias_test_2.cc: New file.
10889 * testsuite/weak_alias_test_3.cc: New file.
10891 2008-04-08 Ian Lance Taylor <iant@google.com>
10893 * options.h (class General_options): Add --noinhibit-exec option.
10894 * main.cc (main): Check --noinhibit-exec.
10896 * options.h (class General_options): Define --wrap as a special
10897 option. Add wrap_symbols_ field.
10898 (General_options::any_wrap_symbols): New function.
10899 (General_options::is_wrap_symbol): New function.
10900 * options.cc (General_options::parse_wrap): New function.
10901 (General_options::General_options): Initialize wrap_symbols_.
10902 * symtab.cc (Symbol_table::wrap_symbol): New function.
10903 (Symbol_table::add_from_object): Handle --wrap.
10904 * symtab.h (class Symbol_table): Declare wrap_symbol.
10905 * target.h (Target::wrap_char): New function.
10906 (Target::Target_info): Add wrap_char field.
10907 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
10908 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10909 * testsuite/testfile.cc (Target_test::test_target_info):
10912 * errors.cc (Errors::undefined_symbol): Mention symbol version if
10915 * layout.h (class Layout): Add added_eh_frame_data_ field.
10916 * layout.cc (Layout::Layout): Initialize new field.
10917 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
10918 output section until we find a section we merged successfully.
10919 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
10920 that the size be non-zero.
10922 * merge.cc (Object_merge_map::get_output_offset): Remove inline
10925 2008-04-08 Craig Silverstein <csilvers@google.com>
10927 * configure.ac: Export new conditional variable HAVE_ZLIB.
10928 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
10930 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
10931 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10933 2008-04-07 Ian Lance Taylor <iant@google.com>
10935 * version.cc (version_string): Set to "1.5".
10937 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
10938 Add issued_non_pic_error_ field. Declare check_non_pic.
10939 (Target_x86_64::Scan::check_non_pic): New function.
10940 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
10941 (Target_x86_64::Scan::global): Likewise.
10943 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
10944 addend parameter. Change caller. Handle merge sections.
10945 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
10946 Address to Addend. Don't add in the result of
10947 local_section_offset, pass down the addend and use the returned
10949 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
10950 Update declarations of local_section_offset and symbol_value.
10951 * testsuite/two_file_test_1.cc (t18): New function.
10952 * testsuite/two_file_test_2.cc (f18): New function.
10953 * testsuite/two_file_test_main.cc (main): Call t18.
10954 * testsuite/two_file_test.h (t18, f18): Declare.
10956 * configure.ac: Don't test for objdump, c++filt, or readelf.
10957 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
10959 (TEST_READELF): New variable.
10960 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
10961 (check_PROGRAMS): Add two_file_strip_test.
10962 (two_file_strip_test): New target.
10963 (check_PROGRAMS): Add two_file_same_shared_strip_test.
10964 (two_file_same_shared_strip_test_SOURCES): New variable.
10965 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
10966 (two_file_same_shared_strip_test_LDFLAGS): New variable.
10967 (two_file_same_shared_strip_test_LDADD): New variable.
10968 (two_file_shared_strip.so): New target.
10969 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
10970 (ver_test_5.syms, ver_test_7.syms): Likewise.
10971 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
10972 (strip_test_3.stdout): Use TEST_OBJDUMP.
10973 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10975 2008-04-04 Cary Coutant <ccoutant@google.com>
10977 * symtab.h (Symbol::is_weak_undefined): New function.
10978 (Symbol::is_strong_undefined): New function.
10979 (Symbol::is_absolute): New function.
10980 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
10981 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
10983 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
10984 (weak_undef_test): New target.
10985 * testsuite/Makefile.in: Rebuild.
10986 * testsuite/weak_undef_file1.cc: New file.
10987 * testsuite/weak_undef_file2.cc: New file.
10988 * testsuite/weak_undef_test.cc: New file.
10990 2008-04-03 Craig Silverstein <csilvers@google.com>
10992 * compressed_output.h (class Output_compressed_section): Use
10994 * compressed_output.cc (zlib_compress): Use unsigned buffers,
10996 (zlib_compressed_suffix): Removed.
10997 (Output_compressed_section::set_final_data_size): Use unsigned
10999 * testsuite/Makefile.am (flagstest_compress_debug_sections):
11000 Fix linker invocation.
11001 (flagstest_o_specialfile_and_compress_debug_sections):
11003 * testsuite/Makefile.in: Regenerated.
11005 2008-04-02 David S. Miller <davem@davemloft.net>
11007 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
11008 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
11010 2008-04-02 Craig Silverstein <csilvers@google.com>
11014 2008-04-02 Ian Lance Taylor <iant@google.com>
11016 * fileread.cc (File_read::find_view): Add byteshift and vshifted
11017 parameters. Update for new key type to views_. Change all
11019 (File_read::read): Adjust for byteshift in returned view.
11020 (File_read::add_view): New function, broken out of
11021 find_and_make_view.
11022 (File_read::make_view): New function, broken out of
11023 find_and_make_view.
11024 (File_read::find_or_make_view): Add offset and aligned
11025 parameters. Rewrite accordingly. Change all callers.
11026 (File_read::get_view): Add offset and aligned parameters. Adjust
11027 for byteshift in return value.
11028 (File_read::get_lasting_view): Likewise.
11029 * fileread.h (class File_read): Update declarations.
11030 (class File_read::View): Add byteshift_ field. Add byteshift to
11031 constructor. Add byteshift method.
11032 * archive.h (Archive::clear_uncached_views): New function.
11033 (Archive::get_view): Add aligned parameter. Change all callers.
11034 * object.h (Object::get_view): Add aligned parameter. Change all
11036 (Object::get_lasting_view): Likewise.
11038 * fileread.cc (File_read::release): Don't call clear_views if
11039 there are multiple objects.
11040 * fileread.h (File_read::clear_uncached_views): New function.
11041 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
11044 2008-03-31 Cary Coutant <ccoutant@google.com>
11046 Add thin archive support.
11047 * archive.cc (Archive::armagt): New const.
11048 (Archive::setup): Remove task parameter and calls to unlock.
11049 (Archive::unlock_nested_archives): New function.
11050 (Archive::read_header): Add nested_off parameter. Change
11052 (Archive::interpret_header): Likewise.
11053 (Archive::include_all_members): Change to handle thin
11055 (Archive::include_member): Likewise.
11056 * archive.h (Archive::Archive): Add new parameters and
11058 (Archive::armagt): New const.
11059 (Archive::setup): Remove task parameter.
11060 (Archive::unlock_nested_archives): New function.
11061 (Archive::read_header): Add nested_off parameter.
11062 (Archive::interpret_header): Likewise.
11063 (Archive::Nested_archive_table): New typedef.
11064 (Archive::is_thin_archive_): New field.
11065 (Archive::nested_archives_): New field.
11066 (Archive::options_): New field.
11067 (Archive::dirpath_): New field.
11068 (Archive::task_): New field.
11069 * readsyms.cc (Read_symbols::do_read_symbols): Add check
11070 for thin archives. Pass additional parameters to
11071 Archive::Archive. Unlock the archive file after calling
11074 2008-03-29 Ian Lance Taylor <iant@google.com>
11076 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
11077 version symbol to be local.
11078 * testsuite/ver_test_4.sh: New file.
11079 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
11080 (check_DATA): Add ver_test_4.syms.
11081 (ver_test_4.syms): New target.
11082 * testsuite/Makefile.in: Rebuild.
11085 (Output_section::Input_section_sort_entry::has_priority): New
11087 (Output_section::Input_section_sort_entry::match_file_name): New
11089 (Output_section::Input_section_sort_entry::match_section_name):
11091 (Output_section::Input_section_sort_entry::match_section_name_prefix):
11093 (Output_section::Input_section_sort_entry::match_section_file):
11095 (Output_section::Input_section_sort_compare::operator()): Rewrite
11096 using new Input_section_sort_entry functions. Sort crtbegin and
11097 crtend first. Sort sections with no priority before sections with
11099 * testsuite/initpri1.c (d3): Check j != 4.
11100 (cd5): New constructor/destructor function.
11101 (main): Check j != 2.
11103 * symtab.cc (Symbol_table::add_from_object): If we don't use the
11104 new symbol when resolving, don't call set_is_default.
11105 * testsuite/ver_test_7.cc: New file.
11106 * testsuite/ver_test_7.sh: New file.
11107 * testsuite/Makefile.am (ver_test_7.so): New target.
11108 (ver_test_7.o): New target.
11109 (check_SCRIPTS): Add ver_test_7.sh.
11110 (check_DATA): Add ver_test_7.syms.
11111 (ver_test_7.syms): New target.
11113 2008-03-28 Ian Lance Taylor <iant@google.com>
11115 * layout.cc (Layout::layout): If we see an input section with a
11116 name that needs sorting, set the must_sort flag for the output
11118 (Layout::make_output_section): If the name of the output section
11119 indicates that it might require sorting, set the may_sort flag.
11120 * output.h (Output_section::may_sort_attached_input_sections): New
11122 (Output_section::set_may_sort_attached_input_sections): New
11124 (Output_section::must_sort_attached_input_sections): New
11126 (Output_section::set_must_sort_attached_input_sections): New
11128 (class Output_section): Declare Input_section_sort_entry. Define
11129 Input_section_sort_compare. Declare
11130 sort_attached_input_sections. Add new fields:
11131 may_sort_attached_input_sections_,
11132 must_sort_attached_input_sections_,
11133 attached_input_sections_are_sorted_.
11134 * output.cc (Output_section::Output_section): Initialize new
11136 (Output_section::add_input_section): Add an entry to
11137 input_sections_ if may_sort or must_sort are true.
11138 (Output_section::set_final_data_size): Call
11139 sort_attached_input_sections if necessary.
11140 (Output_section::Input_section_sort_entry): Define new class.
11141 (Output_section::Input_section_sort_compare::operator()): New
11143 (Output_section::sort_attached_input_sections): New function.
11144 * configure.ac: Check whether the compiler supports constructor
11145 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
11146 * testsuite/initpri1.c: New file.
11147 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
11148 CONSTRUCTOR_PRIORITY.
11149 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
11150 (initpri1_LDFLAGS): New variable.
11151 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11153 2008-03-27 Ian Lance Taylor <iant@google.com>
11155 * common.cc (Sort_commons::operator): Correct sorting algorithm.
11156 * testsuite/common_test_1.c: New file.
11157 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
11158 (common_test_1_SOURCES): New variable.
11159 (common_test_1_DEPENDENCIES): New variable.
11160 (common_test_1_LDFLAGS): New variable.
11162 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
11163 and commons_ correctly when NAME/VERSION does not override
11165 * testsuite/ver_test_6.c: New file.
11166 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
11167 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
11168 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
11170 2008-03-26 Ian Lance Taylor <iant@google.com>
11172 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
11173 of an undefined symbol from a version script.
11174 * testsuite/Makefile.am (ver_test_5.so): New target.
11175 (ver_test_5.o): New target.
11176 (check_SCRIPTS): Add ver_test_5.sh.
11177 (check_DATA): Add ver_test_5.syms.
11178 (ver_test_5.syms): New target.
11179 * testsuite/ver_test_5.cc: New file.
11180 * testsuite/ver_test_5.script: New file.
11181 * testsuite/ver_test_5.sh: New file.
11182 * Makefile.in, testsuite/Makefile.in: Rebuild.
11185 Fix problems building gold with gcc 4.3.0.
11186 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
11187 (gold_error_at_location, gold_warning_at_location): Use it.
11188 * configure.ac: Check whether we can compile and use a template
11189 function with a printf attribute.
11190 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
11191 when jumping over bytes.
11192 * object.cc: Instantiate Object::read_section_data.
11193 * debug.h: Include <cstring>
11194 * dwarf_reader.cc: Include <algorithm>
11195 * main.cc: Include <cstring>.
11196 * options.cc: Include <cstring>.
11197 * output.cc: Include <cstring>.
11198 * script.cc: Include <cstring>.
11199 * script.h: Include <string>.
11200 * symtab.cc: Include <cstring> and <algorithm>.
11201 * target-select.cc: Include <cstring>.
11202 * version.cc: Include <string>.
11203 * testsuite/testmain.cc: Include <cstdlib>.
11204 * configure, config.in: Rebuild.
11206 2008-03-25 Ian Lance Taylor <iant@google.com>
11208 * options.cc: Include "../bfd/bfdver.h".
11209 (options::help): Print bug reporting address.
11211 * version.cc (print_version): Adjust output for current value of
11212 BFD_VERSION_STRING.
11216 * options.cc (options::help): Print list of supported targets.
11217 * target-select.h: Include <vector>.
11218 (class Target_selector): Make machine_, size_, and is_big_endian_
11219 fields const. Add bfd_name_ and instantiated_target_ fields.
11220 (Target_selector::Target_selector): Add bfd_name parameter.
11221 (Target_selector::recognize): Make non-virtual, call
11223 (Target_selector::recognize_by_name): Make non-virtual, call
11224 do_recognize_by_name.
11225 (Target_selector::supported_names): New function.
11226 (Target_selector::bfd_name): New function.
11227 (Target_selector::do_instantiate_target): New pure virtual
11229 (Target_selector::do_recognize): New virtual function.
11230 (Target_selector::do_recognize_by_name): New virtual function.
11231 (Target_selector::instantiate_target): New private function.
11232 (supported_target_names): Declare.
11233 * target-select.cc (Target_selector::Target_selector): Update for
11234 new parameter and fields.
11235 (select_target_by_name): Check that the name matches before
11236 calling recognize_by_name.
11237 (supported_target_names): New function.
11238 * i386.cc (class Target_selector_i386): Update Target_selector
11239 constructor call. Remove recognize and recognize_by_name. Add
11240 do_instantiate_target.
11241 * x86_64.cc (class Target_selector_x86_64): Likewise.
11242 * testsuite/testfile.cc (class Target_selector_test): Update for
11243 changes to Target_selector.
11245 * README: Rewrite, with some notes on unsupported features.
11247 2008-03-24 Cary Coutant <ccoutant@google.com>
11249 * i386.cc (Target_i386::Got_type): New enum declaration.
11250 (Target_i386::Scan::local): Updated callers of Output_data_got
11252 (Target_i386::Scan::global): Likewise.
11253 (Target_i386::Relocate::relocate): Likewise.
11254 (Target_i386::Relocate::relocate_tls): Likewise.
11255 * object.h (Got_offset_list): New class.
11256 (Sized_relobj::local_has_got_offset): Added got_type parameter.
11257 (Sized_relobj::local_got_offset): Likewise.
11258 (Sized_relobj::set_local_got_offset): Likewise.
11259 (Sized_relobj::local_has_tls_got_offset): Removed.
11260 (Sized_relobj::local_tls_got_offset): Removed.
11261 (Sized_relobj::set_local_tls_got_offset): Removed.
11262 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
11263 * output.cc (Output_data_got::add_global): Added got_type parameter.
11264 (Output_data_got::add_global_with_rel): Likewise.
11265 (Output_data_got::add_global_with_rela): Likewise.
11266 (Output_data_got::add_global_pair_with_rel): New function.
11267 (Output_data_got::add_global_pair_with_rela): New function.
11268 (Output_data_got::add_local): Added got_type parameter.
11269 (Output_data_got::add_local_with_rel): Likewise.
11270 (Output_data_got::add_local_with_rela): Likewise.
11271 (Output_data_got::add_local_pair_with_rel): New function.
11272 (Output_data_got::add_local_pair_with_rela): New function.
11273 (Output_data_got::add_global_tls): Removed.
11274 (Output_data_got::add_global_tls_with_rel): Removed.
11275 (Output_data_got::add_global_tls_with_rela): Removed.
11276 (Output_data_got::add_local_tls): Removed.
11277 (Output_data_got::add_local_tls_with_rel): Removed.
11278 (Output_data_got::add_local_tls_with_rela): Removed.
11279 * output.h (Output_data_got::add_global): Added got_type parameter.
11280 (Output_data_got::add_global_with_rel): Likewise.
11281 (Output_data_got::add_global_with_rela): Likewise.
11282 (Output_data_got::add_global_pair_with_rel): New function.
11283 (Output_data_got::add_global_pair_with_rela): New function.
11284 (Output_data_got::add_local): Added got_type parameter.
11285 (Output_data_got::add_local_with_rel): Likewise.
11286 (Output_data_got::add_local_with_rela): Likewise.
11287 (Output_data_got::add_local_pair_with_rel): New function.
11288 (Output_data_got::add_local_pair_with_rela): New function.
11289 (Output_data_got::add_global_tls): Removed.
11290 (Output_data_got::add_global_tls_with_rel): Removed.
11291 (Output_data_got::add_global_tls_with_rela): Removed.
11292 (Output_data_got::add_local_tls): Removed.
11293 (Output_data_got::add_local_tls_with_rel): Removed.
11294 (Output_data_got::add_local_tls_with_rela): Removed.
11295 * resolve.cc (Symbol::override_base_with_special): Removed
11296 reference to has_got_offset_ field.
11297 * symtab.cc (Symbol::init_fields): Replaced initialization
11298 of got_offset_ with got_offsets_. Removed initialization
11300 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
11301 (Symbol::got_offset): Likewise.
11302 (Symbol::set_got_offset): Likewise.
11303 (Symbol::has_tls_got_offset): Removed.
11304 (Symbol::tls_got_offset): Removed.
11305 (Symbol::set_tls_got_offset): Removed.
11306 (Symbol::got_offset_): Removed.
11307 (Symbol::tls_mod_got_offset_): Removed.
11308 (Symbol::tls_pair_got_offset_): Removed.
11309 (Symbol::got_offsets_): New field.
11310 (Symbol::has_got_offset): Removed.
11311 (Symbol::has_tls_mod_got_offset): Removed.
11312 (Symbol::has_tls_pair_got_offset): Removed.
11313 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
11314 (Target_x86_64::Scan::local): Updated callers of Output_data_got
11316 (Target_x86_64::Scan::global): Likewise.
11317 (Target_x86_64::Relocate::relocate): Likewise.
11318 (Target_x86_64::Relocate::relocate_tls): Likewise.
11320 2008-03-25 Ben Elliston <bje@au.ibm.com>
11322 * yyscript.y: Fix spelling error in comment.
11324 2008-03-24 Ian Lance Taylor <iant@google.com>
11326 * options.h (class General_options): Define build_id option.
11327 * layout.h (class Layout): Declare write_build_id, create_note,
11328 create_build_id. Add build_id_note_ member.
11329 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
11330 "libiberty.h", "md5.h", "sha1.h".
11331 (Layout::Layout): Initialize eh_frame_data_,
11332 eh_frame_hdr_section_, and build_id_note_.
11333 (Layout::finalize): Call create_build_id.
11334 (Layout::create_note): New function, broken out of
11335 Layout::create_gold_note.
11336 (Layout::create_gold_note): Call create_note.
11337 (Layout::create_build_id): New function.
11338 (Layout::write_build_id): New function.
11339 (Close_task_runner::run): Call write_build_id.
11341 * x86_64.cc: Correct license to GPLv3.
11343 2008-03-23 Ian Lance Taylor <iant@google.com>
11345 * options.cc: Include "demangle.h".
11346 (parse_optional_string): New function.
11347 (parse_long_option): Handle takes_optional_argument.
11348 (parse_short_option): Update dash_z initializer. Handle
11349 takes_optional_argument.
11350 (General_options::General_options): Initialize do_demangle_.
11351 (General_options::finalize): Set do_demangle_. Handle demangling
11353 * options.h (parse_optional_string): Declare.
11354 (struct One_option): Add optional_arg field. Update constructor.
11355 Update call constructor calls. Add takes_optional_argument
11357 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
11358 (DEFINE_optional_string): Define.
11359 (General_options::demangle): Change from DEFINE_bool to
11360 DEFINE_optional_string.
11361 (General_options::no_demangle): New function.
11362 (General_options::do_demangle): New function.
11363 (General_options::set_do_demangle): New function.
11364 (General_options::execstack_status_): Move definition to end of
11366 (General_options::static_): Likewise.
11367 (General_options::do_demangle_): New field.
11368 * object.cc (big_endian>::get_symbol_location_info): Call
11369 Options::do_demangle, not Options::demangle.
11370 * symtab.cc (demangle): Likewise.
11372 2008-03-22 Ian Lance Taylor <iant@google.com>
11374 * gold.h: Include <cstddef> and <sys/types.h>
11375 * options.h: Include <cstring>.
11377 2008-03-21 Ian Lance Taylor <iant@google.com>
11379 * Added source code to GNU binutils.