gas/
[binutils.git] / gold / ChangeLog
blobe62857d8e9da4db08699f7c5d7f493e72a8ec7a7
1 2011-06-29  Ian Lance Taylor  <iant@google.com>
3         PR gold/12818
4         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
5         symbols which are not used in a relocation.
7 2011-06-28  Ian Lance Taylor  <iant@google.com>
9         PR gold/12898
10         * layout.cc (Layout::segment_precedes): Don't crash if a linker
11         script create indistinguishable segments.
12         (Layout::set_segment_offsets): Use stable_sort when sorting
13         segments.  Pass this to Compare_segments constructor.
14         * layout.h (class Layout): Make segment_precedes non-static.
15         (class Compare_segments): Change from struct to class.  Add
16         layout_ field.  Add constructor.
17         * script-sections.cc
18         (Script_sections::attach_sections_using_phdrs_clause): Rename
19         local orphan to is_orphan.  Don't report failure to put empty
20         section in segment.  On attachment failure, report name of
21         section, and attach to first PT_LOAD segment.
23 2011-06-28  Ian Lance Taylor  <iant@google.com>
25         PR gold/12934
26         * target-select.cc (Target_selector::Target_selector): Add
27         emulation parameter.  Change all callers.
28         (select_target_by_bfd_name): Rename from select_target_by_name.
29         Change all callers.
30         (select_target_by_emulation): New function.
31         (supported_emulation_names): New function.
32         * target-select.h (class Target_selector): Add emulation_ field.
33         Update declarations.
34         (Target_selector::recognize_by_bfd_name): Rename from
35         recognize_by_name.  Change all callers.
36         (Target_selector::supported_bfd_names): Rename from
37         supported_names.  Change all callers.
38         (Target_selector::recognize_by_emulation): New function.
39         (Target_selector::supported_emulations): New function.
40         (Target_selector::emulation): New function.
41         (Target_selector::do_recognize_by_bfd_name): Rename from
42         do_recognize_by_name.  Change all callers.
43         (Target_selector::do_supported_bfd_names): Rename from
44         do_supported_names.  Change all callers.
45         (Target_selector::do_recognize_by_emulation): New function.
46         (Target_selector::do_supported_emulations): New function.
47         (select_target_by_bfd_name): Change name in declaration.
48         (select_target_by_emulation): Declare.
49         (supported_emulation_names): Declare.
50         * parameters.cc (parameters_force_valid_target): Try to find
51         target based on emulation from -m option.
52         * options.h (class General_options): Change doc string for -m.
53         * options.cc (help): Print emulations.
54         (General_options::parse_V): Likewise.
55         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
56         Add emulation parameter.  Change all callers.
58 2011-06-28  Ian Lance Taylor  <iant@google.com>
60         * target.h (class Target): Add osabi_ field.
61         (Target::osabi): New function.
62         (Target::set_osabi): New function.
63         (Target::Target): Initialize osabi_.
64         (Target::do_adjust_elf_header): Make pure virtual.
65         (Sized_target::do_adjust_elf_header): Declare.
66         * target.cc (Sized_target::do_adjust_elf_header): New function.
67         (class Sized_target): Instantiate all versions.
68         * freebsd.h (class Target_freebsd): Remove.
69         (Target_selector_freebsd::do_recognize): Call set_osabi on
70         Target.
71         (Target_selector_freebsd::do_recognize_by_name): Likewise.
72         (Target_selector_freebsd::set_osabi): Remove.
73         * i386.cc (class Target_i386): Inherit from Sized_target rather
74         than Target_freebsd.
75         * x86_64.cc (class Target_x86_64): Likewise.
77 2011-06-28  Ian Lance Taylor  <iant@google.com>
79         * target.h (Target::can_check_for_function_pointers): Rewrite.
80         Make non-virtual.
81         (Target::can_icf_inline_merge_sections): Likewise.
82         (Target::section_may_have_icf_unsafe_poineters): Likewise.
83         (Target::Target_info): Add can_icf_inline_merge_sections field.
84         (Target::do_can_check_for_function_pointers): New virtual
85         function.
86         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
87         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
88         from can_check_for_function_pointers, move in file.
89         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
90         section_may_have_icf_unsafe_poineters, move in file.
91         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
92         * i386.cc (Target_i386::do_can_check_for_function_pointers):
93         Rename from can_check_for_function_pointers, move in file.
94         (Target_i386::can_icf_inline_merge_sections): Remove.
95         (Target_i386::i386_info): Initialize
96         can_icf_inline_merge_sections.
97         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
98         Initialize can_icf_inline_merge_sections.
99         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
100         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
101         Rename from can_check_for_function_pointers, move in file.
102         (Target_x86_64::can_icf_inline_merge_sections): Remove.
103         (Target_x86_64::x86_64_info): Initialize
104         can_icf_inline_merge_sections.
105         * testsuite/testfile.cc (Target_test::test_target_info):
106         Likewise.
107         * icf.cc (get_section_contents): Correct formatting.
109 2011-06-27  Ian Lance Taylor  <iant@google.com>
111         * symtab.cc (Symbol::versioned_name): New function.
112         (Symbol_table::add_to_final_symtab): Use versioned_name when
113         appropriate.
114         (Symbol_table::sized_write_symbol): Likewise.
115         * symtab.h (class Symbol): Declare versioned_name.
116         * stringpool.h (class Stringpool_template): Add variant of add
117         which takes a std::basic_string.
118         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
119         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
120         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
121         (ver_test_12.o): New target.
122         * testsuite/Makefile.in: Rebuild.
124 2011-06-27  Doug Kwan  <dougkwan@google.com>
126         * arm.cc (Arm_relocate_functions::thm_jump8,
127         Arm_relocate_functions::thm_jump11): Use a wider signed
128         type to compute offset.
129         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
130         arm_thm_jump8.
131         * testsuite/Makefile.in: Regenerate.
132         * testsuite/arm_branch_in_range.sh: Check test results of
133         arm_thm_jump11 and arm_thm_jump8.
134         * testsuite/arm_thm_jump11.s: New test source file.
135         * testsuite/arm_thm_jump11.t: New linker script.
136         * testsuite/arm_thm_jump8.s: New test source file.
137         * testsuite/arm_thm_jump8.t: New linker script.
139 2011-06-24  Ian Lance Taylor  <iant@google.com>
141         * layout.cc: Include "object.h".
142         (ctors_sections_in_init_array): New static variable.
143         (Layout::is_ctors_in_init_array): New function.
144         (Layout::layout): Add entry to ctors_sections_in_init_array if
145         appropriate.
146         * layout.h (class Layout): Declare is_ctors_in_init_array.
147         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
148         is_ctors_reverse_view is set.
149         (Sized_relobj_file::write_sections): Add layout parameter.  Change
150         all callers.  Set is_ctors_reverse_view field of View_size.
151         (Sized_relobj_file::reverse_words): New function.
152         * object.h (Sized_relobj_file::View_size): Add
153         is_ctors_reverse_view field.
154         (class Sized_relobj_file): Update declarations.
155         * testsuite/initpri3.c: New test.
156         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
157         initpri3b.
158         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
159         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
160         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
161         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
162         * testsuite/Makefile.in: Rebuild.
164 2011-06-24  Cary Coutant  <ccoutant@google.com>
166         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
167         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
168         (debug_msg_cdebug.err): New targets.
169         * testsuite/Makefile.in: Regenerate.
170         * testsuite/debug_msg.sh: Check output of link with compressed debug.
171         Fix checks for link with shared library.
173 2011-06-24  Doug Kwan  <dougkwan@google.com>
175         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
176         skip empty text sections.
177         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
179 2011-06-22  Ian Lance Taylor  <iant@google.com>
181         PR gold/12910
182         * options.h (class General_options): Add --ctors-in-init-array.
183         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
184         friends as SHT_PROGBITS for merging sections.
185         (Layout::layout): Remove special handling of .init_array and
186         friends.  Don't sort if doing relocatable link.  Sort for .ctors
187         and .dtors if ctors_in_init_array.
188         (Layout::make_output_section): Force correct section types for
189         .init_array and friends.  Don't sort if doing relocatable link,
190         Don't sort .ctors and .dtors if ctors_in_init_array.
191         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
192         (Layout::output_section_name): Add relobj parameter.  Change all
193         callers.  Handle .ctors. and .dtors. in code rather than table.
194         Handle .ctors and .dtors if ctors_in_init_array.
195         (Layout::match_file_name): New function, moved from output.cc.
196         * layout.h (class Layout): Update declarations.
197         * output.cc: Include "layout.h".
198         (Input_section_sort_entry::get_priority): New function.
199         (Input_section_sort_entry::match_file_name): Just call
200         Layout::match_file_name.
201         (Output_section::Input_section_sort_init_fini_compare::operator()):
202         Handle .ctors and .dtors.  Sort by explicit priority rather than
203         by name.
204         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
205         * testsuite/initpri2.c: New test.
206         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
207         (check_PROGRAMS): Add initpri2.
208         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
209         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
210         * configure, testsuite/Makefile.in: Rebuild.
212 2011-06-19  Ian Lance Taylor  <iant@google.com>
214         PR gold/12880
215         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
216         .interp section to a PT_INTERP segment even if we have seen a
217         --dynamic-linker option.  Don't do it if we have seen a PHDRS
218         clause in a linker script.
219         (Layout::finalize): Don't create a .interp section if we've
220         already create a PT_INTERP segment.
221         (Layout::create_interp): Always call choose_output_section (revert
222         patch of 2011-06-17).  Don't create PT_INTERP segment.
223         * script-sections.cc
224         (Script_sections::create_note_and_tls_segments): Add a .interp
225         section to a PT_INTERP segment even if we have seen a
226         --dynamic-linker option.
228 2011-06-18  Ian Lance Taylor  <iant@google.com>
230         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
231         merely because a non-PT_LOAD segment has a dynamic reloc.
233 2011-06-18  Ian Lance Taylor  <iant@google.com>
235         * layout.cc (Layout::finish_dynamic_section): Don't create
236         DT_FLAGS entry if not needed.
238 2011-06-18  Ian Lance Taylor  <iant@google.com>
240         PR gold/12745
241         * layout.cc (Layout::layout_eh_frame): Correct handling of
242         writable .eh_frame section.
244 2011-06-17  Ian Lance Taylor  <iant@google.com>
246         PR gold/12893
247         * resolve.cc (Symbol_table::resolve): Don't give an error if a
248         symbol is redefined with the exact same object and value.
250 2011-06-17  Ian Lance Taylor  <iant@google.com>
252         PR gold/12880
253         * layout.h (class Layout): Add interp_segment_ field.
254         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
255         (Layout::attach_allocated_section_to_segment): If making shared
256         library, put .interp section in PT_INTERP segment.
257         (Layout::finalize): Also call create_interp if -dynamic-linker
258         option was used.
259         (Layout::create_interp): Assert that there is no PT_INTERP
260         segment.  If not using a SECTIONS clause, use make_output_section.
261         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
262         * script-sections.cc
263         (Script_sections::create_note_and_tls_segments): If making shared
264         library, put .interp section in PT_INTERP segment.
266 2011-06-17  Ian Lance Taylor  <iant@google.com>
268         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
269         when making a shared library.
271 2011-06-17  Ian Lance Taylor  <iant@google.com>
273         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
274         parameter.  Change all callers.  Don't issue warning about PC32
275         against locally defined symbol.
277 2011-06-16  Ian Lance Taylor  <iant@google.com>
279         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
280         occurs in same object.
282 2011-06-14  Alan Modra  <amodra@gmail.com>
284         * po/POTFILES.in: Regenerate.
286 2011-06-09  Ian Lance Taylor  <iant@google.com>
288         * script-sections.cc
289         (Orphan_output_section::set_section_addresses): For a relocatable
290         link set address to 0.
292 2011-06-09  Cary Coutant  <ccoutant@google.com>
294         PR gold/12804
295         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
296         used with --compress-debug-sections.
297         * gold/object.cc (Sized_relobj_file::do_layout): Report
298         uncompressed size of compressed input sections.
300 2011-06-08  Cary Coutant  <ccoutant@google.com>
302         PR gold/12804
303         * testsuite/two_file_test_2_v1.cc: Change initialization of
304         v2 to keep it in .data.
306 2011-06-07  Cary Coutant  <ccoutant@google.com>
308         * common.cc (Symbol_table::do_allocate_commons_list): Call
309         gold_fallback.
310         * errors.cc (Errors::fatal): Adjust call to gold_exit.
311         (Errors::fallback): New function.
312         (gold_fallback): New function.
313         * errors.h (Errors::fallback): New function.
314         * gold.cc (gold_exit): Change status parameter to enum; adjust
315         all callers.
316         (queue_initial_tasks): Call gold_fallback.
317         * gold.h: Include cstdlib.
318         (Exit_status): New enum type.
319         (gold_exit): Change status parameter to enum.
320         (gold_fallback): New function.
321         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
322         (Layout::create_symtab_sections): Likewise.
323         (Layout::create_shdrs): Likewise.
324         * main.cc (main): Adjust call to gold_exit.
325         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
326         (Output_data_got::add_got_entry_pair): Likewise.
327         (Output_section::add_input_section): Likewise.
328         (Output_section::add_output_section_data): Likewise.
329         (Output_segment::set_section_list_addresses): Likewise.
330         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
332 2011-06-07  Cary Coutant  <ccoutant@google.com>
334         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
335         for incremental links.
336         * output.cc (Output_segment::set_section_list_addresses): Remove
337         FIXME and test for TLS or BSS.
339 2011-06-07  Cary Coutant  <ccoutant@google.com>
341         * testsuite/Makefile.am: Add incremental_copy_test,
342         incremental_common_test_1.
343         * testsuite/Makefile.in: Regenerate.
344         * testsuite/common_test_1_v1.c: New source file.
345         * testsuite/common_test_1_v2.c: New source file.
346         * testsuite/copy_test_v1.cc: New source file.
348 2011-06-07  Cary Coutant  <ccoutant@google.com>
350         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
351         update, allocate common from bss section's free list.
352         * incremental-dump.cc (dump_incremental_inputs): Print flag for
353         linker-defined symbols.
354         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
355         Skip GOT and PLT entries that are no longer referenced.
356         (Output_section_incremental_inputs::write_info_blocks): Mark
357         linker-defined symbols.
358         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
359         * output.cc (Output_section::allocate): New function.
360         * output.h (Output_section::allocate): New function.
361         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
362         linker-defined symbols.
363         (Symbol::override_base_with_special): Copy is_predefined_ flag.
364         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
365         (Symbol::init_base_output_data): Likewise.
366         (Symbol::init_base_output_segment): Likewise.
367         (Symbol::init_base_constant): Likewise.
368         (Sized_symbol::init_output_data): Likewise.
369         (Sized_symbol::init_output_segment): Likewise.
370         (Sized_symbol::init_constant): Likewise.
371         (Symbol_table::do_define_in_output_data): Likewise.
372         (Symbol_table::do_define_in_output_segment): Likewise.
373         (Symbol_table::do_define_as_constant): Likewise.
374         * symtab.h (Symbol::is_predefined): New function.
375         (Symbol::init_base_output_data): Add is_predefined parameter.
376         (Symbol::init_base_output_segment): Likewise.
377         (Symbol::init_base_constant): Likewise.
378         (Symbol::is_predefined_): New data member.
379         (Sized_symbol::init_output_data): Add is_predefined parameter.
380         (Sized_symbol::init_output_segment): Likewise.
381         (Sized_symbol::init_constant): Likewise.
382         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
384 2011-06-07  Cary Coutant  <ccoutant@google.com>
386         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
387         instead of emit_copy_reloc.
388         (Copy_relocs::emit_copy_reloc): Refactor.
389         (Copy_relocs::make_copy_reloc): New function.
390         (Copy_relocs::add_copy_reloc): Remove.
391         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
392         section.
393         (Copy_relocs::make_copy_reloc): New function.
394         (Copy_relocs::add_copy_reloc): Remove.
395         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
396         unchanged input files.
397         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
398         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
399         Reserve BSS space for COPY relocations.
400         (Sized_incremental_binary::do_emit_copy_relocs): New function.
401         (Output_section_incremental_inputs::write_info_blocks): Record
402         whether a symbol is copied from a shared object.
403         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
404         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
405         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
406         (Incremental_input_entry_reader::get_output_symbol_index): Add
407         is_copy parameter.
408         (Incremental_binary::emit_copy_relocs): New function.
409         (Incremental_binary::do_emit_copy_relocs): New function.
410         (Sized_incremental_binary::Sized_incremental_binary): Initialize
411         new data member.
412         (Sized_incremental_binary::add_copy_reloc): New function.
413         (Sized_incremental_binary::do_emit_copy_relocs): New function.
414         (Sized_incremental_binary::Copy_reloc): New struct.
415         (Sized_incremental_binary::Copy_relocs): New typedef.
416         (Sized_incremental_binary::copy_relocs_): New data member.
417         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
418         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
419         * target.h (Sized_target::emit_copy_reloc): New function.
420         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
422 2011-06-02  Cary Coutant  <ccoutant@google.com>
424         PR gold/12163
425         * gold/archive.cc (Archive::Archive): Initialize new data member.
426         (Archive::include_all_members): Return if archive has already been
427         included.
428         * gold/archive.h (Archive::include_all_members_): New data member.
430 2011-06-02  Nick Clifton  <nickc@redhat.com>
432         * dynobj.h: Fix spelling mistake in comment.
433         * output.cc: Likewise.
435 2011-05-31  Doug Kwan  <dougkwan@google.com>
436             Asier Llano
438         PR gold/12826
439         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
440         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
441         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
442         redundant arm_exidx_test.so.
443         * testsuite/Makefile.in: Regenerate.
444         (check_SCRIPTS): Add pr12826.sh
445         (check_DATA): Add pr12826.stdout
446         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
447         * testsuite/pr12826.sh: New file.
448         * testsuite/pr12826_1.s: Ditto.
449         * testsuite/pr12826_1.s: Ditto.
451 2011-05-30  Ian Lance Taylor  <iant@google.com>
453         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
454         sections.
456 2011-05-29  Ian Lance Taylor  <iant@google.com>
458         PR gold/12804
459         * testsuite/Makefile.am: Use different file name for two_file_test
460         temporary file for each incremental test.
461         * testsuite/Makefile.in: Rebuild.
463 2011-05-29  Ian Lance Taylor  <iant@google.com>
465         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
466         binary input file is empty.
468 2011-05-27  Ian Lance Taylor  <iant@google.com>
470         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
471         (ver_test_9.so): Likewise.
472         * testsuite/Makefile.in: Rebuild.
474 2011-05-26 Cary Coutant  <ccoutant@google.com>
476         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
477         * incremental.cc (Incremental_inputs::report_input_section): Fix
478         comment, indentation.
479         (Incremental_inputs::report_comdat_group): New function.
480         (Output_section_incremental_inputs::set_final_data_size): Adjust size
481         of data for incremental input file entry.
482         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
483         group count, COMDAT group signatures.
484         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
485         an unchanged input file.
486         * incremental.h (Incremental_object_entry::Incremental_object_entry):
487         Initialize new data member.
488         (Incremental_object_entry::add_comdat_group): New function.
489         (Incremental_object_entry::get_comdat_group_count): New function.
490         (Incremental_object_entry::get_comdat_signature_key): New function.
491         (Incremental_object_entry::groups_): New data member.
492         (Incremental_inputs::report_comdat_group): New function.
493         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
494         data for incremental input file entry.
495         (Incremental_input_entry_reader::get_comdat_group_count): New function.
496         (Incremental_input_entry_reader::get_input_section): Adjust size of
497         data for incremental input file entry.
498         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
499         (Incremental_input_entry_reader::get_comdat_group_signature): New
500         function.
501         * object.cc (Sized_relobj::include_section_group): Report kept
502         COMDAT groups for incremental links.
504 2011-05-24  David Meyer  <pdox@google.com>
506         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
507         with name parameter.  Add found_name parameter.
508         * fileread.cc (Input_file::find_file): Adjust code accordingly.
509         * dirsearch.h (class Dirsearch): Update declaration.
511 2011-05-24  Ian Lance Taylor  <iant@google.com>
513         * archive.cc (Library_base::should_include_member): Pull in object
514         from archive if it defines the entry symbol.
515         * parameters.cc (Parameters::entry): New function.
516         * parameters.h (class Parameters): Declare entry.
517         * output.h (class Output_file_header): Remove entry_ field.
518         * output.cc (Output_file_header::Output_file_header): Remove entry
519         parameter.  Change all callers.
520         (Output_file_header::entry): Use parameters->entry.
521         * gold.cc (queue_middle_tasks): Likewise.
522         * plugin.cc (Plugin_hook::run): Likewise.
524 2011-05-24 Cary Coutant  <ccoutant@google.com>
526         * gold.cc (queue_initial_tasks): Pass incremental base filename
527         to Output_file::open_base_file; don't print error message.
528         * incremental-dump.cc (main): Adjust call to
529         Output_file::open_for_modification.
530         * incremental-dump.cc (main): Likewise.
531         * incremental.cc (Incremental_inputs::report_command_line):
532         Ignore --incremental-base option when comparing command lines.
533         Ignore parameter when given as separate argument.
534         * options.h (class General_options): Add --incremental-base.
535         * output.cc (Output_file::Output_file):
536         (Output_file::open_base_file): Add base_name and writable parameters;
537         read base file into new file; print error message here.
538         (Output_file::map_no_anonymous): Add writable parameter; adjust all
539         callers.
540         * output.h (Output_file::open_for_modification): Rename to...
541         (Output_file::open_base_file): ...this; add base_name and
542         writable parameters; adjust all callers.
543         (Output_file::map_no_anonymous): Add writable parameter; adjust all
544         callers.
545         * testsuite/Makefile.am (incremental_test_4): Test
546         --incremental-base.
547         * testsuite/Makefile.in: Regenerate.
549 2011-05-24 Cary Coutant  <ccoutant@google.com>
551         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
552         incremental_test_4.
553         * testsuite/Makefile.in: Regenerate.
554         * testsuite/two_file_test_1_v1.cc: New test source file.
555         * testsuite/two_file_test_1b_v1.cc: New test source file.
556         * testsuite/two_file_test_2_v1.cc: New test source file.
558 2011-05-24 Cary Coutant  <ccoutant@google.com>
560         * dynobj.h (Dynobj::do_dynobj): New function.
561         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
562         flag and soname for shared objects.
563         * incremental.cc (Incremental_inputs::report_object): Make
564         either Incremental_object_entry or Incremental_dynobj_entry; add
565         soname to string table.
566         (Incremental_inputs::report_input_section): Add assertion.
567         (Output_section_incremental_inputs::set_final_data_size): Adjust
568         type of input file entry for shared libraries; adjust size of
569         shared library info entry.
570         (Output_section_incremental_inputs::write_input_files): Write
571         as_needed flag for shared libraries.
572         (Output_section_incremental_inputs::write_info_blocks): Adjust type
573         of input file entry for shared libraries; write soname.
574         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
575         soname from incremental info.
576         * incremental.h (enum Incremental_input_flags): Add
577         INCREMENTAL_INPUT_AS_NEEDED.
578         (Incremental_input_entry::Incremental_input_entry): Initialize new
579         data member.
580         (Incremental_input_entry::set_as_needed): New function.
581         (Incremental_input_entry::as_needed): New function.
582         (Incremental_input_entry::do_dynobj_entry): New function.
583         (Incremental_input_entry::as_needed_): New data member.
584         (Incremental_object_entry::Incremental_object_entry): Don't check
585         for shared library.
586         (Incremental_object_entry::do_type): Likewise.
587         (class Incremental_dynobj_entry): New class.
588         (Incremental_input_entry_reader::as_needed): New function.
589         (Incremental_input_entry_reader::get_soname): New function.
590         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
591         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
592         size of shared library info entry.
593         * layout.cc (Layout::finish_dynamic_section): Don't test for 
594         incremental link when adding DT_NEEDED entries.
595         * object.h (Object::Object): Initialize new data member.
596         (Object::dynobj): New function.
597         (Object::set_as_needed): New function.
598         (Object::as_needed): New function.
599         (Object::do_dynobj): New function.
600         (Object::as_needed_): New data member.
602 2011-05-24 Cary Coutant  <ccoutant@google.com>
604         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
605         info; adjust display of GOT entries.
606         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
607         vector of input objects; remove file_status_.
608         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
609         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
610         got_plt reader; call target hooks to reserve GOT entries.
611         (Output_section_incremental_inputs::set_final_data_size): Adjust size
612         of input file info header and GOT info entry.
613         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
614         relocation info.
615         (Got_plt_view_info::got_descriptor): Remove.
616         (Got_plt_view_info::sym_index): New data member.
617         (Got_plt_view_info::input_index): New data member.
618         (Local_got_offset_visitor::visit): Write input file index.
619         (Global_got_offset_visitor::visit): Write 0 for input file index.
620         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
621         with sym_index and input_index.
622         (Output_section_incremental_inputs::write_got_plt): Adjust size of
623         incremental info GOT entry; replace got_descriptor with input_index.
624         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
625         map from input file index to object.
626         (Sized_relobj_incr::do_layout): Replace direct data member reference
627         with accessor function.
628         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
629         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
630         Adjust size of input file info header.
631         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
632         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
633         (Incremental_input_entry_reader::get_input_section): Adjust size of
634         input file info header.
635         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
636         of incremental info GOT entry.
637         (Incremental_got_plt_reader::get_got_desc): Remove.
638         (Incremental_got_plt_reader::get_got_symndx): New function.
639         (Incremental_got_plt_reader::get_got_input_index): New function.
640         (Sized_incremental_binary::Sized_incremental_binary): Remove
641         file_status_; add input_objects_.
642         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
643         (Sized_incremental_binary::set_file_is_unchanged): Remove.
644         (Sized_incremental_binary::file_is_unchanged): Remove.
645         (Sized_incremental_binary::set_input_object): New function.
646         (Sized_incremental_binary::input_object): New function.
647         (Sized_incremental_binary::file_status_): Remove.
648         (Sized_incremental_binary::input_objects_): New data member.
649         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
650         references.
651         (Sized_relobj_incr::invalid_address): Move to base class.
652         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
653         class.
654         (Sized_relobj_incr::do_output_section_offset): Likewise.
655         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
656         (Sized_relobj_incr::section_offsets_): Likewise.
657         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
658         function.
659         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
660         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
661         with accessor function.
662         (Sized_relobj_file::do_layout): Likewise.
663         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
664         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
665         (Sized_relobj_file::compute_final_local_value): Replace refs to
666         section_offsets_ with accessor function.
667         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
668         * object.h (Relobj::Relobj): Initialize new data members.
669         (Relobj::add_dyn_reloc): New function.
670         (Relobj::first_dyn_reloc): New function.
671         (Relobj::dyn_reloc_count): New function.
672         (Relobj::first_dyn_reloc_): New data member.
673         (Relobj::dyn_reloc_count_): New data member.
674         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
675         references.
676         (Sized_relobj::Address): New typedef.
677         (Sized_relobj::invalid_address): Move here from child class.
678         (Sized_relobj::Sized_relobj): Initialize new data members.
679         (Sized_relobj::sized_relobj): New function.
680         (Sized_relobj::is_output_section_offset_invalid): Move here from
681         child class.
682         (Sized_relobj::get_output_section_offset): Likewise.
683         (Sized_relobj::local_has_got_offset): Likewise.
684         (Sized_relobj::local_got_offset): Likewise.
685         (Sized_relobj::set_local_got_offset): Likewise.
686         (Sized_relobj::do_for_all_local_got_entries): Likewise.
687         (Sized_relobj::clear_got_offsets): New function.
688         (Sized_relobj::section_offsets): Move here from child class.
689         (Sized_relobj::do_output_section_offset): Likewise.
690         (Sized_relobj::do_set_section_offset): Likewise.
691         (Sized_relobj::Local_got_offsets): Likewise.
692         (Sized_relobj::local_got_offsets_): Likewise.
693         (Sized_relobj::section_offsets_): Likewise.
694         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
695         references.
696         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
697         class.
698         (Sized_relobj_file::sized_relobj): New function
699         (Sized_relobj_file::local_has_got_offset): Move to base class.
700         (Sized_relobj_file::local_got_offset): Likewise.
701         (Sized_relobj_file::set_local_got_offset): Likewise.
702         (Sized_relobj_file::get_output_section_offset): Likewise.
703         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
704         (Sized_relobj_file::do_output_section_offset): Likewise.
705         (Sized_relobj_file::do_set_section_offset): Likewise.
706         (Sized_relobj_file::Local_got_offsets): Likewise.
707         (Sized_relobj_file::local_got_offsets_): Likewise.
708         (Sized_relobj_file::section_offsets_): Likewise.
709         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
710         (all constructors).
711         (set_needs_dynsym_index): Convert relobj to derived class pointer.
712         (Output_reloc::get_symbol_index): Likewise.
713         (Output_reloc::local_section_offset): Likewise.
714         (Output_reloc::get_address): Likewise.
715         (Output_reloc::symbol_value): Likewise.
716         (Output_data_got::reserve_slot): Move to class definition.
717         (Output_data_got::reserve_local): New function.
718         (Output_data_got::reserve_slot_for_global): Remove.
719         (Output_data_got::reserve_global): New function.
720         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
721         (all constructors, two instantiations).
722         (Output_reloc::get_relobj): New function (two instantiations).
723         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
724         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
725         (Output_data_reloc::add_global): Adjust type of relobj.
726         (Output_data_reloc::add_global_relative): Likewise.
727         (Output_data_reloc::add_symbolless_global_addend): Likewise.
728         (Output_data_reloc::add_local): Likewise.
729         (Output_data_reloc::add_local_relative): Likewise.
730         (Output_data_reloc::add_symbolless_local_addend): Likewise.
731         (Output_data_reloc::add_local_section): Likewise.
732         (Output_data_reloc::add_output_section): Likewise.
733         (Output_data_reloc::add_absolute): Likewise.
734         (Output_data_reloc::add_target_specific): Likewise.
735         (Output_data_got::reserve_slot): Move definition here.
736         (Output_data_got::reserve_local): New function.
737         (Output_data_got::reserve_global): New function.
738         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
739         section_offsets_ with accessor function.
740         (Sized_relobj_file::write_sections): Likewise.
741         (Sized_relobj_file::do_relocate_sections): Likewise.
742         * target.h (Sized_target::reserve_local_got_entry): New function.
743         (Sized_target::reserve_global_got_entry): New function.
744         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
745         (Target_x86_64::reserve_global_got_entry): New function.
746         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
748 2011-05-23 Cary Coutant  <ccoutant@google.com>
750         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
751         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
752         bit when checking got_type.
753         * incremental.cc (Sized_incremental_binary::setup_readers):
754         Store symbol table and string table locations; initialize bit vector
755         of file status flags.
756         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
757         unchanged files.
758         (Sized_incremental_binary::do_process_got_plt): New function.
759         (Sized_incremental_binary::get_symtab_view): Use stored locations.
760         (Output_section_incremental_inputs::set_final_data_size): Record
761         file index for each input file.
762         (Output_section_incremental_inputs::write_got_plt): Store file index
763         instead of input entry offset for each GOT entry.
764         * incremental.h
765         (Incremental_input_entry::Incremental_input_entry): Initialize new
766         data member.
767         (Incremental_input_entry::set_offset): Store file index.
768         (Incremental_input_entry::get_file_index): New function.
769         (Incremental_input_entry::file_index_): New data member.
770         (Incremental_binary::process_got_plt): New function.
771         (Incremental_binary::do_process_got_plt): New function.
772         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
773         data members.
774         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
775         (Sized_incremental_binary::set_file_is_unchanged): New function.
776         (Sized_incremental_binary::file_is_unchanged): New function.
777         (Sized_incremental_binary::do_process_got_plt): New function.
778         (Sized_incremental_binary::file_status_): New data member.
779         (Sized_incremental_binary::main_symtab_loc_): New data member.
780         (Sized_incremental_binary::main_strtab_loc_): New data member.
781         * output.cc (Output_data_got::Got_entry::write): Add case
782         RESERVED_CODE.
783         (Output_data_got::add_global): Call add_got_entry.
784         (Output_data_got::add_global_plt): Likewise.
785         (Output_data_got::add_global_with_rel): Likewise.
786         (Output_data_got::add_global_with_rela): Likewise.
787         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
788         (Output_data_got::add_global_pair_with_rela): Likewise.
789         (Output_data_got::add_local): Call add_got_entry.
790         (Output_data_got::add_local_plt): Likewise.
791         (Output_data_got::add_local_with_rel): Likewise.
792         (Output_data_got::add_local_with_rela): Likewise.
793         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
794         (Output_data_got::add_local_pair_with_rela): Likewise.
795         (Output_data_got::reserve_slot): New function.
796         (Output_data_got::reserve_slot_for_global): New function.
797         (Output_data_got::add_got_entry): New function.
798         (Output_data_got::add_got_entry_pair): New function.
799         (Output_section::add_output_section_data): Edit FIXME.
800         * output.h
801         (Output_section_data_build::Output_section_data_build): New
802         constructor with size parameter.
803         (Output_data_space::Output_data_space): Likewise.
804         (Output_data_got::Output_data_got): Initialize new data member; new
805         constructor with size parameter.
806         (Output_data_got::add_constant): Call add_got_entry.
807         (Output_data_got::reserve_slot): New function.
808         (Output_data_got::reserve_slot_for_global): New function.
809         (class Output_data_got::Got_entry): Add RESERVED_CODE.
810         (Output_data_got::add_got_entry): New function.
811         (Output_data_got::add_got_entry_pair): New function.
812         (Output_data_got::free_list_): New data member.
813         * target.h (Sized_target::init_got_plt_for_update): New function.
814         (Sized_target::register_global_plt_entry): New function.
815         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
816         Initialize new data member; call init; add constructor with PLT count.
817         (Output_data_plt_x86_64::init): New function.
818         (Output_data_plt_x86_64::add_relocation): New function.
819         (Output_data_plt_x86_64::reserve_slot): New function.
820         (Output_data_plt_x86_64::free_list_): New data member.
821         (Target_x86_64::init_got_plt_for_update): New function.
822         (Target_x86_64::register_global_plt_entry): New function.
823         (Output_data_plt_x86_64::add_entry): Allocate from free list for
824         incremental updates.
825         (Output_data_plt_x86_64::add_relocation): New function.
826         * testsuite/object_unittest.cc (Object_test): Set default options.
828 2011-05-16  Ian Lance Taylor  <iant@google.com>
830         * options.h (class General_options): Make -i a synonym for -r.
832 2011-05-16  Ian Lance Taylor  <iant@google.com>
834         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
836 2011-05-10 Cary Coutant  <ccoutant@google.com>
838         * object.cc (Sized_relobj::do_count_local_symbols): Check for
839         strip_all (-s).
841 2011-05-06  Ian Lance Taylor  <iant@google.com>
843         * layout.cc (Layout::layout): If the output section flags change,
844         update the ordering.
846 2011-04-25 Cary Coutant  <ccoutant@google.com>
848         * incremental-dump.cc (dump_incremental_inputs): Print local
849         symbol info for each input file.
850         * incremental.cc
851         (Output_section_incremental_inputs::set_final_data_size): Add local
852         symbol info to input file entries in incremental info.
853         (Output_section_incremental_inputs::write_info_blocks): Likewise.
854         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
855         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
856         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
857         implementation.
858         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
859         (Sized_incr_relobj::do_relocate): Write the local symbols.
860         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
861         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
862         Adjust size of input file header.
863         (Incremental_inputs_reader::get_local_symbol_offset): New function.
864         (Incremental_inputs_reader::get_local_symbol_count): New function.
865         (Incremental_inputs_reader::get_input_section): Adjust size of input
866         file header.
867         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
868         (Sized_incr_relobj::This): New typedef.
869         (Sized_incr_relobj::sym_size): New const data member.
870         (Sized_incr_relobj::Local_symbol): New struct.
871         (Sized_incr_relobj::do_output_local_symbol_count): New function.
872         (Sized_incr_relobj::do_local_symbol_offset): New function.
873         (Sized_incr_relobj::local_symbol_count_): New data member.
874         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
875         (Sized_incr_relobj::local_symbol_index_): New data member.
876         (Sized_incr_relobj::local_symbol_offset_): New data member.
877         (Sized_incr_relobj::local_dynsym_offset_): New data member.
878         (Sized_incr_relobj::local_symbols_): New data member.
879         * object.h (Relobj::output_local_symbol_count): New function.
880         (Relobj::local_symbol_offset): New function.
881         (Relobj::do_output_local_symbol_count): New function.
882         (Relobj::do_local_symbol_offset): New function.
883         (Sized_relobj::do_output_local_symbol_count): New function.
884         (Sized_relobj::do_local_symbol_offset): New function.
886 2011-04-22  Vladimir Simonov  <sv@sw.ru>
888         * descriptors.cc (set_close_on_exec): New function.
889         (Descriptors::open): Use set_close_on_exec.
890         * output.cc (S_ISLNK): Define if not defined.
892 2011-04-22 Cary Coutant  <ccoutant@google.com>
894         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
895         global symbol map.
896         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
897         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
898         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
899         relocations.
900         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
901         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
902         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
903         * incremental.h
904         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
905         function.
906         (Incremental_binary::apply_incremental_relocs): New function.
907         (Incremental_binary::do_apply_incremental_relocs): New function.
908         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
909         data member.
910         (Sized_incremental_binary::add_global_symbol): New function.
911         (Sized_incremental_binary::global_symbol): New function.
912         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
913         (Sized_incremental_binary::symbol_map_): New data member.
914         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
915         * target.h (Sized_target::apply_relocation): New function.
916         * target-reloc.h (apply_relocation): New function.
917         * x86_64.cc (Target_x86_64::apply_relocation): New function.
919 2011-04-22  Doug Kwan  <dougkwan@google.com>
921         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
922         flag of a SHT_ARM_EXIDX section.
923         * testsuite/Makefile.am (arm_exidx_test): New test rules.
924         * testsuite/Makefile.in: Regenerate.
925         * testsuite/arm_exidx_test.s: New file.
926         * testsuite/arm_exidx_test.sh: Same.
928 2011-04-20 Cary Coutant  <ccoutant@google.com>
930         PR gold/12689
931         * archive.h (Incremental_archive_entry::Archive_member):
932         Initialize arg_serial_ (second constructor).
934 2011-04-17  Ian Lance Taylor  <iant@google.com>
936         * object.cc (Relocate_info::location): Simplify location string.
937         * errors.cc (Errors::error_at_location): Don't print program
938         name.
939         (Errors::warning_at_location): Likewise.
940         (Errors::undefined_symbol): Likewise.
941         * testsuite/debug_msg.sh: Update accordingly.
943 2011-04-14 Cary Coutant  <ccoutant@google.com>
945         * gold/layout.cc (Layout::symtab_section_offset): New function.
946         * gold/layout.h (Layout::symtab_section_offset): New function.
947         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
949 2011-04-12  Ian Lance Taylor  <iant@google.com>
951         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
952         with MREMAP_MAYMOVE.
953         * output.h (class Output_file): Add map_is_allocated_ field.
954         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
955         not available, provide stubs.  If mremap is not available, #define
956         it to gold_mremap.
957         (MREMAP_MAYMOVE): Define if not defined.
958         (Output_file::Output_file): Initialize map_is_allocated_.
959         (Output_file::resize): Check map_is_allocated_.
960         (Output_file::map_anonymous): If mmap fails, use malloc.
961         (Output_file::unmap): Don't do anything for an anonymous map.
962         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
963         is not available, provide stubs.
964         (File_read::View::~View): Use free rather than delete[].
965         (File_read::make_view): Use malloc rather than new[].  If mmap
966         fails, use malloc.
967         (File_read::find_or_make_view): Use malloc rather than new[].
968         * gold.h: Remove HAVE_REMAP code.
969         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
970         exists.  Rename mremap to gold_mremap.  If mmap is not available
971         don't do anything.
972         * configure, config.in: Rebuild.
974 2011-04-11  Ian Lance Taylor  <iant@google.com>
976         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
977         initialize local variable v.
979 2011-04-11  Cary Coutant  <ccoutant@google.com>
981         * archive.cc (Archive::include_member): Adjust call to
982         report_object.
983         (Add_archive_symbols::run): Track argument serial numbers.
984         (Lib_group::include_member): Likewise.
985         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
986         * archive.h (Incremental_archive_entry::Archive_member):
987         Initialize arg_serial_.
988         (Archive_member::arg_serial_): New data member.
989         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
990         (Sized_dynobj::do_add_symbols): Track symbols when doing an
991         incremental link.
992         (Sized_dynobj::do_for_all_local_got_entries): New function.
993         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
994         function.
995         * fileread.cc (get_mtime): New function.
996         * fileread.h (get_mtime): New function.
997         * gold.cc (queue_initial_tasks): Check for incremental update.
998         (process_incremental_input): New function.
999         (queue_middle_tasks): Don't force valid target for incremental
1000         update.
1001         * incremental-dump.cc (find_input_containing_global): Adjust
1002         size of symbol info entry.
1003         (dump_incremental_inputs): Dump argument serial number and
1004         in_system_directory flag; bias shndx by 1; print symbol names
1005         when dumping per-file symbol lists; use new symbol info readers.
1006         * incremental.cc
1007         (Output_section_incremental_inputs:update_data_size): New function.
1008         (Sized_incremental_binary::setup_readers): Setup input readers
1009         for each input file; build maps for files added from libraries
1010         and scripts.
1011         (Sized_incremental_binary::check_input_args): New function.
1012         (Sized_incremental_binary::do_check_inputs): Build map of argument
1013         serial numbers to input arguments.
1014         (Sized_incremental_binary::do_file_has_changed): Rename
1015         do_file_is_unchanged to this; compare file modification times.
1016         (Sized_incremental_binary::do_init_layout): New function.
1017         (Sized_incremental_binary::do_reserve_layout): New function.
1018         (Sized_incremental_binary::do_get_input_reader): Remove.
1019         (Sized_incremental_binary::get_symtab_view): New function.
1020         (Incremental_checker::can_incrementally_link_output_file): Remove.
1021         (Incremental_inputs::report_command_line): Exclude --debug options.
1022         (Incremental_inputs::report_archive_begin): Add parameter; track
1023         argument serial numbers; don't put input file entry for archive
1024         before archive members.
1025         (Incremental_inputs::report_archive_end): Put input file entry
1026         for archive after archive members.
1027         (Incremental_inputs::report_object): Add parameter; track argument
1028         serial numbers and in_system_directory flag.
1029         (Incremental_inputs::report_script): Add parameter; track argument
1030         serial numbers.
1031         (Output_section_incremental_inputs::set_final_data_size): Adjust
1032         size of symbol info entry; check for forwarding symbols.
1033         (Output_section_incremental_inputs::write_input_files): Write
1034         in_system_directory flag and argument serial number.
1035         (Output_section_incremental_inputs::write_info_blocks): Map section
1036         indices between incremental info and original input file; store
1037         input section index for each symbol.
1038         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
1039         change operator() to visit().
1040         (class Global_got_offset_visitor): Likewise.
1041         (class Global_symbol_visitor_got_plt):
1042         (Output_section_incremental_inputs::write_got_plt): Use new visitor
1043         classes.
1044         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
1045         (Sized_incr_relobj::do_read_symbols): New function.
1046         (Sized_incr_relobj::do_layout): New function.
1047         (Sized_incr_relobj::do_layout_deferred_sections): New function.
1048         (Sized_incr_relobj::do_add_symbols): New function.
1049         (Sized_incr_relobj::do_should_include_member): New function.
1050         (Sized_incr_relobj::do_for_all_global_symbols): New function.
1051         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
1052         (Sized_incr_relobj::do_section_size): New function.
1053         (Sized_incr_relobj::do_section_name): New function.
1054         (Sized_incr_relobj::do_section_contents): New function.
1055         (Sized_incr_relobj::do_section_flags): New function.
1056         (Sized_incr_relobj::do_section_entsize): New function.
1057         (Sized_incr_relobj::do_section_address): New function.
1058         (Sized_incr_relobj::do_section_type): New function.
1059         (Sized_incr_relobj::do_section_link): New function.
1060         (Sized_incr_relobj::do_section_info): New function.
1061         (Sized_incr_relobj::do_section_addralign): New function.
1062         (Sized_incr_relobj::do_initialize_xindex): New function.
1063         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
1064         (Sized_incr_relobj::do_read_relocs): New function.
1065         (Sized_incr_relobj::do_gc_process_relocs): New function.
1066         (Sized_incr_relobj::do_scan_relocs): New function.
1067         (Sized_incr_relobj::do_count_local_symbols): New function.
1068         (Sized_incr_relobj::do_finalize_local_symbols): New function.
1069         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
1070         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
1071         (Sized_incr_relobj::do_relocate): New function.
1072         (Sized_incr_relobj::do_set_section_offset): New function.
1073         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
1074         (Sized_incr_dynobj::do_read_symbols): New function.
1075         (Sized_incr_dynobj::do_layout): New function.
1076         (Sized_incr_dynobj::do_add_symbols): New function.
1077         (Sized_incr_dynobj::do_should_include_member): New function.
1078         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
1079         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
1080         (Sized_incr_dynobj::do_section_size): New function.
1081         (Sized_incr_dynobj::do_section_name): New function.
1082         (Sized_incr_dynobj::do_section_contents): New function.
1083         (Sized_incr_dynobj::do_section_flags): New function.
1084         (Sized_incr_dynobj::do_section_entsize): New function.
1085         (Sized_incr_dynobj::do_section_address): New function.
1086         (Sized_incr_dynobj::do_section_type): New function.
1087         (Sized_incr_dynobj::do_section_link): New function.
1088         (Sized_incr_dynobj::do_section_info): New function.
1089         (Sized_incr_dynobj::do_section_addralign): New function.
1090         (Sized_incr_dynobj::do_initialize_xindex): New function.
1091         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
1092         (make_sized_incremental_object): New function.
1093         (Incremental_library::copy_unused_symbols): New function.
1094         (Incremental_library::do_for_all_unused_symbols): New function.
1095         * incremental.h (enum Incremental_input_flags): New type.
1096         (class Incremental_checker): Remove.
1097         (Incremental_input_entry::Incremental_input_entry): Add argument
1098         serial number.
1099         (Incremental_input_entry::arg_serial): New function.
1100         (Incremental_input_entry::set_is_in_system_directory): New function.
1101         (Incremental_input_entry::is_in_system_directory): New function.
1102         (Incremental_input_entry::arg_serial_): New data member.
1103         (Incremental_input_entry::is_in_system_directory_): New data member.
1104         (class Script_info): Move here from script.h.
1105         (Script_info::Script_info): Add filename parameter.
1106         (Script_info::filename): New function.
1107         (Script_info::filename_): New data member.
1108         (Incremental_script_entry::Incremental_script_entry): Add argument
1109         serial number.
1110         (Incremental_object_entry::Incremental_object_entry): Likewise.
1111         (Incremental_object_entry::add_input_section): Build list of input
1112         sections with map to original shndx.
1113         (Incremental_object_entry::get_input_section_index): New function.
1114         (Incremental_object_entry::shndx_): New data member.
1115         (Incremental_object_entry::name_key_): Rename; adjust all refs.
1116         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
1117         (Incremental_archive_entry::Incremental_archive_entry): Add argument
1118         serial number.
1119         (Incremental_inputs::report_archive_begin): Likewise.
1120         (Incremental_inputs::report_object): Likewise.
1121         (Incremental_inputs::report_script): Likewise.
1122         (class Incremental_global_symbol_reader): New class.
1123         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
1124         and store flags and input file type.
1125         (Incremental_input_entry_reader::arg_serial): New function.
1126         (Incremental_input_entry_reader::type): Extract type from flags.
1127         (Incremental_input_entry_reader::is_in_system_directory): New function.
1128         (Incremental_input_entry_reader::get_input_section_count): Call
1129         accessor function for type.
1130         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
1131         function for type; adjust size of global symbol entry.
1132         (Incremental_input_entry_reader::get_global_symbol_count): Call
1133         accessor function for type.
1134         (Incremental_input_entry_reader::get_object_count): Likewise.
1135         (Incremental_input_entry_reader::get_object_offset): Likewise.
1136         (Incremental_input_entry_reader::get_member_count): Likewise.
1137         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
1138         (Incremental_input_entry_reader::get_member_offset): Likewise.
1139         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
1140         (Incremental_input_entry_reader::Global_symbol_info): Remove.
1141         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
1142         (Incremental_input_entry_reader::get_global_symbol_reader): New
1143         function.
1144         (Incremental_input_entry_reader::get_output_symbol_index): New
1145         function.
1146         (Incremental_input_entry_reader::type_): Remove.
1147         (Incremental_input_entry_reader::flags_): New data member.
1148         (Incremental_inputs_reader::input_file_offset): New function.
1149         (Incremental_inputs_reader::input_file_index): New function.
1150         (Incremental_inputs_reader::input_file): Call input_file_offset.
1151         (Incremental_inputs_reader::input_file_at_offset): New function.
1152         (Incremental_relocs_reader::get_r_type): Reformat.
1153         (Incremental_relocs_reader::get_r_shndx): Reformat.
1154         (Incremental_relocs_reader::get_r_offset): Reformat.
1155         (Incremental_relocs_reader::data): New function.
1156         (Incremental_binary::Incremental_binary): Initialize new data members.
1157         (Incremental_binary::check_inputs): Add cmdline parameter.
1158         (Incremental_binary::file_is_unchanged): Remove.
1159         (Input_reader::arg_serial): New function.
1160         (Input_reader::get_unused_symbol_count): New function.
1161         (Input_reader::get_unused_symbol): New function.
1162         (Input_reader::do_arg_serial): New function.
1163         (Input_reader::do_get_unused_symbol_count): New function.
1164         (Input_reader::do_get_unused_symbol): New function.
1165         (Incremental_binary::input_file_count): New function.
1166         (Incremental_binary::get_input_reader): Change signature to use
1167         index instead of filename.
1168         (Incremental_binary::file_has_changed): New function.
1169         (Incremental_binary::get_input_argument): New function.
1170         (Incremental_binary::get_library): New function.
1171         (Incremental_binary::get_script_info): New function.
1172         (Incremental_binary::init_layout): New function.
1173         (Incremental_binary::reserve_layout): New function.
1174         (Incremental_binary::output_file): New function.
1175         (Incremental_binary::do_check_inputs): New function.
1176         (Incremental_binary::do_file_is_unchanged): Remove.
1177         (Incremental_binary::do_file_has_changed): New function.
1178         (Incremental_binary::do_init_layout): New function.
1179         (Incremental_binary::do_reserve_layout): New function.
1180         (Incremental_binary::do_input_file_count): New function.
1181         (Incremental_binary::do_get_input_reader): Change signature.
1182         (Incremental_binary::input_args_map_): New data member.
1183         (Incremental_binary::library_map_): New data member.
1184         (Incremental_binary::script_map_): New data member.
1185         (Sized_incremental_binary::Sized_incremental_binary): Initialize
1186         new data members.
1187         (Sized_incremental_binary::output_section): New function.
1188         (Sized_incremental_binary::inputs_reader): Add const.
1189         (Sized_incremental_binary::symtab_reader): Add const.
1190         (Sized_incremental_binary::relocs_reader): Add const.
1191         (Sized_incremental_binary::got_plt_reader): Add const.
1192         (Sized_incremental_binary::get_symtab_view): New function.
1193         (Sized_incremental_binary::Inputs_reader): New typedef.
1194         (Sized_incremental_binary::Input_entry_reader): New typedef.
1195         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
1196         (Sized_incremental_binary::do_file_is_unchanged): Remove.
1197         (Sized_incremental_binary::do_file_has_changed): New function.
1198         (Sized_incremental_binary::do_init_layout): New function.
1199         (Sized_incremental_binary::do_reserve_layout): New function.
1200         (Sized_input_reader::Inputs_reader): Remove.
1201         (Sized_input_reader::Input_entry_reader): Remove.
1202         (Sized_input_reader::do_arg_serial): New function.
1203         (Sized_input_reader::do_get_unused_symbol_count): New function.
1204         (Sized_input_reader::do_get_unused_symbol): New function.
1205         (Sized_incremental_binary::do_input_file_count): New function.
1206         (Sized_incremental_binary::do_get_input_reader): Change signature;
1207         use index instead of filename.
1208         (Sized_incremental_binary::section_map_): New data member.
1209         (Sized_incremental_binary::input_entry_readers_): New data member.
1210         (class Sized_incr_relobj): New class.
1211         (class Sized_incr_dynobj): New class.
1212         (make_sized_incremental_object): New function.
1213         (class Incremental_library): New class.
1214         * layout.cc (Free_list::num_lists): New static data member.
1215         (Free_list::num_nodes): New static data member.
1216         (Free_list::num_removes): New static data member.
1217         (Free_list::num_remove_visits): New static data member.
1218         (Free_list::num_allocates): New static data member.
1219         (Free_list::num_allocate_visits): New static data member.
1220         (Free_list::init): New function.
1221         (Free_list::remove): New function.
1222         (Free_list::allocate): New function.
1223         (Free_list::dump): New function.
1224         (Free_list::print_stats): New function.
1225         (Layout_task_runner::run): Resize output file for incremental updates.
1226         (Layout::Layout): Initialize new data members.
1227         (Layout::set_incremental_base): New function.
1228         (Layout::init_fixed_output_section): New function.
1229         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
1230         incremental updates.
1231         (Layout::create_gold_note): Do not create gold note section for
1232         incremental updates.
1233         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
1234         for incremental updates.
1235         (Layout::set_section_offsets): For incremental updates, allocate space
1236         from free list.
1237         (Layout::create_symtab_sections): Layout with offsets relative to
1238         start of section; for incremental updates, allocate space from free
1239         list.
1240         (Layout::create_shdrs): For incremental updates, allocate space from
1241         free list.
1242         (Layout::finish_dynamic_section): For incremental updates, do not
1243         check --as-needed (fixed in subsequent patch).
1244         * layout.h (class Free_list): New class.
1245         (Layout::set_incremental_base): New function.
1246         (Layout::incremental_base): New function.
1247         (Layout::init_fixed_output_section): New function.
1248         (Layout::allocate): New function.
1249         (Layout::incremental_base_): New data member.
1250         (Layout::free_list_): New data member.
1251         * main.cc (main): Print Free_list statistics.
1252         * object.cc (Relobj::finalize_incremental_relocs): Add
1253         clear_counts parameter; clear counts only when clear_counts is set.
1254         (Sized_relobj::Sized_relobj): Initialize new base class.
1255         (Sized_relobj::do_layout): Don't report special sections.
1256         (Sized_relobj::do_for_all_local_got_entries): New function.
1257         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
1258         symtab_off to all symbol table offsets.
1259         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
1260         * object.h (class Got_offset_list): Move to top of file.
1261         (Object::Object): Allow case where input_file == NULL.
1262         (Object::~Object): Likewise.
1263         (Object::input_file): Assert that input_file != NULL.
1264         (Object::lock): Allow case where input_file == NULL.
1265         (Object::unlock): Likewise.
1266         (Object::is_locked): Likewise.
1267         (Object::token): Likewise.
1268         (Object::release): Likewise.
1269         (Object::is_incremental): New function.
1270         (Object::get_mtime): New function.
1271         (Object::for_all_local_got_entries): New function.
1272         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
1273         (Object::set_is_in_system_directory): New function.
1274         (Object::is_in_system_directory): New function.
1275         (Object::do_is_incremental): New function.
1276         (Object::do_get_mtime): New function.
1277         (Object::do_for_all_local_got_entries): New function.
1278         (Object::is_in_system_directory_): New data member.
1279         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
1280         (class Sized_relobj_base): New class.
1281         (class Sized_relobj): Derive from Sized_relobj_base.
1282         (class Sized_relobj::Symbols): Redeclare from base class.
1283         (class Sized_relobj::local_got_offset_list): Remove.
1284         (class Sized_relobj::Output_sections): Redeclare from base class.
1285         (class Sized_relobj::do_for_all_local_got_entries): New function.
1286         (class Sized_relobj::write_local_symbols): Add offset parameter.
1287         (class Sized_relobj::local_symbol_offset_): Update comment.
1288         (class Sized_relobj::local_dynsym_offset_): Update comment.
1289         * options.cc (Input_arguments::add_file): Remove const.
1290         * options.h (Input_file_argument::Input_file_argument):
1291         Initialize arg_serial_ (all constructors).
1292         (Input_file_argument::set_arg_serial): New function.
1293         (Input_file_argument::arg_serial): New function.
1294         (Input_file_argument::arg_serial_): New data member.
1295         (Input_arguments::Input_arguments): Initialize file_count_.
1296         (Input_arguments::add_file): Remove const.
1297         (Input_arguments::number_of_input_files): New function.
1298         (Input_arguments::file_count_): New data member.
1299         (Command_line::number_of_input_files): Call
1300         Input_arguments::number_of_input_files.
1301         * output.cc (Output_segment_headers::Output_segment_headers):
1302         Set current size.
1303         (Output_section::Input_section::current_data_size): New function.
1304         (Output_section::Output_section): Initialize new data members.
1305         (Output_section::add_input_section): Don't do merge sections for
1306         an incremental link; allocate space from free list for an
1307         incremental update.
1308         (Output_section::add_output_section_data): Allocate space from
1309         free list for an incremental update.
1310         (Output_section::update_data_size): New function.
1311         (Output_section::set_fixed_layout): New function.
1312         (Output_section::reserve): New function.
1313         (Output_segment::set_section_addresses): Remove const.
1314         (Output_segment::set_section_list_addresses): Remove const; allocate
1315         space from free list for an incremental update.
1316         (Output_segment::set_offset): Adjust size of RELRO segment for an
1317         incremental update.
1318         * output.h (Output_data::current_data_size): Move here from
1319         child classes.
1320         (Output_data::pre_finalize_data_size): New function.
1321         (Output_data::update_data_size): New function.
1322         (Output_section_headers::update_data_size): new function.
1323         (Output_section_data_build::current_data_size): Move to Output_data.
1324         (Output_data_strtab::update_data_size): New function.
1325         (Output_section::current_data_size): Move to Output_data.
1326         (Output_section::set_fixed_layout): New function.
1327         (Output_section::has_fixed_layout): New function.
1328         (Output_section::reserve): New function.
1329         (Output_section::update_data_size): New function.
1330         (Output_section::has_fixed_layout_): New data member.
1331         (Output_section::free_list_): New data member.
1332         (Output_segment::set_section_addresses): Remove const.
1333         (Output_segment::set_section_list_addresses): Remove const.
1334         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
1335         New function.
1336         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
1337         New function.
1338         * readsyms.cc (Read_symbols::do_read_symbols): Add library
1339         parameter when calling Add_symbols constructor; store argument
1340         serial number for members of a lib group.
1341         (Add_symbols::locks): Allow case where token == NULL.
1342         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
1343         (Read_member::~Read_member): New function.
1344         (Read_member::is_runnable): New function.
1345         (Read_member::locks): New function.
1346         (Read_member::run): New function.
1347         (Check_script::~Check_script): New function.
1348         (Check_script::is_runnable): New function.
1349         (Check_script::locks): New function.
1350         (Check_script::run): New function.
1351         (Check_library::~Check_library): New function.
1352         (Check_library::is_runnable): New function.
1353         (Check_library::locks): New function.
1354         (Check_library::run): New function.
1355         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
1356         (Add_symbols::library_): New data member.
1357         (class Read_member): New class.
1358         (class Check_script): New class.
1359         (class Check_library): New class.
1360         * reloc.cc (Read_relocs::is_runnable): Allow case where
1361         token == NULL.
1362         (Read_relocs::locks): Likewise.
1363         (Scan_relocs::locks): Likewise.
1364         (Relocate_task::locks): Likewise.
1365         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
1366         to clear counters.
1367         (Sized_relobj::incremental_relocs_scan): Fix comment.
1368         (Sized_relobj::do_relocate): Pass output file offset to
1369         write_local_symbols.
1370         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
1371         from class declaration.
1372         * script.cc (read_input_script): Allocate Script_info; pass
1373         argument serial number to report_script.
1374         * script.h (class Script_info): Move to incremental.h.
1375         * symtab.cc (Symbol_table::add_from_incrobj): New function.
1376         * symtab.h (Symbol_table::add_from_incrobj): New function.
1377         (Symbol_table::set_file_offset): New function.
1379 2011-04-05  Cary Coutant  <ccoutant@google.com>
1381         * incremental-dump.cc (dump_incremental_inputs): Change signature
1382         to take a Sized_incremental_binary; change caller.  Use readers
1383         in Sized_incremental_binary.
1384         * incremental.cc
1385         (Sized_incremental_binary::find_incremental_inputs_sections):
1386         Rename do_find_incremental_inputs_sections to this.
1387         (Sized_incremental_binary::setup_readers): New function.
1388         (Sized_incremental_binary::do_check_inputs): Check
1389         has_incremental_info_ flag; move setup code to setup_readers;
1390         use input readers.
1391         (Sized_incremental_binary::do_file_is_unchanged): New function.
1392         (Sized_incremental_binary::do_get_input_reader): New function.
1393         * incremental.h (class Incremental_binary): Move to end of file.
1394         (Incremental_binary::file_is_unchanged): New function.
1395         (Incremental_binary::do_file_is_unchanged): New function.
1396         (Incremental_binary::Input_reader): New class.
1397         (Incremental_binary::get_input_reader): New function.
1398         (class Sized_incremental_binary): Move to end of file.
1399         (Sized_incremental_binary::Sized_incremental_binary): Setup the
1400         input section reader classes.
1401         (Sized_incremental_binary::has_incremental_info): New function.
1402         (Sized_incremental_binary::inputs_reader): New function.
1403         (Sized_incremental_binary::symtab_reader): New function.
1404         (Sized_incremental_binary::relocs_reader): New function.
1405         (Sized_incremental_binary::got_plt_reader): New function.
1406         (Sized_incremental_binary::do_file_is_unchanged): New function.
1407         (Sized_incremental_binary::Sized_input_reader): New class.
1408         (Sized_incremental_binary::get_input_reader): New function.
1409         (Sized_incremental_binary::find_incremental_inputs_sections):
1410         Rename do_find_incremental_inputs_sections to this.
1411         (Sized_incremental_binary::setup_readers): New function.
1412         (Sized_incremental_binary::has_incremental_info_): New data member.
1413         (Sized_incremental_binary::inputs_reader_): New data member.
1414         (Sized_incremental_binary::symtab_reader_): New data member.
1415         (Sized_incremental_binary::relocs_reader_): New data member.
1416         (Sized_incremental_binary::got_plt_reader_): New data member.
1417         (Sized_incremental_binary::current_input_file_): New data member.
1419 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
1421         PR gold/12640
1422         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
1423         violation.
1425 2011-03-30  Cary Coutant  <ccoutant@google.com>
1427         * archive.cc (Archive::include_member): Adjust call to report_object.
1428         (Add_archive_symbols::run): Add script_info to call to
1429         report_archive_begin.
1430         (Lib_group::include_member): Adjust call to report_object.
1431         (Add_lib_group_symbols::run): Adjust call to report_object.
1432         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
1433         blocks.  Add object count for script input files.
1434         * incremental.cc (Incremental_inputs::report_archive_begin): Add
1435         script_info parameter; change all callers.
1436         (Incremental_inputs::report_object): Add script_info parameter;
1437         change all callers.
1438         (Incremental_inputs::report_script): Store backpointer to
1439         incremental info entry.
1440         (Output_section_incremental_inputs::set_final_data_size): Record
1441         additional information for scripts.
1442         (Output_section_incremental_inputs::write_info_blocks): Likewise.
1443         * incremental.h (Incremental_script_entry::add_object): New function.
1444         (Incremental_script_entry::get_object_count): New function.
1445         (Incremental_script_entry::get_object): New function.
1446         (Incremental_script_entry::objects_): New data member; adjust
1447         constructor.
1448         (Incremental_inputs::report_archive_begin): Add script_info parameter.
1449         (Incremental_inputs::report_object): Add script_info parameter.
1450         (Incremental_inputs_reader::get_object_count): New function.
1451         (Incremental_inputs_reader::get_object_offset): New function.
1452         * options.cc (Input_arguments::add_file): Return reference to
1453         new input argument.
1454         * options.h (Input_argument::set_script_info): New function.
1455         (Input_argument::script_info): New function.
1456         (Input_argument::script_info_): New data member; adjust all
1457         constructors.
1458         (Input_file_group::add_file): Return reference to new input argument.
1459         (Input_file_lib::add_file): Likewise.
1460         (Input_arguments::add_file): Likewise.
1461         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
1462         * script.cc (Parser_closure::Parser_closure): Add script_info
1463         parameter; adjust all callers.
1464         (Parser_closure::script_info): New function.
1465         (Parser_closure::script_info_): New data member.
1466         (read_input_script): Report scripts earlier to incremental info.
1467         (script_add_file): Set script_info in Input_argument.
1468         (script_add_library): Likewise.
1469         * script.h (Script_options::Script_info): Rewrite class.
1471 2011-03-29  Cary Coutant  <ccoutant@google.com>
1473         * archive.cc (Library_base::should_include_member): Move
1474         method here from class Archive.
1475         (Archive::Archive): Initialize base class.
1476         (Archive::should_include_member): Move to base class.
1477         (Archive::do_for_all_unused_symbols): New function.
1478         (Add_archive_symbols::run): Remove redundant access to
1479         incremental_inputs.
1480         (Lib_group::Lib_group): Initialize base class.
1481         (Lib_group::do_filename): New function.
1482         (Lib_group::include_member): Pass pointer to Lib_group to
1483         report_object.
1484         (Lib_group::do_for_all_unused_symbols): New function.
1485         (Add_lib_group_symbols::run): Report archive information for
1486         incremental links.
1487         * archive.h (class Library_base): New base class.
1488         (class Archive): Derive from Library_base.
1489         (Archive::filename): Move to base class.
1490         (Archive::set_incremental_info): Likewise.
1491         (Archive::incremental_info): Likewise.
1492         (Archive::Should_include): Likewise.
1493         (Archive::should_include_member): Likewise.
1494         (Archive::Armap_entry): Remove.
1495         (Archive::Unused_symbol_iterator): Remove.
1496         (Archive::unused_symbols_begin): Remove.
1497         (Archive::unused_symbols_end): Remove.
1498         (Archive::do_filename): New function.
1499         (Archive::do_get_mtime): New function.
1500         (Archive::do_for_all_unused_symbols): New function.
1501         (Archive::task_): Move to base class.
1502         (Archive::incremental_info_): Likewise.
1503         (class Lib_group): Derive from Library_base.
1504         (Lib_group::do_filename): New function.
1505         (Lib_group::do_get_mtime): New function.
1506         (Lib_group::do_for_all_unused_symbols): New function.
1507         (Lib_group::task_): Move to base class.
1508         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
1509         function.
1510         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
1511         function.
1512         * incremental.cc (Incremental_inputs::report_archive_begin):
1513         Use Library_base; call library's get_mtime; add incremental inputs
1514         entry before members.
1515         (class Unused_symbol_visitor): New class.
1516         (Incremental_inputs::report_archive_end): Use Library_base; use
1517         visitor class to record unused symbols; don't add incremental inputs
1518         entry after members.
1519         (Incremental_inputs::report_object): Use Library_base.
1520         * incremental.h
1521         (Incremental_archive_entry::Incremental_archive_entry): Remove
1522         unused Archive parameter.
1523         (Incremental_inputs::report_archive_begin): Use Library_base.
1524         (Incremental_inputs::report_archive_end): Likewise.
1525         (Incremental_inputs::report_object): Likewise.
1526         * object.cc (Sized_relobj::do_for_all_global_symbols): New
1527         function.
1528         * object.h (Object::for_all_global_symbols): New function.
1529         (Object::do_for_all_global_symbols): New function.
1530         (Sized_relobj::do_for_all_global_symbols): New function.
1531         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
1532         function.
1533         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
1534         function.
1536 2011-03-27  Ian Lance Taylor  <iant@google.com>
1538         * archive.cc (Archive::interpret_header): Return -1 if something
1539         goes wrong.  Change callers accordingly.
1541 2011-03-25  Cary Coutant  <ccoutant@google.com>
1543         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
1544         * testsuite/Makefile.in: Regenerate.
1546 2010-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
1548         * plugin.cc (get_view): New.
1549         (Plugin::load): Pass get_view to the plugin.
1550         (Plugin_manager::get_view): New.
1552 2011-03-21  Ian Lance Taylor  <iant@google.com>
1554         * testsuite/final_layout.sh: Rewrite to not use dc.
1555         * testsuite/relro_test.sh: Fail if dc is not present.
1557 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
1559         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
1560         Change == to -eq.
1561         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
1562         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
1563         Change == to -eq.
1564         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
1565         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
1567 2011-03-14  Ian Lance Taylor  <iant@google.com>
1569         * script-sections.cc (Sort_output_sections::script_compare):
1570         Rename from is_before, change return type.
1571         (Sort_output_sections::operator()): Adjust accordingly.
1573 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
1575         PR gold/12572
1576         * testsuite/odr_violation2.cc: Add comment to make all error line
1577         numbers double digits.
1578         * testsuite/debug_msg.sh: Adjust expected errors.
1580 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
1582         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
1583         but mark earlier ones as non-canonical
1584         (offset_to_iterator): Update search target and example
1585         (do_addr2line): Return extra lines in a vector*
1586         (format_file_lineno): Extract from do_addr2line
1587         (one_addr2line): Add vector* out-param
1588         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
1589         when a lineno entry appeared last for its instruction
1590         (Dwarf_line_info): Add vector* out-param
1591         * object.cc (Relocate_info): Pass NULL for the vector* out-param
1592         * symtab.cc (Odr_violation_compare): Include the lineno in the
1593         comparison again.
1594         (linenos_from_loc): New. Combine the canonical line for an
1595         address with its other lines.
1596         (True_if_intersect): New. Helper functor to make
1597         std::set_intersection a query.
1598         (detect_odr_violations): Compare sets of lines instead of just
1599         one line for each function. This became less deterministic, but
1600         has fewer false positives.
1601         * symtab.h: Declarations.
1602         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
1603         mix an optimized and non-optimized object in the same binary
1604         (odr_violation2.so): Same.
1605         * testsuite/Makefile.in: Regenerate from Makefile.am.
1606         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
1607         * testsuite/debug_msg.sh: Update line numbers and add
1608         assertions.
1609         * testsuite/odr_violation1.cc: Use OdrDerived, in a
1610         non-optimized context.
1611         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
1612         isn't inlined, and use OdrDerived in an optimized context.
1613         * testsuite/odr_header1.h: Defines OdrDerived, where
1614         optimization will change the
1615         first-instruction-in-the-destructor's file and line number.
1616         * testsuite/odr_header2.h: Defines OdrBase.
1618 2011-03-09  Ian Lance Taylor  <iant@google.com>
1620         * fileread.cc (File_read::clear_views): Don't delete the whole
1621         file view.
1623 2011-03-08  Ian Lance Taylor  <iant@google.com>
1625         PR gold/12525
1626         * fileread.cc: #include <climits>.
1627         (GOLD_IOV_MAX): Define.
1628         (File_read::read_multiple): Limit number of entries by iov_max.
1629         * fileread.h (class File_read): Always set max_readv_entries to
1630         128.
1632 2011-03-07  Ian Lance Taylor  <iant@google.com>
1634         PR gold/12525
1635         * options.h (class General_options): Add -dy and -dn.
1637 2011-03-02  Cary Coutant  <ccoutant@google.com>
1639         * testsuite/script_test_9.t: Add TLS segment.
1641 2011-03-02  Simon Baldwin  <simonb@google.com>
1643         * configure.ac: Add check for gnu_indirect_function support in
1644         the toolchain building binutils.
1645         * configure: Rebuild.
1647 2010-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
1649         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
1650         plugin only symbols.
1651         (Symbol_table::sized_finalize_symbol) Mark symbol only present
1652         in plugin files as not needed in the symbol table.
1654 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
1656         * output.cc (Output_section::add_input_section): Delay fill
1657         generation for section ordering.
1659 2011-02-09  Ian Lance Taylor  <iant@google.com>
1661         PR gold/12316
1662         * object.h (class Sized_relobj): Remove clear_local_symbols.
1663         * reloc.cc (Sized_relobj::do_relocate): Don't call
1664         clear_local_symbols.
1666 2010-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
1668         * plugin.cc (is_visible_from_outside): Return true for symbols
1669         in the -u option.
1671 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
1673         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
1674         filename.
1676 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
1678         * icf.h (is_section_foldable_candidate): Change type of parameter
1679         to std::string.
1680         * icf.cc (Icf::find_identical_sections): Change type of local variable
1681         section_name to be std::string.
1682         (is_function_ctor_or_dtor): Change type of parameter to std::string.
1684 2011-01-25  Ian Lance Taylor  <iant@google.com>
1686         * script.cc (script_add_extern): Rewrite to use
1687         add_symbol_reference.
1689 2011-01-25  Doug Kwan  <dougkwan@google.com>
1691         * icf.cc (get_section_contents): Always lock section's object.
1693 2011-01-24  Ian Lance Taylor  <iant@google.com>
1695         * options.h (class General_options): Accept
1696         --no-detect-odr-violations.
1698 2011-01-24  Ian Lance Taylor  <iant@google.com>
1700         * version.cc (version_string): Bump to 1.11.
1702 2011-01-24  Ian Lance Taylor  <iant@google.com>
1704         * plugin.cc (class Plugin_rescan): Define new class.
1705         (Plugin_manager::claim_file): Set any_claimed_.
1706         (Plugin_manager::save_archive): New function.
1707         (Plugin_manager::save_input_group): New function.
1708         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
1709         necessary.
1710         (Plugin_manager::new_undefined_symbol): New function.
1711         (Plugin_manager::rescan): New function.
1712         (Plugin_manager::rescannable_defines): New function.
1713         (Plugin_manager::add_input_file): Set any_added_.
1714         * plugin.h (class Plugin_manager): define new fields rescannable_,
1715         undefined_symbols_, any_claimed_, and any_added_.  Declare
1716         Plugin_rescan as friend.  Declare new functions.
1717         (Plugin_manager::Rescannable): Define type.
1718         (Plugin_manager::Rescannable_list): Define type.
1719         (Plugin_manager::Undefined_symbol_list): Define type.
1720         (Plugin_manager::Plugin_manager): Initialize new fields.
1721         * archive.cc (Archive::defines_symbol): New function.
1722         (Add_archive_symbols::run): Pass archive to plugins if any.
1723         * archive.h (class Archive): Declare defines_symbol.
1724         * readsyms.cc (Input_group::~Input_group): New function.
1725         (Finish_group::run): Pass input_group to plugins if any.
1726         * readsyms.h (class Input_group): Declare destructor.
1727         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
1728         any.
1730 2011-01-10  Ian Lance Taylor  <iant@google.com>
1732         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
1733         section as relro.
1734         (Layout::set_segment_offsets): Reset increase_relro before calling
1735         set_section_addresses a second time.
1737 2011-01-04  Cary Coutant  <ccoutant@google.com>
1739         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
1740         sections before NOBITS sections.
1742 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
1744         * version.cc (print_version): Update copyright to 2011.
1746 2010-12-23  Cary Coutant  <ccoutant@google.com>
1748         * output.h (Output_data_reloc::add_output_section): Pass OD instead
1749         of OS to this->add.  Add OD parameter to second form of the function.
1751 2010-12-20  Ian Lance Taylor  <iant@google.com>
1753         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
1754         second of two consecutive entries with same offset.
1756 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
1758         * testsuite/Makefile.am (ifuncmain2static_LDADD)
1759         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
1760         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
1761         to avoid unneeded links against $(LDADD).
1762         * testsuite/Makefile.in: Regenerate.
1764 2010-12-15  Ian Lance Taylor  <iant@google.com>
1766         PR gold/12324
1767         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
1768         for R_X86_64_32 and R_X86_64_PC32.
1769         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
1770         ver_matching_def_pic.o.
1771         (ver_matching_def_pic.o): New target.
1773 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
1775         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
1776         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
1777         Move definition before File_read::View member definitions.
1778         (File_read::View::~View): Initialize and hold lock before
1779         updating current_mapped_bytes.
1781 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
1783         * dwarf_reader.cc: Remove outdated comment.
1784         * gold-threads.cc: Fix typo in error message.
1785         * archive.cc: Fix typos in comments.
1786         * archive.h: Likewise.
1787         * arm-reloc-property.cc: Likewise.
1788         * arm-reloc-property.h: Likewise.
1789         * arm-reloc.def: Likewise.
1790         * arm.cc: Likewise.
1791         * attributes.h: Likewise.
1792         * cref.cc: Likewise.
1793         * ehframe.cc: Likewise.
1794         * fileread.h: Likewise.
1795         * gold.h: Likewise.
1796         * i386.cc: Likewise.
1797         * icf.cc: Likewise.
1798         * incremental.h: Likewise.
1799         * int_encoding.cc: Likewise.
1800         * layout.h: Likewise.
1801         * main.cc: Likewise.
1802         * merge.h: Likewise.
1803         * object.cc: Likewise.
1804         * object.h: Likewise.
1805         * options.cc: Likewise.
1806         * readsyms.cc: Likewise.
1807         * reduced_debug_output.cc: Likewise.
1808         * reloc.cc: Likewise.
1809         * script-sections.cc: Likewise.
1810         * sparc.cc: Likewise.
1811         * symtab.h: Likewise.
1812         * target-reloc.h: Likewise.
1813         * target.cc: Likewise.
1814         * target.h: Likewise.
1815         * timer.cc: Likewise.
1816         * timer.h: Likewise.
1817         * x86_64.cc: Likewise.
1819 2010-12-09  Cary Coutant  <ccoutant@google.com>
1821         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
1822         stack.
1823         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
1824         parameter; change all callers.
1825         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
1826         * options.h (warn_execstack): New option.
1828 2010-12-07  Doug Kwan  <dougkwan@google.com>
1830         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
1831         like function call relocations.
1833 2010-12-07  Ian Lance Taylor  <iant@google.com>
1835         * archive.cc (Archive::get_elf_object_for_member): Permit
1836         punconfigured to be NULL.
1837         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
1838         (Archive::include_member): Pass NULL to get_elf_object_for_member
1839         if we searched for the archive and this is the first included
1840         object.
1842 2010-12-01  Ian Lance Taylor  <iant@google.com>
1844         * dwarf_reader.h (class Sized_dwarf_line_info): Add
1845         track_relocs_type_ field.
1846         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1847         Set track_relocs_type_.
1848         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
1849         contents when using RELA relocs.
1850         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
1851         reloc_map_.
1852         * reloc.cc (Track_relocs::next_addend): New function.
1853         * reloc.h (class Track_relocs): Declare next_addend.
1855 2010-12-01  Ian Lance Taylor  <iant@google.com>
1857         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
1858         virtual destructor.
1860 2010-12-01  Ian Lance Taylor  <iant@google.com>
1862         * README: Update compilers known to work and fail.
1864 2010-11-23  Matthias Klose  <doko@ubuntu.com>
1866         * configure.in: For --enable-gold, handle value `default' instead of
1867         `both*'.  Always install ld as ld.bfd, install as ld if gold is
1868         not the default.
1869         * configure: Regenerate.
1871 2010-11-18  Doug Kwan  <dougkwan@google.com>
1873         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
1874         and right_alignment to be zero.  Store result alignment only if it is
1875         greater than existing alignment.
1877 2010-11-16  Cary Coutant  <ccoutant@google.com>
1879         PR gold/12220
1880         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1881         Check for ".zdebug_line".
1883 2010-11-16  Doug Kwan  <dougkwan@google.com>
1884             Cary Coutant  <ccoutant@google.com>
1886         * output.h (Output_segment::set_section_addresses): Pass increase_relro
1887         by reference; adjust all callers.
1888         * output.cc (Output_segment::set_section_addresses): Adjust references
1889         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
1890         list is empty.
1891         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
1892         end at page boundary.
1894 2010-11-16  Cary Coutant  <ccoutant@google.com>
1896         PR gold/12220
1897         * layout.cc (Layout::choose_output_section): Transform names of
1898         compressed sections even when using a script with a SECTIONS clause.
1899         (Layout::output_section_name): Remove code to transform
1900         compressed debug section names.
1901         * output.cc (Output_section::add_input_section): Use uncompressed
1902         section size when tracking input sections.
1904 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
1906         * symtab.h (Symbol::NON_PIC_REF): Remove.
1907         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
1908         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
1909         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
1910         (Symbol::use_plt_offset): Take a flags argument and pass it
1911         directly to needs_dynamic_reloc.  Restrict check for undefined
1912         weak symbols to function calls.
1913         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
1914         (Target_arm::Scan::global): Use it.
1915         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
1916         (Target_arm::Relocate::relocate): Likewise.
1917         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
1918         parameter with an r_type parameter.  Use get_reference_flags
1919         to get the flags.
1920         (Target_arm::Relocate::relocate): Update accordingly.
1921         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
1922         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
1923         (Target_i386::Scan::global): Likewise.
1924         (Target_i386::Relocate::relocate): Likewise.
1925         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
1926         parameter with an r_type parameter.  Use get_reference_flags
1927         to get the flags.
1928         (Target_i386::Relocate::relocate): Update accordingly.
1929         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
1930         (Target_powerpc::Scan::global): Use it.
1931         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
1932         (Target_powerpc::Relocate::relocate): Likewise.
1933         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
1934         (Target_sparc::Scan::global): Use it.
1935         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
1936         (Target_sparc::Relocate::relocate): Likewise.
1937         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
1938         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
1939         (Target_x86_64::Scan::global): Likewise.
1940         (Target_x86_64::Relocate::relocate): Likewise.
1942 2010-11-08  Doug Kwan  <dougkwan@google.com>
1943             Cary Coutant  <ccoutant@google.com>
1945         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
1946         (Arm_exidx_merge_section::section_contents_): New data member.
1947         (Arm_input_section::Arm_input_section): Initialize original_contents_.
1948         (Arm_input_section::~Arm_input_section): De-allocate memory.
1949         (Arm_input_section::original_contents_): New data member.       
1950         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
1951         in parameters instead of calling Object::section_contents without
1952         locking.
1953         (Arm_output_section::group_section): New parameter TASK.  Pass it
1954         to callees that need locking objects.
1955         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
1956         to lock EXIDX input sections.  Fix a formatting issue.  Call
1957         Arm_exidx_merged_section::build_contents to create merged section
1958         contents.
1959         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
1960         to lock object of stub table owner.
1961         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
1962         TEXT_SIZE to initialize data member TEXT_SIZE_.
1963         (Arm_exidx_input_section::addralign): Fix typo in comment.
1964         (Arm_exidx_input_section::text_size): New method.
1965         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
1966         that require locking objects.  Lock objects before scanning for stubs
1967         and updating local symbols.
1968         (Arm_input_section<big_endian>::init): Copy contents of original
1969         input section.
1970         (Arm_input_section<big_endian>::do_write): Use saved contents of
1971         original input section instead of calling Object::section_contents
1972         without locking.
1973         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
1974         size without calling Object::section_size().
1975         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
1976         for size.  Allocate a buffer for merged EXIDX entries.
1977         (Arm_exidx_merged_section::build_contents): New method.
1978         (Arm_exidx_merged_section::do_write): Move merge section contents
1979         building code to Arm_exidx_merged_section::build_contetns.  Write
1980         out contetns in buffer instead of building it on the fly.
1981         (Arm_relobj::make_exidx_input_section): Also pass text section size
1982         to Arm_exidx_input_section constructor.
1983         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
1984         (Arm_dynobj::do_read_symbols): Fix memory leak.
1985         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
1986         * target.h: (class Task): Add forward declaration.
1987         (Target::relax): Add new parameter TASK and pass it to
1988         Target::do_relax().
1989         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
1991 2010-11-05  Cary Coutant  <ccoutant@google.com>
1993         PR gold/10708
1994         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
1995         object when reading from the file.
1996         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
1997         second layout pass.
1998         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
1999         when reading section contents.
2000         (get_section_contents): Likewise.
2001         (icf::find_identical_sections): Likewise.
2002         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
2003         object when reading from the file.
2004         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
2005         the object when doing deferred section layout.
2007 2010-11-03  Nick Clifton  <nickc@redhat.com>
2009         PR gold/12001
2010         * script.h (class Symbol_assignment: name): New member.  Returns
2011         the name of the symbol.
2012         * scrfipt.cc (Script_options::is_pending_assignment): New member.
2013         Returns true if the given symbol name is on the list of
2014         assignments wating to be processed.
2015         * archive.cc (should_incldue_member): If the symbol is undefined,
2016         check to see if it is on the list of symbols pending assignment.
2018 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
2020         * script-sections.cc (Script_sections::find_memory_region): Check
2021         for a NULL output section pointer.
2023 2010-10-29  Doug Kwan  <dougkwan@google.com>
2025         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
2026         Output_section::add_relaxed_input_section.
2027         * output.cc (Output_section::add_relaxed_input_section): Add new
2028         arguments LAYOUT and NAME.  Set section order index.
2029         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
2030         Copy section order index.
2031         * output.h (Output_section::add_relaxed_input_section): Add new
2032         arguments LAYOUT and NAME.
2034 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2036         * testsuite/Makefile.am: Move gcctestdir/ld rule to
2037         NATIVE_OR_CROSS_LINKER.
2038         * testsuite/Makefile.in: Regenerate.
2040 2010-10-20  Doug Kwan  <dougkwan@google.com>
2042         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
2043         without SHF_LINK_ORDER flags.
2044         * layout.cc (Layout::choose_output_section): Do not filter
2045         SHF_LINK_ORDER flag in a relocatable link.
2047 2010-10-17  Cary Coutant  <ccoutant@google.com>
2049         * output.h (Output_segment::set_section_addresses): Change function
2050         signature.  Update all callers.
2051         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
2052         sections.
2053         (Output_segment::set_section_addresses): Align after last TLS
2054         section.  Add padding before last relro section instead of after.
2056 2010-10-17  Doug Kwan  <dougkwan@google.com>
2058         * gold/arm.cc (Target_arm::got_section): Use correct order and set
2059         GOT output section to be writable.
2061 2010-10-14  Cary Coutant  <ccoutant@google.com>
2063         * debug.h (DEBUG_INCREMENTAL): New flag.
2064         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
2065         * gold.cc (queue_initial_tasks): Check parameters for incremental link
2066         mode.
2067         * incremental.cc (report_command_line): Ignore all forms of
2068         --incremental.
2069         * layout.cc (Layout::Layout): Check parameters for incremental link
2070         mode.
2071         * options.cc (General_options::parse_incremental): New function.
2072         (General_options::parse_no_incremental): New function.
2073         (General_options::parse_incremental_full): New function.
2074         (General_options::parse_incremental_update): New function.
2075         (General_options::incremental_mode_): New data member.
2076         (General_options::finalize): Check incremental_mode_.
2077         * options.h (General_options): Update help text for --incremental.
2078         Add --no-incremental, --incremental-full, --incremental-update.
2079         (General_options::Incremental_mode): New enum type.
2080         (General_options::incremental_mode): New function.
2081         (General_options::incremental_mode_): New data member.
2082         * parameters.cc (Parameters::incremental_mode_): New data member.
2083         (Parameters::set_options): Set incremental_mode_.
2084         (Parameters::set_incremental_full): New function.
2085         (Parameters::incremental): New function.
2086         (Parameters::incremental_update): New function.
2087         (set_parameters_incremental_full): New function.
2088         * parameters.h (Parameters::set_incremental_full): New function.
2089         (Parameters::incremental): New function.
2090         (Parameters::incremental_update): New function.
2091         (Parameters::incremental_mode_): New data member.
2092         (set_parameters_incremental_full): New function.
2093         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
2094         incremental link mode.
2095         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
2096         (Sized_relobj::do_relocate_sections): Likewise.
2097         * testsuite/Makefile.am (incremental_test): Use --incremental-full
2098         option.
2099         * testsuite/Makefile.in: Regenerate.
2100         * testsuite/incremental_test.sh: Filter all forms of --incremental.
2102 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2104         * script-sections.h (class Script_sections): Make
2105         Sections_elements typedef public.
2106         * script-sections.cc (class Sort_output_sections): Add elements_
2107         field.  Add constructor which sets it; change all callers.
2108         (Sort_output_sections::is_before): New function.
2109         (Sort_output_sections::operator()): Call is_before.
2110         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
2111         conditional.
2112         * testsuite/script_test_10.sh: New test. Test script section
2113         order.
2114         * testsuite/script_test_10.t: Likewise.
2115         * testsuite/script_test_10.s: Likewise.
2116         * testsuite/Makefile.am: Wrap the cross linker tests and the
2117         common tests into NATIVE_OR_CROSS_LINKER.
2118         (check_SCRIPTS): Add script_test_10.sh.
2119         (check_DATA): Add script_test_10.stdout.
2120         (script_test_10.o, script_test_10): New targets.
2121         (script_test_10.stdout): New target.
2122         * configure, testsuite/Makefile.in: Regenerate.
2124 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2126         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
2127         error for the deprecated relocations.
2128         (Target_arm::Scan::global): Likewise.
2129         (Target_arm::Relocate::relocate): Likewise.
2131 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
2133         * fileread.cc (Input_file::find_file): Initialize *found_name
2134         and *namep when using the fallback search for case 4.
2136 2010-10-11  Cary Coutant  <ccoutant@google.com>
2138         * options.h (class General_options): Redefine -z lazy as an alias for
2139         the negation of -z now.
2141 2010-10-11  Ian Lance Taylor  <iant@google.com>
2143         * resolve.cc (symbol_to_bits): Report the value of the unsupported
2144         binding.
2146 2010-10-06  Nick Clifton  <nickc@redhat.com>
2148         * script-sections.cc(class Memory_region): Remove
2149         current_lma_offset_ field.  Rename current_vma_offset_ to
2150         current_offset_.  Add last_section_ field.
2151         (Memory_region::get_current_vma_address): Rename to
2152         get_current_address.
2153         (Memory_region::get_current_lma_address): Delete.
2154         (Memory_region::increment_vma_offset): Rename to
2155         increment_offset.
2156         (Memory_region::increment_lma_offset): Delete.
2157         (Memory_region::attributes_compatible): New method.  Returns
2158         true if the provided section is compatible with the region.
2159         (Memory_region::get_last_section): New method.  Returns the last
2160         section to use the region.
2161         (Memory_region::set_last_section): New method.  Stores the last
2162         section to use the region.
2163         (Script_sections::block_in_region): New method.  Returns true if
2164         a block of memory is contained within a region.
2165         (Script_sections::find_memory_region): New method.  Locates a
2166         memory region to be used to set a VMA or LMA address.
2167         (Output_section_definition::set_section_addresses): Add code to
2168         check for addresses set by memory regions.
2169         (Output_segment::set_section_addresses): Remove memory region
2170         walking code.
2171         (Script_sections::create_segment): Add a warning if a header
2172         segment is created outside of any region.
2173         * script-sections.h (class Script_sections): Add prototypes for
2174         find_memory_region and block_in_region methods.
2175         * testsuite/memory_test.s: Use .long instead of .word.
2176         * testsuite/memory_test.t: Add some more output sections.
2177         * testsuite/memory_test.sh: Update expected output.
2179 2010-10-02  Doug Kwan  <dougkwan@google.com>
2181         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
2182         defintion to symtab.h
2183         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
2184         declaration to defintion.
2186 2010-10-01  Nick Clifton  <nickc@redhat.com>
2188         * expression.cc (eval): Replace dummy argument with NULL.
2189         (eval_maybe_dot): Check for a NULL result section pointer.
2190         (Symbol_expression::value): Likewise.
2191         (Dot_expression::value): Likewise.
2192         (BINARY_EXPRESSION): Likewise.
2193         (Max_expression::value): Likewise.
2194         (Min_expression::value): Likewise.
2195         (Absolute_expression::value): Likewise.
2196         (Addr_expression::value_from_output_section): Likewise.
2197         (Loaddddr_expression::value_from_output_section): Likewise.
2198         (Segment_start_expression::value): Likewise.
2199         * script-sections.cc
2200         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
2201         argument with NULL.
2202         (Sections_elememt_dot_assignment::set_section_addresses):
2203         Likewise.
2204         (Output_data_expression::do_write_to_buffer): Likewise.
2205         (Output_section_definition::finalize_symbols): Likewise.
2206         (Output_section_definition::set_section_addresses): Likewise.
2208 2010-09-30  Doug Kwan  <dougkwan@google.com>
2210         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
2212 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
2214         * target.h (Target::can_icf_inline_merge_sections): New virtual
2215         function.
2216         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
2217         virtual function.
2218         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
2219         virtual function.
2220         * icf.cc (get_section_contents): Inline merge sections only when
2221         target allows it.
2223 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2225         * configure: Regenerate.
2227 2010-09-17  Ian Lance Taylor  <iant@google.com>
2229         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
2230         * testsuite/Makefile.am (memory_test.o): New target.
2231         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
2232         memory_test.t.
2233         * testsuite/Makefile.in: Rebuild.
2235 2010-09-17  Doug Kwan  <dougkwan@google.com>
2237         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
2238         defintion if relocation uses GOT entries of the symbol.
2239         * testsuite/icf_safe_test.sh: Fix test.
2240         * testsuite/icf_safe_so_test.sh: Fix test.
2242 2010-09-16  Cary Coutant  <ccoutant@google.com>
2244         * script_sections.cc (class Memory_region): Remove "NULL" from
2245         vector initializations.
2247 2010-09-15  Cary Coutant  <ccoutant@google.com>
2249         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
2250         Resolve forwarding symbols.
2252 2010-09-15  Doug Kwan  <dougkwan@google.com>
2254         * gold/testsuite/script_test_3.t: Add ARM special sections.
2255         * gold/testsuite/script_test_4.t: Same.
2256         * gold/testsuite/script_test_5.t: Same.
2257         * gold/testsuite/script_test_6.t: Same.
2258         * gold/testsuite/script_test_7.t: Same.
2259         * gold/testsuite/script_test_7.t: Same.
2260         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
2262 2010-09-14  Cary Coutant  <ccoutant@google.com>
2264         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
2265         (Target_x86_64::Relocate::relocate_tls): Replace check for
2266         saw_tls_block_reloc_ with test for executable section.
2268 2010-09-12  Cary Coutant  <ccoutant@google.com>
2270         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
2271         position-independent executables to shared libraries need dynamic
2272         relocations.
2273         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
2274         position-independent executables.
2275         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
2276         * testsuite/Makefile.in: Regenerate.
2278 2010-09-10  Nick Clifton  <nickc@redhat.com>
2280         PR gold/11997
2281         * testsuite/memory_test.t: Discard any sections that are not
2282         needed.
2284 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
2286         PR gold/11996
2287         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
2288         "This::" to work around a bug in gcc 4.2.
2290         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
2292 2010-09-09  Rafael Espindola  <espindola@google.com>
2294         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
2295         sections with different PF_X flags in the same segment.
2296         (Layout::find_first_load_seg): Search all segments to find the first
2297         one.
2298         * options.h (rosegment): New.
2300 2010-09-08  Rafael Espindola  <espindola@google.com>
2302         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
2304 2010-09-08  Doug Kwan  <dougkwan@google.com>
2306         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
2307         (Arm_relobj::do_relocate_sections): Add new parameter for output
2308         file to match the parent.
2309         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
2310         of local symbols instead of input values.  Update code to track
2311         changes in gold::relocate_section.
2312         * object.cc (Sized_relobj::compute_final_local_value): New methods.
2313         (Sized_relobj::compute_final_local_value_internal): New methods.
2314         (Sized_relobj::do_finalize_local_symbols): Move code from loop
2315         body into private version of Sized_relobj::compute_final_local_value.
2316         Call the inline method.
2317         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
2318         merged symbol value if there is one.
2319         (Symbol_value::has_output_value): New method defintiion.
2320         (Sized_relobj::Compute_final_local_value_status): New enum type.
2321         (Sized_relobj::compute_final_local_value): New methods.
2322         (Sized_relobj::compute_final_local_value_internal): New methods.
2323         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
2324         and arm_cortex_a8.sh.
2325         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
2326         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
2327         New tests.
2328         * Makefile.in: Regenerate.
2329         * testsuite/arm_bl_out_of_range.s: Update test.
2330         * testsuite/thumb_bl_out_of_range.s: Ditto.
2331         * testsuite/thumb_blx_out_of_range.s: Ditto.
2332         * testsuite/arm_branch_out_of_range.sh: New file.
2333         * testsuite/arm_cortex_a8.sh: Ditto.
2334         * testsuite/arm_cortex_a8_b.s: Ditto.
2335         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
2336         * testsuite/arm_cortex_a8_b_local.s: Ditto.
2337         * testsuite/arm_cortex_a8_bl.s: Ditto.
2338         * testsuite/arm_cortex_a8_blx.s: Ditto.
2339         * testsuite/arm_cortex_a8_local.s: Ditto.
2340         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
2341         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
2343 2010-09-08  Rafael Espindola  <espindola@google.com>
2345         * Makefile.am (memory_test.stdout): Run readelf with -W.
2346         * Makefile.in: Regenerate.
2347         * testsuite/memory_test.sh: Make the regexps accept both 32 and
2348         64 bit output.
2350 2010-09-08  Rafael Espindola  <espindola@google.com>
2352         * script-sections.cc (Script_sections::add_memory_region): Convert
2353         field precision to int.
2354         * script.cc (script_set_section_region, script_set_section_region):
2355         Convert field precision to int.
2357 2010-09-08  Rafael Espindola  <espindola@google.com>
2359         * arm.cc (do_finalize_sections): Create the __exidx_start and
2360         __exdix_end symbols even when the section is missing.
2362 2010-09-08  Nick Clifton  <nickc@redhat.com>
2364         * README: Remove claim that MEMORY is not supported.
2365         * expression.cc (script_exp_function_origin)
2366         (script_exp_function_length): Move from here to ...
2367         * script.cc: ... here.
2368         (script_set_section_region, script_add_memory)
2369         (script_parse_memory_attr, script_include_directive): New
2370         functions.
2371         * script-sections.cc
2372         (class Memory_region): New class.
2373         (class Output_section_definition): Add set_memory_region,
2374         set_section_vma, set_section_lma and get_section_name methods.
2375         (class Script_Sections): Add add_memory_region,
2376         find_memory_region, find_memory_region_origin,
2377         find_memory_region_length and set_memory_region methods.
2378         Have set_section_addresses method walk the list of set memory
2379         regions.
2380         Extend the print methos to display memory regions.
2381         * script-sections.h: Add prototypes for new methods.
2382         Add enum for MEMORY region attributes.
2383         * yyscript.y: Add support for parsing MEMORY regions.
2384         * script-c.h: Add prototypes for new functions.
2385         * testsuite/Makefile.am: Add test of MEMORY region functionality.
2386         * testsuite/Makefile.in: Regenerate.
2387         * testsuite/memory_test.sh: New script.
2388         * testsuite/memory_test.s: New assembler source file.
2389         * testsuite/memory_test.t: New linker script.
2391 2010-08-27  Doug Kwan  <dougkwan@google.com>
2393         * gold/resolve.cc (Symbol_table::should_override): Let a weak
2394         reference override an existing dynamic weak reference.
2395         * testsuite/Makefile.am: Add new test dyn_weak_ref.
2396         * testsuite/Makefile.in: Regenerate.
2397         * testsuite/dyn_weak_ref.sh: New file.
2398         * testsuite/dyn_weak_ref_1.c: Ditto.
2399         * testsuite/dyn_weak_ref_2.c: Ditto.
2401 2010-08-27  Ian Lance Taylor  <iant@google.com>
2403         * incremental.h (class Incremental_input_entry): Add virtual
2404         destructor.
2406 2010-08-27  Ian Lance Taylor  <iant@google.com>
2408         * testsuite/start_lib_test_3.c: Mark t3 as used.
2410 2010-08-27  Nick Clifton  <nickc@redhat.com>
2412         * options.cc (version_script): Fix small typo in previous
2413         whitespace tidyup.
2415 2010-08-25  Nick Clifton  <nickc@redhat.com>
2417         * archive.cc: Formatting fixes: Remove whitespace between
2418         typename and following asterisk.  Remove whitespace between
2419         function name and opening parenthesis.
2420         * archive.h: Likewise.
2421         * arm.cc: Likewise.
2422         * attributes.cc: Likewise.
2423         * attributes.h: Likewise.
2424         * common.cc: Likewise.
2425         * copy-relocs.cc: Likewise.
2426         * dirsearch.h: Likewise.
2427         * dynobj.cc: Likewise.
2428         * ehframe.cc: Likewise.
2429         * ehframe.h: Likewise.
2430         * expression.cc: Likewise.
2431         * fileread.cc: Likewise.
2432         * fileread.h: Likewise.
2433         * gc.h: Likewise.
2434         * gold-threads.cc: Likewise.
2435         * gold.cc: Likewise.
2436         * i386.cc: Likewise.
2437         * icf.h: Likewise.
2438         * incremental-dump.cc: Likewise.
2439         * incremental.cc: Likewise.
2440         * layout.cc: Likewise.
2441         * layout.h: Likewise.
2442         * main.cc: Likewise.
2443         * merge.cc: Likewise.
2444         * merge.h: Likewise.
2445         * object.cc: Likewise.
2446         * object.h: Likewise.
2447         * options.cc: Likewise.
2448         * options.h: Likewise.
2449         * output.cc: Likewise.
2450         * output.h: Likewise.
2451         * plugin.cc: Likewise.
2452         * plugin.h: Likewise.
2453         * powerpc.cc: Likewise.
2454         * reloc.cc: Likewise.
2455         * script-c.h: Likewise.
2456         * script-sections.cc: Likewise.
2457         * script.cc: Likewise.
2458         * stringpool.cc: Likewise.
2459         * symtab.cc: Likewise.
2460         * symtab.h: Likewise.
2461         * target.cc: Likewise.
2462         * timer.cc: Likewise.
2463         * timer.h: Likewise.
2464         * version.cc: Likewise.
2465         * x86_64.cc: Likewise.
2467 2010-08-24  Nick Clifton  <nickc@redhat.com>
2469         PR 11899
2470         * layout.cc (segment_precedes): Sort segments by their physical
2471         addresses, if they have been set.
2473 2010-08-23  Cary Coutant  <ccoutant@google.com>
2475         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
2476         symbols data.
2477         (Lib_group::include_member): Unlock object after deleting its
2478         symbols data.
2479         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
2480         the bug fixed here.
2482 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
2483             Cary Coutant  <ccoutant@google.com>
2485         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
2486         constructor, and set_blocker.
2487         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
2488         readsyms_blocker_.
2489         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
2490         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
2491         * testsuite/Makefile.am (start_lib_test): New test case.
2492         * testsuite/Makefile.in: Regenerate.
2493         * testsuite/start_lib_test_main.c: New file.
2494         * testsuite/start_lib_test_1.c: New file.
2495         * testsuite/start_lib_test_2.c: New file.
2496         * testsuite/start_lib_test_3.c: New file.
2498 2010-08-19  Ian Lance Taylor  <iant@google.com>
2500         * Makefile.in: Rebuild with automake 1.11.1.
2501         * aclocal.m4: Likewise.
2502         * testsuite/Makefile.in: Likewise.
2504 2010-08-19  Ian Lance Taylor  <iant@google.com>
2506         PR 10893
2507         * i386.cc (class Output_data_plt_i386): Update declarations.
2508         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
2509         local_ifuncs_ fields.
2510         (Target_i386::do_plt_section_for_global): New function.
2511         (Target_i386::do_plt_section_for_local): New function.
2512         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
2513         parameter; change all callers.  Initialize global_ifuncs_ and
2514         local_ifuncs_.  If doing a static link define __rel_iplt_start and
2515         __rel_iplt_end.
2516         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
2517         (Output_data_plt_i386::add_local_ifunc_entry): New function.
2518         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
2519         symbols.
2520         (Target_i386::make_plt_section): New function, broken out of
2521         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
2522         (Target_i386::make_plt_entry): Call make_plt_section.
2523         (Target_i386::make_local_ifunc_plt_entry): New function.
2524         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
2525         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
2526         R_386_IRELATIVE to switch.
2527         (Target_i386::Scan::global): Likewise.
2528         (Target_i386::Relocate::relocate): Likewise.
2529         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
2530         switch.
2531         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
2532         (Target_x86_64::do_plt_section_for_global): New function.
2533         (Target_x86_64::do_plt_section_for_local): New function.
2534         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
2535         parameter; change all callers.  If doing a static link define
2536         __rela_iplt_start and __rela_iplt_end.
2537         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
2538         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
2539         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
2540         to point to .plt.
2541         (Target_x86_64::make_local_ifunc_plt_entry): New function.
2542         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
2543         switch.
2544         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
2545         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
2546         R_X86_64_IRELATIVE to switch.
2547         (Target_x86_64::Scan::global): Likewise.
2548         (Target_x86_64::Relocate::relocate): Likewise.
2549         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
2550         switch.
2551         * target.h (class Target): Add plt_section_for_global and
2552         plt_section_for_local functions.  Add do_plt_section_for_global
2553         and do_plt_section_for_local virtual functions.
2554         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
2555         clarifying comments.
2556         (Symbol::use_plt_offset): Handle IFUNC symbol.
2557         * object.cc (Sized_relobj::Sized_relobj): Initialize
2558         local_plt_offsets_.
2559         (Sized_relobj::local_has_plt_offset): New function.
2560         (Sized_relobj::local_plt_offset): New function.
2561         (Sized_relobj::set_local_plt_offset): New function.
2562         (Sized_relobj::do_count): Handle IFUNC symbol.
2563         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
2564         a bit away from input_shndx_ field.  Add set_is_func_symbol and
2565         is_ifunc_symbol functions.
2566         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
2567         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
2568         local_plt_offsets_ field.
2569         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
2570         * output.h (class Output_section_data): Add non-const
2571         output_section function.
2572         (class Output_data_got): Update declarations.
2573         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
2574         Add use_plt_offset parameter to global and local constructors.
2575         Change all callers.  Change local_sym_index_ field to 31 bits.
2576         Change GSYM_CODE and CONSTANT_CODE accordingly.
2577         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
2578         doing a static link don't set sh_link field.
2579         (Output_data_got::Got_entry::write): Use PLT offset if
2580         appropriate.
2581         (Output_data_got::add_global_plt): New function.
2582         (Output_data_got::add_local_plt): New function.
2583         * target-reloc.h (relocate_section): Handle IFUNC symbol.
2584         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
2585         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
2586         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
2587         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
2588         IFUNC conditional.
2589         * testsuite/ifunc-sel.h: New file.
2590         * testsuite/ifuncmain1.c: New file.
2591         * testsuite/ifuncmain1vis.c: New file.
2592         * testsuite/ifuncmod1.c: New file.
2593         * testsuite/ifuncdep2.c: New file.
2594         * testsuite/ifuncmain2.c: New file.
2595         * testsuite/ifuncmain3.c: New file.
2596         * testsuite/ifuncmod3.c: New file.
2597         * testsuite/ifuncmain4.c: New file.
2598         * testsuite/ifuncmain5.c: New file.
2599         * testsuite/ifuncmod5.c: New file.
2600         * testsuite/ifuncmain6pie.c: New file.
2601         * testsuite/ifuncmod6.c: New file.
2602         * testsuite/ifuncmain7.c: New file.
2603         * configure, testsuite/Makefile.in: Rebuild.
2605 2010-08-18  Ian Lance Taylor  <iant@google.com>
2607         * incremental.cc
2608         (Output_section_incremental_inputs::write_input_files): Add cast
2609         to avoid signed/unsigned comparison warning.
2610         (Output_section_incremental_inputs::write_info_blocks): Likewise.
2612 2010-08-12  Cary Coutant  <ccoutant@google.com>
2614         * common.cc (Sort_commons::operator()): Remove unnecessary code.
2616 2010-08-13  Ian Lance Taylor  <iant@google.com>
2618         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
2620 2010-08-12  Cary Coutant  <ccoutant@google.com>
2621             Doug Kwan  <dougkwan@google.com>
2623         * resolve.cc (Symbol_table::should_override): When a weak dynamic
2624         defintion overrides non-weak undef, remember that the original undef
2625         is not weak.
2626         * symtab.cc (Symbol_table::sized_write_global): For undef without
2627         an original weak binding, set binding to global in output.
2628         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
2629         * testsuite/Makefile.in: Regenerate.
2630         * testsuite/strong_ref_weak_def.sh: New file.
2631         * testsuite/strong_ref_weak_def_1.c: Ditto.
2632         * testsuite/strong_ref_weak_def_2.c: Ditto.
2634 2010-08-12  Cary Coutant  <ccoutant@google.com>
2636         * testsuite/incremental_test.sh: Rewrite.
2637         * testsuite/incremental_test_1.c: Rewrite.
2638         * testsuite/incremental_test_2.c: Rewrite.
2640 2010-08-12  Cary Coutant  <ccoutant@google.com>
2642         * arm.cc (Target_arm::got_size): Add const.
2643         (Target_arm::got_entry_count): New function.
2644         (Target_arm::plt_entry_count): New function.
2645         (Target_arm::first_plt_entry_offset): New function.
2646         (Target_arm::plt_entry_size): New function.
2647         (Output_data_plt_arm::entry_count): New function.
2648         (Output_data_plt_arm::first_plt_entry_offset): New function.
2649         (Output_data_plt_arm::get_plt_entry_size): New function.
2650         * i386.cc (Target_i386::got_size): Add const.
2651         (Target_i386::got_entry_count): New function.
2652         (Target_i386::plt_entry_count): New function.
2653         (Target_i386::first_plt_entry_offset): New function.
2654         (Target_i386::plt_entry_size): New function.
2655         (Output_data_plt_i386::entry_count): New function.
2656         (Output_data_plt_i386::first_plt_entry_offset): New function.
2657         (Output_data_plt_i386::get_plt_entry_size): New function.
2658         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
2659         find_incremental_inputs_sections.  Dump incremental_got_plt section.
2660         * incremental.cc: Include target.h.
2661         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
2662         parameter.  Adjust all callers.  Find incremental_got_plt section.
2663         (Incremental_inputs::create_data_sections): Create incremental_got_plt
2664         section.
2665         (Output_section_incremental_inputs::set_final_data_size): Calculate
2666         size of incremental_got_plt section.
2667         (Output_section_incremental_inputs::do_write): Write the
2668         incremental_got_plt section.
2669         (Got_plt_view_info): New struct.
2670         (Local_got_offset_visitor): New class.
2671         (Global_got_offset_visitor): New class.
2672         (Global_symbol_visitor_got_plt): New class.
2673         (Output_section_incremental_inputs::write_got_plt): New function.
2674         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
2675         Add parameter.  Adjust all callers.
2676         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2677         (Incremental_inputs::got_plt_section): New function.
2678         (Incremental_inputs::got_plt_section_): New data member.
2679         (Incremental_got_plt_reader): New class.
2680         * layout.cc (Layout::create_incremental_info_sections): Add the
2681         incremental_got_plt section.
2682         * object.h (Got_offset_list::get_list): New function.
2683         (Got offset_list::for_all_got_offsets): New function.
2684         (Sized_relobj::local_got_offset_list): New function.
2685         * powerpc.cc (Target_powerpc::got_size): Add const.
2686         (Target_powerpc::got_entry_count): New function.
2687         (Target_powerpc::plt_entry_count): New function.
2688         (Target_powerpc::first_plt_entry_offset): New function.
2689         (Target_powerpc::plt_entry_size): New function.
2690         (Output_data_plt_powerpc::entry_count): New function.
2691         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
2692         (Output_data_plt_powerpc::get_plt_entry_size): New function.
2693         * sparc.cc (Target_sparc::got_size): Add const.
2694         (Target_sparc::got_entry_count): New function.
2695         (Target_sparc::plt_entry_count): New function.
2696         (Target_sparc::first_plt_entry_offset): New function.
2697         (Target_sparc::plt_entry_size): New function.
2698         (Output_data_plt_sparc::entry_count): New function.
2699         (Output_data_plt_sparc::first_plt_entry_offset): New function.
2700         (Output_data_plt_sparc::get_plt_entry_size): New function.
2701         * symtab.h (Symbol::got_offset_list): New function.
2702         (Symbol_table::for_all_symbols): New function.
2703         * target.h (Sized_target::got_entry_count): New function.
2704         (Sized_target::plt_entry_count): New function.
2705         (Sized_target::plt_entry_size): New function.
2706         * x86_64.cc (Target_x86_64::got_size): Add const.
2707         (Target_x86_64::got_entry_count): New function.
2708         (Target_x86_64::plt_entry_count): New function.
2709         (Target_x86_64::first_plt_entry_offset): New function.
2710         (Target_x86_64::plt_entry_size): New function.
2711         (Output_data_plt_x86_64::entry_count): New function.
2712         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
2713         (Output_data_plt_x86_64::get_plt_entry_size): New function.
2715 2010-08-12  Cary Coutant  <ccoutant@google.com>
2717         * archive.cc: Include incremental.h.
2718         (Archive::Archive): Initialize incremental_info_.
2719         (Archive::include_member): Record archive members in incremental info.
2720         (Add_archive_symbols::run): Record begin and end of an archive in
2721         incremental info.
2722         (Lib_group::include_member): Record objects in incremental info.
2723         * archive.h (Incremental_archive_entry): Forward declaration.
2724         (Archive::set_incremental_info): New member function.
2725         (Archive::incremental_info): New member function.
2726         (Archive::Unused_symbol_iterator): New class.
2727         (Archive::unused_symbols_begin): New member function.
2728         (Archive::unused_symbols_end): New member function.
2729         (Archive::incremental_info_): New data member.
2730         * incremental-dump.cc (find_input_containing_global): New function.
2731         (dump_incremental_inputs): Dump new incremental info sections.
2732         * incremental.cc: Include symtab.h.
2733         (Output_section_incremental_inputs): New class.
2734         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
2735         new incremental info sections.
2736         (Sized_incremental_binary::do_check_inputs): Likewise.
2737         (Incremental_inputs::report_archive): Remove.
2738         (Incremental_inputs::report_archive_begin): New function.
2739         (Incremental_inputs::report_archive_end): New function.
2740         (Incremental_inputs::report_object): New function.
2741         (Incremental_inputs::finalize_inputs): Remove.
2742         (Incremental_inputs::report_input_section): New function.
2743         (Incremental_inputs::report_script): Rewrite.
2744         (Incremental_inputs::finalize): Do nothing but finalize string table.
2745         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2746         (Incremental_inputs::sized_create_inputs_section_data): Remove.
2747         (Incremental_inputs::create_data_sections): New function.
2748         (Incremental_inputs::relocs_entsize): New function.
2749         (Output_section_incremental_inputs::set_final_data_size): New function.
2750         (Output_section_incremental_inputs::do_write): New function.
2751         (Output_section_incremental_inputs::write_header): New function.
2752         (Output_section_incremental_inputs::write_input_files): New function.
2753         (Output_section_incremental_inputs::write_info_blocks): New function.
2754         (Output_section_incremental_inputs::write_symtab): New function.
2755         * incremental.h (Incremental_script_entry): Forward declaration.
2756         (Incremental_object_entry): Forward declaration.
2757         (Incremental_archive_entry): Forward declaration.
2758         (Incremental_inputs): Forward declaration.
2759         (Incremental_inputs_header_data): Remove.
2760         (Incremental_inputs_header): Remove.
2761         (Incremental_inputs_header_write): Remove.
2762         (Incremental_inputs_entry_data): Remove.
2763         (Incremental_inputs_entry): Remove.
2764         (Incremental_inputs_entry_write): Remove.
2765         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
2766         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
2767         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2768         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
2769         Likewise.
2770         (Incremental_input_entry): New class.
2771         (Incremental_script_entry): New class.
2772         (Incremental_object_entry): New class.
2773         (Incremental_archive_entry): New class.
2774         (Incremental_inputs::Incremental_inputs): Initialize new data members.
2775         (Incremental_inputs::report_inputs): Remove.
2776         (Incremental_inputs::report_archive): Remove.
2777         (Incremental_inputs::report_archive_begin): New function.
2778         (Incremental_inputs::report_archive_end): New function.
2779         (Incremental_inputs::report_object): Change prototype.
2780         (Incremental_inputs::report_input_section): New function.
2781         (Incremental_inputs::report_script): Change prototype.
2782         (Incremental_inputs::get_reloc_count): New function.
2783         (Incremental_inputs::set_reloc_count): New function.
2784         (Incremental_inputs::create_data_sections): New function.
2785         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2786         (Incremental_inputs::inputs_section): New function.
2787         (Incremental_inputs::symtab_section): New function.
2788         (Incremental_inputs::relocs_section): New function.
2789         (Incremental_inputs::get_stringpool): Add const.
2790         (Incremental_inputs::command_line): Add const.
2791         (Incremental_inputs::inputs): Remove.
2792         (Incremental_inputs::command_line_key): New function.
2793         (Incremental_inputs::input_file_count): New function.
2794         (Incremental_inputs::input_files): New function.
2795         (Incremental_inputs::relocs_entsize): New function.
2796         (Incremental_inputs::sized_create_inputs_section_data): Remove.
2797         (Incremental_inputs::finalize_inputs): Remove.
2798         (Incremental_inputs::Input_info): Remove.
2799         (Incremental_inputs::lock_): Remove.
2800         (Incremental_inputs::inputs_): Change type.
2801         (Incremental_inputs::inputs_map_): Remove.
2802         (Incremental_inputs::current_object_entry_): New data member.
2803         (Incremental_inputs::inputs_section_): New data member.
2804         (Incremental_inputs::symtab_section_): New data member.
2805         (Incremental_inputs::relocs_section_): New data member.
2806         (Incremental_inputs::reloc_count_): New data member.
2807         (Incremental_inputs_reader): New class.
2808         (Incremental_symtab_reader): New class.
2809         (Incremental_relocs_reader): New class.
2810         * layout.cc (Layout::finalize): Move finalization of incremental info
2811         and creation of incremental info sections to follow finalization of
2812         symbol table.  Set offsets for postprocessing sections.
2813         (Layout::create_incremental_info_sections): Call
2814         Incremental_inputs::create_data_sections.  Add incremental symtab
2815         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
2816         sections to layout after input sections.
2817         * layout.h (struct Timespec): Forward declaration.
2818         (Layout::incremental_inputs): Add const.
2819         (Layout::create_incremental_info_sections): Add parameter.
2820         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
2821         * object.cc: Include incremental.h.
2822         (Relobj::finalize_incremental_relocs): New function.
2823         (Sized_relobj::do_layout): Record input sections in incremental info.
2824         * object.h (Object::output_section): New function.
2825         (Object::output_section_offset): Moved from Relobj.
2826         (Object::get_incremental_reloc_base): New function.
2827         (Object::get_incremental_reloc_count): New function.
2828         (Object::do_output_section): New function.
2829         (Object::do_output_section_offset): Moved from Relobj.
2830         (Object::do_get_incremental_reloc_base): New function.
2831         (Object::do_get_incremental_reloc_count): New function.
2832         (Object::Object): Initialize new data members.
2833         (Relobj::output_section): Renamed do_output_section and moved to
2834         protected.
2835         (Relobj::output_section_offset): Moved to Object.
2836         (Relobj::do_get_incremental_reloc_base): New function.
2837         (Relobj::do_get_incremental_reloc_count): New function.
2838         (Relobj::allocate_incremental_reloc_counts): New function.
2839         (Relobj::count_incremental_reloc): New function.
2840         (Relobj::finalize_incremental_relocs): New function.
2841         (Relobj::next_incremental_reloc_index): New function.
2842         (Relobj::reloc_counts_): New data member.
2843         (Relobj::reloc_bases_): New data member.
2844         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
2845         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
2846         (Sized_relobj::incremental_relocs_scan): New function.
2847         (Sized_relobj::incremental_relocs_scan_reltype): New function.
2848         (Sized_relobj::incremental_relocs_write): New function.
2849         (Sized_relobj::incremental_relocs_write_reltype): New function.
2850         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
2851         incremental link.
2852         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
2853         archives and object files elsewhere.
2854         (Add_symbols::run): Report object files here.
2855         (Finish_group::run): Report end of archive at end of group.
2856         * reloc.cc: Include layout.h, incremental.h.
2857         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
2858         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
2859         (Sized_relobj::incremental_relocs_scan): New function.
2860         (Sized_relobj::incremental_relocs_scan_reltype): New function.
2861         (Sized_relobj::do_relocate_sections): Write incremental relocations.
2862         (Sized_relobj::incremental_relocs_write): New function.
2863         (Sized_relobj::incremental_relocs_write_reltype): New function.
2864         * script.cc (read_input_script): Rewrite test for incremental link.
2865         Change call to Incremental_inputs::report_script.
2866         * symtab.h (Symbol_table::first_global_index): New function.
2867         (Symbol_table::output_count): New function.
2869 2010-08-12  Doug Kwan  <dougkwan@google.com>
2871         * arm.cc (Target_arm::merge_object_attributes): Check command line
2872         options --no-wchar-size-warning and --no-enum-size-warning.
2873         * options.h (General_options): Add ld-compatible options
2874         --no-enum-size-warning and --no-wchar-size-warning.
2876 2010-08-04  Ian Lance Taylor  <iant@google.com>
2878         * x86_64.cc (Target_x86_64::Scan::local): Use
2879         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
2880         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
2881         (Target_x86_64::Scan::global): Likewise.
2882         (Target_x86_64::Relocate::relocate): Likewise.
2883         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
2884         Likewise.
2886 2010-08-03  Cary Coutant  <ccoutant@google.com>
2888         * merge.cc (Output_merge_string::do_add_input_section): Count strings
2889         to reserve space in merged_strings vector. Keep total input size
2890         for stats.
2891         (Output_merge_string::do_print_merge_stats): Print total input size.
2892         * merge.h (Output_merge_string): Add input_size_ field.
2893         * stringpool.cc (Stringpool_template::string_length): Move
2894         implementations out of Stringpool_template class and place in
2895         stringpool.h.
2896         * stringpool.h (string_length): Move out of Stringpool_template.
2898 2010-08-03  Ian Lance Taylor  <iant@google.com>
2900         PR 11712
2901         * layout.cc (relaxation_loop_body): If address of load segment is
2902         set, adjust address to include headers if possible.
2904 2010-08-03  Ian Lance Taylor  <iant@google.com>
2906         * version.cc (version_string): Bump to 1.10.
2908 2010-08-03  Ian Lance Taylor  <iant@google.com>
2910         PR 11805
2911         * layout.h (enum Output_section_order): Define.
2912         (class Layout): Update declarations.
2913         * layout.cc (Layout::get_output_section): Add order parameter.
2914         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
2915         is_first_non_relro parameters.  Change all callers.
2916         (Layout::choose_output_section): Likewise.
2917         (Layout::add_output_section_data): Likewise.
2918         (Layout::make_output_section): Likewise.  Set order.
2919         (Layout::default_section_order): New function.
2920         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
2921         * output.cc (Output_section::Output_section): Initialize order_.
2922         Don't initialize deleted fields.
2923         (Output_segment::Output_segment): Don't initialize deleted
2924         fields.
2925         (Output_segment::add_output_section_to_load): New function
2926         replacing add_output_section.  Change all callers to call this or
2927         add_output_section_to_nonload.
2928         (Output_segment::add_output_section_to_nonload): New function.
2929         (Output_segment::remove_output_section): Rewrite.
2930         (Output_segment::add_initial_output_data): Likewise.
2931         (Output_segment::has_any_data_sections): Likewise.
2932         (Output_segment::is_first_section_relro): Likewise.
2933         (Output_segment::maximum_alignment): Likewise.
2934         (Output_segment::has_dynamic_reloc): New function replacing
2935         dynamic_reloc_count.  Change all callers.
2936         (Output_segment::has_dynamic_reloc_list): New function replacing
2937         dynamic_reloc_count_list.  Change all callers.
2938         (Output_segment::set_section_addresses): Rewrite.
2939         (Output_segment::set_offset): Rewrite.
2940         (Output_segment::find_first_and_last_list): Remove.
2941         (Output_segment::set_tls_offsets): Rewrite.
2942         (Output_segment::first_section_load_address): Likewise.
2943         (Output_segment::output_section_count): Likewise.
2944         (Output_segment::section_with_lowest_load_address): Likewise.
2945         (Output_segment::write_section_headers): Likewise.
2946         (Output_segment::print_sections_to_map): Likewise.
2947         * output.h (class Output_data): Remove dynamic_reloc_count_
2948         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
2949         (Output_data::add_dynamic_reloc): Rewrite.
2950         (Output_data::has_dynamic_reloc): New function.
2951         (Output_data::dynamic_reloc_count): Remove.
2952         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
2953         is_last_relro_, is_first_non_relro_, is_interp_,
2954         is_dynamic_linker_section_ fields.  Add order and set_order
2955         functions.  Remove is_relro_local, set_is_relro_local,
2956         is_last_relro, set_is_last_relro, is_first_non_relro,
2957         set_is_first_non_relro functions, is_interp, set_is_interp,
2958         is_dynamic_linker_section, and set_is_dynamic_linker_section
2959         functions.
2960         (class Output_segment): Change Output_data_list from std::list to
2961         std:;vector.  Add output_lists_ field.  Remove output_data_ and
2962         output_bss_ fields.  Update declarations.
2964 2010-08-02  Ian Lance Taylor  <iant@google.com>
2966         * arm.cc (Target_arm::gc_process_relocs): Use typename.
2967         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
2968         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
2970 2010-08-02  Ian Lance Taylor  <iant@google.com>
2972         PR 11855
2973         * script.cc (Script_options::Script_options): Initialize
2974         symbol_definitions_ and symbol_references_.
2975         (Script_options::add_symbol_assignment): Update
2976         symbol_definitions_ and symbol_references_.
2977         (Script_options::add_symbol_reference): New function.
2978         (script_symbol): New function.
2979         * script.h (class Script_options): Add symbol_definitions_ and
2980         symbol_references_ fields.
2981         (Script_options::referenced_const_iterator): New type.
2982         (Script_options::referenced_begin): New function.
2983         (Script_options::referenced_end): New function.
2984         (Script_options::is_referenced): New function.
2985         (Script_options::any_unreferenced): New function.
2986         * script-c.h (script_symbol): Declare.
2987         * yyscript.y (exp): Call script_symbol.
2988         * symtab.cc: Include "script.h".
2989         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
2990         Change all callers.  Check symbols referenced by scripts.
2991         (Symbol_table::add_undefined_symbols_from_command_line): Add
2992         layout parameter.  Change all callers.
2993         (Symbol_table::do_add_undefined_symbols_from_command_line):
2994         Likewise.  Break out loop body.  Check symbols referenced by
2995         scripts.
2996         (Symbol_table::add_undefined_symbol_from_command_line): New
2997         function broken out of
2998         do_add_undefined_symbols_from_command_line.
2999         * symtab.h (class Symbol_table): Update declarations.
3000         * archive.cc: Include "layout.h".
3001         (Archive::should_include_member): Add layout parameter.  Change
3002         all callers.  Check for symbol mentioned in expression.
3003         * archive.h (class Archive): Update declaration.
3004         * object.cc (Sized_relobj::do_should_include_member): Add layout
3005         parameter.
3006         * object.h (Object::should_include_member): Add layout parameter.
3007         Change all callers.
3008         (Object::do_should_include_member): Add layout parameter.
3009         (class Sized_relobj): Update declaration.
3010         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
3011         parameter.
3012         * dynobj.h (class Sized_dynobj): Update declaration.
3013         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
3014         layout parameter.
3015         * plugin.h (class Sized_pluginobj): Update declaration.
3017 2010-08-02  Ian Lance Taylor  <iant@google.com>
3019         PR 11866
3020         * output.cc (Output_segment::set_offset): Search for the first and
3021         last sections rather than assuming that the list is in order.
3022         (Output_segment::find_first_and_last_list): New function.
3023         * output.h (class Output_segment): Update declarations.
3024         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
3025         (relro_strip_test_SOURCES): New variable.
3026         (relro_strip_test_DEPENDENCIES): New variable.
3027         (relro_strip_test_LDFLAGS): New variable.
3028         (relro_strip_test_LDADD): New variable.
3029         (relro_strip_test.so): New target.
3031 2010-08-02  Ian Lance Taylor  <iant@google.com>
3033         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
3034         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
3035         (Target_i386::got_tlsdesc_section): New function.
3036         (Target_i386::got_section): Create space for GOT entries for
3037         TLSDESC relocations.
3038         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
3039         R_386_TLS_GOTDESC.
3040         (Target_i386::Scan::global): Likewise.
3041         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
3042         using TLSDESC GOT.
3043         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
3044         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
3045         (Target_x86_64::got_tlsdesc_section): New function.
3046         (Target_x86_64::got_section): Create space for GOT entries for
3047         TLSDESC relocations.
3048         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
3049         R_386_TLS_GOTDESC.
3050         (Target_x86_64::Scan::global): Likewise.
3051         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
3052         using TLSDESC GOT.
3054 2010-08-02  Ian Lance Taylor  <iant@google.com>
3056         * testsuite/final_layout.sh: Use dc to convert from hex to
3057         decimal.
3059 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
3061         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
3062         paramter to the call to gold::gc_process_relocs.
3063         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
3064         paramter to the call to gold::gc_process_relocs.
3065         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
3066         parameter to the call to gold::gc_process_relocs.
3067         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
3068         template parameter to the call to gold::gc_process_relocs.
3069         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
3070         paramter to the call to gold::gc_process_relocs.
3071         * gc.h (get_embedded_addend_size): New function.
3072         (gc_process_relocs): Save the size of the reloc for use by ICF.
3073         * icf.cc (get_section_contents): Get the addend from the text section
3074         for SHT_REL relocation sections.
3075         * icf.h (Icf::Reloc_addend_size_info): New typedef.
3076         (Icf::Reloc_info): Add new member reloc_addend_size_info.
3077         * int_encoding.h (read_from_pointer): New overloaded function.
3078         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
3079         * testsuite/icf_sht_rel_addend_test.sh: New file.
3080         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
3081         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
3083 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3085         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
3086         * Makefile.in: Regenerate.
3087         * testsuite/Makefile.in: Regenerate.
3089 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
3091         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
3092         * gold/testsuite/debug_msg.cc: Likewise.
3093         * gold/testsuite/odr_violation1.cc
3094         * gold/testsuite/odr_violation2.cc
3096 2010-07-21  Cary Coutant  <ccoutant@google.com>
3098         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
3099         string, and length fields.
3100         (Output_merge_string::Merged_strings_list): New type.
3101         (Output_merge_string::Merged_strings_lists): New typedef.
3102         (Output_merge_string): Replace merged_strings_ with
3103         merged_strings_lists_.
3104         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
3105         Merged_strings_list per input object and section.  Don't store pointer
3106         to the string.  Don't store length with each merged string entry.
3107         (Output_merge_string::finalize_merged_data): Loop over list of merged
3108         strings lists.  Recompute length of each merged string.
3110 2010-07-15  Cary Coutant  <ccoutant@google.com>
3112         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
3113         here.
3115 2010-07-14  Ian Lance Taylor  <iant@google.com>
3117         * descriptors.cc (Descriptors::open): Report correct name in error
3118         message.
3120 2010-07-13  Doug Kwan  <dougkwan@google.com>
3122         * arm.cc (Arm_input_section::Arm_input_section): For a
3123         SHT_ARM_EXIDX section, always keeps the input sections.
3124         (Arm_input_section::set_exidx_section_link): New method.
3125         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
3126         has_errors_ to false.
3127         (Arm_exidx_input_section::has_errors,
3128         Arm_exidx_input_section::set_has_errors): New methods.
3129         (Arm_exidx_input_section::has_errors_): New data member.
3130         (Arm_relobj::get_exidx_shndx_list): New method.
3131         (Arm_output_section::append_text_sections_to_list): Do not skip
3132         section without SHF_EXECINSTR.
3133         (Arm_output_section::fix_exidx_coverage): Skip input sections with
3134         errors.
3135         (Arm_relobj::make_exidx_input_section): Add new parameter for text
3136         section header.  Make error messages more verbose.  Check for
3137         a non-executable section linked to an EXIDX section.
3138         (Arm_relobj::do_read_symbols): Remove error checking, which has been
3139         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
3140         check that there is no deferred EXIDX section if we exit early.
3141         Instead of not making an EXIDX section in case of an error, make one
3142         and set the has_errors flag of it.
3143         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
3144         in a relocatable link.
3145         (Target_arm::do_relax): Look for the EXIDX output section instead of
3146         assuming that it is called .ARM.exidx.
3147         (Target_arm::fix_exidx_coverage): Add a new parameter for input
3148         section list.  Do not check for SHF_EXECINSTR section flags but
3149         skip any input section with errors.
3150         * output.cc (Output_section::Output_section): Initialize
3151         always_keeps_input_sections_ to false.
3152         (Output_section::add_input_section): Check for
3153         always_keeps_input_sections_.
3154         *  output.h (Output_section::always_keeps_input_sections,
3155         Output_section::set_always_keeps_input_sections): New methods.
3156         (Output_section::always_keeps_input_sections): New data member.
3158 2010-07-13  Rafael Espindola  <espindola@google.com>
3160         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
3161         * fileread.h (Input_file): Add try_extra_search_path and find_file.
3163 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
3164             Ian Lance Taylor  <iant@google.com>
3166         * output.h (Output_section_lookup_maps::add_merge_section):
3167         Correct check of whether value was inserted.
3168         (Output_section_lookup_maps::add_merge_input_section): Likewise.
3169         (Output_section_lookup_maps::add_relaxed_input_section):
3170         Likewise.
3171         * arm.cc (Target_arm::got_section): Remove used local os.
3172         * i386.cc (Target_i386::got_section): Likewise.
3173         * x86_64.cc (Target_x86_64::got_section): Likewise.
3174         * sparc.cc (Target_sparc::got_section): Likewise.
3175         (Target_sparc::relocate): Remove unused local have_got_offset.
3176         * powerpc.cc (Target_powerpc::relocate): Likewise.
3178 2010-07-13  Ian Lance Taylor  <iant@google.com>
3180         * compressed_output.cc (zlib_decompress): Fix signature in
3181         !HAVE_ZLIB_H case.
3183         * archive.cc (Archive::include_member): Unlock an external member
3184         of a thin archive.  Don't bother to delete an object we know is
3185         NULL.
3187 2010-07-12  Cary Coutant  <ccoutant@google.com>
3189         * compressed_output.cc (zlib_decompress): New function.
3190         (get_uncompressed_size): New function.
3191         (decompress_input_section): New function.
3192         * compressed_output.h (get_uncompressed_size): New function.
3193         (decompress_input_section): New function.
3194         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
3195         Handle compressed debug sections.
3196         * layout.cc (is_compressed_debug_section): New function.
3197         (Layout::output_section_name): Map compressed section names to
3198         canonical names.
3199         * layout.h (is_compressed_debug_section): New function.
3200         (is_debug_info_section): Recognize compressed debug sections.
3201         * merge.cc: Include compressed_output.h.
3202         (Output_merge_data::do_add_input_section): Handle compressed
3203         debug sections.
3204         (Output_merge_string::do_add_input_section): Handle compressed
3205         debug sections.
3206         * object.cc: Include compressed_output.h.
3207         (Sized_relobj::Sized_relobj): Initialize new data members.
3208         (build_compressed_section_map): New function.
3209         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
3210         * object.h (Object::section_is_compressed): New method.
3211         (Object::do_section_is_compressed): New method.
3212         (Sized_relobj::Compressed_section_map): New type.
3213         (Sized_relobj::do_section_is_compressed): New method.
3214         (Sized_relobj::compressed_sections_): New data member.
3215         * output.cc (Output_section::add_input_section): Handle compressed
3216         debug sections.
3217         * reloc.cc: Include compressed_output.h.
3218         (Sized_relobj::write_sections): Handle compressed debug sections.
3220 2010-07-08  Cary Coutant  <ccoutant@google.com>
3222         * resolve.cc (Symbol_table::resolve): Remember whether undef was
3223         weak when resolving to a dynamic def.
3224         (Symbol_table::should_override): Add adjust_dyndef flag; set it
3225         for weak undef/dynamic def cases. Adjust callers.
3226         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
3227         undef_binding_weak_.
3228         (Symbol_table::sized_write_globals): Adjust symbol binding.
3229         (Symbol_table::sized_write_symbol): Add binding parameter.
3230         * symtab.h (Symbol::set_undef_binding): New method.
3231         (Symbol::is_undef_binding_weak): New method.
3232         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
3233         (Symbol_table::should_override): Add new parameter.
3234         (Symbol_table::sized_write_symbol): Add new parameter.
3236         * testsuite/weak_undef_file1.cc: Add new test case.
3237         * testsuite/weak_undef_file2.cc: Fix header comment.
3238         * testsuite/weak_undef_test.cc: Add new test case.
3240 2010-06-29  Doug Kwan  <dougkwan@google.com>
3242         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
3243         Initialize USE_SYMBOL_.
3244         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
3245         definition.
3246         (Arm_reloc_property::uses_symbol_): New data member declaration.
3247         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
3248         uses symbol value and symbol is undefined but not weakly undefined.
3250 2010-06-28  Rafael Espindola  <espindola@google.com>
3252         * plugin.cc (Plugin::load): Use dlerror.
3254 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
3256         * symtab.cc (detect_odr_violations): When reporting an ODR
3257         violation, report an object where the symbol is defined.
3259 2010-06-25  Doug Kwan  <dougkwan@google.com>
3261         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
3262         (Target_arm::section_may_have_icf_unsafe_pointers): New method
3263         definition.
3264         (Target_arm::Scan::local_reloc_may_be_function_pointer,
3265         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
3266         target hook to detect function points.
3267         (Target_arm::Scan::possible_function_pointer_reloc): New method.
3268         * icf.h (Icf::check_section_for_function_pointers): Change type of
3269         parameter SECTION_NAME to const reference to std::string.  Use
3270         target hook to determine if section may have unsafe pointers.
3271         * target.h (Target::section_may_have_icf_unsafe_pointers): New
3272         method definition.
3274 2010-06-21  Rafael Espindola  <espindola@google.com>
3276         * fileread.cc (Input_file::find_fie): New
3277         (Input_file::open): Use Input_file::find_fie.
3278         * fileread.h (Input_file::find_fie): New
3279         * plugin.cc (set_extra_library_path): New.
3280         (Plugin::load): Add set_extra_library_path to the transfer vector.
3281         (Plugin_manager::set_extra_library_path): New.
3282         (Plugin_manager::add_input_file): Use the extra search path if set.
3283         (set_extra_library_path(): New.
3284         * plugin.h (Plugin_manager): Add set_extra_library_path and
3285         extra_search_path_.
3287 2010-06-19  Cary Coutant  <ccoutant@google.com>
3289         * layout.cc (gdb_sections): Add .debug_types.
3290         (lines_only_debug_sections): Likewise.
3292 2010-06-18  Rafael Espindola  <espindola@google.com>
3294         * plugin.cc (add_input_file,add_input_library)
3295         (Plugin_manager::add_input_file): Make filename arguments const.
3296         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
3297         const.
3299 2010-06-16  Doug Kwan  <dougkwan@google.com>
3301         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
3302         .ARM.attributes section if we have not merged any input
3303         attributes sections.
3305 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3307         * arm.cc: Allow combining objects with no EABI version
3308         information.
3310 2010-06-15  Rafael Espindola  <espindola@google.com>
3312         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
3314 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3316         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
3317         (struct iovec): Correct !HAVE_READV definition.
3319 2010-06-10  Cary Coutant  <ccoutant@google.com>
3321         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
3322         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
3323         reloc sections.
3324         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
3326         PR 11683
3327         * symtab.h (Symbol::is_placeholder): New member function.
3328         * target-reloc.h (relocate_section): Check for placeholder symbols.
3330         * testsuite/Makefile.am (plugin_test_8): New test.
3331         (plugin_test_9): New test.
3332         * testsuite/Makefile.in: Regenerate.
3334 2010-06-09  Nick Clifton  <nickc@redhat.com>
3336         * yyscript.y (input_list_element): Allow strings prefixed with
3337         the '-' character.  Treat these as libraries.
3338         * script.cc (script_add_library): New function.  Adds a library
3339         specified by "-l<name>" found in an input script.
3340         * script-c.h: Add prototype for script_add_library.
3342 2010-06-07  Doug Kwan  <dougkwan@google.com>
3344         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
3345         Restrict stub-group size to be within long conditional branch
3346         range when working around cortex-A8 erratum.
3348 2010-06-07  Damien Diederen  <dd@crosstwine.com>
3350         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
3351         #ifdef typo.
3353 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
3355         PR gold/11658
3356         * output.cc
3357         (Output_section::Input_section_sort_entry::compare_section_ordering):
3358         Change to return non-zero correctly.
3359         (Output_section::Input_section_sort_section_order_index_compare
3360         ::operator()): Change to fix ambiguity in comparisons.
3362 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
3364         * gold.h (is_wildcard_string): New function.
3365         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
3366         (Layout::layout_eh_frame): Ditto.
3367         (Layout::find_section_order_index): New method.
3368         (Layout::read_layout_from_file): New method.
3369         * layout.h (Layout::find_section_order_index): New method.
3370         (Layout::read_layout_from_file): New method.
3371         (Layout::input_section_position_): New private member.
3372         (Layout::input_section_glob_): New private member.
3373         * main.cc (main): Call read_layout_from_file here.
3374         * options.h (--section-ordering-file): New option.
3375         * output.cc (Output_section::input_section_order_specified_): New
3376         member.
3377         (Output_section::Output_section): Initialize new member.
3378         (Output_section::add_input_section): Add new parameter.
3379         Keep input sections when --section-ordering-file is used.
3380         (Output_section::set_final_data_size): Sort input sections when
3381         section ordering file is specified.
3382         (Output_section::Input_section_sort_entry): Add new parameter.
3383         Check sorting type.
3384         (Output_section::Input_section_sort_entry::compare_section_ordering):
3385         New method.
3386         (Output_section::Input_section_sort_compare::operator()): Change to
3387         consider section_order_index.
3388         (Output_section::Input_section_sort_init_fini_compare::operator()):
3389         Change to consider section_order_index.
3390         (Output_section::Input_section_sort_section_order_index_compare
3391         ::operator()): New method.
3392         (Output_section::sort_attached_input_sections): Change to sort
3393         according to section order when specified.
3394         (Output_section::add_input_section<32, true>): Add new parameter.
3395         (Output_section::add_input_section<64, true>): Add new parameter.
3396         (Output_section::add_input_section<32, false>): Add new parameter.
3397         (Output_section::add_input_section<64, false>): Add new parameter.
3398         * output.h (Output_section::add_input_section): Add new parameter.
3399         (Output_section::input_section_order_specified): New
3400         method.
3401         (Output_section::set_input_section_order_specified): New method.
3402         (Input_section::Input_section): Initialize section_order_index_.
3403         (Input_section::section_order_index): New method.
3404         (Input_section::set_section_order_index): New method.
3405         (Input_section::section_order_index_): New member.
3406         (Input_section::Input_section_sort_section_order_index_compare): New
3407         struct.
3408         (Output_section::input_section_order_specified_): New member.
3409         * script-sections.cc (is_wildcard_string): Delete and move modified
3410         method to gold.h.
3411         (Output_section_element_input::Output_section_element_input): Modify
3412         call to is_wildcard_string.
3413         (Output_section_element_input::Input_section_pattern
3414         ::Input_section_pattern): Ditto.
3415         (Output_section_element_input::Output_section_element_input): Ditto.
3416         * testsuite/Makefile.am (final_layout): New test case.
3417         * testsuite/Makefile.in: Regenerate.
3418         * testsuite/final_layout.cc: New file.
3419         * testsuite/final_layout.sh: New file.
3421 2010-06-01  Rafael Espindola  <espindola@google.com>
3423         * plugin.cc (Plugin::load): Pass the output name to the plugin.
3425 2010-06-01  Rafael Espindola  <espindola@google.com>
3427         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
3428         visibility of symbols.
3430 2010-05-27  Doug Kwan  <dougkwan@google.com>
3432         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
3433         from start of output section instead of address for a local symbol
3434         in a merged or relaxed section when doing a relocatable link.
3436 2010-05-26  Rafael Espindola  <espindola@google.com>
3438        PR 11604
3439         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
3440         adding sections the garbage collector removed.
3441         * gold/testsuite/Makefile.am: Add test.
3442         * gold/testsuite/Makefile.in: Regenerate.
3443         * gold/testsuite/plugin_test_7.sh: New.
3444         * gold/testsuite/plugin_test_7_1.c: New.
3445         * gold/testsuite/plugin_test_7_2.c: New.
3447 2010-05-26  Rafael Espindola  <espindola@google.com>
3449         * script-sections.cc (Output_section_definition::set_section_addresses):
3450         Check for --section-start.
3452 2010-05-26  Doug Kwan  <dougkwan@google.com>
3454         * arm.cc (Arm_scan_relocatable_relocs): New class.
3455         (Target_arm::relocate_special_relocatable): New method.
3456         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
3457         (Arm_relocate_functions::thumb_branch_common): Same.
3458         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
3459         instead of Default_scan_relocatable_relocs.
3460         * target-reloc.h (relocate_for_relocatable): Let target handle
3461         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
3462         * target.h (Sized_target::relocate_special_relocatable): New method.
3464 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3466         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
3468 2010-05-23  Doug Kwan  <dougkwan@google.com>
3470         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
3471         instead of a cast.
3472         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
3473         with a direct branch, not a conditional branch, to a stub.
3474         * merge.cc (Output_merge_base::record_input_section): New method
3475         defintion.
3476         (Output_merge_data::do_add_input_section): Record input section if
3477         keeps-input-sections flag is set.
3478         (Output_merge_string::do_add_input_section): Ditto.
3479         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
3480         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
3481         INPUT_SECTIONS_.
3482         (Output_merge_base::keeps_input_sections,
3483         Output_merge_base::set_keeps_input_sections,
3484         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
3485         method definitions.
3486         (Output_merge_base::Input_sections): New type declaration.
3487         (Output_merge_base::input_sections_begin,
3488         Output_merge_base::input_sections_end,
3489         Output_merge_base::do_set_keeps_input_sections): New method definitions.
3490         (Output_merge_base::bool keeps_input_sections_,
3491         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
3492         Output_merge_base::input_sections_): New data members.
3493         (Output_merge_data::do_set_keeps_input_sections): New method
3494         defintion.
3495         (Output_merge_string::do_set_keeps_input_sections): Ditto.
3496         * output.cc (Output_section::Input_section::relobj): Move method
3497         defintion from class declaration to here and handle merge sections.
3498         (Output_section::Input_section::shndx): Ditto.
3499         (Output_section::Output_section): Remove initializations of removed
3500         data members and initialize new data member LOOKUP_MAPS_.
3501         (Output_section::add_input_section): Set keeps-input-sections flag
3502         for a newly created merge output section as appropriate.  Adjust code
3503         to use Output_section_lookup_maps class.
3504         (Output_section::add_relaxed_input_section): Adjst code for lookup
3505         maps code refactoring.
3506         (Output_section::add_merge_input_section): Add a new parameter
3507         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
3508         class.  If adding input section to a newly created merge output
3509         section fails, remove the new merge section.
3510         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
3511         Adjust code for use of the Output_section_lookup_maps class.
3512         (Output_section::find_merge_section): Ditto.
3513         (Output_section::build_lookup_maps): New method defintion.
3514         (Output_section::find_relaxed_input_section): Adjust code to use
3515         Output_section_lookup_maps class.
3516         (Output_section::get_input_sections): Export merge sections.  Adjust
3517         code to use Output_section_lookup_maps class.
3518         (Output_section:::add_script_input_section): Adjust code to use
3519         Output_section_lookup_maps class.  Update lookup maps for merge
3520         sections also.
3521         (Output_section::discard_states): Use Output_section_lookup_maps.
3522         (Output_section::restore_states): Same.
3523         * output.h (Merge_section_properties): Move class defintion out of
3524         Output_section.
3525         (Output_section_lookup_maps): New class.
3526         (Output_section::Input_section::is_merge_section): New method
3527         defintion.
3528         (Output_section::Input_section::relobj): Move defintion out of class
3529         defintion.  Declare method only.
3530         (Output_section::Input_section::shndx): Ditto.
3531         (Output_section::Input_section::output_merge_base): New method defintion.
3532         (Output_section::Input_section::u2_.pomb): New union field.
3533         (Output_section::Merge_section_by_properties_map,
3534         Output_section::Output_section_data_by_input_section_map,
3535         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
3536         Remove types.
3537         (Output_section::add_merge_input_section): Add new parameter
3538         KEEPS_INPUT_SECTIONS.
3539         (Output_section::build_lookup_maps): New method declaration.
3540         (Output_section::merge_section_map_,
3541         Output_section::merge_section_by_properties_map_,
3542         Output_section::relaxed_input_section_map_,
3543         Output_section::is_relaxed_input_section_map_valid_): Remove data
3544         members.
3545         (Output_section::lookup_maps_): New data member.
3547 2010-05-21  Doug Kwan  <dougkwan@google.com>
3549         PR gold/11619
3550         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
3551         avoid a compilation error.
3553 2010-05-19  Rafael Espindola  <espindola@google.com>
3555         * script-sections.cc (Output_section_definition::allocate_to_segment):
3556         Update the phdrs_list even when the output section is NULL.
3557         * testsuite/Makefile.am: Add test.
3558         * testsuite/Makefile.in: Regenerate.
3559         * testsuite/script_test_9.cc: New.
3560         * testsuite/script_test_9.sh: New.
3561         * testsuite/script_test_9.t: New.
3563 2010-05-19  Doug Kwan  <dougkwan@google.com>
3565         * arm.cc (Arm_input_section::original_size): New method.
3566         (Arm_input_section::do_addralign): Add a cast.
3567         (Arm_input_section::do_output_offset): Remove static cast.
3568         (Arm_input_section::original_addralign,
3569          Arm_input_section::original_size_): Change type to uint32_t.
3570         (Arm_input_section::init): Add safe casts for section alignment
3571         and size.
3572         (Arm_input_section::set_final_data_size): Do not set address and
3573         offset of stub table.
3574         (Arm_output_section::fix_exidx_coverage): Change use of of
3575         Output_section::Simple_input_section to that of
3576         Output_section::Input_section.
3577         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
3578         except for the first pass.
3579         * output.cc (Output_section::get_input_sections): Change type of
3580         input_sections to std::list<Input_section>.
3581         (Output_section::add_script_input_section): Rename from
3582         Output_section::add_simple_input_section.  Change type of SIS
3583         parameter from Simple_input_section to Input_section.
3584         * output.h (Output_section::Simple_input_section): Remove class.
3585         (Output_section::Input_section): Change class visibility to public.
3586         (Output_section::Input_section::addralign): Use stored alignments
3587         for special input sections if set.
3588         (Output_section::Input_section::set_addralign): New method.
3589         (Output_section::get_input_sections): Change parameter type from
3590         list of Simple_input_section to list of Input_section.
3591         (Output_section::add_script_input_section): Rename from
3592         Output_section::add_simple_input_section. Change first parameter's
3593         type from Simple_input_section to Input_section and remove the
3594         second and third parameters.
3595         * script-sections.cc (Input_section::Input_section_list): Change
3596         type to list of Output_section::Input_section/
3597         (Input_section_info::Input_section_info): Change parameter type of
3598         INPUT_SECTION to Output_section::Input_section.
3599         (Input_section_info::input_section): Change return type.
3600         (Input_section_info::input_section_): Change type to
3601         Output_section::Input_section.
3602         (Output_section_element_input::set_section_addresses): Adjust code
3603         to use Output_section::Input_section instead of
3604         Output_section::Simple_input_section.  Adjust code for renaming
3605         of Output_section::add_simple_input_section.
3606         (Orphan_output_section::set_section_addresses): Ditto.
3608 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3610         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
3611         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
3613 2010-05-18  Rafael Espindola  <espindola@google.com>
3615         * options.cc (General_options::finalize): Handle -nostdlib.
3616         * options.h (nostdlib): New option.
3617         * script.cc (script_add_search_dir): Handle -nostdlib.
3619 2010-05-12  Doug Kwan  <dougkwan@google.com>
3621         * arm.cc (Target_arm::do_finalize_sections): Create an empty
3622         attributes section only if there no attributes section after merging.
3623         (Target_arm::merge_object_attributes): Move value of
3624         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
3625         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
3626         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
3627         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
3628         and arm_attr_merge_7.stdout.
3629         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
3630         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
3631         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
3632         arm_attr_merge_7b.o): New rules.
3633         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
3634         arm_attr_merge_7
3635         * testsuite/Makefile.in: Regenerate.
3636         * testsuite/arm_attr_merge.sh: New file.
3637         * testsuite/arm_attr_merge_[67][ab].s: Same.
3639 2010-05-05  Nick Clifton  <nickc@redhat.com>
3641         * po/es.po: Updated Spanish translation.
3643 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
3645         * Makefile.am (install-exec-local): Properly install gold as
3646         default cross linker.
3647         * Makefile.in: Regenerated.
3649 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
3650             Nick Clifton  <nickc@redhat.com>
3652         * configure.ac (install_as_default): Define and set to false
3653         unless --enable-gold or --enable-gold=both/gold has been
3654         specified.
3655         * configure: Regenerate.
3657         * Makefile.am (install-exec-local): Install the executable as
3658         'ld.gold'.  If install_as_default is true then also install it as
3659         'ld'.
3660         * Makefile.in: Regenerated.
3662 2010-04-24  Ian Lance Taylor  <iant@google.com>
3664         * layout.cc (Layout::layout_reloc): In relocatable link don't
3665         combine reloc sections for grouped sections.
3667 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
3669         * gc.h (gc_process_relocs): Pass information on relocs pointing to
3670         sections that are not ordinary to icf.
3671         * icf.cc (get_section_contents): Handle relocation pointing to section
3672         with no object or shndx information.
3673         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
3674         * testsuite/Makefile.in: Regenerate.
3675         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
3676         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
3678 2010-04-22  Ian Lance Taylor  <iant@google.com>
3680         * expression.cc (Expression::Expression_eval_info): Add
3681         result_alignment_pointer field.
3682         (Expression::eval_with_dot): Add result_alignment_pointer
3683         parameter.  Change all callers.
3684         (Expression::eval_maybe_dot): Likewise.
3685         (class Binary_expression): Add alignment_pointer parameter to
3686         left_value and right_value.  Change all callers.
3687         (BINARY_EXPRESSION): Set result alignment.
3688         (class Trinary_expression): Add alignment_pointer parameter to
3689         arg2_value and arg3_value.  Change all callers.
3690         (Trinary_cond::value): Set result alignment.
3691         (Max_expression::value, Min_expression::value): Likewise.
3692         (Align_expression::value): Likewise.
3693         * script-sections.cc (class Sections_element): Add dot_alignment
3694         parameter to set_section_addresses virtual function.  Update
3695         instantiations.
3696         (class Output_section_element): Likewise.
3697         (Script_sections::create_segments): Add dot_alignment parameter.
3698         Change all callers.
3699         (Script_sections::create_segments_from_phdrs_clause): Likewise.
3700         (Script_sections::set_phdrs_clause_addresses): Likewise.
3701         * script-sections.h: Update declarations.
3702         * script.h: Update declarations.
3703         * output.h (Output_segment::set_minimum_p_align): Don't decrease
3704         min_p_align.
3705         * testsuite/script_test_3.t: Set large alignment.
3706         * testsuite/script_test_3.sh: Make sure that at least one LOAD
3707         segment has expected alignment.
3709 2010-04-22  Nick Clifton  <nickc@redhat.com>
3711         * po/gold.pot: Updated by the Translation project.
3712         * po/vi.po: Updated Vietnamese translation.
3714 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
3716         * testsuite/Makefile.am (check_PROGRAMS): Add
3717         icf_virtual_function_folding_test.
3718         * testsuite/Makefile.in: Regenerated.
3720 2010-04-15  Andrew Haley  <aph@redhat.com>
3722         * options.h (merge_exidx_entries): New option.
3723         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
3724         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
3725         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
3726         (Target_arm::merge_exidx_entries): New function.
3727         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
3728         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
3729         to Arm_exidx_fixup constructor.
3730         Add new arg, merge_exidx_entries.
3731         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
3732         Arm_output_section::fix_exidx_coverage.
3734 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
3736         * icf.cc (get_section_contents): Check for preemptible functions.
3737         Ignore addend when appropriate.
3738         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
3739         section folded.
3740         (add_from_relobj): Check for section folded.
3741         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
3742         * symtab.h (should_add_dynsym_entry): Add new parameter.
3743         * target-reloc.h (scan_relocs): Check for section folded.
3744         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
3745         Check reloc types for function pointers in shared objects.
3746         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
3747         case.
3748         (icf_preemptible_functions_test): New test case.
3749         (icf_string_merge_test): New test case.
3750         * testsuite.Makefile.in: Regenerate.
3751         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
3752         bar_glob.  Refactor code.
3753         * testsuite/icf_preemptible_functions_test.cc: New file.
3754         * testsuite/icf_preemptible_functions_test.sh: New file.
3755         * testsuite/icf_string_merge_test.cc: New file.
3756         * testsuite/icf_string_merge_test.sh: New file.
3757         * testsuite/icf_virtual_function_folding_test.cc: New file.
3758         * testsuite/icf_virtual_function_folding_test.sh: New file.
3760 2010-04-14  Doug Kwan  <dougkwan@google.com>
3762         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
3763         for local symbol recounting if we remove a section due to ICF.
3764         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
3765         there are no regular objects in input.
3767 2010-04-13  Doug Kwan  <dougkwan@google.com>
3769         * arm.cc (Arm_input_section::set_final_data_size): Compute
3770         accurate final data size instead of using current data size.
3772 2010-04-09  Doug Kwan  <dougkwan@google.com>
3774         * layout.cc (Layout::choose_output_section): Handle script section
3775         types.
3776         (Layout::make_output_section_for_script): Add section type parameter.
3777         Handle script section types.
3778         * layout.h (Layout::make_output_section_for_script): Add section
3779         type parameter.
3780         * output.cc (Output_section::Output_section): Initialize data member
3781         is_noload_.
3782         (Output_section::do_reset_address_and_file_offset): Do not set address
3783         to 0 if section is a NOLOAD section.
3784         * output.h (Output_section::is_noload): New method.
3785         (Output_section::set_is_noload): Ditto.
3786         (Output_section::is_noload_): New data member.
3787         * script-c.h (Script_section_type): New enum type.
3788         (struct Parser_output_section_header): Add new file section_type.
3789         * script-sections.cc (Sections_element::output_section_name): Add
3790         parameter for returning script section type.
3791         (Output_section_definition::output_section_name): Ditto.
3792         (Output_section_definition::section_type)P; New method.
3793         (Output_section_definiton::script_section_type_name): Ditto.
3794         (Output_section_definition::script_section_type_): New data member.
3795         (Output_section_definition::Output_section_definition): Initialize
3796         data member Output_section_definition::script_section_type_.
3797         (Output_section_definition::create_sections): Pass script section type
3798         to Layout::make_output_section_for_script.
3799         (Output_section_definition::output_section_name): Return script
3800         section type to caller.
3801         (Output_section_definition::set_section_address): Do not advance
3802         dot value and load address if section type is NOLOAD.  Set address
3803         of NOLOAD sections regardless of section flags.
3804         (Output_section_definition::print): Print section type if it is
3805         not SCRIPT_SECTION_TYPE_NONE.
3806         (Output_section_definition::section_type): New method.
3807         (Output_section_definition::script_section_type_name): Ditto.
3808         (Script_sections::output_section_name): Add new parameter
3809         PSECTION_TYPE for returning script section type.  Pass it to
3810         section elements.  Handle discard sections.
3811         (Sort_output_sections::operator()): Handle NOLOAD sections.
3812         * script-sections.h (Script_sections::Section_type): New enum type.
3813         (Script_sections::output_section_name): Add a new parameter for
3814         returning script section type.
3815         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
3816         INFO and NOLOAD.
3817         * yyscript.y (union): Add new field SECTION_TYPE.
3818         (COPY, DSECT, INFO, NOLOAD): New tokens.
3819         (opt_address_and_section_type): Change type to output_section_header.
3820         (section_type): New non-terminal
3821         (section_header): Handle section type.
3822         (opt_address_and_section_type): Return section type value.
3824 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
3826         * testsuite/plugin_common_test_1.c (foo): Add prototype.
3827         * testsuite/plugin_common_test_2.c (foo): Likewise.
3829 2010-04-08  Doug Kwan  <dougkwan@google.com>
3831         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
3832         Output_merge_data.
3833         * output.cc (Output_section::add_merge_input_section): Simplify
3834         code and return status of Output_merge_base::add_input_section.
3835         Update merge section map only if Output_merge_base::add_input_section
3836         returns true.
3838 2010-04-07  Doug Kwan  <dougkwan@google.com>
3840         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
3841         if section is marked as containing instructions but has no mapping
3842         symbols.
3843         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
3844         correct section index.
3845         (Arm_relobj::find_linked_text_section): Ditto.
3847 2010-04-07  Cary Coutant  <ccoutant@google.com>
3849         * archive.cc (include_member): Destroy Read_symbols_data object before
3850         releasing file.
3851         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
3852         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
3853         (Read_symbols_data::~Read_symbols_data) New destructor.
3854         (Section_relocs::Section_relocs) New constructor.
3855         (Section_relocs::~Section_relocs) New destructor.
3856         (Read_relocs_data::Read_relocs_data) New constructor.
3857         (Read_relocs_data::~Read_relocs_data) New destructor.
3858         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
3859         pointers to NULL after deleting.
3861 2010-04-07  Doug Kwan  <dougkwan@google.com>
3863         * arm.cc: Replace "endianity" with "endianness" in comments.
3864         (Arm_exidx_cantunwind): Ditto.
3865         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
3866         (Arm_relobj::merge_flags_and_attributes): New method.
3867         (Arm_relobj::merge_flags_and_attributes_): New data member.
3868         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
3869         (Arm_relobj::scan_sections_for_stubs): Ditto.
3870         (Arm_relobj::do_read_symbols): Check to see if we really want to
3871         merge processor-specific flags and attributes.  Exit early if
3872         an object is empty except for section names and the undefined symbol.
3873         (Target_arm::do_finalize_sections): Move check for ELF format to
3874         Arm_relobj::do_read_symbols.  Merge processor specific flags and
3875         attributes from a regular object only when we have determined that
3876         it is aapropriate.  Do not create an .ARM.attributes section in
3877         output if there is no regular input object.
3878         (Target_arm::merge_processor_specific_flags): Check
3879         --warn-mismatch before printing any error.
3880         (Target_arm::merge_object_attributes): Ditto.
3881         * gold.cc (queue_middle_tasks): Handle the case in which there is
3882         no regular object in input.
3883         * options.cc (General_options::parse_EB): New method.
3884         (General_options::parse_EL): Same.
3885         (General_options::General_options): Initialize endianness_.
3886         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
3887         New options.
3888         (General_options::Endianness): New enum.
3889         (General_options::endianness): New method.
3890         (General_options::endianness_): New data member.
3891         * parameters.cc (Parameters::set_options): Check target endianness.
3892         (Parameters::set_target_once): Ditto.
3893         (Parameters::check_target_endianness): New method.
3894         (parameters_force_valid_target): If either -EL or -EB is specified,
3895         use it to define endianness of default target.
3896         * parameters.h (Parameters::check_target_endianness): New method
3897         declaration.
3898         * target.h (class Target): Change "endianity" to "endianness"
3899         in comments.
3901 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3903         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
3904         * configure: Regenerate.
3905         * Makefile.in: Regenerate.
3906         * testsuite/Makefile.in: Regenerate.
3908 2010-04-06  Cary Coutant  <ccoutant@google.com>
3910         gcc PR lto/42757
3911         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
3912         prevailing definitions of common symbols.
3913         * testsuite/plugin_test_6.sh: New test case.
3914         * testsuite/plugin_common_test_1.c: New test case.
3915         * testsuite/plugin_common_test_2.c: New test case.
3916         * testsuite/Makefile.am (plugin_test_6): New test case.
3917         * testsuite/Makefile.in: Regenerate.
3919 2010-04-06  Nick Clifton  <nickc@redhat.com>
3921         * po/vi.po: New Vietnamese translation.
3923 2010-03-30  Doug Kwan  <dougkwan@google.com>
3925         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
3927 2010-03-25  Doug Kwan  <dougkwan@google.com>
3929         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
3930         to avoid a conversion warning on a 32-bit host.
3932 2010-03-24  Ian Lance Taylor  <iant@google.com>
3934         * testsuite/script_test_3.t: Add a TLS segment.
3935         * testsuite/Makefile.am (check_PROGRAMS): Add
3936         tls_phdrs_script_test.
3937         (tls_phdrs_script_test_SOURCES): Define.
3938         (tls_phdrs_script_test_DEPENDENCIES): Define.
3939         (tls_phdrs_script_test_LDFLAGS): Define.
3940         (tls_phdrs_script_test_LDADD): Define.
3941         * testsuite/Makefile.in: Rebuild.
3943 2010-03-23  Cary Coutant  <ccoutant@google.com>
3945         * fileread.cc (find_or_make_view): Fix comment.
3947 2010-03-23  Ian Lance Taylor  <iant@google.com>
3949         * script-sections.cc (class Orphan_section_placement): Define
3950         PLACE_TLS and PLACE_TLS_BSS.
3951         (Orphan_section_placement::Orphan_section_placement): Initialize
3952         new places.
3953         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
3954         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
3955         (tls_script_test_SOURCES): Define.
3956         (tls_script_test_DEPENDENCIES): Define.
3957         (tls_script_test_LDFLAGS): Define.
3958         (tls_script_test_LDADD): Define.
3959         * testsuite/Makefile.in: Rebuild.
3961 2010-03-22  Doug Kwan  <dougkwan@google.com>
3963         * arm.cc (Arm_relocate_functions::abs8,
3964         Arm_relocate_functions::abs16): Use correct check for overflow
3965         specified in the ARM ELF specs.
3966         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
3967         target of a BLX instruction specially.
3968         (Reloc_stub::stub_type_for_reloc): Ditto.
3969         (Relocate::relocate): Use symbolic names instead of numeric relocation
3970         codes to report error.
3971         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
3972         workaround.
3973         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
3974         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
3975         thumb2_blx_out_of_range.stdout
3976         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
3977         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
3978         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
3979         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
3980         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
3981         thumb2_blx_in_range, thumb2_blx_in_range.o,
3982         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
3983         thumb2_blx_out_of_range.o): New rules.
3984         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
3985         thumb2_blx_in_range and thumb2_blx_out_of_range.
3986         * testsuite/Makefile.in: Regenerate.
3987         * arm_branch_in_range.sh: Add tests for THUMB BLX.
3988         * testsuite/thumb_blx_in_range.s: New file.
3989         * testsuite/thumb_blx_out_of_range.s: New file.
3991 2010-03-22  Rafael Espindola  <espindola@google.com>
3993         * archive.cc (Should_include): Move to archive.h.
3994         (should_include_member): Make it a member of Archive.
3995         (Lib_group): New.
3996         (Add_lib_group_symbols): New.
3997         * archive.h: Include options.h.
3998         (Archive_member): Moved from Archive.
3999         (Should_include): Moved from archive.cc.
4000         (Lib_group): New.
4001         (Add_lib_group_symbols): New.
4002         * dynobj.cc (do_should_include_member): New.
4003         * dynobj.h (do_should_include_member): New.
4004         * gold.cc (queue_initial_tasks): Update call to queue.
4005         * main.cc (main): Print lib group stats.
4006         * object.cc (do_should_include_member): New.
4007         * object.h: Include archive.h.
4008         (Object::should_include_member): New.
4009         (Object::do_should_include_member): New.
4010         (Sized_relobj::do_should_include_member): New.
4011         * options.cc (General_options::parse_start_lib): New.
4012         (General_options::parse_end_lib): New.
4013         (Input_arguments::add_file): Handle lib groups.
4014         (Input_arguments::start_group): Check we are not in a lib.
4015         (Input_arguments::start_lib): New.
4016         (Input_arguments::end_lib): New.
4017         * options.h (General_options): Add start_lib and end_lib.
4018         (Input_argument::lib_): New.
4019         (Input_argument::lib): New.
4020         (Input_argument::is_lib): New.
4021         (Input_file_lib): New.
4022         (Input_arguments::in_lib_): New.
4023         (Input_arguments::in_lib): New.
4024         (Input_arguments::start_lib): New.
4025         (Input_arguments::end_lib_): New.
4026         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
4027         in unused members as preempted.
4028         (Sized_pluginobj::do_should_include_member): New.
4029         * plugin.h (Sized_pluginobj::do_should_include_member): New.
4030         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
4031         return the blocker.
4032         (Read_symbols::do_whole_lib_group): New.
4033         (Read_symbols::do_lib_group): New.
4034         (Read_symbols::do_read_symbols): Handle lib groups.
4035         (Read_symbols::get_name): Handle lib groups.
4036         * readsyms.h (Read_symbols): Add an archive member pointer.
4037         (Read_symbols::do_whole_lib_group): New.
4038         (Read_symbols::do_lib_group): New.
4039         (Read_symbols::member_): New.
4040         * script.cc (read_input_script): Update call to queue_soon.
4042 2010-03-19  Doug Kwan  <dougkwan@google.com>
4044         * arm.cc (Stub_table::Stub_table): Initialize new data members
4045         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
4046         (Stub_table::add_reloc_stub): Assign stub offset and update
4047         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
4048         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
4049         New data members.
4050         (Stub_table::update_data_size_and_addralign): Use
4051         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
4052         instead of going over all reloc stubs.
4053         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
4054         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
4055         Stringpool_template::offset_ to size of Stringpool_char.
4056         (Stringpool_template::new_key_offset): Remove code to initialize
4057         Stringpool_template::offset_.
4058         * stringpool.h (Stringpool_template::set_no_zero_null): Set
4059         Stringpool_template::offset_ to zero.
4061 2010-03-15  Doug Kwan  <dougkwan@google.com>
4063         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
4064         offset_.
4065         (Stringpool_template::new_key_offset): New method.
4066         (Stringpool_template::add_string): Assign offsets when adding new
4067         strings.
4068         (Stringpool_template::set_string_offsets): Do not set string offsets
4069         when not optimizing.
4070         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
4071         member size_.
4072         (Chunked_vector::clear): Clear size_.
4073         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
4074         (Chunked_vector::size): Return size_.
4075         (Chunked_vector::push_back): Use size_ to find insert position.
4076         (Chunked_vector::size_): New data member.
4077         (Stringpool_template::set_no_zero_null): Assert string set is empty.
4078         (Stringpool_template::new_key_offset): New method declaration.
4079         (Stringpool_template::offset_): New data member.
4081 2010-03-15   Rafael Espindola  <espindola@google.com>
4083         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
4084         Add_symbols' constructor.
4085         * readsyms.h (Add_symbols): Remove the input_group member.
4087 2010-03-10  Ian Lance Taylor  <iant@google.com>
4089         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
4090         target to ask whether a reference to a symbol requires a stack
4091         split.
4092         * target.h (Target::is_call_to_non_split): New function.
4093         (Target::do_is_call_to_non_split): Declare virtual function.
4094         * target.cc: Include "symtab.h".
4095         (Target::do_is_call_to_non_split): New function.
4096         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
4098 2010-03-10  Cary Coutant  <ccoutant@google.com>
4100         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
4101         (File_read::open[1]): Remove initial mapping of whole_file_view_.
4102         (File_read::open[2]): Add whole_file_view_ to list of views.
4103         (File_read::make_view): Remove test of whole_file_view_.
4104         (File_read::find_or_make_view): Create whole_file_view_ if
4105         necessary.
4106         (File_read::clear_views): Replace bool parameter with enum;
4107         adjust all callers.  Don't delete views with permanent data;
4108         do delete cached views and views from archives if
4109         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
4110         if clearing the corresponding view.
4111         * fileread.h (File_read::Clear_views_mode): New enum.
4112         (File_read::View::is_permanent_view): New method.
4113         (File_read::clear_views): Replace bool parameter
4114         with enum; adjust all callers.
4115         * options.h (General_options): Change keep_files_mapped option;
4116         add map_whole_files.
4117         * readsyms.cc (Add_symbols::run): Delete sd_ object before
4118         releasing the file.
4119         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
4120         the file.
4122 2010-03-10  David S. Miller  <davem@davemloft.net>
4124         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
4126 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
4128         * icf.cc (get_section_contents): Add '@' marker after processing the
4129         merge reloc.
4131 2010-03-08  Doug Kwan  <dougkwan@google.com>
4133         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
4134         due to a conversion warning.
4135         (Arm_relobj::update_output_local_symbol_count): Check for local
4136         symbol with unset output index.
4138 2010-03-05  Ian Lance Taylor  <iant@google.com>
4140         * options.h (class General_options): Add --spare-dynamic-tags.
4141         * output.cc (Output_data_dynamic::set_final_data_size): Implement
4142         --spare-dynamic-tags.
4144 2010-03-05  Ian Lance Taylor  <iant@google.com>
4146         * incremental.cc: Include "libiberty.h".
4148 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
4150         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
4151         function, is_info_ member.
4152         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
4153         (Versions::Versions): Update caller.
4154         (Versions::define_base_version): Likewise.
4155         (Versions::add_def): Likewise.
4157 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
4159         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
4160         (Scan::possible_function_pointer_reloc): New function.
4161         (Scan::local_reloc_may_be_function_pointer): Change to call
4162         possible_function_pointer_reloc.
4163         (Scan::global_reloc_may_be_function_pointer): Ditto.
4164         * icf.h (Icf::check_section_for_function_pointers): Change to reject
4165         relocations in ".data.rel.ro._ZTV" section.
4166         * testsuite/icf_safe_so_test.sh: Change to pass i386.
4167         * testsuite/icf_safe_so_test.cc: Ditto.
4168         * testsuite/icf_safe_test.cc: Ditto.
4169         * testsuite/icf_safe_test.sh: Ditto.
4171 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4172             Ian Lance Taylor  <iant@google.com>
4174         * target-reloc.h (relocate_section): Check the symbol table index
4175         for -1U before setting the local symbol index.
4176         (scan_relocatable_relocs): If copying the relocation, record that
4177         the local symbol is required.
4178         * object.h (Symbol_value::is_output_symtab_index_set): New
4179         function.
4180         (Symbol_value::may_be_discarded_from_output_symtab): New
4181         function.
4182         (Symbol_value::has_output_symtab_entry): New function.
4183         (Symbol_value::needs_output_symtab_entry): Remove.
4184         (Symbol_value::output_symtab_index): Make sure the symbol index is
4185         set.
4186         (Symbol_value::set_output_symtab_index): Make sure the symbol
4187         index is not set.  Make sure the new index is valid.
4188         (Symbol_value::set_must_have_output_symtab_entry): New function.
4189         (Symbol_value::has_output_dynsym_entry): New function.
4190         (Symbol_value::set_output_dynsym_index): Make sure the new index
4191         is valid.
4192         (Sized_relobj::set_must_have_output_symtab_entry): New function.
4193         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
4194         local symbol if permitted.
4195         (Sized_relobj::do_finalize_local_symbols): Call
4196         is_output_symtab_index_set rather than needs_output_symtab_entry.
4197         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
4198         rather than needs_output_symtab_entry.  Call
4199         has_output_dynsym_entry rather than needs_output_dynsym_entry.
4200         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
4201         is_output_symtab_index_set rather than needs_output_symtab_entry.
4202         * testsuite/discard_locals_relocatable_test.c: New file.
4203         * testsuite/discard_locals_test.sh: Test -r.
4204         * testsuite/Makefile.am (check_DATA): Add
4205         discard_locals_relocatable_test1.syms,
4206         discard_local_relocatable_test2.syms.
4207         (MOSTLYCLEANFILES): Likewise.  Also add
4208         discard_locals_relocatable_test1.lout and
4209         discard_locals_relocatable_test2.out.
4210         (discard_locals_relocatable_test1.syms): New target.
4211         (discard_locals_relocatable_test.o): New target.
4212         (discard_locals_relocatable_test1.out): New target.
4213         (discard_locals_relocatable_test2.syms): New target.
4214         (discard_locals_relocatable_test2.out): New target.
4215         (various): Add missing ../ld-new dependencies.
4216         * testsuite/Makefile.in: Rebuild.
4218 2010-03-03  Nick Clifton  <nickc@redhat.com>
4220         * po/fi.po: New Finnish translation.
4222 2010-03-01  Doug Kwan  <dougkwan@google.com>
4224         * layout.cc (Layout::Layout): Force section types of .init_array*,
4225         .preinit_array* and .fini_array* sections.
4226         * output.cc (Output_section::Input_section_sort_entry::has_priority):
4227         Fix check of return value of std::string::find.().
4228         (Output_section::Input_section_sort_compare::operator()): Remove
4229         comment about .init_array.
4230         (Output_section::Input_section_sort_init_fini_compare::operator()):
4231         New method.
4232         (Output_section::sort_attached_input_sections): Handle .init_array
4233         and .fini_array specially.
4234         * output.h (Output_section::Inut_section_sort_compare): Update
4235         comment.
4236         (Output_section::Input_section_sort_init_fini_compare): New struct.
4238 2010-02-26  Doug Kwan  <dougkwan@google.com>
4240         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
4241         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
4242         * testsuite/debug_msg.sh: Avoid matching source line number for
4243         use of global variable undef_int.
4245 2010-02-26  Doug Kwan  <dougkwan@google.com>
4247         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
4248         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
4249         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
4250         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
4251         * options.cc (General_options::General_options): Initialize member
4252         fix_v4bx_.
4253         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
4254         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
4255         and rm_no_fix_v4bx.stdout
4256         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
4257         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
4258         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
4259         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
4260         and arm_no_fix_v4bx.
4261         * Makefile.in: Regenerate.
4262         * testsuite/arm_fix_v4bx.s: New file.
4263         * testsuite/arm_fix_v4bx.sh: Ditto.
4265 2010-02-24  Doug Kwan  <dougkwan@google.com>
4267         * arm.cc (Target_arm::got_section): Make the .got section the first
4268         non RELRO section in the data segment.
4269         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
4270         suffixes of section names.
4272 2010-02-24  Doug Kwan  <dougkwan@google.com>
4274         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
4275         flags and attributes merging if an input file is a binary file.
4276         * fileread.cc (Input_file::open): Record format of original file.
4277         * fileread.h (Input_file::Format): New enum type.
4278         (Input_file::Input_file): Initialize data member format_.
4279         (Input_file::format): New method definition.
4280         (Input_file::format_):: New data member.
4282 2010-02-24  Doug Kwan  <dougkwan@google.com>
4284         * arm.cc (Arm_output_data_got): New class.
4285         (ARM_TCB_SIZE): New constant
4286         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
4287         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
4288         If user uses a script with a SECTIONS clause, issue only a warning
4289         for a misplaced EXIDX input section.  Otherwise, issue an error.
4290         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
4291         garbage collection.
4292         (Target_arm::got_mode_index_entry): Handle static linking.
4293         (Target_arm::Scan::local): Ditto.
4294         (Target_arm::Scan::global): Ditto.
4295         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
4296         all incorrectly implemented relocations.
4297         (Target_arm::fix_exidx_coverage): Pass layout to
4298         Arm_output_section::fix_exidx_coverage.
4299         * layout.cc (Layout::section_name_mapping): Remove trailing dots
4300         from ".ARM.exidx." and ".ARM.extab.".
4302 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4304         * arm.cc (Target_arm::do_finalize_sections): Create attribute
4305         section if it does not already exist.
4306         * attributes.cc (Attributes_section_data::Attributes_section_data):
4307         Don't crash if size is zero.
4309 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4310             Ian Lance Taylor  <iant@google.com>
4312         * gold.cc (queue_middle_tasks): If no input files were opened,
4313         exit.
4314         * workqueue.h (Task_function::Task_function): Assert that there is
4315         a blocker.
4317 2010-02-22  Doug Kwan  <dougkwan@google.com>
4319         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
4320         * icf.cc (get_section_contents): Cast snprintf arguments to long long
4321         types to avoid warnings due to different uint64_t implementations
4322         on different hosts.
4324 2010-02-21  Doug Kwan  <dougkwan@google.com>
4326         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
4327         handling of the maximum backward branch offset.
4328         (Arm_relocate_functions::thumb_branch_common): Ditto.
4329         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
4330         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
4331         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
4332         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
4333         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
4334         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
4335         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
4336         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
4337         thumb_bl_out_of_range thumb_bl_out_of_range.o,
4338         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
4339         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
4340         thumb2_bl_out_of_range.o): New rules.
4341         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
4342         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
4343         thumb2_bl_out_of_range
4344         * testsuite/Makefile.in: Regenerate.
4345         * testsuite/arm_bl_in_range.s: New file.
4346         * testsuite/arm_bl_out_of_range.s: Ditto.
4347         * testsuite/arm_branch_in_range.sh: Ditto.
4348         * testsuite/arm_branch_range.t: Ditto.
4349         * testsuite/thumb2_branch_range.t: Ditto.
4350         * testsuite/thumb_bl_in_range.s: Ditto.
4351         * testsuite/thumb_bl_out_of_range.s: Ditto.
4352         * testsuite/thumb_branch_range.t: Ditto.
4354 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
4356         * gc.h (gc_process_relocs): Change vectors to point to the new list.
4357         Add reloc offset information.
4358         * icf.cc (get_section_contents): Change iterators to point to the new
4359         vectors. Add reloc offset information to the contents.
4360         * icf.h (Icf::Sections_reachable_info): New typedef.
4361         (Icf::Sections_reachable_list): New typedef.
4362         (Icf::Offset_info): New typedef.
4363         (Icf::Reloc_info): New struct typedef.
4364         (Icf::Reloc_info_list): New typedef.
4365         (Icf::symbol_reloc_list): Delete method.
4366         (Icf::addend_reloc_list): Delete method.
4367         (Icf::section_reloc_list): Delete method.
4368         (Icf::reloc_info_list): New method.
4369         (Icf::reloc_info_list_): New member.
4371 2010-02-19  Doug Kwan  <dougkwan@google.com>
4373         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
4374         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
4375         * arm.cc (Arm_relocation_functions): New forward declaration.
4376         (Target_arm::Target_arm): Initialize new data members
4377         got_mod_index_offset_ and tls_base_symbol_defined_.
4378         (Target_arm::Relocate::relocate_tls): New method.
4379         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
4380          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
4381         New methods.
4382         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
4383         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
4384         (Target_arm::got_mod_index_offset_,
4385         Target_arm::tls_base_symbol_defined_): New data members.
4386         (Target_arm::Scan::local, Target::Scan::global,
4387         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
4388         relocations.
4390 2010-02-18  Doug Kwan  <dougkwan@google.com>
4392         * arm.cc (Arm_relobj::find_linked_text_section): New method.
4393         (Arm_relobj::make_exidx_input_section): Pass section index of linked
4394         text section as a parameter becuase some broken tools may not set
4395         the link in section header.
4396         (Target_arm::has_got_section): New method.
4397         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
4398         without any mapping symbol as data only.  Remove warning.
4399         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
4400         link in its section header, try to discover the link by inspecting the
4401         REL31 relocation at the beginning of the section.
4402         (Target_arm::Scan::check_non_pic): Report name of offending relocation
4403         in error message.
4404         (Target_arm::Scan::global): Treat any reference to the symbol
4405         _GLOBAL_OFFSET_TABLE_ as a GOT access.
4407 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
4409         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
4410         (Scan::global_reloc_may_be_function_pointer): New function.
4411         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
4412         (Scan::global_reloc_may_be_function_pointer): New function.
4413         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
4414         (Scan::global_reloc_may_be_function_pointer): New function.
4415         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
4416         (Scan::global_reloc_may_be_function_pointer): New function.
4417         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
4418         (Scan::global_reloc_may_be_function_pointer): New function.
4419         (Scan::possible_function_pointer_reloc): New function.
4420         (Target_x86_64::can_check_for_function_pointers): New function.
4421         * gc.h (gc_process_relocs): Scan relocation types to determine if
4422         function pointers were taken for targets that support it.
4423         * icf.cc (Icf::find_identical_sections): Include functions for
4424         folding in safe ICF whose pointer is not taken.
4425         * icf.h (Secn_fptr_taken_set): New typedef.
4426         (fptr_section_id_): New member.
4427         (section_has_function_pointers): New function.
4428         (set_section_has_function_pointers): New function.
4429         (check_section_for_function_pointers): New function.
4430         * options.h: Fix comment for safe ICF option.
4431         * target.h (can_check_for_function_pointers): New function.
4432         * testsuite/Makefile.am: Add icf_safe_so_test test case.
4433         Modify icf_safe_test for X86-64.
4434         * testsuite/Makefile.in: Regenerate.
4435         * testsuite/icf_safe_so_test.cc: New file.
4436         * testsuite/icf_safe_so_test.sh: New file.
4437         * testsuite/icf_safe_test.cc (kept_func_3): New function.
4438         (main): Change to take pointer to function kept_func_3.
4439         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
4440         folding is done correctly for X86-64.
4442 2010-02-12  David S. Miller  <davem@davemloft.net>
4444         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
4445         is_symbolless parameter.
4446         (Output_reloc<SHT_REL>::is_symbolless): New.
4447         (Output_reloc<SHT_REL>::is_symbolless_): New.
4448         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
4449         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
4450         (Output_reloc<SHT_RELA>::is_symbolless): New.
4451         (Output_data_reloc::add_global): Handle is_symbolless.
4452         (Output_data_reloc::add_global_relative): Likewise.
4453         (Output_data_reloc::add_local): Likewise.
4454         (Output_data_reloc::add_local_relative): Likewise.
4455         (Output_data_reloc::add_symbolless_global_addend): New.
4456         (Output_data_reloc::add_symbolless_local_addend): New.
4457         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
4458         is_symbolless.
4459         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
4460         instead of ->is_relative_
4461         (Output_reloc::write): Likewise.
4462         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
4463         (Output_reloc::write_rel): Simplify.
4465         * sparc.cc (Target_sparc::Scan::local): Use
4466         ->add_symbolless_local_addend as needed.
4467         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
4468         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
4469         based upon relocation offset.
4471 2010-02-11  Doug Kwan  <dougkwan@google.com>
4473         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
4474         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
4475         beginning of function.
4476         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
4477         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
4478         parameter is_32bit in calls to should_apply_static_reloc.
4479         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
4480         (check_DATA): Add arm_abs_global.stdout.
4481         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
4482         arm_abs_global.stdout): New rules.
4483         (MOSTLLYCLEANFILES): Add arm_abs_global
4484         * Makefile.in: Regenerate.
4485         * testsuite/arm_abs_global.s: New file.
4486         * testsuite/arm_abs_global.sh: Ditto.
4487         * testsuite/arm_abs_lib.s: Ditto.
4489 2010-02-11  Ian Lance Taylor  <iant@google.com>
4491         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
4492         Read_relocs task.
4493         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
4494         Allocate_commons_task first.
4495         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
4496         task, rather than symtab_lock_.
4497         (Gc_process_relocs::~Gc_process_relocs): New function.
4498         (Gc_process_relocs::is_runnable): Check this_blocker_.
4499         (Gc_process_relocs::locks): Use next_blocker_ rather than
4500         blocker_.
4501         (Scan_relocs::~Scan_relocs): New function.
4502         (Scan_relocs::is_runnable): Check this_blocker_ rather than
4503         symtab_lock_.
4504         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
4505         next_blocker_.
4506         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
4507         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
4508         constructor accordingly.
4509         (class Gc_process_relocs): Likewise.
4510         (class Scan_relocs): Likewise.
4511         * common.h (class Allocate_commons_task): Remove symtab_lock_
4512         field, and corresponding constructor parameter.
4513         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
4514         symtab_lock_.
4515         (Allocate_commons_task::locks): Likewise.
4517 2010-02-11  Ian Lance Taylor  <iant@google.com>
4519         * gold-threads.h (class Once): Define.
4520         (class Initialize_lock): Rewrite as child of Once.
4521         * gold-threads.cc (class Once_initialize): Define.
4522         (once_pointer_control): New static variable.
4523         (once_pointer, once_arg): New static variables.
4524         (c_run_once): New static function.
4525         (Once::Once, Once::run_once, Once::internal_run): New functions.
4526         (class Initialize_lock_once): Remove.
4527         (initialize_lock_control): Remove.
4528         (initialize_lock_pointer): Remove.
4529         (initialize_lock_once): Remove.
4530         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
4531         (Initialize_lock::initialize): Rewrite.
4532         (Initialize_lock::do_run_once): New function.
4533         * archive.cc (Archive::interpret_header): Only clear name if it is
4534         not already empty.
4535         * fileread.cc: Include "gold-threads.h"
4536         (file_counts_lock): New static variable.
4537         (file_counts_initialize_lock): Likewise.
4538         (File_read::release): Only increment counts when using --stats.
4539         Use a lock around the increment.
4540         * parameters.cc (class Set_parameters_target_once): Define.
4541         (set_parameters_target_once): New static variable.
4542         (Parameters::Parameters): Move here from parameters.h.
4543         (Parameters::set_target): Rewrite.
4544         (Parameters::set_target_once): New function.
4545         (Parameters::clear_target): Move here and rewrite.
4546         * parameters.h (class Parameters): Update declarations.  Add
4547         set_parameters_target_once_ field.
4548         (Parameters::Parameters): Move to parameters.cc.
4549         (Parameters::clear_target): Likewise.
4550         * readsyms.cc (Read_symbols::do_group): Create a Start_group
4551         task.
4552         (Start_group::~Start_group): New function.
4553         (Start_group::is_runnable): New function.
4554         (Start_group::locks, Start_group::run): New functions.
4555         (Finish_group::run): Change saw_undefined to size_t.
4556         * readsyms.h (class Start_group): Define.
4557         (class Finish_group): Change saw_undefined_ field to size_t.
4558         (Finish_group::Finish_group): Remove saw_undefined and
4559         this_blocker parameters.  Change all callers.
4560         (Finish_group::set_saw_undefined): New function.
4561         (Finish_group::set_blocker): New function.
4562         * symtab.h (class Symbol_table): Change saw_undefined to return
4563         size_t.  Change saw_undefined_ field to size_t.
4564         * target-select.cc (Set_target_once::do_run_once): New function.
4565         (Target_selector::Target_selector): Initialize set_target_once_
4566         field.  Don't initialize lock_ and initialize_lock_ fields.
4567         (Target_selector::instantiate_target): Rewrite.
4568         (Target_selector::set_target): New function.
4569         * target-select.h (class Set_target_once): Define.
4570         (class Target_selector): Update declarations.  Make
4571         Set_target_once a friend.  Remove lock_ and initialize_lock_
4572         fields.  Add set_target_once_ field.
4574 2010-02-10  Ian Lance Taylor  <iant@google.com>
4576         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
4577         queueing any tasks.
4578         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
4579         (queue_middle_tasks): Add all blockers before queueing any tasks.
4580         (queue_final_tasks): Likewise.
4581         * token.h (Task_token::add_blockers): New function.
4582         * object.h (Input_objects::number_of_relobjs): New function.
4584 2010-02-10  Ian Lance Taylor  <iant@google.com>
4586         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
4587         shared, not if not position independent.
4588         * x86_64.cc (Relocate::relocate_tls): Likewise.
4589         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
4590         (tls_pie_pic_test): New target.
4591         * testsuite/Makefile.in: Rebuild.
4593         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
4594         (tls_test_main_pie.o, tls_test_pie.o): New targets.
4595         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
4596         * testsuite/Makefile.in: Rebuild.
4598 2010-02-09  David S. Miller  <davem@davemloft.net>
4600         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
4601         R_SPARC_RELATIVE using ->add_local_relative().
4602         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
4604         * output.h (Output_data_dynamic::add_section_size): New method
4605         that takes two Output_data objects.
4606         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
4607         entry param.  Handle it in initializers.
4608         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
4609         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
4610         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
4611         arg.
4612         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
4613         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
4614         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
4615         for dynrel_includes_plt.
4616         * i386.cc (Target_i386::do_finalize_sections): Likewise.
4617         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4618         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
4619         before .rela.plt
4620         (Target_sparc::do_finalize_sections): Update to pass true for
4621         dynrel_includes_plt.
4622         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
4623         output before .rela.plt
4624         (Target_powerpc::do_finalize_sections): Update to pass true for
4625         dynrel_includes_plt when 32-bit.
4627 2010-02-08  Doug Kwan  <dougkwan@google.com>
4629         * arm.cc (Arm_relobj::simple_input_section_output_address): New
4630         method.
4631         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
4632         Arm_relobj::scan_section_for_cortex_a8_stubs,
4633         Arm_relobj::do_relocation_section): Instead of calling
4634         Output_section::output_address, use faster
4635         Arm_relobj::simple_input_section_output_address.
4637 2010-02-08  David S. Miller  <davem@davemloft.net>
4639         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
4640         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
4641         relocation helper function.
4643         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
4644         just like R_SPARC_GOT{10,13,22}.
4645         (Target_sparc::Scan::local): Likewise.
4646         (Target_sparc::Relocate:relocate): Likewise.
4648 2010-02-06  Ian Lance Taylor  <iant@google.com>
4650         * configure.ac: Rewrite targetobjs duplicate removal code to use
4651         only shell constructs.
4652         * configure: Rebuild.
4654 2010-02-05  Doug Kwan  <dougkwan@google.com>
4656         PR 11247
4657         * arm.cc (Arm_relobj::section_is_scannable): New method.
4658         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
4659         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
4661 2010-02-04  Doug Kwan  <dougkwan@google.com>
4663         PR 11247
4664         * arm-reloc-property.cc (cstdio): Include.
4665         * configure.ac (targetobjs): Remove duplicates.
4666         * configure: Regenerate.
4667         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
4668         big and little endian version for a given address size.
4670 2010-02-03  Doug Kwan  <dougkwan@google.com>
4672         * arm-reloc-property.cc
4673         (Arm_reloc_property_table::reloc_name_in_error_message): New method
4674         definition.
4675         * arm-reloc-property.h
4676         (Arm_reloc_property_table::get_implemented_static_reloc_property):
4677         New method definition.
4678         (Arm_reloc_property_table::reloc_name_in_error_message): New method
4679         declaration.
4680         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
4681         overflow to N.
4682         (GOT_PREL): Change implemented to Y.
4683         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
4684         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
4685         (Arm_relocate_functions::movw_abs_nc): Remove method.
4686         (Arm_relocate_functions::movt_abs): Ditto.
4687         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
4688         (Arm_relocate_functions::thm_movt_abs): Ditto.
4689         (Arm_relocate_functions::movw_rel_nc): Ditto.
4690         (Arm_relocate_functions::movw_rel): Ditto.
4691         (Arm_relocate_functions::movt_rel): Ditto.
4692         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
4693         (Arm_relocate_functions:thm_movw_rel): Ditto.
4694         (Arm_relocate_functions:thm_movt_rel): Ditto.
4695         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
4696         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
4697         New method definitions.
4698         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
4699         (Arm_relocation_functions::arm_grp_ldr): Ditto.
4700         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
4701         (Arm_relocation_functions::arm_grp_ldc): Ditto.
4702         (Target_arm::Relocate::relocate): Check for non-static or
4703         unimplemented relocation code and exit early.  Change calls to
4704         Target_arm::reloc_uses_thumb_bit and
4705         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
4706         instead.  Refactor code to handle similar relocations to increase
4707         code sharing.  Remove check for unsupported relocation code in switch
4708         statement.
4709         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
4710         relocation property table to find out size.  Change error message to
4711         print out the name of a relocation code instead of the numeric value.
4712         (Target_arm::scan_reloc_for_stub): Use relocation property table
4713         instead of calling Target_arm::reloc_uses_thumb_bit().
4715 2010-02-02  Doug Kwan  <dougkwan@google.com>
4717         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
4718         types of relaxed input section.
4720 2010-02-02  Doug Kwan  <dougkwan@google.com>
4722         * Makefile.am (HFILES): Add arm-reloc-property.h.
4723         (DEFFILES): New.
4724         (TARGETSOURCES): Add arm-reloc-property.cc
4725         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
4726         (libgold_a_SOURCES): $(DEFFILES)
4727         * Makefile.in: Regenerate.
4728         * arm-reloc-property.cc: New file.
4729         * arm-reloc-property.h: New file.
4730         * arm-reloc.def: New file.
4731         * arm.cc: Update comments.
4732         (arm-reloc-property.h): New included header.
4733         (arm_reloc_property_table): New global variable.
4734         (Target_arm::do_select_as_default_target): New method definition.
4735         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
4736         arm-reloc-property to targ_extra_obj.
4737         * parameters.cc (set_parameters_target): Call
4738         Target::select_as_default_target().
4739         * target.h (Target::select_as_default_target): New method definition.
4740         (Target::do_select_as_default_target): Same.
4742 2010-02-01  Doug Kwan  <dougkwan@google.com>
4744         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
4745         first_output_text_section_.
4746         (Arm_exidx_fixup::first_output_text_section): New method definition.
4747         (Arm_exidx_fixup::first_output_text_section_): New data member.
4748         (Arm_exidx_fixup::process_exidx_section): Record the first text
4749         output section seen.
4750         (Arm_output_section::fix_exidx_coverage): Set correct linked section
4751         and entsize in output section header.
4753 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4755         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
4756         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
4757         (Arm_relocate_functions::thm_alu11): New Method.
4758         (Arm_relocate_functions::thm_pc8): New Method.
4759         (Arm_relocate_functions::thm_pc12): New Method.
4760         (Target_arm::Scan::local): Handle the relocations.
4761         (Target_arm::Scan::global): Likewise.
4762         (Target_arm::Relocate::relocate): Likewise.
4763         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
4765 2010-01-29  Doug Kwan  <dougkwan@google.com>
4767         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
4768         of relocation types as ld.
4770 2010-01-29  Doug Kwan  <dougkwan@google.com>
4772         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
4773         to public.
4774         (Arm_relocate_functions::thumb_branch_common): Ditto.
4775         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
4776         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
4777         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
4778         Arm_relocate_functions::jump24): Remove.
4779         (Target_arm::Relocate::relocate): Adjust code to call
4780         Arm_relocation_functions::arm_branch_common and
4781         Arm_relocation_functions::thumb_branch_common instead of their removed
4782         wrappers.  Merge switch-cases together to reduce source code size.
4784 2010-01-29  Doug Kwan  <dougkwan@google.com>
4786         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
4787         output_local_symbol_count_needs_update_.
4788         (Arm_relobj::output_local_symbol_count_needs_update,
4789          Arm_relobj::set_output_local_symbol_count_needs_update,
4790          Arm_relobj::update_output_local_symbol_count): New methods.
4791         (Arm_relobj::output_local_symbol_count_needs_update_): New data
4792         member.
4793         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
4794         of pointed function as in a R_ARM_PREL31 relocation.
4795         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
4796         for output local symbol count updating.
4797         (Target_arm::do_relax): Update output local symbol counts in objects
4798         if necessary.
4799         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
4801 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4803         * arm.cc: Added support for the ARM relocations:
4804         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
4805         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
4806         (Arm_relocate_functions::movw_rel_nc): Renamed (was
4807         movw_prel_nc).
4808         (Arm_relocate_functions::movw_rel): New method.
4809         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
4810         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
4811         thm_movw_prel_nc).
4812         (Arm_relocate_functions::thm_movw_rel): New method.
4813         (Arm_relocate_functions::thm_movt_rel): Renamed (was
4814         thm_movt_prel).
4815         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
4816         relocations.
4817         (Target_arm::Scan::global): Likewise.
4818         (Target_arm::Relocate::relocate): Likewise.
4819         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4820         Likewise.
4822 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4824         * arm.cc: Added support for ARM group relocations.
4825         (Target_arm::reloc_needs_sym_origin): New method.
4826         (Arm_relocate_functions::calc_grp_kn): New method.
4827         (Arm_relocate_functions::calc_grp_residual): New method.
4828         (Arm_relocate_functions::calc_grp_gn): New method.
4829         (Arm_relocate_functions::arm_grp_alu): New Method.
4830         (Arm_relocate_functions::arm_grp_ldr): New Method.
4831         (Arm_relocate_functions::arm_grp_ldrs): New Method.
4832         (Arm_relocate_functions::arm_grp_ldc): New Method.
4833         (Target_arm::Scan::local): Handle the ARM group relocations.
4834         (Target_arm::Scan::global): Likewise.
4835         (Target_arm::Relocate::relocate): Likewise.
4836         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4837         Likewise.
4839 2010-01-26  Doug Kwan  <dougkwan@google.com>
4841         * arm.cc (set): Include.
4842         (class Arm_exidx_fixup): Change type of last_input_section_ to const
4843         pointer type.
4844         (Arm_output_section::Text_section_list): New type.
4845         (Arm_output_section::append_text_sections_to_list): New method.
4846         (Arm_output_section::fix_exidx_coverage): Ditto.
4847         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
4848         (Arm_relobj::convert_input_section_to_relaxed_section): Use
4849         Relobj::set_section_offset() instead of
4850         Sized_relobj::invalidate_section_offset().
4851         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
4852         parameter for section headers. Ignore relocation sections for
4853         unallocated sections and EXIDX sections.
4854         (Target_arm::fix_exidx_coverage): New method.
4855         (Target_arm::output_section_address_less_than): New type.
4856         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
4857         linked text section instead of the EXIDX section.
4858         (Arm_output_section::create_stub_group): Add an assertion to check
4859         that this is not an EXIDX output section.
4860         (Arm_output_section::append_text_sections_to_list): New method.
4861         (Arm_output_section::fix_exidx_coverage): Ditto.
4862         (Arm_relobj::scan_sections_for_stubs): Adjust call to
4863         Arm_relobj::section_needs_reloc_stub_scanning.
4864         (Target_arm::do_relax): Fix EXIDX output section coverage in the
4865         first pass.
4866         (Target_arm::fix_exidx_coverage): New method.
4867         * object.h (Relobj::set_output_section): New method.
4868         (Sized_relobj::invalidate_section_offset): Remove method.
4869         (Sized_relobj::do_invalidate_section_offset): Remove method.
4870         (Sized_relobj::do_set_section_offset): Handle offset value -1.
4872 2010-01-25  Doug Kwan  <dougkwan@google.com>
4874         * arm.cc (Arm_exidx_merged_section::do_output_offset):
4875         Fix warning due to signed and unsigned comparison on a 32-bit host.
4877 2010-01-22  Doug Kwan  <dougkwan@google.com>
4879         * arm.cc (Target_arm::do_relax): Record an output section for section
4880         offset adjustment it contains any stub table that has changed.
4881         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
4882         offsets in an output section if necessary.
4883         * output.cc (Output_section::Output_section): Initialize
4884         section_offsets_need_adjustments_.
4885         (Output_section::add_input_section_for_script): Renamed to
4886         Output_section::add_simple_input_section.
4887         (Output_section::save_states): Add a comment.
4888         (Output_section::discard_states): New method defintion.
4889         (Output_section::adjust_section_offsets): Same.
4890         * output.h (Output_section::add_input_section_for_script): Renamed to
4891         Output_section::add_simple_input_section.
4892         (Output_section::discard_states): New method declaration.
4893         (Output_section::adjust_section_offsets): Same.
4894         (Output_section::section_offsets_need_adjustment,
4895         Output_section::set_section_offsets_need_adjustment): New method
4896         definitions.
4897         (Output_section::section_offsets_need_adjustment_): New data member.
4898         * script-sections.cc
4899         (Output_section_element_input::set_section_address): Adjust code for
4900         renaming of Output_section::add_input_section_for_script.
4901         (Orphan_output_section::set_section_address): Same.
4903 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4905         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
4906         Fix_v4bx enum values .
4907         * gold/options.h (General_options): New option definitions.
4908         (General_options::fix_v4bx): New method.
4909         (General_options::Fix_v4bx): New enum.
4910         * gold/options.cc (General_options::parse_fix_v4bx): New method.
4911         (General_options::parse_fix_v4bx_interworking): New method.
4913 2010-01-22  Doug Kwan  <dougkwan@google.com>
4915         * arm.cc (Arm_exidx_fixup): New class.
4917 2010-01-21  Doug Kwan  <dougkwan@google.com>
4919         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
4920         classes.
4921         (Arm_exidx_section_offset_map): New type.
4923 2010-01-21  Doug Kwan  <dougkwan@google.com>
4925         * arm.cc (Arm_exidx_input_section): New class.
4926         (Arm_relobj::exidx_input_section_by_link,
4927         Arm_relobj::exidx_input_section_by_shndx,
4928         Arm_relobj::make_exidx_input_section): New methods.
4929         (read_arm_attributes_section): Remove.
4930         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
4931         information about them.
4932         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
4933         to here.
4935 2010-01-20  Doug Kwan  <dougkwan@google.com>
4937         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
4938         Input_section_specifier to Section_id.
4939         (Target_arm::new_arm_input_section: Adjust code for change of key
4940         type.
4941         (Target_arm::find_arm_input_section): Ditto.
4942         * gc.h (object.h): Include for Section_id nand Section_id_hash.
4943         (Section_id): Remove.
4944         (Garbage_collection::Section_id_hash): Remove.
4945         * icf.h (object.h): Include for Section_id nand Section_id_hash.
4946         (Section_id): Remove.
4947         (Icf::Section_id_hash): Remove.
4948         * object.h (Section_id, Const_section_id, Section_id_hash,
4949         Const_section_id_hash): New type definitions.
4950         * output.cc (Output_section::add_relaxed_input_section): Change to
4951         use Const_section_id instead of Input_section_specifier as key type.
4952         (Output_section::add_merge_input_section): Ditto.
4953         (Output_section::build_relaxation_map): Change to use Section_id
4954         instead of Input_section_specifier as key type.
4955         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4956         Ditto.
4957         (Output_section::convert_input_sections_to_relaxed_sections): Change
4958         to use Const_section_id instead of Input_section_specifier as key type.
4959         (Output_section::find_merge_section): Ditto.
4960         (Output_section::find_relaxed_input_section): Ditto.
4961         * output.h (Input_section_specifier): Remove class.
4962         (Output_section::Output_section_data_by_input_section_map): Change
4963         key type to Const_section_id.
4964         (Output_section::Output_relaxed_input_section_by_input_section_map):
4965         Ditto.
4966         (Output_section::Relaxation_map): Change key type to Section_id.
4968 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4970         * gold/arm.cc: Added support for R_ARM_V4BX relocation
4971         (class Arm_v4bx_stub): New class.
4972         (DEF_STUBS): Updated definition to support v4_veneer_bx.
4973         (Stub_factory::make_arm_v4bx_stub): New method.
4974         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
4975         (Stub_table::empty): Handle v4bx stubs.
4976         (Stub_table::add_arm_v4bx_stub): New method.
4977         (Stub_table::find_arm_v4bx_stub): New method.
4978         (Arm_relocate_functions::v4bx): New method.
4979         (Target_arm::fix_v4bx): New method.
4980         (Target_arm::Target_arm): Handle R_ARM_V4BX.
4981         (Stub_table::relocate_stubs): Likewise.
4982         (Stub_table::do_write): Likewise.
4983         (Stub_table::update_data_size_and_addralign): Likewise.
4984         (Stub_table::finalize_stubs):  Likewise.
4985         (Target_arm::Scan::local): Likewise.
4986         (Target_arm::Scan::global): Likewise.
4987         (Target_arm::do_finalize_sections): Likewise.
4988         (Target_arm::Relocate::relocate): Likewise.
4989         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4990         Likewise.
4991         (Target_arm::scan_reloc_for_stub): Likewise.
4992         (Target_arm::scan_reloc_section_for_stubs): Likewise.
4994 2010-01-19  Ian Lance Taylor  <iant@google.com>
4996         * output.cc (Output_section_headers::do_sized_write): Write large
4997         segment count to sh_info field.
4998         (Output_file_header::do_sized_write): For large segment count,
4999         write PN_XNUM to e_phnum field.
5001 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5003         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
5004         (Arm_relocate_functions::thm_jump8): New function.
5005         (Arm_relocate_functions::thm_jump11): New function.
5006         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
5007         R_ARM_THM_JUMP11.
5008         (Target_arm::Scan::global): Likewise.
5009         (Target_arm::Relocate::relocate): Likewise.
5010         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5011         Likewise.
5013 2010-01-14  Doug Kwan  <dougkwan@google.com>
5015         * arm.cc (map, utility): Include headers.
5016         (Target_arm::apply_cortex_a8_workaround): New method.
5017         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
5018         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
5019         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
5020         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
5021         the --[no-]fix-cortex-a8 command line options.
5022         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
5023         (Target_arm::relocate_stub): Use addend in instruction template.
5024         * options.h (DEFINE_bool): Set the user-set flag.
5025         (General_options): Add --[no-]-fix-cortex options.
5026         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
5027         : Update fast look-up map after conversion.
5029 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
5031         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
5032         in the first pass of do_layout.
5034 2010-01-13  Doug Kwan  <dougkwan@google.com>
5036         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
5037         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
5038         apparent compiler problem of not folding static constant integral
5039         data members of elfcpp::Elf_sizes<32>.
5041 2010-01-13  Doug Kwan  <dougkwan@google.com>
5043         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
5044         Arm_relobj::section_needs_cortex_a8_stub_scanning,
5045         Arm_relobj::scan_section_for_cortex_a8_erratum,
5046         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
5047         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
5048         sections to scan for relocation stubs into a new method
5049         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
5050         relocation and Cortex-A8 stub scanning.
5051         (Target_arm::do_relax): Force stubs to be after stubbed sections
5052         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
5053         the beginning of a new relaxation pass.  Update a comment.
5054         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
5056 2010-01-12  Ian Lance Taylor  <iant@google.com>
5058         * target-reloc.h (visibility_error): New inline function.
5059         (relocate_section): Call visibility_error.
5060         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
5061         (MOSTLYCLEANFILES): Likewise.
5062         (protected_4_pic.o, protected_3.err): New targets.
5063         * testsuite/protected_4.cc: New file.
5065 2010-01-12  Doug Kwan  <dougkwan@google.com>
5067         * arm.cc (Cortex_a8_reloc): New class.
5068         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
5069         and cortex_a8_relocs_info_.
5070         (Target_arm::fix_cortex_a8): New method definition.
5071         (Target_arm::Cortex_a8_relocs_info): New type.
5072         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
5073         New data member declarations.
5074         (Target_arm::scan_reloc_for_stub): Record information about
5075         relocations for THUMB branches that might be exempted from the
5076         Cortex-A8 workaround.
5077         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
5078         at the beginning of a relaxation pass.
5080 2010-01-12  Doug Kwan  <dougkwan@google.com>
5082         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
5083         (Arm_relobj::Mapping_symbol_position,
5084          Arm_reloj::Mapping_symbol_position_less,
5085          Arm_relobj::Mapping_symbols_info): New types.
5086         (Target_arm::is_mapping_symbol_name): New method definition.
5087         (Arm_relobj::do_count_local_symbols): Save information about mapping
5088         symbols.
5090 2010-01-11  Doug Kwan  <dougkwan@google.com>
5092         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
5093         Arm_relocate_functions::thumb32_branch_upper,
5094         Arm_relocate_functions::thumb32_branch_lower,
5095         Arm_relocate_functions::thumb32_cond_branch_offset,
5096         Arm_relocate_functions::thumb32_cond_branch_upper,
5097         Arm_relocate_functions::thumb32_cond_branch_lower,
5098         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
5099         branch offset encoding.
5100         (Arm_relocate_functions::thumb_branch_common): Use new branch
5101         offset encoding methods to avoid code duplication.
5102         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
5103         (Stub_addend_reader::operator()): Use new branch encoding method
5104         to avoid code duplication.
5106 2010-01-11  Doug Kwan  <dougkwan@google.com>
5108         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
5109         (Target_arm::do_finalize_sections): Define special EXIDX section
5110         symbols only if referenced.
5111         * gc.h (Garbage_collection::add_reference): New method.
5112         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
5113         code duplication.
5115 2010-01-11  Ian Lance Taylor  <iant@google.com>
5117         * script.cc (Version_script_info::build_expression_list_lookup):
5118         Change complaing about duplicate wildcard match from error to
5119         warning.
5121         * script.cc (class Lazy_demangler): Recreate--revert part of patch
5122         of 2009-12-30.
5123         (Version_script_info::Version_script_info): Initialize globs_,
5124         default_version_, default_is_global_, and exact_.  Don't
5125         initialize globals_ or locals_.
5126         (Version_script_info::build_lookup_tables): Build local symbols
5127         first.
5128         (Version_script_info::unquote): New function.
5129         (Version_script_info::add_exact_match): New function.
5130         (Version_script_info::build_expression_list_lookup): Remove lookup
5131         parameter.  Add is_global parameter.  Change all callers.  Handle
5132         wildcard pattern specially.  Unquote pattern.  Call
5133         add_exact_match.
5134         (Version_script_info::get_name_to_match): New function.
5135         (Version_script_info::get_symbol_version): New function.
5136         (Version_script_info::get_symbol_version_helper): Remove.
5137         (Version_script_info::check_unmatched_names): Call unquote.
5138         * script.h (class Version_script_info): Change get_symbol_version
5139         to be non-inline and add is_global parameter; change all callers.
5140         Rewrite symbol_is_local.  Update declarations.  Define struct
5141         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
5142         Remove globals_ and locals_ members.  Add exact_, globs_,
5143         default_version_, is_global_.
5144         (Version_script_info::Glob): Remove pattern, add expression and
5145         is_global.  Update constructor.  Change all callers.
5146         * dynobj.cc (Versions::finalize): Mark the version symbol as the
5147         default version.
5148         (Versions::symbol_section_contents): If a symbol is undefined, or
5149         defined in a dynamic object, set the version index to
5150         VER_NDX_LOCAL.
5151         * symtab.cc (Symbol_table::add_from_relobj): Don't call
5152         symbol_is_local.
5153         (Symbol_table::add_from_pluginobj): Likewise.
5154         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
5156 2010-01-11  Doug Kwan  <dougkwan@google.com>
5158         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
5159         (incremental_dump_LDADD): Add linking option for libintl.
5160         * Makefile.in: Regenerate.
5162 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
5164         PR gold/11144
5165         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
5166         instead of -Ds.
5167         * testsuite/Makefile.in: Regenerated.
5169 2010-01-10  Doug Kwan  <dougkwan@google.com>
5171         * options.h (DEFINE_var): Use parentheses around argument varname__
5172         in macro body to avoid any unintended subsequent substitutions.
5174 2010-01-10  Ian Lance Taylor  <iant@google.com>
5176         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
5177         candidates before doing symbol resolution.
5179         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
5180         ODR candidates if only one is weak.
5182 2010-01-08  Ian Lance Taylor  <iant@google.com>
5184         * script.cc (Version_script_info::build_expression_list_lookup):
5185         Don't warn about ambiguous version, just record the ambiguity.
5186         (Version_script_info::get_symbol_version_helper): Give error if
5187         version is ambiguous.
5189 2010-01-08  Doug Kwan  <dougkwan@google.com>
5191         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
5192           prev_data_size_ and prev_addralign_.  Remove initializer for
5193           deleted data member has_been_changed_.
5194           (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
5195           to determine if the table is empty.
5196           (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
5197           Remove.
5198           (Stub_table::add_reloc_stub): Define method in class definition
5199           instead of just declaring it there.
5200           (Stub_table::add_cortex_a8_stub): New method definition.
5201           (Stub_table::update_data_size_and_addralign): Ditto.
5202           (Stub_table::finalize_stubs): Ditto.
5203           (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
5204           (Stub_table::do_addralign_): Return address alignment in the
5205           (Stub_table::do_reset_address_and_file_offset): Define method in
5206           class definition instead of declaring it there.  Set current data
5207           size to be the data size of the previous pass.
5208           (Stub_table::set_final_data_size): Use current data size as the
5209           final data size.
5210           (Stub_table::relocate_stub): Change parameter type of stub from
5211           Reloc_stub pointer to Stub pointer.
5212           (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
5213           (Stub_table::Cortex_a8_stub_list): New typedef.
5214           (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
5215            Stub_table::prev_addralign_): New data member.
5216           (Arm_relobj::Arm_relobj): Initialize data member
5217           section_has_cortex_a8_workaround_.
5218           (Arm_relobj::section_has_cortex_a8_workaround,
5219            Arm_relobj::mark_section_for_cortex_a8_workaround): New method
5220            definitions.
5221           (Arm_relobj::section_has_cortex_a8_workaround_): New data member
5222           declarations.
5223           (Target_arm::relocate_stub): Change parameter type of stub from
5224           Reloc_stub pointer to Stub pointer.
5225           (Insn_template::size, Insn_template::alignment): Handle
5226           THUMB16_SPECIAL_TYPE.
5227           (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
5228            Stub_table::update_data_size_and_addralign,
5229            Stub_table::apply_cortex_a8_workaround_to_address_range): New method
5230           definitions.
5231           (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
5232           (Stub_table::do_write): Ditto.
5233           (Target_arm::do_relax): Adjust code for changes in Stub_table.
5235 2010-01-08  Ian Lance Taylor  <iant@google.com>
5237         PR 11108
5238         * symtab.h (class Symbol): Remove fields is_target_special_ and
5239         has_plt_offset_.  Add field is_defined_in_discarded_section_.
5240         (Symbol::is_defined_in_discarded_section): New function.
5241         (Symbol::set_is_defined_in_discarded_section): New function.
5242         (Symbol::has_plt_offset): Rewrite.
5243         (Symbol::set_plt_offset): Verify that new offset is not -1U.
5244         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
5245         Don't initialize is_target_special_ or has_plt_offset_.
5246         Initialize is_defined_in_discarded_section_.
5247         (Symbol_table::add_from_relobj): If appropriate, set
5248         is_defined_in_discarded_section.
5249         * resolve.cc (Symbol::override_base_with_special): Don't test
5250         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
5251         * target-reloc.h (relocate_section): Do special handling for
5252         symbols defined in discarded sections for global symbols as well
5253         as local symbols.
5255 2010-01-08  Ian Lance Taylor  <iant@google.com>
5257         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
5258         the SHT_SYMTAB case.
5260 2010-01-08  Ian Lance Taylor  <iant@google.com>
5262         * object.cc (Sized_relobj::do_layout): Don't get confused if
5263         layout_eh_frame returns NULL.
5265 2010-01-08  Ian Lance Taylor  <iant@google.com>
5267         PR 11084
5268         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
5269         dynamic symbol table, use the normal symbol table.
5270         (Sized_dynobj::do_read_symbols): Remove assertion about type of
5271         symbol table.
5273 2010-01-08  Ian Lance Taylor  <iant@google.com>
5275         PR 11072
5276         * layout.cc (Layout::include_section): Remove .gnu_debuglink
5277         sections.
5279 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
5281         * version.cc (print_version): Change to "Copyright 2010".
5283 2010-01-08  Ian Lance Taylor  <iant@google.com>
5285         PR 10287
5286         PR 11063
5287         * i386.cc (class Target_i386): Change return type of plt_section
5288         to be non-const.
5289         (class Output_data_plt_i386): Add tls_desc_rel_ field.
5290         (Output_data_plt_i386::Output_data_plt_i386): Initialize
5291         tls_desc_rel_ field.
5292         (Output_data_plt_i386::rel_tls_desc): New function.
5293         (Target_i386::rel_tls_desc_section): New function.
5294         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
5295         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
5296         R_386_TLS_DESC reloc in rel_tls_desc_section.
5297         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
5298         Define struct Tlsdesc_info.
5299         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
5300         (Target_x86_64::do_reloc_symbol_index): New function.
5301         (Target_x86_64::add_tlsdesc_info): New function.
5302         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
5303         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
5304         tlsdesc_rel_ field.
5305         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
5306         all callers.
5307         (Output_data_plt_x86_64::rela_tlsdesc): New function.
5308         (Target_x86_64::rela_tlsdesc_section): New function.
5309         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
5310         handling.
5311         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
5312         (Target_x86_64::do_reloc_addend): New function.
5313         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
5314         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
5315         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
5316         (Output_reloc::type): New function.
5317         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
5318         (Output_reloc::is_target_specific): New function.
5319         (Output_reloc::target_arg): New function.
5320         (class Output_reloc) [SHT_RELA]: Add four new constructors for
5321         absolute relocs and target specific relocs.
5322         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
5323         add_target_specific.
5324         (class Output_data_reloc) [SHT_RELA]: Likewise.
5325         * output.cc (Output_reloc::Output_reloc): Add four new versions
5326         for absolute relocs and target specific relocs.
5327         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
5328         (Output_reloc::get_symbol_index): Likewise.
5329         (Output_reloc::local_section_offset): Check that local_sym_index_
5330         is not TARGET_CODE or 0.
5331         (Output_reloc::symbol_value): Likewise.
5332         (Output_reloc::write) [SHT_RELA]: Call target for target specific
5333         reloc.
5334         * target.h (class Target): Add reloc_symbol_index and reloc_addend
5335         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
5336         functions.
5337         * layout.cc (add_target_dynamic_tags): Use output section for
5338         DT_PLTRELSZ and DT_JMPREL.
5340 2010-01-07  Ian Lance Taylor  <iant@google.com>
5342         PR 11061
5343         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
5344         function.
5345         (class Output_data_reloc_generic): Define.
5346         (class Output_data_reloc_base): Change base class to
5347         Output_data_reloc_generic.  Change add() method to call
5348         bump_relative_reloc_count for a relative reloc.  Remove
5349         sort_relocs_ field.
5350         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
5351         to sort_relocs().
5352         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
5353         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
5354         appropriate.
5355         * layout.h (class Layout): Update declaration.
5357 2010-01-07  Ian Lance Taylor  <iant@google.com>
5359         * output.h (class Output_data): Add const version of
5360         output_section and do_output_section.
5361         (class Output_section_data): Add const version of
5362         do_output_section.
5363         (class Output_section): Likewise.
5364         * layout.cc (Layout::add_target_dynamic_tags): New function.
5365         * layout.h (class Layout): Update declarations.
5366         * arm.cc (Target_arm::do_finalize_sections): Use
5367         add_target_dynamic_tags.
5368         * i386.cc (Target_i386::do_finalize_sections): Likewise.
5369         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
5370         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
5371         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5373 2010-01-07  Ian Lance Taylor  <iant@google.com>
5375         PR 11042
5376         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
5377         object as needed.
5379 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
5380             Ian Lance Taylor  <iant@google.com>
5382         PR 11019
5383         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
5384         Xindex::read_symtab_xindex.
5386 2010-01-07  Doug Kwan  <dougkwan@google.com>
5388         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
5389         (Insn_template::thumb16_bcond_insn): New method declaration.
5390         (Insn_template): Fix spelling.
5391         (Stub::thumb16_special): New method declaration.
5392         (Stub::do_write): Define virtual method which was previously pure
5393         virtual.
5394         (Stub::do_thumb16_special): New method declaration.
5395         (Stub::do_fixed_endian_write): New template member.
5396         (Reloc_stub::do_write): Remove.
5397         (Reloc_stub::do_fixed_endian_write): Remove.
5398         (Cortex_a8_stub): New class definition.
5399         (Stub_factory::make_cortex_a8_stub): New method definition.
5400         (Stub_factory::Stub_factory): Add missing static storage class
5401         qualifier for elf32_arm_stub_a8_veneer_blx.
5403 2010-01-07  Ian Lance Taylor  <iant@google.com>
5405         PR 10980
5406         * options.h (class General_options): Add --warn-unresolved-symbols
5407         and --error-unresolved-symbols.
5408         * errors.cc (Errors::undefined_symbol): Implement
5409         --warn-unresolved-symbols.
5411         * options.h (class General_options): Add -z text and -z textoff.
5412         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
5414 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
5416         * gc.h (Garbage_collection::Cident_section_map): New typedef.
5417         (Garbage_collection::cident_sections): New function.
5418         (Garbage_collection::add_cident_section): New function.
5419         (Garbage_collection::cident_sections_): New member.
5420         (gc_process_relocs): Add references to sections whose names are C
5421         identifiers.
5422         * gold.h (cident_section_start_prefix): New constant.
5423         (cident_section_stop_prefix): New constant.
5424         (is_cident): New function.
5425         * layout.cc (Layout::define_section_symbols): Replace string constants
5426         with the newly defined constants.
5427         * object.cc (Sized_relobj::do_layout): Track sections whose names are
5428         C identifiers.
5429         * testsuite/Makefile.am: Add gc_orphan_section_test.
5430         * testsuite/Makefile.in: Regenerate.
5431         * testsuite/gc_orphan_section_test.cc: New file.
5432         * testsuite/gc_orphan_section_test.sh: New file.
5434 2010-01-06  Ian Lance Taylor  <iant@google.com>
5436         PR 10980
5437         * options.h (class General_options): Add --warn-shared-textrel.
5438         * layout.cc (Layout::finish_dynamic_section): Implement
5439         --warn-shared-textrel.
5441         PR 10980
5442         * options.h (class General_options): Add --warn-multiple-gp.
5444 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5446         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
5447         $(THREADSLIB) and $(LIBDL).
5448         * Makefile.in: Rebuild.
5450 2010-01-06  Ian Lance Taylor  <iant@google.com>
5452         PR 10980
5453         * options.cc (General_options::parse_section_start): New function.
5454         (General_options::section_start): New function.
5455         (General_options::General_options): Initialize all members.
5456         * options.h: Include <map>
5457         (class General_options): Add --section-start.  Add section_starts_
5458         member.
5459         * layout.cc (Layout::attach_allocated_section_to_segment): If
5460         --section-start was used, set the address of the segment.  Remove
5461         local sort_sections.
5462         (Layout::relaxation_loop_body): If the address of the load segment
5463         has been set by --section-start, don't use it.
5464         * output.h (Output_segment::update_flags_for_output_section): New
5465         function.
5466         * output.cc (Output_segment::add_output_section): Call
5467         update_flags_for_output_section.
5469 2010-01-05  Ian Lance Taylor  <iant@google.com>
5471         PR 10980
5472         * options.h (class General_options): Add --undefined-version.
5473         * script.cc (struct Version_expression): Add was_matched_by_symbol
5474         field.
5475         (Version_script_info::matched_symbol): New function.
5476         (Version_script_info::get_symbol_version_helper): Call
5477         matched_symbol.
5478         (Version_script_info::check_unmatched_names): New function.
5479         * script.h (class Version_script_info): Update declarations.
5480         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
5482         * options.h (class General_options): Use DEFINE_bool_alias for
5483         allow_multiple_definition.
5484         * resolve.cc (Symbol_table::should_override): Don't test
5485         allow_multiple_definition.
5487         PR 10980
5488         * options.h (class General_options): Add --cref.
5489         * main.cc (main): Print cref table if --cref.  Don't close mapfile
5490         until after printing cref table.
5491         * cref.cc: Include "symtab.h".
5492         (class Cref_inputs): Define Cref_table_compare and Cref_table.
5493         (Cref_table_compare::operator()): New function.
5494         (Cref_inputs::gather_cref): New function.
5495         (filecol): New static const.
5496         (Cref_inputs::print_cref): New function.
5497         (Cref::print_cref): New function.
5498         * cref.h: Include <cstdio>.
5499         (class Cref): Update declarations.
5500         * mapfile.h (Mapfile::file): New function.
5501         * object.h (class Object): Define Symbols.  Declare virtual
5502         do_get_global_symbols.
5503         (Object::get_global_symbols): New function.
5504         * object.cc (Input_objects::add_object): Pass object to cref_ if
5505         --cref.
5506         (Input_objects::archive_start): Likewise.
5507         (Input_objects::archive_stop): Likewise.
5508         (Input_objects::print_cref): New function.
5509         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
5510         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
5511         --cref.
5512         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
5513         function.
5514         * plugin.h (class Sized_pluginobj): Update declarations.
5516 2010-01-05  Ian Lance Taylor  <iant@google.com>
5518         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
5519         to is_default_version.  Rename insdef to insdefault.
5520         (Symbol_table::add_from_relobj): Rename def to is_default_version
5521         and local to is_forced_local.
5522         (Symbol_table::add_from_pluginobj): Likewise.
5523         (Symbol_table::add_from_dynobj): Likewise.
5524         (Symbol_table::define_special_symbol): Rename insdef to
5525         insdefault.
5527 2010-01-04  Ian Lance Taylor  <iant@google.com>
5529         PR 10980
5530         * options.h (class General_options): Add
5531         --allow-multiple-definition and -z muldefs.
5532         * resolve.cc (Symbol_table::should_override): Don't warn about a
5533         multiple symbol definition if --allow-multiple-definition or -z
5534         muldefs.
5536         PR 10980
5537         * options.h (class General_options): Add --add-needed and
5538         --copy-dt-needed-entries.  Tweak --as-needed help entry.
5539         * object.cc (Input_objects::check_dynamic_dependencies): Give an
5540         error if --copy-dt-needed-entries aka --add-needed is used and
5541         would cause a change in behaviour.
5543         PR 10980
5544         * options.h (class General_options): Add -G as a short version of
5545         --shared.  Add no-op options -assert, -g, and -i.
5547 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
5549         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
5550         check for .text or .gnu.linkonce.t sections.
5551         * icf.cc (Icf::find_identical_sections): Ditto.
5552         Change the detection for mangled function name within the section
5553         name.
5554         * icf.h (is_section_foldable_candidate): New function.
5556 2009-12-30  Ian Lance Taylor  <iant@google.com>
5558         PR 10980
5559         * options.h (class General_options): Permit two dashes with
5560         --retain-symbols-file.
5562 2009-12-30  Ian Lance Taylor  <iant@google.com>
5564         PR 10979
5565         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
5566         don't put the file header and segment headers in the text
5567         segment.
5569         PR 10979
5570         * common.cc (Sort_commons::operator()): Stabilize sort when both
5571         entries are NULL.
5572         (Symbol_table::do_allocate_commons_list): When allocating common
5573         symbols, skip a symbol which is no longer common.
5574         * symtab.h (Symbol::is_common): Test whether the symbol comes from
5575         an object before checking its type.
5576         * testsuite/common_test_2.c: New file.
5577         * testsuite/common_test_3.c: New file.
5578         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
5579         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
5580         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
5581         (common_test_2_pic.o, common_test_2.so): New targets.
5582         (common_test_3_pic.o, common_test_3.so): New targets.
5583         * testsuite/Makefile.in: Rebuild.
5585         PR 10979
5586         * script.cc (read_input_script): If we see a new SECTIONS clause,
5587         and we have added an input section, give an error.
5588         * layout.h (class Layout): Add have_added_input_section function.
5589         Add have_added_input_section_ field.
5590         * layout.cc (Layout::Layout): Initialize
5591         have_added_input_section_.
5592         (Layout::layout): Set have_added_input_section_.
5593         (Layout::layout_eh_frame): Likewise.
5595 2009-12-30  Ian Lance Taylor  <iant@google.com>
5597         PR 10931
5598         * options.h (class General_options): Add --sort-common option.
5599         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
5600         * common.cc (Sort_common): Add sort_order parameter to
5601         constructor.  Add sort_order_ field.
5602         (Sort_commons::operator): Check sort_order_.
5603         (Symbol_table::allocate_commons): Determine the sort order.
5604         (Symbol_table::do_allocate_commons): Add sort_order parameter.
5605         Change all callers.
5606         (Symbol_table::do_allocate_commons_list): Likewise.
5608 2009-12-30  Ian Lance Taylor  <iant@google.com>
5610         PR 10916
5611         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
5612         symbols from this object, don't change the visibility of an
5613         undefined symbol.
5614         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
5616 2009-12-30  Ian Lance Taylor  <iant@google.com>
5618         PR 10861
5619         * script.h (class Version_script_info): Define Language enum.
5620         Update declarations.  Define Glob, Exact, and Lookup types.  Add
5621         new fields globals_, locals_, and is_finalized_.
5622         * script.cc: Various formatting fixes.
5623         (class Parser_closure): Change language_stack_ from a vector of
5624         std::string to one of Version_script_info::Language.  Adjust all
5625         uses accordingly.
5626         (class Lazy_demangler): Remove.
5627         (struct Version_expression): Change language from std::string to
5628         Version_script_info::Language.
5629         (Version_script_info::Version_script_info): New function.
5630         (Version_script_info::~Version_script_info): Don't call clear.
5631         (Version_script_info::finalize): New function.
5632         (Version_script_info::build_lookup_tables): New function.
5633         (Version_script_info::build_expression_list_lookup): New
5634         function.
5635         (Version_script_info::get_symbol_version_helper): Rewrite to use
5636         lookup tables.
5637         (Version_script_info::print_expression_list): Adjust to use
5638         Version_script_info::Language.
5639         (script_push_lex_into_version_mode): Check that the version script
5640         has not been finalized.
5641         (version_script_push_lang): Change language string to
5642         Version_script_info::Language.
5643         * options.cc (Command_line::version_script): New function.
5644         * options.h (class General_options): Add finalize_dynamic_list
5645         function.  Change version_script from declaration to definition.
5646         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
5647         * testsuite/version_script.map: Remove duplicate def of foo.
5648         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
5649         version_script.map.
5650         * testsuite/Makefile.in: Rebuild.
5652 2009-12-30  Ian Lance Taylor  <iant@google.com>
5654         PR 10843
5655         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
5656         if the input symbol index is 0, make the output symbol index 0.
5658 2009-12-30  Ian Lance Taylor  <iant@google.com>
5660         PR 10670
5661         * options.h (class General_options): Add -x/--discard-all.
5662         * object.cc (Sized_relobj::do_count_local_symbols): Handle
5663         --discard-all.  If the local symbol needs a dynamic entry, check
5664         that before handling --discard-locals.
5666 2009-12-30  Ian Lance Taylor  <iant@google.com>
5668         PR 10450
5669         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
5670         flags to PF_R.
5671         (Output_segment::add_output_section): Don't change the flags if
5672         the type is PT_TLS.
5674         PR 10450
5675         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
5676         GNU hash table if they need a dynamic value.  Otherwise, don't add
5677         them if they are defined in a dynamic object or are forced local.
5679 2009-12-29  Ian Lance Taylor  <iant@google.com>
5681         PR 10450
5682         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
5683         .gnu.hash table for a 32-bit target.
5685         PR 10450
5686         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
5687         regular and a dynamic object only needs a dynamic symbol table
5688         entry if it is externally visible.
5690         PR 10450
5691         * i386.cc (class Target_i386): Initialize global_offset_table_ in
5692         constructor.  Add global_offset_table_ field.
5693         (Target_i386::got_section): Set global_offset_table_.
5694         (Target_i386::do_finalize_sections): Set global_offset_table_
5695         size.
5696         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
5697         in constructor.  Add global_offset_table_ field.
5698         (Target_x86_64::got_section): Set global_offset_table_.
5699         (Target_x86_64::do_finalize_sections): Set global_offset_table_
5700         size.
5702         * layout.cc (Layout::Layout): Initialize increase_relro_.
5703         (Layout::get_output_section): Add is_relro, is_last_relro, and
5704         is_first_non_relro parameters.  Change all callers.
5705         (Layout::choose_output_section): Likewise.
5706         (Layout::add_output_section_data): Likewise.
5707         (Layout::make_output_section): Likewise.
5708         (Layout::set_segment_offsets): Clear increase_relro when using a
5709         linker script.
5710         * layout.h (class Layout): Add increase_relro method.  Add
5711         increase_relro_ field.  Update declarations.
5712         * output.cc (Output_section::Output_section): Initialize
5713         is_last_relro_ and is_first_non_relro_.
5714         (Output_segment::add_output_section): Group relro sections is
5715         do_sort is true.  Handle is_last_relro and is_first_non_relro.
5716         (Output_segment::maximum_alignment): Remove relro handling.
5717         (Output_segment::set_section_addresses): Add increase_relro
5718         parameter.  Change all callers.  Add initial alignment to align
5719         relro sections on separate page.  Remove old relro handling.
5720         (Output_segment::set_section_list_addresses): Remove in_relro
5721         parameter.  Change all callers.
5722         (Output_segment::set_offset): Add increase parameter.  Change all
5723         callers.  Remove old relro handling.
5724         * output.h (class Output_section): Add new methods: is_last_relro,
5725         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
5726         Add is_last_relro_ and is_first_non_relro_ fields.
5727         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
5728         Create separate .got.plt section.  Call increase_relro.
5729         * x86_64.cc (Target_x86_64::got_section): Likewise.
5730         * testsuite/relro_script_test.t: Add .got.plt.
5732         PR 10450
5733         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
5734         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
5735         (Layout::finalize): Call set_dynamic_symbol_size.
5736         (Layout::set_dynamic_symbol_size): New function.
5737         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
5738         set_dynamic_symbol_size.
5740         PR 10450
5741         * output.h (class Output_section): Add is_entsize_zero_ field.
5742         * output.cc (Output_section::Output_section): Initialize
5743         is_entsize_zero_.
5744         (Output_section::set_entsize): If two different entsizes are
5745         requested, force it to zero.
5746         (Output_section::add_input_section): Set flags for .debug_str
5747         before updating section flags.  Set entsize.
5748         (Output_section::update_flags_for_input_section): Set SHF_MERGE
5749         and SHF_STRING if all input sections have those flags.
5751 2009-12-29   Rafael Espindola  <espindola@google.com>
5753         * main.cc (main): Fix the sys time reporting.
5754         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
5755         reporting.
5757 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
5759         * options.cc (General_options::parse_version): Allow -v to exit
5760         without an error if there is nothing to link.
5762 2009-12-29  Ian Lance Taylor  <iant@google.com>
5764         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
5765         using a version of gcc before 4.1.
5766         * configure: Rebuild.
5768 2009-12-28  Chris Demetriou  <cgd@google.com>
5770         * attributes.cc (Output_attributes_section_data::do_write): Use
5771         std::vector::front rather than std::vector::data.
5773 2009-12-28  Ian Lance Taylor  <iant@google.com>
5775         * symtab.h (class Symbol_table): Add enum Defined.
5776         * resolve.cc (Symbol_table::should_override): Add defined
5777         parameter.  Change all callers.  Test whether object is NULL
5778         before calling a method on it.
5779         (Symbol_table::report_resolve_problem): Add defined parameter.
5780         Change all callers.
5781         (Symbol_table::should_override_with_special): Likewise.
5782         * symtab.cc (Symbol_table::define_in_output_data): Add defined
5783         parameter.  Change all callers.
5784         (Symbol_table::do_define_in_output_data): Likewise.
5785         (Symbol_table::define_in_output_segment): Likewise.
5786         (Symbol_table::do_define_in_output_segment): Likewise.
5787         (Symbol_table::define_as_constant): Likewise.
5788         (Symbol_table::do_define_as_constant): Likewise.
5789         * script.h (class Symbol_assignment): Add is_defsym parameter to
5790         constructor; change all callers.
5791         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
5792         parameter.  Change all callers.  Add is_defsym_ field.
5793         (class Parser_closure): Add parsing_defsym parameter to
5794         constructor; change all callers.  Add parsing_defsym accessor
5795         function.  Add parsing_defsym_ field.
5797 2009-12-28  Ian Lance Taylor  <iant@google.com>
5799         * gold.cc (queue_middle_tasks): Fix formatting.
5800         * object.cc (Relobj::is_section_name_included): Likewise.
5802 2009-12-23  Ian Lance Taylor  <iant@google.com>
5804         * i386.cc (Target_i386::do_calls_non_split): Recognize
5805         -fsplit-stack prologue for a function with a static chain.
5806         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
5807         -fsplit-stack prologue when using %r11.
5809 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
5811         * options.cc (General_options::parse_version): Make -v continue and do
5812         the link like GNU ld does.
5814 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
5816         * Makefile.am (CCFILES): Add timer.cc.
5817         (HFILES): Add timer.h.
5818         * configure.ac: Check for sysconf and times.
5819         * main.cc: include timer.h.
5820         (main): Use Timer instead of get_run_time.
5821         * timer.cc: New.
5822         * timer.h: New.
5823         * workqueue.cc: include timer.h.
5824         (Workqueue::find_and_run_task):
5825         Report user, sys and wall time.
5826         * Makefile.in: Regenerate.
5827         * config.in: Regenerate.
5828         * configure: Regenerate.
5830 2009-12-16  Doug Kwan  <dougkwan@google.com>
5832         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
5833         sections.
5834         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
5835         relaxed input sections.
5836         * output.cc (Output_section::find_relaxed_input_section): Change
5837         return type to Output_relaxed_input_section pointer.  Adjust code
5838         for new type of relaxed_input_section_map_.
5839         * output.h (Output_section::find_relaxed_input_section): Change
5840         return type to Output_relaxed_input_section pointer.
5841         (Output_section::Output_relaxed_input_section_by_input_section_map):
5842         New type.
5843         (Output_section::relaxed_input_section_map_): Change type to
5844         Output_section::Output_relaxed_input_section_by_input_section_map.
5845         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
5846         input section.
5848 2009-12-15  Ian Lance Taylor  <iant@google.com>
5850         * layout.cc (Layout::create_shstrtab): Only write out after input
5851         sections if we are compressing debug sections.
5853 2009-12-15  Ian Lance Taylor  <iant@google.com>
5855         * archive.cc (Archive::add_symbols): Only look up a symbol without
5856         a version if there is, in fact, a version.
5858 2009-12-14  Ian Lance Taylor  <iant@google.com>
5860         Revert -Wshadow changes, all changes from:
5861         2009-12-11  Doug Kwan  <dougkwan@google.com>
5862         2009-12-11  Nick Clifton  <nickc@redhat.com>
5863         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
5865 2009-12-11  Doug Kwan  <dougkwan@google.com>
5867         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
5868         due to -Wshadow.
5869         * attributes.cc (Object_attribute::size): Ditto.
5870         (Attributes_section_data::size): Ditto.
5871         (Attributes_section_data::Attributes_section_data): Ditto.
5872         (Output_attributes_section_data::do_write): Ditto.
5873         * attributes.h (Object_attribute::set_type): Ditto.
5874         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
5876 2009-12-11  Nick Clifton  <nickc@redhat.com>
5878         * archive.cc: Fix shadowed variable warnings.
5879         * arm.cc: Likewise.
5880         * compressed_output.cc: Likewise.
5881         * compressed_output.h: Likewise.
5882         * configure: Likewise.
5883         * dwarf_reader.cc: Likewise.
5884         * dynobj.cc: Likewise.
5885         * dynobj.h: Likewise.
5886         * ehframe.cc: Likewise.
5887         * ehframe.h: Likewise.
5888         * errors.cc: Likewise.
5889         * expression.cc: Likewise.
5890         * fileread.cc: Likewise.
5891         * fileread.h: Likewise.
5892         * freebsd.h: Likewise.
5893         * i386.cc: Likewise.
5894         * icf.cc: Likewise.
5895         * incremental.h: Likewise.
5896         * layout.cc: Likewise.
5897         * layout.h: Likewise.
5898         * mapfile.cc: Likewise.
5899         * merge.cc: Likewise.
5900         * merge.h: Likewise.
5901         * object.cc: Likewise.
5902         * object.h: Likewise.
5903         * options.h: Likewise.
5904         * output.cc: Likewise.
5905         * output.h: Likewise.
5906         * parameters.cc: Likewise.
5907         * plugin.cc: Likewise.
5908         * powerpc.cc: Likewise.
5909         * reduced_debug_output.cc: Likewise.
5910         * reduced_debug_output.h: Likewise.
5911         * reloc.cc: Likewise.
5912         * reloc.h: Likewise.
5913         * resolve.cc: Likewise.
5914         * script-sections.cc: Likewise.
5915         * script.cc: Likewise.
5916         * script.h: Likewise.
5917         * sparc.cc: Likewise.
5918         * symtab.cc: Likewise.
5919         * symtab.h: Likewise.
5920         * target-select.cc: Likewise.
5921         * target-select.h: Likewise.
5922         * token.h: Likewise.
5923         * workqueue.cc: Likewise.
5924         * workqueue.h: Likewise.
5925         * x86_64.cc: Likewise.
5927 2009-12-10  Doug Kwan  <dougkwan@google.com>
5929         * arm.cc (attributes.h): New include.
5930         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
5931         (Arm_relobj::~Arm_relobj): Delete object pointed by
5932         attributes_section_data_.
5933         (Arm_relobj::attributes_section_data): New method definition.
5934         (Arm_relobj::attributes_section_data_): New data member declaration.
5935         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
5936         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
5937         attributes_section_data_.
5938         (Arm_dynobj::attributes_section_data): New method definition.
5939         (Arm_dynobj::attributes_section_data_): New data member declaration.
5940         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
5941         initialization value of may_use_blx_ to false.
5942         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
5943         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
5944         object attributes to compute results instead of hard-coding.
5945         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
5946         Target_arm::get_secondary_compatible_arch,
5947         Target_arm::set_secondary_compatible_arch
5948         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5949         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
5950         New method declarations.
5951         (Target_arm::get_aeabi_object_attribute): New method definition.
5952         (Target_arm::attributes_section_data_): New data member declaration.
5953         (read_arm_attributes_section): New template definition.
5954         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
5955         (Arm_dynobj::do_read_symbols): Ditto.
5956         (Target_arm::do_finalize_sections): Merge attributes sections from
5957         input.  Check for BLX use after attributes section merging.
5958         Fix __exidx_start and __exidx_end visibility.  Create an
5959         .ARM.attributes section if necessary.
5960         (Target_arm::get_secondary_compatible_arch,
5961         Target_arm::set_secondary_compatible_arch,
5962         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5963         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
5964         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
5965         New method definitions.
5967 2009-12-09  Ian Lance Taylor  <iant@google.com>
5969         * plugin.cc (Plugin::load): Don't cast from void* to a function
5970         pointer.
5972 2009-12-09  Ian Lance Taylor  <iant@google.com>
5974         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
5975         information fields.
5977 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
5979         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
5980         Replace two_file_shared_1.so with two_file_shared_2.so.
5981         * testsuite/Makefile.in: Regenerated.
5983 2009-12-08  Doug Kwan  <dougkwan@google.com>
5985         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
5986         (HFILES): Add attributes.h and int_encoding.h.
5987         * Makefile.in: Regenerate.
5988         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
5989         function definitions to int_encoding.cc
5990         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
5991         prototypes to int_encoding.h
5992         * reduced_debug_output.cc (int_encoding.h): New include.
5993         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
5994         function definitions to int_encoding.cc
5995         (insert_into_vector, read_from_pointer): Move template definitions to
5996         int_encoding.h
5997         * attributes.cc: New file.
5998         * attributes.h: New file.
5999         * int_encoding.cc: New file.
6000         * int_encoding.h: New file.
6002 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
6004         PR gold/11055
6005         * incremental-dump.cc (dump_incremental_inputs): New.
6006         (main): Use dump_incremental_inputs.
6008 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
6010         PR gold/10893
6011         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
6012         checking elfcpp::STT_FUNC.
6013         (Target_i386::Relocate::relocate): Likewise.
6014         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
6016         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
6017         symbols from shared libraries into normal FUNC symbols.
6019         * symtab.h (Symbol): Add is_func and use it.
6021 2009-12-05  Doug Kwan  <dougkwan@google.com>
6023         * arm.cc (Target_arm::arm_info): Initialize new fields
6024         attributes_section and attributes_vendor.
6025         * i386.cc (Target_i386::i386_info): Same.
6026         * object.cc (Sized_relobj::do_layout): Skip attribute section.
6027         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
6028         fields attributes_section and attributes_vendor.
6029         * sparc.cc (Target_sparc::sparc_info): Same.
6030         * target.h (Target::attributes_section, Target::attributes_vendor,
6031         Target::is_attributes_section, Target::attribute_arg_type,
6032         Target::attributes_order): New method definitions.
6033         (Target::Target_info::attributes_section,
6034         Target::Target_info::attributes_vendor): New fields.
6035         (Target::do_attribute_arg_type, Target::do_attributes_order): New
6036         virtual method definitions.
6037         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
6038         attributes_section and attributes_vendor.
6039         * testsuite/testfile.cc (Target_test::test_target_info): Same.
6041 2009-12-05  Doug Kwan  <dougkwan@google.com>
6043         * arm.cc: Update comments about interworking and stub generation.
6044         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
6045         considered as non-PIC.
6046         (Arm_relocate_functions::base_abs): Fix formatting.
6047         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
6048         of function to use GOT entry address instead of offset.
6049         (Target_arm::Scan::global): Issue an error if a symbol would need a
6050         PLT does not get one because it is untyped.  Remove code to create
6051         dynamic symbols for relative branches.
6052         (Target_arm::Relocate::relocate: Use 0 instead of false since function
6053         takes unsigned integer instead of boolean.
6055 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
6057         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
6058         (two_file_test_LDADD): Likewise.
6059         (common_test_1_LDADD): Likewise.
6060         (exception_test_LDADD) Likewise.
6061         (weak_test_LDADD): Likewise.
6062         (many_sections_test_LDADD): Likewise.
6063         (initpri1_LDADD): Likewise.
6064         (script_test_1_LDADD): Likewise.
6065         (script_test_2_LDADD): Likewise.
6066         (justsyms_LDADD): Likewise.
6067         (binary_test_LDADD): Likewise.
6068         (large_LDADD): Likewise.
6069         * testsuite/Makefile.in: Regenerated.
6071 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
6073         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
6074         (Symbol_table::override_with_special): Likewise.
6075         (Symbol_table::add_from_object): Likewise.
6077 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
6079         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
6080         Don't set the data_offset twice.
6082 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
6084         * testsuite/Makefile.in: Regenerate.
6086 2009-12-03  Doug Kwan  <dougkwan@google.com>
6088         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
6089         (Target_arm::do_finalize_sections): Add parameter for symbol table
6090         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
6091         * i386.cc (Target_i386::do_finalize_sections): Add an additional
6092         parameter for symbol table pointer.
6093         * layout.cc (Layout::finalize): Call Target::finalize_sections with
6094         an additional parameter for a pointer to symbol table.
6095         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
6096         parameter for a symbol table pointer.
6097         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
6098         * target.h (Target::finalize_sections, Target::do_finalize_sections):
6099         Ditto.
6100         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
6101         parameter for a symbol table pointer.
6103 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
6105         * incremental.cc (Incremental_inputs_header)
6106         (Incremental_inputs_header_write, Incremental_inputs_entry)
6107         (Incremental_inputs_entry_write): Move ...
6108         * incremental.h (Incremental_inputs_header)
6109         (Incremental_inputs_header_write, Incremental_inputs_entry)
6110         (Incremental_inputs_entry_write): here.
6112 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
6114         * incremental.cc (make_sized_incremental_binary): Set the target.
6115         Error if it is incompatible.
6116         * output.h (Output_file): Add filename method.
6118 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
6120         * incremental.cc (Incremental_inputs_entry): Remove unused argument
6121         from the get_* methods.
6123 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
6125         * incremental-dump.cc (main): Check that the offeset of a script is 0.
6126         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
6127         Write 0 for the data_offset of scripts.
6129 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
6131         * testsuite/Makefile.am: Add the incremental_test.sh test.
6132         * testsuite/incremental_test.sh: New.
6133         * testsuite/incremental_test_1.c: New.
6134         * testsuite/incremental_test_2.c: New.
6136 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
6138        * incremental-dump.cc (main): Fix typos.
6140 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
6142         PR gold/11025
6143         * incremental-dump.cc (main): Use llu to print 64 bit values.
6145 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
6146             H.J. Lu  <hongjiu.lu@intel.com>
6148         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
6149         $(LIBDL).
6150         (incremental_dump_LDADD): Likewise.
6151         * Makefile.in: Regenerated.
6153 2009-11-25  Doug Kwan  <dougkwan@google.com>
6155         Revert:
6157         2009-11-25  Doug Kwan  <dougkwan@google.com>
6159                 * arm.cc (Target_arm::Target_arm): Move method definition
6160                 outside of class definition.  Add code to handle
6161                 --target1-rel, --target1-abs and --target2= options.
6162                 (Target_arm::get_reloc_reloc_type): Change method to be
6163                 non-static and const.
6164                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
6165                 New data member declaration.
6166                 (Target_arm::Scan::local, Target_arm::Scan::global,
6167                 Target_arm::Relocate::relocate,
6168                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6169                 Adjust call to Target_arm::get_real_reloc_type.
6170                 (Target_arm::get_real_reloc_type): Use command line options
6171                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
6172                 * options.h (--target1-rel, --target1-abs, --target2): New
6173                 ARM-only options.
6175 2009-11-25  Doug Kwan  <dougkwan@google.com>
6177         * arm.cc (Target_arm::Target_arm): Move method definition outside of
6178         class definition.  Add code to handle --target1-rel, --target1-abs
6179         and --target2= options.
6180         (Target_arm::get_reloc_reloc_type): Change method to be non-static
6181         and const.
6182         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
6183         member declaration.
6184         (Target_arm::Scan::local, Target_arm::Scan::global,
6185         Target_arm::Relocate::relocate,
6186         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
6187         call to Target_arm::get_real_reloc_type.
6188         (Target_arm::get_real_reloc_type): Use command line options to
6189         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
6190         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
6191         options.
6193 2009-11-25  Doug Kwan  <dougkwan@google.com>
6195         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
6196         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
6197         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
6198         formatting.
6199         (Arm_relocate_functions::thm_call): Replace body with a call to
6200         Arm_relocate_functions::thumb_branch_common.
6201         (Arm_relocate_functions::thm_jump24,
6202         Arm_relocate_functions::thm_xpc22): New method definitions.
6203         (Arm_relocate_functions::thumb_branch_common): New method definition.
6204         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
6205         operator.
6206         (Target_arm::Relocate::relocate): Adjust call to thm_call.
6207         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
6209 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
6211         * Makefile.am: Build incremental-dump
6212         * Makefile.in: Regenerate.
6213         * incremental-dump.cc: New.
6214         * incremental.cc (Incremental_inputs_header_data,
6215         Incremental_inputs_entry_data): Move to incremental.h
6216         * incremental.h: (Incremental_inputs_header_data,
6217         Incremental_inputs_entry_data): Move from incremental.cc
6219 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
6221         * incremental.cc (Incremental_inputs_header,
6222         Incremental_inputs_header_write, Incremental_inputs_entry,
6223         Incremental_inputs_entry_write): Add a typedef with the data type.
6225 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
6227         * incremental.cc (Incremental_inputs_header,
6228         Incremental_inputs_header_write, Incremental_inputs_entry,
6229         Incremental_inputs_entry_write): Update comment about which
6230         type has the filed descriptions.
6232 2009-11-15  Doug Kwan  <dougkwan@google.com>
6234         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
6235         (Arm_relocate_functions::arm_branch_common): Change method defintion
6236         in class definition to a method declaration and update list of formal
6237         parameters.
6238         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
6239         Arm_relocation_functions::jump24): Adjust call to
6240         Arm_relocate_functions::arm_branch_common.  Update list of formal
6241         parameters.
6242         (Arm_relocate_functions::xpc25): New method definition.
6243         (Arm_relocate_functions::arm_branch_common): Move method defintion
6244         out from class definition.  Use stubs for mode-switching and extending
6245         branch ranges.
6246         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
6247         specially.  Change code to enable use of stubs in ARM branches.
6249 2009-11-10  Doug Kwan  <dougkwan@google.com>
6251         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
6252         in method declaration.
6253         (Target_arm::relocate_stub): New method declaration.
6254         (Target_arm::default_target): Change to return a pointer instead of
6255         a const reference.
6256         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
6257         Target_arm::default_target.
6258         (Arm_Relobj::do_relocate_sections): Remove options paramater in
6259         method definition.
6260         (Target_arm::relocate_section): Adjust view.
6261         (Target_arm::relocate_stub): New method definition.
6263 2009-11-10  Doug Kwan  <dougkwan@google.com>
6265         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
6266         a format warning.
6267         * incremental.cc (open_incremental_binary): Initialized local
6268         variables to avoid warnings.
6269         * object.cc (make_elf_object): Ditto.
6270         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
6271         a format warning.
6273 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
6275         PR gold/10930
6276         * testsuite/plugin_test.c: Include "config.h".
6278 2009-11-09  Doug Kwan  <dougkwan@google.com>
6280         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
6281         (arm_symbol_value): Remove.
6282         (Arm_relocate_functions::arm_branch_common,
6283         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
6284         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
6285         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
6286         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
6287         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
6288         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
6289         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
6290         Arm_relocate_functions::thm_mobw_abs_nc,
6291         Arm_relocate_functions::thm_mov_abs,
6292         Arm_relocate_functions::movw_prel_nc,
6293         Arm_relocate_functions::thm_movt_abs,
6294         Arm_relocate_functions::movt_prel,
6295         Arm_relocate_functions::thm_movw_prel_nc,
6296         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
6297         (Target_arm::Relocate::relocate): Only decompose address into two
6298         parts if relocation type uses the thumb-bit and pass the actual
6299         bit instead of a flag indicating that the thumb-bit is used.  Adjust
6300         calls to methods in Arm_relocate_functions for this change.
6302 2009-11-08  Ian Lance Taylor  <iant@google.com>
6304         PR 10925
6305         * reloc.cc: Instantiate
6306         Sized_relobj::initialize_input_to_output_maps and
6307         Sized_relobj:free_input_to_output_maps.
6309 2009-11-06  Ian Lance Taylor  <iant@google.com>
6311         PR 10876
6312         * defstd.cc (in_segment): Set only_if_ref true for "end".
6314 2009-11-06  Doug Kwan  <dougkwan@google.com>
6316         * arm.cc (class Reloc_stub): Correct a comment.
6317         (Target_arm::Target_arm): Initialize arm_input_section_map_.
6318         (Target_arm::scan_section_for_stubs): New method declaration.
6319         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
6320         Change methods from private to protected.
6321         (Target_arm::do_may_relax): New method definition.
6322         (Target_arm::do_relax, Target_arm::group_sections,
6323         Target_arm::scan_reloc_for_stub,
6324         Target_arm::scan_reloc_section_for_stubs): New method declarations.
6325         (Target_arm::arm_input_section_map_): New data member declaration.
6326         (Target_arm::scan_reloc_for_stub,
6327         Target_arm::scan_reloc_section_for_stubs,
6328         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
6329         Target_arm::do_relax): New method definitions.
6331 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
6333         * configure.ac: Check for (struct stat)::st_mtim
6334         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
6335         * config.in: Regenerate.
6336         * configure: Regenerate.
6338 2009-11-05  Ian Lance Taylor  <iant@google.com>
6340         PR 10910
6341         * output.cc (Output_segment::add_output_section): Add missing
6342         return statement.
6344 2009-11-04  Ian Lance Taylor  <iant@google.com>
6346         PR 10880
6347         * object.h (class Object): Add is_needed and set_is_needed
6348         methods.  Add is_needed_ field.  Make bool fields into bitfields.
6349         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
6350         defined in a dynamic object and referenced by a regular object,
6351         set is_needed for the dynamic object.
6352         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
6353         if the file is marked with as_needed and it is not needed.
6355 2009-11-04  Ian Lance Taylor  <iant@google.com>
6357         PR 10887
6358         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
6359         tags if data is discarded by linker script.
6360         * i386.cc (Target_i386::do_finalize_sections): Likewise.
6361         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6362         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6363         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6365 2009-11-04  Ian Lance Taylor  <iant@google.com>
6367         * layout.cc (Layout::get_output_section): Add is_interp and
6368         is_dynamic_linker_section parameters.  Change all callers.
6369         (Layout::choose_output_section): Likewise.
6370         (Layout::make_output_section): Likewise.
6371         (Layout::add_output_section_data): Add is_dynamic_linker_section
6372         parameter.  Change all callers.
6373         * layout.h (class Layout): Update declarations.
6374         * output.h (class Output_section): Add is_interp, set_is_interp,
6375         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
6376         Add is_interp_, is_dynamic_linker_section_ fields.  Change
6377         generate_code_fills_at_write_ to a bitfield.
6378         * output.cc (Output_section::Output_sections): Initialize new
6379         fields.
6380         (Output_segment::add_output_section): Add do_sort parameter.
6381         Change all callers.
6383 2009-11-03  Ian Lance Taylor  <iant@google.com>
6385         PR 10860
6386         * options.h (class General_options): Add --warn-common.
6387         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
6388         merging two common symbols.
6389         (Symbol_table::should_override): Handle --warn-common when merging
6390         a common symbol with a defined symbol.  Use report_resolve_problem
6391         for multiple definitions.
6392         (Symbol_table::report_resolve_problem): New function.
6393         * symtab.h (class Symbol_table): Declare report_resolve_problem.
6395 2009-11-03  Doug Kwan  <dougkwan@google.com>
6397         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
6398         stub_factory_.
6399         (Target_arm::stub_factory): New method definition.
6400         (Target_arm::new_arm_input_section,
6401         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
6402         Target_arm::reloc_uses_thumb_bit): New method declarations.
6403         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
6404         New type definitions.
6405         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
6406         member declarations.
6407         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
6408         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
6409         New method definitions.
6411 2009-11-03  Ian Lance Taylor  <iant@google.com>
6413         * options.h (class General_options): Add --warn_constructors.
6415 2009-11-03  Ian Lance Taylor  <iant@google.com>
6417         PR 10893
6418         * defstd.cc (in_section): Add entries for __rel_iplt_start,
6419         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
6421 2009-11-03  Ian Lance Taylor  <iant@google.com>
6423         PR 10895
6424         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
6425         --msgid-bugs-address.
6426         (install-pdf): New target.
6427         (install-data_yes): Look up one directory to find mkinstalldirs.
6429 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
6431         * po/Make-in (.po.gmo): Don't generate .gmo files in source
6432         tree.
6434 2009-10-30  Doug Kwan  <dougkwan@google.com>
6436         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
6438 2009-10-30  Doug Kwan  <dougkwan@google.com>
6440         * arm.cc (Stub_addend_reader): New struct template definition
6441         and partial specializations.
6442         (Stub_addend_reader::operator()): New method definition for a
6443         partially specialized template.
6445 2009-10-30  Doug Kwan  <dougkwan@google.com>
6447         * arm.cc (Arm_relobj::processor_specific_flags): New method
6448         definition.
6449         (Arm_relobj::do_read_symbols): New method declaration.
6450         (Arm_relobj::processor_specific_flags_): New data member declaration.
6451         (Arm_dynobj): New class definition.
6452         (Target_arm::do_finalize_sections): Add input_objects parameter.
6453         (Target_arm::do_adjust_elf_header): New method declaration.
6454         (Target_arm::are_eabi_versions_compatible,
6455         (Target_arm::merge_processor_specific_flags): New method declaration.
6456         (Target_arm::do_make_elf_object): New overloaded method definitions
6457         and declaration.
6458         (Arm_relobj::do_read_symbols): New method definition.
6459         (Arm_dynobj::do_read_symbols): Ditto.
6460         (Target_arm::do_finalize_sections): Add input_objects parameters.
6461         Merge processor-specific flags from all input objects.
6462         (Target_arm::are_eabi_versions_compatible,
6463         Target_arm::merge_processor_specific_flags,
6464         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
6465         New method definitions.
6466         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
6467         Input_objects pointer type parameter.
6468         * layout.cc (Layout::finalize): Pass input objects to target's.
6469         finalize_sections function.
6470         * output.cc (Output_file_header::do_sized_write): Set ELF file
6471         header's processor-specific flags.
6472         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
6473         Input_objects pointer type parameter.
6474         * sparc.cc (Target_sparc::do_finalize_sections): Same.
6475         * target.h (Input_objects): New forward class declaration.
6476         (Target::processor_specific_flags,
6477         Target::are_processor_specific_flags_sect): New method definitions.
6478         (Target::finalize_sections): Add input_objects parameter.
6479         (Target::Target): Initialize processor_specific_flags_ and
6480         are_processor_specific_flags_set_.
6481         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
6482         parameter.
6483         (Target::set_processor_specific_flags): New method definition.
6484         (Target::processor_specific_flags_,
6485         Target::are_processor_specific_flags_set_): New data member
6486         declarations.
6487         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
6488         Input_objects pointer type parameter.
6490 2009-10-30  Doug Kwan  <dougkwan@google.com>
6492         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
6494 2009-10-28  Ian Lance Taylor  <iant@google.com>
6496         * object.h (class Relobj): Drop options parameter from
6497         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
6498         do_scan_relocs, do_relocate.  Change all callers.
6499         (class Sized_relobj): Drop options parameters from
6500         do_gc_process_relocs, do_scan_relocs, do_relocate,
6501         do_relocate_sections, relocate_sections, emit_relocs_scan,
6502         emit_relocs_scan_reltype.  Change all callers.
6503         (struct Relocate_info): Remove options field and all references to
6504         it.
6505         * reloc.h (class Read_relocs): Remove options constructor
6506         parameter and options_ field.  Change all callers.
6507         (class Gc_process_relocs, class Scan_relocs): Likewise.
6508         (class Relocate_task): Likewise.
6509         * target-reloc.h (scan_relocs): Remove options parameter.  Change
6510         all callers.
6511         (scan_relocatable_relocs): Likewise.
6512         * target.h (class Sized_target): Remove options parameter from
6513         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
6514         all callers.
6515         * gc.h (gc_process_relocs): Remove options parameter.  Change all
6516         callers.
6517         * arm.cc: Update functions to remove options parameters.
6518         * i386.cc: Likewise.
6519         * powerpc.cc: Likewise.
6520         * sparc.cc: Likewise.
6521         * x86_64.cc: Likewise.
6522         * testsuite/testfile.cc: Likewise.
6524 2009-10-28  Doug Kwan  <dougkwan@google.com>
6526         * arm.cc (Arm_relobj): New class definition.
6527         (Arm_relobj::scan_sections_for_stubs,
6528         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
6529         New method definitions.
6531 2009-10-28  Cary Coutant  <ccoutant@google.com>
6533         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
6534         (Plugin::cleanup_done_): New member.
6535         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
6536         (Plugin_manager::cleanup_done_): Remove.
6537         (Plugin_manager::add_input_file): Edit error message.
6538         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
6539         (Plugin_manager::cleanup): Remove use of cleanup_done_.
6541 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
6543         * fileread.cc: (File_read::View::~View): Use the new
6544         data_ownership_ filed.
6545         (File_read::~File_read): Dispose the new whole_file_view_.
6546         (File_read::open): Mmap the whole file if needed.
6547         (File_read::open): Use whole_file_view_ instead of contents_.
6548         (File_read::find_view): Use whole_file_view_ if applicable.
6549         (File_read::do_read): Use whole_file_view_ instead of contents_.
6550         (File_read::make_view): Use whole_file_view_ instead of contents_,
6551         update File_read::View::View call.
6552         (File_read::find_or_make_view): Update File_read::View::View
6553         call.
6554         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
6555         remove contents_
6556         (File_read::View::Data_ownership): New enum.
6557         (File_read::View::View): Replace bool mapped_ with Data_ownership
6558         argument.
6559         (File_read::View::mapped_): Remove (replaced by data_ownership_).
6560         (File_read::View::data_ownership_): New field.
6561         (File_read::contents_): Remove (replaced by whole_file_view_).
6562         (File_read::whole_file_view_): New field.
6563         * options.h (class General_options): Add --keep-files-mapped.
6565 2009-10-27  Cary Coutant  <ccoutant@google.com>
6567         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
6568         * testsuite/Makefile.am (plugin_test_5): New test case.
6569         * testsuite/Makefile.in: Regenerate.
6571 2009-10-25  Doug Kwan  <dougkwan@google.com>
6573         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
6574         from private to protected to allow access by child class.
6575         (Sized_relobj::do_relocate_sections): New method declaration.
6576         (Sized_relobj::relocate_sections): Virtualize.
6577         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
6578         Sized_relobj::relocate_sections.  Instantiate template explicitly
6579         for different target sizes and endianity.
6581 2009-10-24  Doug Kwan  <dougkwan@google.com>
6583         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
6584         (Arm_input_section::as_arm_input_section): New method.
6585         (Arm_output_section): New class definition.
6586         (Arm_output_section::create_stub_group,
6587         Arm_output_section::group_sections): New method definitions.
6589 2009-10-22  Doug Kwan  <dougkwan@google.com>
6591         * arm.cc (Arm_input_section): New class definition.
6592         (Arm_input_section::init, Arm_input_section:do_write,
6593         Arm_input_section::set_final_data_size,
6594         Arm_input_section::do_reset_address_and_file_offset): New method
6595         definitions.
6597 2009-10-21  Doug Kwan  <dougkwan@google.com>
6599         * arm.cc (Stub_table, Arm_input_section): New forward class
6600         declarations.
6601         (Stub_table): New class defintion.
6602         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
6603         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
6604         New method definition.
6606 2009-10-21  Doug Kwan  <dougkwan@google.com>
6608         * arm.cc: Update copyright comments.
6609         (Target_arm): New forward class template declaration.
6610         (Arm_address): New type.
6611         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
6612         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
6613         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
6614         constants.
6615         (Insn_template): Same.
6616         (DEF_STUBS): New macro.
6617         (Stub_type): New enum type.
6618         (Stub_template): New class definition.
6619         (Stub): Same.
6620         (Reloc_stub): Same.
6621         (Stub_factory): Same.
6622         (Target_arm::Target_arm): Initialize may_use_blx_ and
6623         should_force_pic_veneer_.
6624         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
6625         Target_arm::should_force_pic_veneer,
6626         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
6627         Target_arm::using_thumb_only, Target_arm:;default_target): New
6628         method defintions.
6629         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
6630         New data member declarations.
6631         (Insn_template::size, Insn_template::alignment): New method defintions.
6632         (Stub_template::Stub_template): New method definition.
6633         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
6634         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
6635         (Stub_factory::Stub_factory): New method definition.
6636         * gold.h (string_hash): New template.
6637         * output.h (Input_section_specifier::hash_value): Use
6638         gold::string_hash.
6639         (Input_section_specifier::string_hash): Remove.
6640         * stringpool.cc (Stringpool_template::string_hash): Use
6641         gold::string_hash.
6643 2009-10-20  Doug Kwan  <dougkwan@google.com>
6645         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
6646         symbols of relaxed input sections.
6647         * output.h (Output_section::find_relaxed_input_section): Make
6648         method public.
6650 2009-10-16  Doug Kwan  <dougkwan@google.com>
6652         * dynobj.cc (Versions::Versions): Initialize version_script_.
6653         Only insert base version symbol definition for a shared object
6654         if version script defines any version versions.
6655         (Versions::define_base_version): New method definition.
6656         (Versions::add_def): Check that base version is not needed.
6657         (Versions::add_need): Define base version lazily.
6658         * dynobj.h (Versions::define_base_version): New method declaration.
6659         (Versions::needs_base_version_): New data member declaration.
6660         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
6661         (check_DATA): Add no_version_test.stdout.
6662         (libno_version_test.so, no_version_test.o no_version_test.stdout):
6663         New make rules.
6664         * testsuite/Makefile.in: Regenerate.
6665         * testsuite/no_version_test.c: New file.
6666         * testsuite/no_version_test.sh: Ditto.
6668 2009-10-16  Doug Kwan  <dougkwan@google.com>
6670         * expression.cc (class Segment_start_expression): New class definition.
6671         (Segment_start_expression::value): New method definition.
6672         (script_exp_function_segment_start): Return a new
6673         Segment_start_expression.
6674         * gold/script-c.h (script_saw_segment_start_expression): New function
6675         prototype.
6676         * script-sections.cc (Script_sections::Script_sections): Initialize
6677         SAW_SEGMENT_START_EXPRESSION_ to false.
6678         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
6679         and -Tbbs options to specify section addresses if given in
6680         command line and no SEGMENT_START expression is seen in a script.
6681         * script-sections.h (Script_sections::saw_segment_start_expression,
6682         Script_sections::set_saw_segment_start_expression): New method
6683         definition.
6684         (Script_sections::saw_segment_start_expression_): New data member
6685         declaration.
6686         * script.cc (script_saw_segment_start_expression): New function.
6687         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
6688         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
6689         script_test_7.sh and script_test_8.sh.
6690         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
6691         script_test_8.stdout.
6692         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
6693         (script_test_6, script_test_6.stdout, script_test_7,
6694         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
6695         * Makefile.in: Regenerate.
6696         * testsuite/script_test_6.sh: New file.
6697         * testsuite/script_test_6.t: Same.
6698         * testsuite/script_test_7.sh: Same.
6699         * testsuite/script_test_7.t: Same.
6700         * testsuite/script_test_8.sh: Same.
6702 2009-10-16  Doug Kwan  <dougkwan@google.com>
6704         * output.cc (Output_segment::set_section_list_address): Cast
6705         expressions to unsigned long long type to avoid format warnings.
6707 2009-10-15  Ian Lance Taylor  <iant@google.com>
6709         * script.cc (Script_options::add_symbol_assignment): Always add a
6710         dot assignment to script_sections_.
6711         * script-sections.cc (Script_sections::add_dot_assignment):
6712         Initialize if necessary.
6714         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
6715         program headers with no load segment if there is a linker script.
6717         * layout.cc (Layout::set_segment_offsets): Align the file offset
6718         to the segment aligment for -N or -n with no load segment.
6719         * output.cc (Output_segment::add_output_section): Don't crash if
6720         the first section is a TLS section.
6721         (Output_segment::set_section_list_addresses): Print an error
6722         message if the address moves backward in a linker script.
6723         * script-sections.cc
6724         (Output_section_element_input::set_section_addresses): Don't
6725         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
6726         (Orphan_output_section::set_section_addresses): Likewise.
6728 2009-10-15  Doug Kwan  <dougkwan@google.com>
6730         * layout.cc (Layout::finish_dynamic_section): Generate tags
6731         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
6732         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
6733         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
6735 2009-10-14  Ian Lance Taylor  <iant@google.com>
6737         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
6738         fields.
6739         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
6740         data_shdr fields of relinfo.
6741         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
6742         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
6743         R_386_TLS_LDO_32, adjust based on section flags.
6744         (Target_i386::Relocate::fix_up_ldo): Remove.
6746 2009-10-13  Ian Lance Taylor  <iant@google.com>
6748         Add support for -pie.
6749         * options.h (class General_options): Add -pie and
6750         --pic-executable.
6751         (General_options::output_is_position_independent): Test -pie.
6752         (General_options::output_is_executable): Return true if not shared
6753         and not relocatable.
6754         (General_options::output_is_pie): Remove.
6755         * options.cc (General_options::finalize): Reject incompatible uses
6756         of -pie.
6757         * gold.cc (queue_middle_tasks): A -pie link is not static.
6758         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
6759         * symtab.cc (Symbol::final_value_is_known): Return false if
6760         output_is_position_independent.
6761         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
6762         output_is_position_independent.
6763         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
6764         output_is_position_independent.
6765         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
6766         output_is_position_independent.
6767         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
6768         two_file_pie_test.
6769         (basic_pie_test.o, basic_pie_test): New targets.
6770         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
6771         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
6772         (two_file_pie_test): New target.
6773         * testsuite/Makefile.in: Rebuild.
6774         * README: Remove note saying that -pie is not supported.
6776 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
6778         * options.h (class General_options): Add -init and -fini.
6779         * layout.cc (Layout::finish_dynamic_section): Emit
6780         given init and fini functions.
6782 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
6784         * gc.h (gc_process_relocs): Check if icf is enabled using new
6785         function.
6786         * gold.cc (queue_initial_tasks): Likewise.
6787         (queue_middle_tasks): Likewise.
6788         * object.cc (do_layout): Likewise.
6789         * symtab.cc (is_section_folded): Likewise.
6790         * main.cc (main): Likewise.
6791         * reloc.cc (Read_relocs::run): Likewise.
6792         (Sized_relobj::do_scan_relocs): Likewise.
6793         * icf.cc (is_function_ctor_or_dtor): New function.
6794         (Icf::find_identical_sections): Check if function is ctor or dtor when
6795         safe icf is chosen.
6796         * options.h (General_options::icf): Change option to be an enum.
6797         (Icf_status): New enum.
6798         (icf_enabled): New method.
6799         (icf_safe_folding): New method.
6800         (set_icf_status): New method.
6801         (icf_status_): New variable.
6802         * (options.cc) (General_options::finalize): Set icf_status_.
6803         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
6804         icf_test and icf_keep_unique_test to use the --icf enum flag.
6805         * testsuite/icf_safe_test.sh: New file.
6806         * testsuite/icf_safe_test.cc: New file.
6808 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
6810         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
6811         includes to gc.h and icf.h.
6812         * arm.cc: Include gc.h.
6813         * gold.cc: Likewise.
6814         * i386.cc: Likewise.
6815         * powerpc.cc: Likewise.
6816         * sparc.cc: Likewise.
6817         * x86_64.cc: Likewise.
6818         * gc.h: Include icf.h.
6820 2009-10-11  Ian Lance Taylor  <iant@google.com>
6822         * plugin.cc: Include "gold.h" before other header files.
6824 2009-10-10  Chris Demetriou  <cgd@google.com>
6826         * options.h (Input_file_argument::Input_file_type): New enum.
6827         (Input_file_argument::is_lib_): Replace with...
6828         (Input_file_argument::type_): New member.
6829         (Input_file_argument::Input_file_argument): Take Input_file_type
6830         'type' rather than boolean 'is_lib' as second argument.
6831         (Input_file_argument::is_lib): Use type_.
6832         (Input_file_argument::is_searched_file): New function.
6833         (Input_file_argument::may_need_search): Handle is_searched_file.
6834         * options.cc (General_options::parse_library): Support -l:filename.
6835         (General_options::parse_just_symbols): Update for Input_file_argument
6836         changes.
6837         (Command_line::process): Likewise.
6838         * archive.cc (Archive::get_file_and_offset): Likewise.
6839         * plugin.cc (Plugin_manager::release_input_file): Likewise.
6840         * script.cc (read_script_file, script_add_file): Likewise.
6841         * fileread.cc (Input_file::Input_file): Likewise.
6842         (Input_file::will_search_for): Handle is_searched_file.
6843         (Input_file::open): Likewise.
6844         * readsyms.cc (Read_symbols::get_name): Likewise.
6845         * testsuite/Makefile.am (searched_file_test): New test.
6846         * testsuite/Makefile.in: Regenerate.
6847         * testsuite/searched_file_test.cc: New file.
6848         * testsuite/searched_file_test_lib.cc: New file.
6850 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6851             Ian Lance Taylor  <iant@google.com>
6853         * descriptor.cc: Include <cstdio> and "binary-io.h".
6854         (Descriptors::open): Open the files in binary mode always.
6855         * script.cc (Lex::get_token): Treat \r as whitespace.
6857 2009-10-09  Ian Lance Taylor  <iant@google.com>
6859         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
6861 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6862             Ian Lance Taylor  <iant@google.com>
6864         * configure.ac: Check for readv function also.
6865         * fileread.cc (readv): Define if not HAVE_READV.
6866         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
6867         does not exist.
6868         * config.in: Regenerate.
6869         * configure: Regenerate.
6871 2009-10-09  Doug Kwan  <dougkwan@google.com>
6873         * layout.cc (Layout::make_output_section): Call target hook to make
6874         ordinary output section.
6875         (Layout::finalize): Adjust parameter list of call the
6876         Target::may_relax().
6877         * layout.h (class Layout::section_list): New method.
6878         * merge.h (Output_merge_base::entsize): Change visibility to public.
6879         (Output_merge_base::is_string, Output_merge_base::do_is_string):
6880         New methods.
6881         (Output_merge_string::do_is_string): New method.
6882         * object.cc (Sized_relobj::do_setup): renamed from
6883         Sized_relobj::set_up.
6884         * object.h (Sized_relobj::adjust_shndx,
6885         Sized_relobj::initializ_input_to_output_maps,
6886         Sized_relobj::free_input_to_output_maps): Change visibilities to
6887         protected.
6888         (Sized_relobj::setup): Virtualize.
6889         (Sized_relobj::do_setup): New method declaration.
6890         (Sized_relobj::invalidate_section_offset,
6891         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
6892         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
6893         * options.cc (parse_int): New function.
6894         * options.h (parse_int): New declaration.
6895         (DEFINE_int): New macro.
6896         (stub_group_size): New option.
6897         * output.cc (Output_section::Output_section): Initialize memebers
6898         merge_section_map_, merge_section_by_properties_map_,
6899         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
6900         (Output_section::add_input_section): Handled deferred code-fill
6901         generation and remove an old comment.
6902         (Output_section::add_relaxed_input_section): New method definition.
6903         (Output_section::add_merge_input_section): Use merge section by
6904         properties map to speed to search.  Update merge section maps
6905         as appropriate.
6906         (Output_section::build_relaxation_map): New method definition.
6907         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6908         Same.
6909         (Output_section::relax_input_section): Renamed to
6910         Output_section::convert_input_sections_to_relaxed_sections and change
6911         interface to take a vector of pointers to relaxed sections.
6912         (Output_section::find_merge_section,
6913         Output_section::find_relaxed_input_section): New method definitions.
6914         (Output_section::is_input_address_mapped,
6915         Output_section::output_offset, Output_section::output_address):
6916         Use output section data maps to speed up searching.
6917         (Output_section::find_starting_output_address): Add comments.
6918         (Output_section::do_write,
6919         Output_section::write_to_postprocessing_buffer): Do code-fill
6920         generation as appropriate.
6921         (Output_section::get_input_sections): Invalidate relaxed input section
6922         map.
6923         (Output_section::restore_states): Adjust type of checkpoint .
6924         Invalidate relaxed input section map.
6925         * output.h (Output_merge_base): New class declaration.
6926         (Input_section_specifier): New class defintion.
6927         (class Output_relaxed_input_section) Change base class to
6928         Output_section_data_build.
6929         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
6930         base class initializer.
6931         (Output_section::add_relaxed_input_section): New method declaration.
6932         (Output_section::Input_section): Change visibility to protected.
6933         (Output_section::Input_section::relobj,
6934         Output_section::Input_section::shndx): Handle relaxed input sections.
6935         Output_section::input_sections) Change visibility to protected.  Also
6936         define overload to return a non-const pointer.
6937         (Output_section::Merge_section_properties): New class defintion.
6938         (Output_section::Merge_section_by_properties_map,
6939         Output_section::Output_section_data_by_input_section_map,
6940         Output_section::Relaxation_map): New types.
6941         (Output_section::relax_input_section): Rename method to
6942         Output_section::convert_input_sections_to_relaxed_sections and change
6943         interface to take a vector of relaxed section pointers.
6944         (Output_section::find_merge_section,
6945         Output_section::find_relaxed_input_section,
6946         Output_section::build_relaxation_map,
6947         Output_section::convert_input_sections_in_list_to_relaxed_sections):
6948         New method declarations.
6949         (Output_section::merge_section_map_
6950         Output_section::merge_section_by_properties_map_,
6951         Output_section::relaxed_input_section_map_,
6952         Output_section::is_relaxed_input_section_map_valid_,
6953         Output_section::generate_code_fills_at_write_): New data members.
6954         * script-sections.cc
6955         (Output_section_element_input::set_section_addresses): Call
6956         current_data_size and addralign methods of relaxed input sections.
6957         (Orphan_output_section::set_section_addresses): Call current_data_size
6958         and addralign methods of relaxed input sections.
6959         * symtab.cc (Symbol_table::compute_final_value): Extract template
6960         from the body of Symbol_table::sized_finalize_symbol.
6961         (Symbol_table::sized_finalized_symbol): Call
6962         Symbol_table::compute_final_value.
6963         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
6964         (Symbol_table::compute_final_value): New templated method declaration.
6965         * target.cc (Target::do_make_output_section): New method defintion.
6966         * target.h (Target::make_output_section): New method declaration.
6967         (Target::relax): Add more parameters for input objects, symbol table
6968         and layout.  Adjust call to do_relax.
6969         (Target::do_make_output_section): New method declaration.
6970         (Target::do_relax): Add parameters for input objects, symbol table
6971         and layout.
6973 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6975         * pread.c: Include stdio.h.
6977 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6979         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
6980         defined.
6982 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6984         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6985         Change read_shndx type to unsigned int.
6986         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6987         int.
6988         (Sized_dwarf_line_info::read_line_mappings): Likewise.
6989         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
6990         Change read_shndx type to unsigned int.
6991         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6992         int.
6993         (Sized_dwarf_line_info::read_line_mappings): Likewise.
6994         * layout.cc (Layout::create_symtab_sections): Cast the result of
6995         local_symcount * symsize to off_t in the gold_assert.
6997 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6999         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
7000         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
7001         R_ARM_BASE_ABS.
7002         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
7003         (Arm_relocate_functions::thm_abs5): New function.
7004         (Arm_relocate_functions::abs12): New function.
7005         (Arm_relocate_functions::abs16): New function.
7006         (Arm_relocate_functions::base_abs): New function.
7007         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
7008         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
7009         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
7010         R_ARM_BASE_ABS.
7011         (Scan::global): Likewise.
7012         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
7013         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
7014         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
7015         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
7016         R_ARM_BASE_ABS.
7018 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7020         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
7021         (Arm_relocate_functions::movt_prel): New function.
7022         (Arm_relocate_functions::thm_movw_prel_nc): New function.
7023         (Arm_relocate_functions::thm_movt_prel): New function.
7024         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
7025         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
7026         (Scan::global, Relocate::relocate): Likewise.
7027         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7029 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
7031         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
7032         Incremental_checker.
7033         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
7034         unsigned int.
7035         (class Incremental_inputs_header): New class.
7036         (Incremental_inputs_header_writer): Edit comment.
7037         (Incremental_inputs_entry): New class.
7038         (Incremental_inputs_entry_writer): Edit comment.
7039         (Sized_incremental_binary::do_find_incremental_inputs_section):
7040         Add *strtab_shndx parameter, fill it.
7041         (Sized_incremental_binary::do_check_inputs): New method.
7042         (Incremental_checker::can_incrementally_link_output_file): Use
7043         Sized_incremental_binary::check_inputs.
7044         (Incremental_inputs::report_command_line): Save command line in
7045         command_line_.
7046         * incremental.h:
7047         (Incremental_binary::find_incremental_inputs_section): New
7048         method.
7049         (Incremental_binary::do_find_incremental_inputs_section): Add
7050         strtab_shndx parameter.
7051         (Incremental_binary::do_check_inputs): New pure virtual method.
7052         (Sized_incremental_binary::do_check_inputs): Declare.
7053         (Incremental_checker::Incremental_checker): Add incremental_inputs
7054         parameter, use it to initialize incremental_inputs_.
7055         (Incremental_checker::incremental_inputs_): New field.
7056         (Incremental_checker::command_line): New method.
7057         (Incremental_checker::inputs): New method.
7058         (Incremental_checker::command_line_): New field.
7060 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
7062         * incremental.cc: Include <cstdarg> and "target-select.h".
7063         (vexplain_no_incremental): New function.
7064         (explain_no_incremental): New function.
7065         (Incremental_binary::error): New method.
7066         (Sized_incremental_binary::do_find_incremental_inputs_section): New
7067         method.
7068         (make_sized_incremental_binary): New function.
7069         (open_incremental_binary): New function.
7070         (can_incrementally_link_file): Add checks if output is ELF and has
7071         inputs section.
7072         * incremental.h: Include "elfcpp_file.h" and "output.h".
7073         (Incremental_binary): New class.
7074         (Sized_incremental_binary): New class.
7075         (open_incremental_binary): Declare.
7076         * object.cc (is_elf_object): Use
7077         elfcpp::Elf_recognizer::is_elf_file.
7078         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
7079         * output.h (Output_file::filesize): New method.
7081 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7083         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
7084         New function.
7085         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
7086         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
7087         function.
7088         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
7089         function.
7090         (Arm_relocate_functions::movw_abs_nc): New function.
7091         (Arm_relocate_functions::movt_abs): New function.
7092         (Arm_relocate_functions::thm_movw_abs_nc): New function.
7093         (Arm_relocate_functions::thm_movt_abs): New function.
7094         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
7095         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
7096         (Scan::global): Likewise.
7097         (Relocate::relocate): Likewise.
7098         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7100 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7102         * arm.cc (Arm_relocate_functions::got_prel) New function.
7103         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
7104         (Relocate::relocate): Likewise.
7105         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7107 2009-10-06  Ian Lance Taylor  <iant@google.com>
7109         * options.h (class General_options): Define
7110         split_stack_adjust_size parameter.
7111         * object.h (class Object): Add uses_split_stack_ and
7112         has_no_split_stack_ fields.  Add uses_split_stack and
7113         has_no_split_stack accessor functions.  Declare
7114         handle_split_stack_section.
7115         (class Reloc_symbol_changes): Define.
7116         (class Sized_relobj): Define Function_offsets.  Declare
7117         split_stack_adjust, split_stack_adjust_reltype, and
7118         find_functions.
7119         * object.cc (Object::handle_split_stack_section): New function.
7120         (Sized_relobj::do_layout): Call handle_split_stack_section.
7121         * dynobj.cc (Sized_dynobj::do_layout): Call
7122         handle_split_stack_section.
7123         * reloc.cc (Sized_relobj::relocate_sections): Call
7124         split_stack_adjust for executable sections in split_stack
7125         objects.  Pass reloc_map to relocate_section.
7126         (Sized_relobj::split_stack_adjust): New function.
7127         (Sized_relobj::split_stack_adjust_reltype): New function.
7128         (Sized_relobj::find_functions): New function.
7129         * target-reloc.h: Include "object.h".
7130         (relocate_section): Add reloc_symbol_changes parameter.  Change
7131         all callers.
7132         * target.h (class Target): Add calls_non_split method.  Declare
7133         do_calls_non_split virtual method.  Declare match_view and
7134         set_view_to_nop.
7135         * target.cc: Include "elfcpp.h".
7136         (Target::do_calls_non_split): New function.
7137         (Target::match_view): New function.
7138         (Target::set_view_to_nop): New function.
7139         * gold.cc (queue_middle_tasks): Give an error if mixing
7140         split-stack and non-split-stack objects with -r.
7141         * i386.cc (Target_i386::relocate_section): Add
7142         reloc_symbol_changes parameter.
7143         (Target_i386::do_calls_non_split): New function.
7144         * x86_64.cc (Target_x86_64::relocate_section): Add
7145         reloc_symbol_changes parameter.
7146         (Target_x86_64::do_calls_non_split): New function.
7147         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
7148         parameter.
7149         * powerpc.cc (Target_powerpc::relocate_section): Add
7150         reloc_symbol_changes parameter.
7151         * sparc.cc (Target_sparc::relocate_section): Add
7152         reloc_symbol_changes parameter.
7153         * configure.ac: Call AM_CONDITIONAL for the default target.
7154         * configure: Rebuild.
7155         * testsuite/Makefile.am (TEST_AS): New variable.
7156         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
7157         (check_DATA): Add split_i386 and split_x86_64 files.
7158         (SPLIT_DEFSYMS): Define.
7159         (split_i386_[1234n].o): New targets.
7160         (split_i386_[124]): New targets.
7161         (split_i386_[1234r].stdout): New targets.
7162         (split_x86_64_[1234n].o): New targets.
7163         (split_x86_64_[124]): New targets.
7164         (split_x86_64_[1234r].stdout): New targets.
7165         (MOSTLYCLEANFILES): Add new executables.
7166         * testsuite/split_i386.sh: New file.
7167         * testsuite/split_x86_64.sh: New file.
7168         * testsuite/split_i386_1.s: New file.
7169         * testsuite/split_i386_2.s: New file.
7170         * testsuite/split_i386_3.s: New file.
7171         * testsuite/split_i386_4.s: New file.
7172         * testsuite/split_i386_n.s: New file.
7173         * testsuite/split_x86_64_1.s: New file.
7174         * testsuite/split_x86_64_2.s: New file.
7175         * testsuite/split_x86_64_3.s: New file.
7176         * testsuite/split_x86_64_4.s: New file.
7177         * testsuite/split_x86_64_n.s: New file.
7178         * testsuite/testfile.cc (Target_test): Update relocation_section
7179         function.
7180         * testsuite/Makefile.in: Rebuild.
7182 2009-10-06  Ian Lance Taylor  <iant@google.com>
7184         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
7185         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
7186         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
7187         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
7188         the address on ldo_addrs_.
7189         (Target_i386::Relocate::fix_up_ldo): New function.
7191 2009-10-06   Rafael Espindola  <espindola@google.com>
7193         * plugin.cc (add_input_library): New.
7194         (Plugin::load): Add add_input_library to tv.
7195         (Plugin_manager::add_input_file): Add the is_lib argument.
7196         (add_input_file): Update call to Plugin_manager::add_input_file.
7197         (add_input_library): New.
7198         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
7200 2009-09-30  Doug Kwan  <dougkwan@google.com>
7202         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
7203         symbol and call Symbol::may_need_copy_reloc to determine if
7204         a copy reloc is needed.
7205         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
7206         nocopyreloc is given in command line.
7207         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
7208         given in command line.
7209         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
7210         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
7211         of the removed Target_i386::may_need_copy_reloc.
7212         * options.h (copyreloc): New option with default value false.
7213         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
7214         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
7215         instead of the removed Target_powerpc::may_need_copy_reloc.
7216         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
7217         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
7218         instead of the removed Target_sparc::may_need_copy_reloc.
7219         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
7220         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
7221         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
7222         instead of the removed Target_x86_64::may_need_copy_reloc.
7224 2009-09-30  Ian Lance Taylor  <iant@google.com>
7226         * object.h (class Object): Remove target_ field, and target,
7227         sized_target, and set_target methods.
7228         (Object::sized_target): Remove.
7229         (class Sized_relobj): Update declarations.  Remove sized_target.
7230         * object.cc (Sized_relobj::setup): Remove target parameter.
7231         Change all callers.
7232         (Input_objects::add_object): Don't do anything with the target.
7233         (make_elf_sized_object): Add punconfigured parameter.  Change all
7234         callers.  Set or test parameter target.
7235         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
7236         Change all callers.
7237         * parameters.cc (Parameters::set_target): Change parameter type to
7238         be non-const.
7239         (Parameters::default_target): Remove.
7240         (set_parameters_target): Change parameter type to be non-const.
7241         (parameters_force_valid_target): New function.
7242         (parameters_clear_target): New function.
7243         * parameters.h (class Parameters): Update declarations.  Remove
7244         default_target method.  Add sized_target and clear_target
7245         methods.  Change target_ to be non-const.
7246         (set_parameters_target): Update declaration.
7247         (parameters_force_valid_target): Declare.
7248         (parameters_clear_target): Declare.
7249         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
7250         as NULL if we aren't searching.
7251         (Add_symbols::run): Don't check for compatible target.
7252         * fileread.cc (Input_file::open_binary): Call
7253         parameters_force_valid_target.
7254         * gold.cc (queue_middle_tasks): Likewise.
7255         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
7256         set_target on object.
7257         * dynobj.h (class Sized_dynobj): Update declarations.
7258         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
7259         make_elf_object returns NULL.
7260         (Archive::include_member): Don't check whether object target is
7261         compatible.
7262         * output.cc (Output_section::add_input_section): Get target from
7263         parameters.
7264         (Output_section::relax_input_section): Likewise.
7265         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
7266         parameters.
7267         (Sized_relobj::do_scan_relocs): Likewise.
7268         (Sized_relobj::relocate_sections): Likewise.
7269         * resolve.cc (Symbol_table::resolve): Likewise.
7270         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
7271         parameter.  Change all callers.
7272         (Symbol_table::add_from_object): Get target from parameters.
7273         (Symbol_table::add_from_relobj): Don't check object target.
7274         (Symbol_table::add_from_dynobj): Likewise.
7275         (Symbol_table::define_special_symbol): Get target from
7276         parameters.
7277         * symtab.h (class Symbol_table): Update declaration.
7278         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
7279         parameter.  Change all callers.  Clear parameter target.
7280         (Binary_test): Test target here.
7281         * testsuite/object_unittest.cc (gold_testsuite): Remove
7282         target_test_pointer parameter.  Change all callers.
7283         (Object_test): Test target here.
7285 2009-09-26  Ian Lance Taylor  <iant@google.com>
7287         * testsuite/initpri1.c: Don't try to use constructor priorities if
7288         compiling with gcc before 4.3.
7290 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
7292         * testsuite/retain_symbols_file_test.sh (check_present): Change
7293         output file name to retain_symbols_file_test.stdout.
7294         (check_absent): Likewise.
7296 2009-09-18  Craig Silverstein  <csilvers@google.com>
7298         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
7299         * options.cc: Include <cerrno> and <fstream>.
7300         (General_options::finalize): Parse -retain-symbols-file tag.
7301         * options.h: New flag.
7302         (General_options): New method should_retain_symbol, new
7303         variable symbols_to_retain.
7304         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
7305         should_retain_symbol map.
7306         * testsuite/Makefile.am (retain_symbols_file_test): New test.
7307         * testsuite/Makefile.in: Regenerate.
7308         * testsuite/retain_symbols_file_test.sh: New file.
7310 2009-09-18  Nick Clifton  <nickc@redhat.com>
7312         * po/es.po: Updated Spanish translation.
7314 2009-09-17  Doug Kwan  <dougkwan@google.com>
7316         * debug.h (DEBUG_RELAXATION): New constant.
7317         (DEBUG_ALL): Add DEBUG_RELAXATION.
7318         (debug_string_to_enum): Add relaxation debug option.
7319         * layout.cc
7320         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
7321         Layout::Relaxation_debug_check::read_sections,
7322         Layout::Relaxation_debug_check::read_sections): New method definitions.
7323         (Layout::Layout): Initialize data members
7324         record_output_section_data_from_scrips_,
7325         script_output_section_data_list_ and relaxation_debug_check_.
7326         (Layout::save_segments, Layout::restore_segments,
7327         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7328         Layout::relaxation_loop_body): New method definitions.
7329         (Layout::finalize): Support relaxation.  Move section layout code to
7330         Layout::relaxation_loop_body.
7331         (Layout::set_asection_address_from_script): Move code for orphan
7332         section placement out.
7333         (Layout::place_orphan_sections_in_script): New method definition.
7334         * layout.h (Output_segment_headers, Output_file_header):
7335         New forward class declarations.
7336         (Layout::~Layout): Define.
7337         (Layout::new_output_section_data_from_script): New method definition.
7338         (Layout::place_orphan_sections_in_script): New method declaration.
7339         (Layout::Segment_states): New type declaration.
7340         (Layout::save_segments, Layout::restore_segments,
7341         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7342         Layout::relaxation_loop_body): New method declarations.
7343         (Layout::Output_section_data_list): New type declaration.
7344         (Layout::Relaxation_debug_check): New class definition.
7345         (Layout::record_output_section_data_from_script_,
7346         Layout::script_output_section_data_list_, Layout::segment_states_,
7347         Layout::relaxation_debug_check_): New data members.
7348         * output.cc: (Output_section_headers::do_size): New method definition.
7349         (Output_section_headers::Output_section_headers): Move size
7350         computation to Output_section_headers::do_size.
7351         (Output_segment_headers::do_size): New method definition.
7352         (Output_file_header::Output_file_header): Move size computation to
7353         Output_file_header::do_size and call it.
7354         (Output_file_header::do_size): New method definition.
7355         (Output_data_group::Output_data_group): Adjust call to
7356         Output_section_data.
7357         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
7358         (Output_symtab_xindex::do_write): Add array bound check.
7359         (Output_section::Input_section::print_to_mapfile): Handle
7360         RELAXED_INPUT_SECTION_CODE.
7361         (Output_section::Output_section): Initialize data member checkpoint_.
7362         (Output_section::~Output_section): Delete checkpoint object pointed
7363         by checkpoint_.
7364         (Output_section::add_input_section): Always add an Input_section if
7365         relaxing.
7366         (Output_section::add_merge_input_section): Add assert.
7367         (Output_section::relax_input_section): New method definition.
7368         (Output_section::set_final_data_size): Set load address to zero for
7369         an unallocated section.
7370         (Output_section::do_address_and_file_offset_have_reset_values):
7371         New method definition.
7372         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
7373         Handle relaxed input section.
7374         (Output_section::sort_attached_input_sections): Checkpoint input
7375         section list lazily.
7376         (Output_section::get_input_sections): Change type of input_sections to
7377         list of Simple_input_section pointers.  Checkpoint input section list
7378         lazily.  Also handle relaxed input sections.
7379         (Output_section::add_input_section_for_script): Take a reference to
7380         a Simple_input_section object instead of Relobj pointer and section
7381         index as parameter.  Handle relaxed input sections.
7382         (Output_section::save_states, Output_section::restore_states): New
7383         method definitions.
7384         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
7385         (Output_data::is_data_size_fixed): New method definition.
7386         (Output_data::reset_addresss_and_file_offset): Do not reset data size
7387         if it is fixed.
7388         (Output_data::address_and_file_offset_have_reset_values): New method
7389         definition.
7390         (Output_data::do_address_and_file_offset_have_reset_values): New method
7391         definition.
7392         (Output_data::set_data_size): Check that data size is not fixed.
7393         (Output_data::fix_data_size): New method definition.
7394         (Output_data::is_data_size_fixed_): New data member.
7395         (Output_section_headers::set_final_data_size): New method definition.
7396         (Output_section_headers::do_size): New method declaration.
7397         (Output_segment_headers::set_final_data_size): New method definition.
7398         (Output_segment_headers::do_size): New method declaration.
7399         (Output_file_header::set_final_data_size)::New method definition.
7400         (Output_file_header::do_size)::New method declaration.
7401         (Output_section_data::Output_section_data): Add new parameter
7402         is_data_size_fixed and use it to fix data size.
7403         (Output_data_const::Output_data_const): Adjust call to base class
7404         constructor and fix data size.
7405         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
7406         base class constructor and fix data size.
7407         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
7408         base class constructor and fix data size.
7409         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
7410         class constructor and fix data size.
7411         (Output_data_group::set_final_data_size): New method definition.
7412         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
7413         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
7414         class constructor and fix data size.
7415         (Output_relaxed_input_section): New class definition.
7416         (Output_section::Simple_input_section): New class definition.
7417         (Output_section::get_input_sections): Adjust parameter list.
7418         (Output_section::add_input_section_for_script): Same.
7419         (Output_section::save_states, Output_section::restore_states,
7420         Output_section::do_address_and_file_offset_have_reset_values,
7421         (Output_section::Input_section::Input_section): Handle
7422         RELAXED_INPUT_SECTION_CODE.  Add new overload for
7423         Output_relaxed_input_section.
7424         (Output_section::Input_section::is_input_section,
7425         Output_section::Input_section::set_output_section): Handle relaxed
7426         input section.
7427         (Output_section::Input_section::is_relaxed_input_section,
7428         Output_section::Input_section::output_section_data,
7429         Output_section::Input_section::relaxed_input_section): New method
7430         definitions.
7431         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
7432         value.
7433         (Output_section::Input_section::u1_): Update comments.
7434         (Output_section::Input_section::u2_): Add new union member poris.
7435         (Output_section::Checkpoint_output_section): New classs definition.
7436         (Output_section::relax_input_section): New method declaration.
7437         (Output_section::checkpoint_): New data member.
7438         (Output_segment): Update comments.
7439         (Output_segment::Output_segment): Un-privatize copy constructor.
7440         (Output_segment::operator=): Un-privatize.
7441         * script-sections.cc (Output_section_element::Input_section_list):
7442         Change element type to Output_section::Simple_input_section.
7443         (Output_section_element_dot_assignment::set_section_addresses):
7444         Register output section data for relaxation clean up.
7445         (Output_data_exression::Output_data_expression): Adjust call to base
7446         constructor to fix data size.
7447         (Output_section_element_data::set_section_addresses): Register
7448         Output_data_expression object for relaxation clean up.
7449         (struct Input_section_info): Replace Relobj pointer and section index
7450         pair with Output_section::Simple_input_section and Convert struct to a
7451         class.
7452         (Input_section_sorter::operator()): Adjust access to
7453         Input_section_info data member to use accessors.
7454         (Output_section_element_input::set_section_addresses): Use layout
7455         parameter.  Adjust code to use Output_section::Simple_input_section
7456         and Input_secction_info classes.  Register filler for relaxation
7457         clean up.
7458         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
7459         and section index pair with Output_section::Simple_input_section
7460         class.  Adjust code accordingly.
7461         (Phdrs_element::release_segment): New method definition.
7462         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
7463         segment list.
7464         (Script_sections::release_segments): New method definition.
7465         * gold/script-sections.h (Script_sections::release_segments): New
7466         method declaration.
7467         * gold/target.h (Target::may_relax, Target::relax,
7468         Target::do_may_relax, Target::do_relax): New method definitions.
7470 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7472         * arm.cc (has_signed_unsigned_overflow): New function.
7473         (Arm_relocate_functions::abs8): New function.
7474         (Target_arm::Scan::local): Handle R_ARM_ABS8.
7475         (Target_arm::Scan::global): Likewise.
7476         (Target_arm::relocate::relocate): Likewise.
7477         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7478         Likewise.
7480 2009-09-16  Cary Coutant  <ccoutant@google.com>
7482         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
7483         * testsuite/Makefile.in: Regenerate.
7485 2009-09-11  Nick Clifton  <nickc@redhat.com>
7487         * po/gold.pot: Updated by the Translation project.
7489 2009-09-08  Cary Coutant  <ccoutant@google.com>
7491         * output.cc (Output_file::open): Add execute permission to empty file.
7492         * testsuite/Makefile.am (permission_test): New test.
7493         * testsuite/Makefile.in: Regenerate.
7495 2009-09-02  Ian Lance Taylor  <iant@google.com>
7497         * output.cc (Output_file::resize): Call map_no_anonymous rather
7498         than map.
7500 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
7502         * gold.cc: Include "incremental.h".
7503         (queue_initial_tasks): Call Incremental_checker methods.
7504         * incremental.cc: Include "output.h".
7505         (Incremental_checker::can_incrementally_link_output_file): New
7506         method.
7507         * incremental.h (Incremental_checker): New class.
7509         * output.cc (Output_file::open_for_modification): New method.
7510         (Output_file::map_anonymous): Changed return type to bool.  Record
7511         map in base_ field.
7512         (Output_file::map_no_anonymous): New method, broken out of map.
7513         (Output_file::map): Use map_no_anonymous and map_anonymous.
7514         * output.h (class Output_file): Update declarations.
7516 2009-08-24  Cary Coutant  <ccoutant@google.com>
7518         * options.h (Command_line::Pre_options): New class.
7519         (Command_line::pre_options): New member.
7520         * options.cc (gold::options::ready_to_register): New variable.
7521         (One_option::register_option): Do nothing if not registering options.
7522         Assert if same short option registered twice.
7523         (General_options::General_options): Turn off option registration when
7524         done constructing.
7525         (Command_line::Pre_options::Pre_options): New constructor.
7527 2009-08-24  Cary Coutant  <ccoutant@google.com>
7529         * options.h (General_options::no_keep_memory): Remove incorrect
7530         short option.
7532 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7534         * Makefile.am (am__skiplex, am__skipyacc): New.
7535         * Makefile.in: Regenerate.
7537 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7539         * Makefile.am (AM_CPPFLAGS): Renamed from ...
7540         (INCLUDES): ... this.
7541         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
7542         (AM_CPPFLAGS): Renamed from ...
7543         (INCLUDE): ... this.
7544         * Makefile.in, testsuite/Makefile.in: Regenerate.
7546         * Makefile.in: Regenerate.
7547         * aclocal.m4: Likewise.
7548         * config.in: Likewise.
7549         * configure: Likewise.
7550         * testsuite/Makefile.in: Likewise.
7552         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7553         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7554         * Makefile.in: Regenerate.
7555         * testsuite/Makefile.in: Regenerate.
7557 2009-08-19  Cary Coutant  <ccoutant@google.com>
7559         * resolve.cc (Symbol_table::resolve): Don't complain about defined
7560         symbols in shared libraries overridden by hidden or internal symbols
7561         in the main program.
7563 2009-08-19  Chris Demetriou  <cgd@google.com>
7565         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
7566         checking source file names in error messages.
7568 2009-08-18  Doug Kwan  <dougkwan@google.com>
7570         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
7571         an elcpp::Ehdr as parameter.  Adjust call to set_target.
7572         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
7573         an elfcpp::Ehdr as parameter.
7574         * object.cc (Object::set_target): Remove the version that looks up
7575         a target and sets it.
7576         (Sized_relobj::setup): Take a Target object instead of
7577         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
7578         (make_elf_sized_object): Find target and ask target to
7579         make an ELF object.
7580         * object.h: (Object::set_target): Remove the version that looks up
7581         a target and sets it.
7582         (Sized_relobj::setup): Take a Target object instead of
7583         an elfcpp:Ehdr as parameter.
7584         * target.cc: Include dynobj.h.
7585         (Target::do_make_elf_object_implementation): New.
7586         (Target::do_make_elf_object): New.
7587         * target.h (Target::make_elf_object): New template declaration.
7588         (Target::do_make_elf_object): New method declarations.
7589         (Target::do_make_elf_object_implementation): New template declaration.
7591 2009-08-14  Ian Lance Taylor  <iant@google.com>
7593         * gold.h (FUNCTION_NAME): Define.
7594         (gold_unreachable): Use FUNCTION_NAME.
7596 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
7598         * icf.cc (Icf::find_identical_sections): Issue a warning when a
7599         symbol in the --keep-unique list is not found.
7601 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
7603         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
7604         been maked as --keep-unique.
7605         (Icf::unfold_section): New function.
7606         * icf.h (Icf::unfold_section): New function.
7607         * options.h (General_options::keep_unique): New option.
7608         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
7609         * testsuite/Makefile.in: Regenerate.
7610         * testsuite/icf_keep_unique_test.sh: New file.
7611         * testsuite/icf_keep_unique_test.cc: New file.
7613 2009-08-12  Cary Coutant  <ccoutant@google.com>
7615         PR 10471
7616         * resolve.cc (Symbol_table::resolve): Check for references from
7617         dynamic objects to hidden and internal symbols.
7618         * testsuite/Makefile.am (hidden_test.sh): New test.
7619         * testsuite/Makefile.in: Regenerate.
7620         * testsuite/hidden_test.sh: New script.
7621         * testsuite/hidden_test_1.c: New test source.
7622         * testsuite/hidden_test_main.c: New test source.
7624 2009-08-11  Doug Kwan  <dougkwan@google.com>
7626         * arm.cc: Update comments.
7627         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
7628         segment to locate the .ARM.exidx section if present.
7630 2009-08-09  Doug Kwan  <dougkwan@google.com>
7632         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
7633         patch.
7635 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
7636         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
7637         compiler warnings.
7639 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
7641         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
7642         valid tls_segment only for non-debug-section relocations.
7643         * testsuite/Makefile.am: Add gc_tls_test.
7644         * testsuite/Makefile.in: Regenerate.
7645         * testsuite/gc_tls_test.cc: New file.
7646         * testsuite/gc_tls_test.sh: New file.
7648 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
7650         * icf.cc: New file.
7651         * icf.h: New file.
7652         * Makefile.am (CCFILES): Add icf.cc.
7653         (HFILES): Add icf.h
7654         * Makefile.in: Regenerate.
7655         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
7656         * gc.h (gc_process_relocs): Populate lists used by icf to contain
7657         section, symbol and addend information for the relocs.
7658         * gold.cc (queue_middle_tasks): Call identical code folding.
7659         * gold.h: Add defines for multimap.
7660         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
7661         to the call of finalize_local_symbols.
7662         * main.cc (main): Create object of class Icf.
7663         * object.cc (Sized_relobj::do_layout): Allow this function to be
7664         called twice during icf.
7665         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
7666         to sections marked as identical by icf.
7667         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
7668         when available.
7669         (Sized_relobj::do_section_entsize): New function.
7670         * object.h (Object::section_entsize): New function.
7671         (Object::do_section_entsize): New pure virtual function.
7672         (Relobj::finalize_local_symbols): Add new parameter.
7673         (Relobj::do_section_entsize): New function.
7674         * options.h (General_options::icf): New option.
7675         (General_options::icf_iterations): New option.
7676         (General_options::print_icf_sections): New option.
7677         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
7678         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
7679         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
7680         icf.
7681         * symtab.cc (Symbol_table::is_section_folded): New function.
7682         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
7683         to sections marked as identical by icf.
7684         * symtab.h (Symbol_table::set_icf): New function.
7685         (Symbol_table::icf): New function.
7686         (Symbol_table::is_section_folded): New function.
7687         (Symbol_table::icf_): New data member.
7688         * target-reloc.h (relocate_section): Ignore sections folded by icf.
7689         * testsuite/Makefile.am: Add commands to build icf_test.
7690         * testsuite/Makefile.in: Regenerate.
7691         * testsuite/icf_test.sh: New file.
7692         * testsuite/icf_test.cc: New file.
7694 2009-07-24  Chris Demetriou  <cgd@google.com>
7696         * layout.cc (is_compressible_debug_section): Fix incorrect
7697         comment about compressed section names.
7699 2009-07-20  Ian Lance Taylor  <ian@airs.com>
7701         PR 10419
7702         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
7704 2009-07-16  Ian Lance Taylor  <iant@google.com>
7706         PR 10400
7707         * layout.h: #include <map>.
7708         (class Kept_section): Change from struct to class.  Add accessors
7709         and setters.  Add section size to Comdat_group mapping.  Change
7710         Comdat_group to std::map.  Add is_comdat_ field.  Add
7711         linkonce_size field in union.
7712         (class Layout): Update declaration of find_or_add_kept_section.
7713         Don't declare find_kept_object.
7714         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
7715         parameter.  Add object, shndx, is_comdat, and is_group_name
7716         parameters.  Change all callers.  Adjust for new Kept_section.
7717         (Layout::find_kept_object): Remove.
7718         * object.cc (Sized_relobj::include_section_group): Update use of
7719         Kept_section.  Rename secnum to shndx.  Only record
7720         Kept_comdat_section if sections are the same size.
7721         (Sized_relobj::include_linkonce_section): Update use of
7722         Kept_section.  Only record Kept_comdat_section if sections are the
7723         same size.  Set size of linkonce section.
7724         (Sized_relobj::map_to_kept_section): Update call to
7725         get_kept_comdat_section.
7726         * object.h (class Sized_relobj): Rename fields in
7727         Kept_comdat_section to drop trailing underscores; change object
7728         field to Relobj*.  Change Kept_comdat_section_table to store
7729         struct rather than pointer.
7730         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
7731         Add kept_object and kept_shndx parameters.  Change all callers.
7732         (Sized_relobj::get_kept_comdat_section): Change return type to
7733         bool.  Add kept_object and kept_shndx parameters.  Change all
7734         callers.
7735         * plugin.cc (Pluginobj::include_comdat_group): Update call to
7736         Layout::find_or_add_kept_section.
7738 2009-07-09  Ian Lance Taylor  <iant@google.com>
7740         * merge.cc (Object_merge_map::initialize_input_to_output_map):
7741         Reserve space in the hash table.
7743 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
7745         * fileread.cc (File_read::get_mtime): New method.
7746         * fileread.h (Timespec): New structure.
7747         (File_read::get_mtime): New method.
7748         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
7749         Renamed from timestamp_nsec.
7750         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
7751         Elf_Xword.
7752         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
7753         timestamp_nsec.
7754         (Incremental_inputs::report_archive): Save mtime; style fix.
7755         (Incremental_inputs::report_obejct): Save mtime; style fix.
7756         (Incremental_inputs::report_script): Save mtime; style fix.
7757         (Incremental_inputs::finalize_inputs): Style fix.
7758         (Incremental_inputs::finalize): Style fix.
7759         (Incremental_inputs::create_input_section_data): Store inputs
7760         mtime.
7761         * incremental.h (Incremental_inputs::report_script): Add mtime
7762         argument.
7763         (Incremental_inputs::Input_info::Input_info): Intialize only one
7764         union member.
7765         (Incremental_inputs::Input_info::archive): Move to nameless
7766         union.
7767         (Incremental_inputs::Input_info::obejct): Move to nameless union.
7768         (Incremental_inputs::Input_info::script): Move to nameless union.
7769         (Incremental_inputs::mtime): New field.
7770         * script.cc (read_input_script): Pass file mtime to
7771         Incremental_input.
7772         * script.h (Script_info::inputs): Style fix.
7774 2009-07-01  Ian Lance Taylor  <ian@airs.com>
7776         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
7777         instead of 32.
7779 2009-06-24  Ian Lance Taylor  <iant@google.com>
7781         PR 10156
7782         * layout.cc (Layout::choose_output_section): If we find an
7783         existing section, update the flags.
7784         (Layout::create_notes): New function, broken out of
7785         Layout::finalize.
7786         (Layout::finalize): Don't create note sections.
7787         (Layout::create_note): Don't crash if linker script discards
7788         section.
7789         (Layout::create_gold_note): Likewise.
7790         (Layout::create_build_id): Likewise.  Don't set
7791         after_input_sections on the section.
7792         (Layout::create_executable_stack_info): Remove target parameter.
7793         Change caller.
7794         * layout.h (class Layout): Declare create_notes.  Update
7795         declaration of create_executable_stack_info.
7796         * gold.cc (queue_middle_tasks): Call create_notes.
7797         * output.cc (Output_section::update_flags_for_input_section): Move
7798         here from output.h.  If SHF_ALLOC flag is newly set, mark address
7799         invalid.
7800         * output.h (Output_data::mark_address_invalid): New function.
7801         (class Output_section): Only declare, not define,
7802         update_flags_for_input_section.  Remove set_flags.
7804 2009-06-24  Ian Lance Taylor  <iant@google.com>
7806         * script-sections.cc (Output_section_definition::
7807         set_section_addresses): Rename shadowing local load_address to
7808         laddr.
7810 2009-06-24  Ian Lance Taylor  <iant@google.com>
7812         PR 10244
7813         * reloc.cc (relocate_sections): Skip empty relocation sections.
7815 2009-06-23  Ian Lance Taylor  <iant@google.com>
7817         PR 10156
7818         * layout.cc (Layout::create_note): Use choose_output_section
7819         rather than make_output_section.
7821 2009-06-23  Ian Lance Taylor  <iant@google.com>
7823         PR 10237
7824         * options.cc (General_options::parse_V): Set printed_version_.
7825         (General_options::General_options): Initialize printed_version_.
7826         * options.h (class General_options): Add printed_version_ field.
7827         * gold.cc (queue_initial_tasks): If there are no input files,
7828         don't give a fatal error if we printed the version information.
7829         (queue_middle_tasks): If using -r with a shared object, give a
7830         fatal error rather than an ordinary error.
7832 2009-06-23  Ian Lance Taylor  <iant@google.com>
7834         PR 10219
7835         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
7836         (Layout::make_output_section): Set have_stabstr_section_ if we see
7837         a .stab*str section.
7838         (Layout::finalize): Call link_stabs_sections.
7839         (Layout::link_stabs_sections): New file.
7840         * layout.h (class Layout): Add have_stabstr_section_ field.
7841         Declare link_stabs_sections.
7843 2009-06-23  Doug Kwan  <dougkwan@google.com>
7845         * Makefile.am (libgold_a_LIBADD): New.
7846         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
7847         * Makefile.in: Regenerate.
7848         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
7849         * configure: Regenerate.
7850         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
7851         * fileread.cc: Include sys/state.h
7852         * gold.h: Declare memmem and strndup if found missing.
7853         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
7855 2009-06-23  Ian Lance Taylor  <iant@google.com>
7857         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
7858         * configure: Rebuild.
7860 2009-06-23  Ian Lance Taylor  <iant@google.com>
7862         PR 10147
7863         * object.cc (Object::section_contents): Don't try to get a view if
7864         the section has length zero.
7865         (Object::handle_gnu_warning_section): If the section is empty, use
7866         the name of the section as the warning.
7868 2009-06-23  Ian Lance Taylor  <iant@google.com>
7870         PR 10133
7871         * stringpool.h (class Stringpool_template): Add optimize_ field.
7872         (Stringpool_template::set_optimize): New function.
7873         * stringpool.cc (Stringpool_template::Stringpool_template):
7874         Initialize optimize_ field.
7875         (Stringpool_template::set_string_offsets): Test local optimize
7876         fild rather than parameter.
7877         * layout.cc (Layout::Layout): Call set_optimize on the section
7878         name stringpool.
7880 2009-06-22  Ian Lance Taylor  <iant@google.com>
7882         PR 10030
7883         * yyscript.y: Parse TARGET.
7884         * script.cc (script_set_target): New function.
7885         * script-c.h (script_set_target): Declare.
7886         * options.cc (General_options::string_to_object_format): Rename
7887         from string_to_object_format in anonymous namespace.  Change
7888         callers.
7889         * options.h (class General_options): Declare
7890         string_to_object_format.
7892 2009-06-22  Ian Lance Taylor  <iant@google.com>
7894         * script-sections.cc (Script_sections::create_segments): Don't put
7895         program headers in a PT_LOAD segment if -n or -N.
7897 2009-06-22  Ian Lance Taylor  <iant@google.com>
7899         PR 10141
7900         * options.h (class General_options): Add -z lazy and -z now.  Sort
7901         -z options into alphabetical order.
7902         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
7904 2009-06-21  Ian Lance Taylor  <iant@google.com>
7906         * layout.cc (Layout::make_output_section): Call
7907         Target::new_output_section.
7908         (Layout::attach_allocated_section_to_segment): Put large section
7909         sections in a separate load segment with the large segment flag
7910         set.
7911         (Layout::segment_precedes): Sort large data segments after other
7912         load segments.
7913         (align_file_offset): New static function.
7914         (Layout::set_segment_offsets): Use align_file_offset.
7915         * output.h (class Output_section): Add is_small_section_ and
7916         is_large_section_ fields.
7917         (Output_section::is_small_section): New function.
7918         (Output_section::set_is_small_section):  New function.
7919         (Output_section::is_large_section): New function.
7920         (Output_section::set_is_large_section): New function.
7921         (Output_section::is_large_data_section): New function.
7922         (class Output_segment): Add is_large_data_segment_ field.
7923         (Output_segment::is_large_data_segment): New function.
7924         (Output_segment::set_is_large_data_segment): New function.
7925         * output.cc (Output_section::Output_section): Initialize new
7926         fields.
7927         (Output_segment::Output_segment): Likewise.
7928         (Output_segment::add_output_section): Add assertion that large
7929         data sections always go in large data segments.  Force small data
7930         sections to the end of the list of data sections.  Force small BSS
7931         sections to the start of the list of BSS sections.  For large BSS
7932         sections to the end of the list of BSS sections.
7933         * symtab.h (class Symbol): Declare is_common_shndx.
7934         (Symbol::is_defined): Check Symbol::is_common_shndx.
7935         (Symbol::is_common): Likewise.
7936         (class Symbol_table): Define enum Commons_section_type.  Update
7937         declarations.  Add small_commons_ and large_commons_ fields.
7938         * symtab.cc (Symbol::is_common_shndx): New function.
7939         (Symbol_table::Symbol_table): Initialize new fields.
7940         (Symbol_table::add_from_object): Put small and large common
7941         symbols in the right list.
7942         (Symbol_table::sized_finalized_symbol): Check
7943         Symbol::is_common_shndx.
7944         (Symbol_table::sized_write_globals): Likewise.
7945         * common.cc (Symbol_table::do_allocate_commons): Allocate new
7946         common symbol lists.  Don't call do_allocate_commons_list if the
7947         list is empty.
7948         (Symbol_table::do_allocate_commons_list): Remove is_tls
7949         parameter.  Add comons_section_type parameter.  Change all
7950         callers.  Handle small and large common symbols.
7951         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
7952         Symbol::is_common_shndx.
7953         * resolve.cc (symbol_to_bits): Likewise.
7954         * target.h (Target::small_common_shndx): New function.
7955         (Target::small_common_section_flags): New function.
7956         (Target::large_common_shndx): New function.
7957         (Target::large_common_section_flags): New function.
7958         (Target::new_output_section): New function.
7959         (Target::Target_info): Add small_common_shndx, large_common_shndx,
7960         small_common_section_flags, and large_common_section_flags
7961         fields.
7962         (Target::do_new_output_section): New virtual function.
7963         * arm.cc (Target_arm::arm_info): Initialize new fields.
7964         * i386.cc (Target_i386::i386_info): Likewise.
7965         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
7966         Likewise.
7967         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
7968         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
7969         (Target_x86_64::do_new_output_section): New function.
7970         * configure.ac: Define conditional MCMODEL_MEDIUM.
7971         * testsuite/Makefile.am (check_PROGRAMS): Add large.
7972         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
7973         (large_LDFLAGS): Define.
7974         * testsuite/large.c: New file.
7975         * testsuite/testfile.cc (Target_test::test_target_info):
7976         Initialize new fields.
7977         * configure, testsuite/Makefile.in: Rebuild.
7979 2009-06-05  Doug Kwan  <dougkwan@google.com>
7981         * Makefile.am (CCFILES): Add target.cc.
7982         * Makefile.in: Regenerate.
7983         * i386.cc (class Target_i386): Define new virtual method to
7984         override do_is_local_label_name in parent.
7985         * object.cc (Sized_relobj::do_count_local_symbols): Discard
7986         local symbols if --discard-locals or -X is given.
7987         * options.h (class General_options): Declare new options
7988         '--discard-locals' and '-X' for discarding locals.
7989         * target.h (class Target): Define new methods is_local_label_name.
7990         Declare new virtual method do_is_local_label_name.
7991         * target.cc: New file.
7992         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
7993         (check_SCRIPTS): Add discard_locals_test.sh.
7994         (check_DATA): Add discard_local_tests.syms.
7995         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
7996         (discard_local_tests.syms, discard_locals_test.o): New make rules.
7997         * testsuite/Makefile.in: Regenerate.
7998         * testsuite/discard_locals_test.c: New file.
7999         * testsuite/discard_locals_test.sh: Same.
8001 2009-06-05  Doug Kwan  <dougkwan@google.com>
8003         * object.cc (Sized_relobj::Sized_relobj): Initialize
8004         discarded_eh_frame_shndx_ to -1U.
8005         (Sized_relobj::do_layout): Record index of a discard .eh_frame
8006         section.
8007         (Sized_relobj::do_count_local_symbols): Skip local symbols in
8008         a discarded .eh_frame section.
8009         (Sized_relobj::do_finalize_local_symbols): Ditto.
8010         * object.h (class Sized_relobj): Declare new member
8011         discarded_eh_frame_shndx_.
8012         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
8013         (local_labels_test.o, local_labels_test): New rules.
8014         * testsuite/Makefile.in: Regenerate.
8016 2009-06-04  Doug Kwan  <dougkwan@google.com>
8018         * layout.cc (Layout::section_name_mapping): Add mapping for
8019         special ARM sections.
8021 2009-06-03  Doug Kwan  <dougkwan@google.com>
8023         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
8024         (utils::has_overflow): Same.
8026 2009-06-03  Ian Lance Taylor  <iant@google.com>
8028         * layout.cc (Layout::section_name_mapping): New array, replacing
8029         Layout::linkonce_mapping.
8030         (Layout::section_name_mapping_count): New variable, replacing
8031         Layout::linkonce_mapping_count.
8032         (Layout::linkonce_output_name): Remove.
8033         (Layout::output_section_name): Rewrite.
8034         * layout.h (class Layout): Rename Linkonce_mapping to
8035         Section_name_mapping, linkonce_mapping to section_name_mapping,
8036         linkonce_mapping_count to section_name_mapping_count.  Don't
8037         declare linkonce_output_name.
8039 2009-06-03  Doug Kwan  <dougkwan@google.com>
8041         * gold/arm.cc (namespace utils): New.
8042         (Target_arm::reloc_is_non_pic): Define new method.
8043         (class Arm_relocate_functions): New.
8044         (Target_arm::Relocate::relocate): Handle relocation types used by
8045         Android.
8047 2009-06-03  Ian Lance Taylor  <iant@google.com>
8049         * arm.cc (Target_arm::scan::global): Use || instead of |.
8051 2009-06-02  Doug Kwan  <dougkwan@google.com>
8053         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
8054         issued_non_pic_error_.
8055         (class Target_arm::Scan): Declare new method check_non_pic.
8056         Define new method symbol_needs_plt_entry.
8057         Declare new data member issued_non_pic_error_.
8058         (class Target_arm::Relocate): Declare new method
8059         should_apply_static_reloc.
8060         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
8061         (Target_arm::Scan::check_non_pic): Define new method.
8062         (Target_arm::Scan::local): Handle a small subset of reloc types used
8063         by Android.
8064         (Target_arm::Scan::local): Same.
8065         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
8067 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
8069         * incremental.cc (Incremental_inputs::report_command_line): Filter
8070         out --incremental-* options.
8072 2009-05-29  Doug Kwan  <dougkwan@google.com>
8074         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
8075         template class.
8076         (class Target_arm): Update comment.
8077         (Target_arm::Target_arm): Initialize new data members GOT_,
8078         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
8079         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
8080         and Target_arm::rel_dyn_section.
8081         Declare new_enum Target_arm::Got_type.
8082         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
8083         and DYNBSS_.
8084         Update commments for member do_dynsym_value.
8085         (Target_arm::got_size, Target_arm::plt_section,
8086         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
8087         new methods inside class defintion.
8088         (Target_arm::got_section): Define new method.
8089         (Target_arm::rel_dyn_section): Same.
8090         (Output_data_plt_arm): New template class.
8091         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
8092         (Output_data_plt_arm:do_adjust_output_section): Define new method.
8093         (Output_data_plt_arm::add_entry): Same.
8094         (Output_data_plt_arm::first_plt_entry): Define new
8095         static data member for PLT instruction template.
8096         (Output_data_plt_arm::plt_entry): Same.
8097         (Output_data_plt_arm::do_write): Define new method.
8098         (Target_arm::make_plt_entry): Same.
8099         (Target_arm::do_finalize_sections): Same.
8100         (Target_arm::do_dynsym_value): Same.
8102 2009-05-28  Doug Kwan  <dougkwan@google.com>
8104         * Makefile.am (TARGETSOURCES): Add arm.cc.
8105         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
8106         * Makefile.in: Regenerate.
8107         * arm.cc: New file.
8108         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
8110 2009-05-26  Doug Kwan  <dougkwan@google.com>
8112         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
8113         (General_options::check_excluded_libs): Strip off directories in
8114         archive name before matching like GNU ld does.
8115         * testsuite/Makefile.am (MOSTLYCLEANFILES,
8116         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
8117         (exclude_libs_test_LDFLAGS): Add linker option
8118         -Wl,--exclude-libs,libexclude_libs_test_3
8119         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
8120         an explicit archive without using -l.
8121         (alt/libexclude_libs_test_3.a): New make rule.
8122         * testsuite/Makefile.in: Regenerate.
8123         * testsuite/exclude_libs_test.c : Declare lib3_default().
8124         (main): Call it.
8125         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
8126         * exclude_libs_test_3.c: New file.
8128 2009-05-26  Nick Clifton  <nickc@redhat.com>
8130         * po/id.po: New Indonesian translation.
8131         * po/gold.pot: Updated template file.
8133 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
8135         * testsuite/Makefile.am: Add -ffunction-sections to compile
8136         gc_comdat_test files.  Add -Wl,--gc-sections to build
8137         gc_comdat_test.
8138         * testsuite/Makefile.in: Regenerate.
8139         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
8141 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
8143         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
8144         kept comdat section was garbage collected.
8145         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
8146         * testsuite/Makefile.in: Regenerate.
8147         * testsuite/gc_comdat_test.sh: New file.
8148         * testsuite/gc_comdat_test_1.cc: New file.
8149         * testsuite/gc_comdat_test_2.cc: New file.
8151 2009-05-19  Doug Kwan  <dougkwan@google.com>
8153         * archive.cc (Archive::Archive): Move constructor from archive.h
8154         to here.  Initialize no_export_.
8155         (Archive::get_elf_object_for_member): Set no_export flag of object.
8156         * archive.h (Archive::Archive): Move constructor body to
8157         archive.cc.
8158         (Archive::no_export): New method.
8159         (Archive::no_export_): New field.
8160         * object.h (Object::Object): Initialize no_export_ to false.
8161         (Object::no_export, Object::set_no_export): New methods.
8162         (Object::no_export_): New field.
8163         * options.cc (General_options::parse_exclude_libs): New method.
8164         (General_options::check_excluded_libs) Same.
8165         * options.h (exclude_libs): New option.
8166         (General_options::check_excluded_libs): New method declaration.
8167         (General_options::excluded_libs_): New field.
8168         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
8169         default or protected visibility if an object has no-export flag set.
8170         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
8171         (check_SCRIPTS): Add exclude_libs_test.sh.
8172         (check_DATA): Add exclude_libs_test.syms.
8173         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
8174         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
8175         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
8176         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
8177         (exclude_libs_test.syms, libexclude_libs_test_1.a,
8178         libexclude_libs_test_2.a): New rules.
8179         * testsuite/Makefile.in: Regenerate.
8180         * testsuite/exclude_libs_test.c: New file.
8181         * testsuite/exclude_libs_test.sh: Ditto.
8182         * testsuite/exclude_libs_test_1.c: Ditto.
8183         * testsuite/exclude_libs_test_2.c: Ditto.
8185 2009-05-15  Ian Lance Taylor  <iant@google.com>
8187         * configure.ac: Check for declarations for cases where libiberty.h
8188         checks HAVE_DECL_xxx.
8189         * configure, config.in: Rebuild.
8191 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
8193         * gold.h (Incremental_argument_list): Remove (invalid) forward
8194         declaration.
8195         * incremental.cc (Incremental_inputs::report_achive): New method.
8196         (Incremental_inputs::report_object): New method.
8197         (Incremental_inputs::report_script): New method.
8198         (Incremental_inputs::finalize_inputs): New method.
8199         (Incremental_inputs::finalize): Call finalize_inputs().
8200         (Incremental_inputs::sized_create_incremental_inputs_section_data):
8201         Create inputs entries.
8202         * incremental.h (Incremental_input_type): New enum.
8203         (Incremental_inputs::Incremental_input): Initialize new fields.
8204         (Incremental_inputs::report_inputs): New method.
8205         (Incremental_inputs::report_achive): New method.
8206         (Incremental_inputs::report_object): New method.
8207         (Incremental_inputs::report_script): New method.
8208         (Incremental_inputs::finalize_inputs): New method.
8209         (Incremental_inputs::Input_info): New struct.
8210         (Incremental_inputs::Input_info_map): New typedef.
8211         (Incremental_inputs::lock_): New field.
8212         (Incremental_inputs::Inputs_): New field.
8213         (Incremental_inputs::Inputs_map): New field.
8214         * main.cc (main): Call Incremental_input::report_inputs.
8215         * options.h (Input_argument_list): Typedef moved from
8216         Input_arguments.
8217         (Input_file_group::Files): Remove, use ::Input_argument_list.
8218         (Input_file_group::Input_argument_list): Remove, use
8219         ::Input_argument_list.
8220         * plugin.cc (Plugin_manager::add_input_file): Add error in
8221         incremental build.
8222         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
8223         functions.
8224         * script.cc (read_input_script): Call
8225         Incremental_input::report_script.
8226         * script.h (Script_info): New class.
8228 2009-04-27  Ian Lance Taylor  <iant@google.com>
8230         * x86_64.cc (do_adjust_output_section): Set entsize to
8231         plt_entry_size.
8233 2009-04-23  Elliott Hughes  <enh@google.com>
8235         * output.cc (Output_file::close): After short writes, continue
8236         writing from the correct offset in the buffer being written.
8238 2009-04-23  Chris Demetriou  <cgd@google.com>
8240         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
8241         * configure: Regenerate.
8242         * config.in: Regenerate.
8243         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
8244         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
8246 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
8248         * incremental.cc (Incremental_inputs_header_data): Renamed from
8249         Incremental_input_header_data.
8250         (Incremental_inputs_header_data::data_size): New field.
8251         (Incremental_inputs_header_data::put_input_file_count): Renamed
8252         from input_file_count.
8253         (Incremental_inputs_header_data::put_command_line_offset): Renamed
8254         from command_line_offset.
8255         (Incremental_inputs_header_data::put_reserved): Renamed from
8256         put_reserved.
8257         (Incremental_inputs_entry_data): Renamed from
8258         Incremental_input_entry_data.
8259         (Incremental_inputs_entry_data::data_size): New field.
8260         (Incremental_inputs::report_command_line): New method.
8261         (Incremental_inputs::finalize): New method.
8262         (Incremental_inputs::create_incremental_inputs_data): New method.
8263         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
8264         * incremental.h: New file.
8265         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
8266        (Layout::finalize): Create incremental inputs section in
8267         incremental builds.
8268        (Layout::create_incremental_info_sections): New method.
8269         * layout.h (Layout::incremental_inputs): New method.
8270        (Layout::create_incremental_info_sections): New method.
8271        (Layout::incremental_inputs_): New field.
8272         * main.cc (main): Notify Incremental_input of the command line.
8274 2009-04-01  Ian Lance Taylor  <iant@google.com>
8275             Mikolaj Zalewski  <mikolajz@google.com>
8277         * gold.h (reserve_unordered_map): Define, three versions, one for
8278         each version of Unordered_map.
8279         * layout.cc (Layout::Layout): Remove options parameter.  Add
8280         number_of_input_files parameter.  Don't initialize options_.
8281         Initialize number_of_input_files_ and resized_signatures_.  Move
8282         sections_are_attached_.
8283         (Layout::layout_group): Reserve space for group_signatures_.
8284         (Layout::find_or_add_kept_section): Change name parameter to be a
8285         reference.  Resize signatures_ map when it gets large enough.
8286         (Layout::layout_eh_frame): Use parameters->options() instead of
8287         this->options_.
8288         (Layout::make_output_section): Likewise.
8289         (Layout::attach_allocated_section_to_segment): Likewise.
8290         (Layout::finalize, Layout::create_executable_stack): Likewise.
8291         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
8292         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
8293         * layout.h (class Layout): Update declarations.  Remove options_
8294         field.  Add number_of_input_files_ and resized_signatures_
8295         fields.  Move sections_are_attached_ field.
8296         * main.cc (main): Pass number of input files to Layout
8297         constructor.  Don't pass options.
8299 2009-03-30  Ian Lance Taylor  <iant@google.com>
8301         * ffsll.c (ffsll): Correct implementation.
8303 2009-03-27  Ian Lance Taylor  <iant@google.com>
8305         * ffsll.c: New file.
8306         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
8307         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
8308         * ftruncate.c (ftruncate): Declare before definition.
8309         * mremap.c (mremap): Likewise.
8310         * pread.c (pread): Likewise.
8311         * configure, Makefile.in, config.in: Rebuild.
8313         * mremap.c: New file.
8314         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
8315         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
8316         (mremap): Declare if HAVE_MREMAP is not defined.
8317         * configure, Makefile.in, config.in: Rebuild.
8319 2009-03-27  Cary Coutant  <ccoutant@google.com>
8321         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
8322         position independent.
8323         * sparc.cc (Target_sparc::check_non_pic): Likewise.
8324         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
8326 2009-03-24  Cary Coutant  <ccoutant@google.com>
8328         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
8329         an executable.
8330         (needs_dynamic_reloc): Likewise.
8332 2009-03-24  Ian Lance Taylor  <iant@google.com>
8334         * yyscript.y (file_cmd): Recognize EXTERN.
8335         (extern_name_list, extern_name_list_body): New nonterminals.
8336         * script.cc (script_add_extern): Define.
8337         * script-c.h (script_add_extern): Declare.
8339 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
8341         * object.cc (is_elf_object): Define.
8342         * object.h (is_elf_object): Declare.
8343         * archive.cc (Archive::get_elf_object_for_member): Call
8344         is_elf_object.
8345         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
8347 2009-03-24  Elliott Hughes  <enh@google.com>
8349         * output.cc (Output_file::map_anonymous): Define.
8350         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
8351         try an anonymous one.  Report the size if the mmap fails.
8352         * output.h (class Output_file): Declare map_anonymous.
8354 2009-03-24  Ian Lance Taylor  <iant@google.com>
8356         * target-select.cc (instantiate_target): Don't acquire the lock if
8357         the instantiated_target_ field has already been set.
8359 2009-03-23  Ian Lance Taylor  <iant@google.com>
8361         * gold-threads.h (class Initialize_lock): Define.
8362         * gold-threads.cc (class Initialize_lock_once): Define.
8363         (initialize_lock_control): New static variable.
8364         (initialize_lock_pointer): New static variable.
8365         (initialize_lock_once): New static function.
8366         (Initialize_lock::Initialize_lock): Define.
8367         (Initialize_lock::initialize): Define.
8368         * target-select.h: Include "gold-threads.h".
8369         (class Target_selector): Add lock_ and initialize_lock_ fields.
8370         Don't define instantiate_target, just declare it.
8371         * target-select.cc (Target_selector::Target_selector): Initialize
8372         new fields.
8373         (Target_selector::instantiate_target): Define.
8374         * descriptors.h: Include "gold-threads.h".
8375         (class Descriptors): Add initialize_lock_ field.
8376         * descriptors.cc (Descriptors::Descriptors): Initialize new
8377         field.
8378         (Descriptors::open): Use initialize_lock_ field
8379         * errors.h (class Errors): Add initialize_lock_ field.
8380         * errors.cc (Errors::Errors): Initialize new field.
8381         (Errors::initialize_lock): Use initialize_lock_ field.
8382         * powerpc.cc (class Target_selector_powerpc): Remove
8383         instantiated_target_ field.  In do_recognize call
8384         instantiate_target rather than do_instantiate_target.  In
8385         do_instantiate_target just allocate a new target.
8386         * sparc.cc (class Target_selector_sparc): Likewise.
8388         * freebsd.h: New file.
8389         * i386.cc: Include "freebsd.h".
8390         (Target_i386): Derive from Target_freebsd rather than
8391         Sized_target.
8392         (Target_selector_i386): Derive from Target_selector_freebsd rather
8393         than Target_selector.
8394         * x86_64.cc: Include "freebsd.h".
8395         (Target_x86_64): Derive from Target_freebsd rather than
8396         Sized_target.
8397         (Target_selector_x86_64): Derive from Target_selector_freebsd
8398         rather than Target_selector.
8399         * target.h (class Target): Add adjust_elf_header and
8400         do_adjust_elf_header.
8401         * output.cc (Output_file_header:: do_sized_write): Call target
8402         adjust_elf_header routine.
8403         * configure.tgt: Set targ_osabi.
8404         * configure.ac: Define GOLD_DEFAULT_OSABI.
8405         * parameters.cc (Parameters::default_target): Pass
8406         GOLD_DEFAULT_OSABI to select_target.
8407         * target-select.h (class Target_selector): Make instantiate_target
8408         protected rather than private.
8409         * Makefile.am (HFILES): Add freebsd.h.
8410         * configure, Makefile.in, config.in: Rebuild.
8412         * merge.cc (do_add_input_section): Correct pend value.  Change
8413         message about last entry not being null terminated from error to
8414         warning.
8416 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
8418         * incremental.cc: New file.
8419         * Makefile.am (CCFILES): Add incremental.cc.
8420         * Makefile.in: Rebuild.
8422 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
8424         * layout.cc (Layout::output_section_name): Preserve names
8425         of '.note.' sections.
8427 2009-03-19  Ian Lance Taylor  <iant@google.com>
8429         * descriptors.cc (Descriptors::open): Check that the options are
8430         valid before using them.
8432 2009-03-18  Ian Lance Taylor  <iant@google.com>
8434         * script-sections.h: Include <list>.
8435         (class Script_sections): Change Sections_elements from std::vector
8436         to std::list.  Typedef public Elements_iterator.  Add
8437         orphan_section_placement_, data_segment_align_start_, and
8438         saw_data_segment_align_ fields.  Remove data_segment_align_index_
8439         field.
8440         * script-sections.cc (class Orphan_section_placement): New class.
8441         (class Sections_element): Add virtual functions is_relro and
8442         orphan_section_init.  Remove virtual function place_orphan_here.
8443         (class Output_section_definition): Add is_relro and
8444         orphan_section_init.  Remove place_orphan_here.
8445         (class Orphan_output_section): Likewise.
8446         (Script_sections::Script_sections): Update for field changes.
8447         (Script_sections::data_segment_align): Set saw_data_segment_align_
8448         and data_segment_align_start_, not data_segment_align_index.
8449         (Script_sections::data_segment_relro_end): Check
8450         saw_data_segment_align_.  Use data_segment_align_start_ rather
8451         than data_segment_align_index_.
8452         (Script_sections::place_orphan): Rewrite to use
8453         Orphan_section_placement.
8455 2009-03-17  Ian Lance Taylor  <iant@google.com>
8457         * archive.cc (Archive::add_symbols): Check for a version attached
8458         to the symbol name in the archive map.
8459         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
8460         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
8461         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
8462         (ver_test_11.a): New target.
8463         * testsuite/Makefile.in: Rebuild.
8465         * configure.ac: Check for chsize and posix_fallocate.  Replace
8466         ftruncate.
8467         * ftruncate.c: New file, from gnulib.
8468         * output.cc (posix_fallocate): Define dummy version if not
8469         HAVE_POSIX_FALLOCATE.
8470         (Output_file::map): Call posix_fallocate rather than lseek and
8471         write.
8472         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
8473         * configure, Makefile.in, config.in: Rebuild.
8475 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
8477         * layout.h (Layout::create_note): Add section_name parameter.
8478         * layout.cc (Layout::create_note): Likewise.
8479         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
8481 2009-03-17  Ian Lance Taylor  <iant@google.com>
8483         * descriptors.cc: Include "options.h".
8484         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
8485         (Descriptors::open): Always use O_CLOEXEC when opening a new
8486         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
8487         then set FD_CLOEXEC.
8489         * sparc.cc (class Target_sparc): Add has_got_section.
8490         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
8491         make sure we have a GOT section.
8493         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
8494         (Target_sparc::Scan::local): Likewise.
8495         (Target_sparc::Scan::global): Likewise.
8496         (Target_sparc::Relocate::relocate): Likewise.
8497         (Target_sparc::Relocate::relocate_tls): Likewise.
8499         * symtab.cc (Symbol_table::define_default_version): New function,
8500         broken out of add_from_object.
8501         (Symbol_table::add_from_object): Call define_default_version.
8502         (Symbol_table::define_special_symbol): Add resolve_oldsym
8503         parameter.  Change all callers.  If the version for a symbol comes
8504         from a version script, resolve it with the symbol with the same
8505         name with no version.  Also add the symbol without a version if
8506         appropriate.
8507         (do_define_in_output_data): If resolving with oldsym, don't delete
8508         sym.
8509         (do_define_in_output_segment): Likewise.
8510         (do_define_as_constant): Likewise.
8511         * symtab.h (class Symbol_table): Update declarations.
8513 2009-03-13  Ian Lance Taylor  <iant@google.com>
8515         * readsyms.cc (Read_symbols::incompatible_warning): New function.
8516         (Read_symbols::requeue): New function.
8517         (Read_symbols::do_read_symbols): If make_elf_object fails because
8518         the target type is not configured, and the file was searched for,
8519         issue a warning and retry with the next directory.
8520         (Add_symbols::run): If the file has an incompatible format, and
8521         it was searched for, requeue the Read_symbols task.  On error,
8522         release the object.
8523         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
8524         dirindex parameter to constructor.  Change all callers.  Declare
8525         incompatible_warning and requeue.
8526         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
8527         input_argument_ and input_group_ fields.  Add them to
8528         constructor.  Change all callers.
8529         (class Read_script): Add dirindex_ field.  Add it to constructor.
8530         Change all callers.
8531         * archive.cc (Archive::setup): Remove input_objects parameter.
8532         Change all callers.
8533         (Archive::get_file_and_offset): Likewise.
8534         (Archive::read_all_symbols): Likewise.
8535         (Archive::read_symbols): Likewise.
8536         (Archive::get_elf_object_for_member): Remove input_objects
8537         parameter.  Add punconfigured parameter.  Change all callers.
8538         (Archive::add_symbols): Change return type to bool.  Check return
8539         value of include_member.
8540         (Archive::include_all_members): Likewise.
8541         (Archive::include_member): Change return type to bool.  Return
8542         false if first included object has incompatible target.  Set
8543         included_member_ field.
8544         (Add_archive_symbols::run): If add_symbols returns false, requeue
8545         Read_symbols task.
8546         * archive.h (class Archive): Add included_member_ field.
8547         Initialize it in constructor.  Add input_file and searched_for
8548         methods.  Update declarations.
8549         (class Add_archive_symbols): Add dirpath_, dirindex_, and
8550         input_argument_ fields.  Add them to constructor.  Change all
8551         callers.
8552         * script.cc: Include "target-select.h".
8553         (class Parser_closure): Add skip_on_incompatible_target_ and
8554         found_incompatible_target_ fields.  Add
8555         skip_on_incompatible_target parameter to constructor.  Change all
8556         callers.  Add methods skip_on_incompatible_target,
8557         clear_skip_on_incompatible_target, found_incompatible_target, and
8558         set_found_incompatible_target.
8559         (read_input_script): Add dirindex parameter.  Change all callers.
8560         If parser finds an incompatible target, requeue Read_symbols
8561         task.
8562         (script_set_symbol): Clear skip_on_incompatible_target in
8563         closure.
8564         (script_add_assertion, script_parse_option): Likewise.
8565         (script_start_sections, script_add_phdr): Likewise.
8566         (script_check_output_format): New function.
8567         * script.h (read_input_script): Update declaration.
8568         * script-c.h (script_check_output_format): Declare.
8569         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
8570         (ignore_cmd): Remove OUTPUT_FORMAT.
8571         * fileread.cc (Input_file::Input_file): Add explicit this.
8572         (Input_file::will_search_for): New function.
8573         (Input_file::open): Add pindex parameter.  Change all callers.
8574         * fileread.h (class Input_file): Add input_file_argument method.
8575         Declare will_search_for.  Update declarations.
8576         * object.cc (make_elf_object): Add punconfigured parameter.
8577         Change all callers.
8578         * object.h (class Object): Make input_file public.  Add
8579         searched_for method.
8580         (make_elf_object): Update declaration.
8581         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
8582         restart search.
8583         * dirsearch.h (class Dirsearch): Update declaration.
8584         * options.h (class General_options): Add --warn-search-mismatch.
8585         * parameters.cc (Parameters::is_compatible_target): New function.
8586         * parameters.h (class Parameters): Declare is_compatible_target.
8587         * workqueue.cc (Workqueue::add_blocker): New function.
8588         * workqueue.h (class Workqueue): Declare add_blocker.
8590         * fileread.cc (Input_file::open): Remove options parameter.
8591         Change all callers.
8592         (Input_file::open_binary): Likewise.
8593         * script.cc (read_input_script): Likewise.
8594         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
8595         options parameter from constructor.  Change all callers.
8596         (class Read_script): Likewise.
8597         * fileread.h (class Input_file): Update declarations.
8598         * script.h (read_input_script): Update declaration.
8600 2009-03-10  Nick Clifton  <nickc@redhat.com>
8602         * po/es.po: New Spanish translation.
8604 2009-03-06  Cary Coutant  <ccoutant@google.com>
8606         * options.cc (parse_short_option): Keep dash_z from registering itself.
8608 2009-03-03  Ian Lance Taylor  <iant@google.com>
8610         PR 9918
8611         * target-reloc.h (relocate_section): Pass output_section to
8612         relocate.
8613         * i386.cc (Target_i386::should_apply_static_reloc): Add
8614         output_section parameter.  Change all callers.
8615         (Target_i386::Relocate::relocate): Add output_section parameter.
8616         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8617         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
8618         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
8619         * testsuite/two_file_shared.sh: New script.
8620         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
8621         (check_DATA): Add two_file_shared.dbg.
8622         (two_file_shared.dbg): New target.
8623         * testsuite/Makefile.in: Rebuild.
8625 2009-03-01  Ian Lance Taylor  <iant@google.com>
8627         * configure.ac: Check for byteswap.h.
8628         * configure: Rebuild.
8629         * config.in: Rebuild.
8631 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
8633         * layout.cc (Layout::find_or_add_kept_section): New function.
8634         (Layout::add_comdat): Removed.
8635         * layout.h (struct Kept_section): Move out of class Layout.
8636         Remove trailing underscores from field names.  Add group_sections
8637         field.  Rename group_ field to is_group.  Change all uses.
8638         (class Layout): Declare find_or_add_kept_section, not add_comdat.
8639         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
8640         comdat_groups_ field.
8641         (Sized_relobj::include_section_group): Use
8642         find_or_add_kept_section and Kept_section::group_sections.
8643         (Sized_relobj::include_linkonce_section): Likewise.
8644         * object.cc (class Sized_relobj): Don't define Comdat_group or
8645         Comdat_group_table.  Remove find_comdat_group and
8646         add_comdat_group.  Remove comdat_groups_ field.
8647         * plugin.cc (include_comdat_group): Use
8648         Layout::find_or_add_kept_section.
8650 2009-02-28  Ian Lance Taylor  <iant@google.com>
8652         * README: --gc-sections and map files are now supported.  Document
8653         some build requirements.
8655         PR 6992
8656         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
8657         relocatable link set the value of the section symbol to zero.
8658         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
8659         relocatable link don't include the section address in the local
8660         symbol value.
8662 2009-02-27  Ian Lance Taylor  <iant@google.com>
8664         PR 6811
8665         * options.h (class Search_directory): Add is_system_directory.
8666         (class General_options): Declare is_in_system_directory.
8667         * options.cc (get_relative_sysroot): Make static.
8668         (get_default_sysroot): Make static.
8669         (General_optoins::is_in_system_directory): New function.
8670         * fileread.cc (Input_file::is_in_system_directory): New function.
8671         * fileread.h (class Input_file): Declare is_in_system_directory.
8672         * object.h (class Object): Add is_in_system_directory.
8673         (class Input_objects): Remove system_library_directory_ field.
8674         * object.cc (Input_objects::add_object): Don't set
8675         system_library_directory_.
8676         (input_objects::found_in_system_library_directory): Remove.
8677         * symtab.cc (Symbol_table::write_globals): Remove input_objects
8678         parameter.  Change all callers.
8679         (Symbol_table::sized_write_globals): Likewise.
8680         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
8681         Call Object::is_in_system_directory.
8682         * symtab.h (class Symbol_table): Update declarations.
8684         PR 5990
8685         * descriptors.h (Open_descriptor): Add is_on_stack field.
8686         * descriptors.cc (Descriptors::open): If the descriptor is on the
8687         top of the stack, remove it.  Initialize is_on_stack field.
8688         (Descriptors::release): Only add pod to stack if it is not on the
8689         stack already.
8690         (Descriptors::close_some_descriptor): Clear stack_next and
8691         is_on_stack fields.
8693         PR 7091
8694         * output.cc (Output_section::find_starting_output_address): Rename
8695         from starting_output_address; add PADDR parameter; change return
8696         type.
8697         * output.h (class Output_section): Declare
8698         find_starting_output_address instead of starting_output_address.
8699         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
8700         section symbol for which we can't find a merge section.
8702         PR 9836
8703         * symtab.cc (Symbol_table::add_from_object): If the visibility is
8704         hidden or internal, force the symbol to be local.
8705         * resolve.cc (Symbol::override_visibility): Define.
8706         (Symbol::override_base): Use override_visibility.
8707         (Symbol_table::resolve): Likewise.
8708         (Symbol::override_base_with_special): Likewise.
8709         (Symbol_table::override_with_special): If the visibility is hidden
8710         or internal, force the symbol to be local.
8711         * symtab.h (class Symbol): Add set_visibility and
8712         override_visibility.
8713         * testsuite/ver_test_1.sh: New file.
8714         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
8715         (check_DATA): Add ver_test_1.syms.
8716         (ver_test_1.syms): New target.
8717         * testsuite/Makefile.in: Rebuild.
8719 2009-02-25  Cary Coutant  <ccoutant@google.com>
8721         * layout.cc (Layout::choose_output_section): Don't rename sections
8722         when using a linker script that has a SECTIONS clause.
8723         * Makefile.in: Regenerate.
8725         * testsuite/Makefile.am (script_test_5.sh): New test case.
8726         * testsuite/Makefile.in: Regenerate.
8727         * testsuite/script_test_5.cc: New file.
8728         * testsuite/script_test_5.sh: New file.
8729         * testsuite/script_test_5.t: New file.
8731 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
8733         * archive.cc (Archive::include_member): Update calls to add_symbols.
8734         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
8735         the Layout argument.
8736         * dynobj.h (do_add_symbols): Add the Layout argument.
8737         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
8738         Layout argument.
8739         * object.h (Object::add_symbols): Add the Layout argument.
8740         (Object::do_add_symbols): Add the Layout argument.
8741         (Sized_relobj::do_add_symbols): Add the Layout argument.
8742         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
8743         Unify the two versions.
8744         (Add_plugin_symbols): Remove.
8745         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
8746         (Sized_pluginobj::do_add_symbols): Unify the two versions.
8747         (Add_plugin_symbols): Remove.
8748         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
8749         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
8750         (Add_symbols::run): Make it work with Pulginobj.
8752 2009-02-06  Ian Lance Taylor  <iant@google.com>
8754         * object.cc (Sized_relobj::do_layout): Make info message start
8755         with lower case letter.
8757 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
8759         * binary.cc: Fix file comment.
8761         * options.h (enum Incremental_disposition): Define.
8762         (class General_options): Add new options: --incremental,
8763         --incremental_changed, --incremental_unchanged,
8764         --incremental_unknown.  Add incremental_disposition_ and
8765         implicit_incremental_ fields.
8766         (General_options::incremental_disposition): New function.
8767         (class Position_dependent_options): Add incremental_disposition
8768         option.
8769         (Position_dependent_options::copy_from_options): Set incremental
8770         dispositions.
8771         * options.cc (General_options::parse_incremental_changed): New
8772         function.
8773         (General_options::parse_incremental_unchanged): New function.
8774         (General_options::parse_incremental_unknown): New function.
8775         (General_options::General_options): Initialize new fields
8776         incremental_disposition_ and implicit_incremental_.
8777         (General_options::finalize): Check for uasge of --incremental-*
8778         without --incremental.
8780 2009-02-06  Chris Demetriou  <cgd@google.com>
8782         * gold.h (gold_undefined_symbol): Change to take only a Symbol
8783         pointer and to report location as the file name associated with
8784         the symbol.
8785         (gold_undefined_symbol_at_location): New function to replace the
8786         old gold_undefined_symbol functionality.
8787         * target-reloc.h (relocate_section): Update to use
8788         gold_undefined_symbol_at_location.
8789         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
8790         Call gold_undefined_symbol function rather than gold_error.
8791         * errors.h (Errors::undefined_symbol): Take location as a
8792         string, rather than calculating it from a relocation.
8793         * errors.cc (Errors::fatal): Print "fatal error:" before the
8794         formatted message.
8795         (Errors::error, Errors::error_at_location): Print "error: "
8796         before the formatted message.
8797         (Errors::undefined_symbol): Take location as a string, rather
8798         than calculating it from a relocation.
8799         (gold_undefined_symbol_at_location): New function akin to
8800         old gold_undefined_symbol, calculates location from relocation.
8801         (gold_undefined_symbol): Change to take only a Symbol pointer
8802         and to report location as the file name associated with the symbol.
8803         * testsuite/debug_msg.sh: Update for changed error messages.
8804         * testsuite/undef_symbol.sh: Likewise.
8806 2009-02-04  Duncan Sands  <baldrick@free.fr>
8808         PR 9812
8809         * reduced_debug_output.h
8810         (Output_reduced_debug_abbrev_section::failed): Use format for
8811         gold_warning.
8812         (Output_reduced_debug_info_section::faild): Likewise.
8814 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
8816         * script.cc (Lazy_demangler): New class.
8817         (Version_script_info::get_symbol_version_helper): Demangle a
8818         symbol only once.
8820 2009-01-29  Cary Coutant  <ccoutant@google.com>
8822         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
8823         to __tls_get_addr.
8824         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8826 2009-01-28  Ian Lance Taylor  <iant@google.com>
8828         * version.cc (version_string): Bump to 1.9.
8830         * gold.h: Include <cstring> and <stdint.h>.
8831         * version.cc: Include <cstdio>.
8832         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
8833         warning.
8834         * reduced_debug_output.cc (insert_into_vector): Rename from
8835         Insert_into_vector; change all callers.  Use Swap_unaligned to
8836         avoid aliasing issue; remove union since it is unnecessary.
8838 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
8840         * Makefile.am (CCFILES): Add gc.cc.
8841         (HFILES): Add gc.h.
8842         * Makefile.in: Regenerate.
8843         * gold.cc (Gc_runner): New class.
8844         (queue_initial_tasks): Call garbage collection related tasks
8845         when corresponding options are invoked.
8846         (queue_middle_gc_tasks): New function.
8847         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
8848         processed early before laying out sections during garbage collection.
8849         * gold.h (queue_middle_gc_tasks): New function.
8850         (is_prefix_of): Move from "layout.cc".
8851         * i386.cc (Target_i386::gc_process_relocs): New function.
8852         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
8853         * main.cc (main): Create object of class "Garbage_collection".
8854         * object.cc (Relobj::copy_symbols_data): New function.
8855         (Relobj::is_section_name_included): New function.
8856         (Sized_relobj::do_layout): Allow this function to be called twice
8857         during garbage collection and defer layout of section during the
8858         first call.
8859         * object.h (Relobj::get_symbols_data): New function.
8860         (Relobj::is_section_name_included): New function.
8861         (Relobj::copy_symbols_data): New function.
8862         (Relobj::set_symbols_data): New function.
8863         (Relobj::get_relocs_data): New function.
8864         (Relobj::set_relocs_data): New function.
8865         (Relobj::is_output_section_offset_invalid): New pure virtual function.
8866         (Relobj::gc_process_relocs): New function.
8867         (Relobj::do_gc_process_relocs): New pure virtual function.
8868         (Relobj::sd_): New data member.
8869         (Sized_relobj::is_output_section_offset_invalid): New function.
8870         (Sized_relobj::do_gc_process_relocs): New function.
8871         * options.h (General_options::gc_sections): Modify to not be a no-op.
8872         (General_options::print_gc_sections): New option.
8873         * plugin.cc (Plugin_finish::run): Remove function call to
8874         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
8875         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
8876         * reloc.cc (Read_relocs::run): Add task to process relocs and
8877         determine unreferenced sections when doing garbage collection.
8878         (Gc_process_relocs): New class.
8879         (Sized_relobj::do_gc_process_relocs): New function.
8880         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
8881         sections that are garbage collected.
8882         * reloc.h (Gc_process_relocs): New class.
8883         * sparc.cc (Target_sparc::gc_process_relocs): New function.
8884         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
8885         symbols whose corresponding sections are garbage collected.
8886         (Symbol_table::Symbol_table): Add new parameter for the garbage
8887         collection object.
8888         (Symbol_table::gc_mark_undef_symbols): New function.
8889         (Symbol_table::gc_mark_symbol_for_shlib): New function.
8890         (Symbol_table::gc_mark_dyn_syms): New function.
8891         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
8892         as garbage.
8893         (Symbol_table::add_from_object): Likewise.
8894         (Symbol_table::add_from_relobj): When building shared objects, do not
8895         treat externally visible symbols as garbage.
8896         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
8897         table information for static and relocatable links.
8898         * symtab.h (Symbol_table::set_gc): New function.
8899         (Symbol_table::gc): New function.
8900         (Symbol_table::gc_mark_undef_symbols): New function.
8901         (Symbol_table::gc_mark_symbol_for_shlib): New function.
8902         (Symbol_table::gc_mark_dyn_syms): New function.
8903         (Symbol_table::gc_): New data member.
8904         * target.h (Sized_target::gc_process_relocs): New pure virtual
8905         function.
8906         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
8907         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
8909 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
8911         * options.h (General_options::gc_sections): Define as a no-op for now.
8912         (General_options::no_keep_memory): Ditto.
8913         (General_options::Bshareable): Define.
8914         * options.cc (General_options::finalize): Honor -Bshareable.
8916 2009-01-20  Andreas Schwab  <schwab@suse.de>
8918         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
8919         read the value in the contents, since we don't use it.  Use the
8920         template endianness when writing.
8921         (Relocate::relocate): Use it for R_PPC_REL16_HA.
8923 2009-01-19  Andreas Schwab  <schwab@suse.de>
8925         * configure.tgt (powerpc64-*): Fix targ_obj.
8927 2009-01-15  Ian Lance Taylor  <iant@google.com>
8929         * object.cc (Sized_relobj::write_local_symbols): Don't write out
8930         local symbols when stripping all symbols.
8932 2009-01-14  Cary Coutant  <ccoutant@google.com>
8934         * output.cc (Output_reloc): Add explicit instantiations.
8936 2009-01-14  Cary Coutant  <ccoutant@google.com>
8938         * archive.cc (Archive::get_elf_object_for_member): Remove call
8939         to File_read::claim_for_plugin.
8940         * descriptors.cc (Descriptors::open): Remove reference to
8941         is_claimed.
8942         (Descriptors::claim_for_plugin): Remove.
8943         * descriptors.h (Descriptors::claim_for_plugin): Remove.
8944         (Descriptors::is_claimed): Remove.
8945         (claim_descriptor_for_plugin): Remove.
8946         * fileread.cc (File_read::claim_for_plugin): Remove.
8947         * fileread.h (File_read::claim_for_plugin): Remove.
8948         (File_read::descriptor): Reopen descriptor if necessary.
8949         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
8950         (Plugin_manager::all_symbols_read): Add task parameter. Change
8951         all callers.
8952         (Plugin_manager::get_input_file): New function.
8953         (Plugin_manager::release_input_file): New function.
8954         (Pluginobj::Pluginobj): Add filesize parameter and initialize
8955         corresponding data member.
8956         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
8957         and pass to base constructor. Change all callers.
8958         (get_input_file, release_input_file): New functions.
8959         (make_sized_plugin_object): Add filesize parameter. Change all callers.
8960         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
8961         (Plugin_manager::all_symbols_read): Add task parameter.
8962         (Plugin_manager::get_input_file): New function.
8963         (Plugin_manager::release_input_file): New function.
8964         (Plugin_manager::task_): New data member.
8965         (Pluginobj::Pluginobj): Add filesize parameter.
8966         (Pluginobj::filename): New function.
8967         (Pluginobj::descriptor): New function.
8968         (Pluginobj::filesize): New function.
8969         (Pluginobj::filesize_): New data member.
8970         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
8971         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
8972         File_read::claim_for_plugin; use Object::unlock to unlock the file.
8974         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
8975         with archive libraries.
8976         * testsuite/Makefile.in: Regenerate.
8977         * testsuite/plugin_test.c (struct sym_info): New type.
8978         (get_input_file, release_input_file): New static variables.
8979         (onload): Capture new transfer vector entries.
8980         (claim_file_hook): Stop reading at end of file according to filesize.
8981         Factor out parsing of readelf output into separate function.
8982         (all_symbols_read_hook): Exercise get_input_file and release_input_file
8983         APIs and get the source file name from the symbol table.  Convert
8984         source file name to corresponding object file name.  Print info
8985         message when adding new input files.
8986         (parse_readelf_line): New function.
8987         * testsuite/plugin_test_1.sh: Add checks for new info messages.
8988         * testsuite/plugin_test_2.sh: Likewise.
8989         * testsuite/plugin_test_3.sh: Likewise.
8990         * testsuite/plugin_test_4.sh: New test case.
8992 2009-01-07  Ian Lance Taylor  <iant@google.com>
8994         * version.cc (version_string): Bump to 1.8.
8996 2008-12-23  Cary Coutant  <ccoutant@google.com>
8998         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
8999         * plugin.cc (Plugin_manager::finish): Rename as
9000         layout_deferred_objects.  Move cleanup to separate function.
9001         (Plugin_manager::cleanup): New function.
9002         (Plugin_finish::run): Call layout_deferred_objects and cleanup
9003         separately.
9004         * plugin.h (Plugin_manager::finish): Rename as
9005         layout_deferred_objects.
9006         (Plugin_manager::cleanup): New function.
9007         (Plugin_manager::cleanup_done): New field.
9009 2008-12-23  Cary Coutant  <ccoutant@google.com>
9011         * plugin.cc (is_visible_from_outside): New function.
9012         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
9013         so we don't return "IR only" status for exported symbols or -r links.
9015         * testsuite/Makefile.am (plugin_test_3): New test case.
9016         * testsuite/Makefile.in: Regenerate.
9017         * testsuite/plugin_test_3.sh: New file.
9019 2008-12-22  Cary Coutant  <ccoutant@google.com>
9021         * object.cc (Sized_relobj::layout_section): New function.
9022         (Sized_relobj::do_layout): Defer layout of input sections until after
9023         plugin has provided replacement files.
9024         (Sized_relobj::do_layout_deferred_sections): New function.
9025         * object.h (Relobj::set_section_offset): Remove virtual keyword.
9026         (Relobj::layout_deferred_sections): New function.
9027         (Relobj::do_layout_deferred_sections): New function.
9028         (Sized_relobj::do_layout_deferred_sections): New function.
9029         (Sized_relobj::layout_section): New function.
9030         (Sized_relobj::Deferred_layout): New structure.
9031         (Sized_relobj::deferred_layout_): New field.
9032         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
9033         Change all callers.  Layout deferred sections.
9034         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
9035         references.
9036         (Plugin_hook::run): Move code from do_plugin_hook inline.
9037         (Plugin_hook::do_plugin_hook): Remove.
9038         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
9039         (Plugin_manager::finish): Renamed, was cleanup.
9040         (Plugin_manager::should_defer_layout): New function.
9041         (Plugin_manager::add_deferred_layout_object): New function.
9042         (Plugin_manager::Deferred_layout_list): New type.
9043         (Plugin_manager::deferred_layout_objects_): New field.
9044         (Plugin_hook::do_plugin_hook): Remove.
9046 2008-12-17  Ian Lance Taylor  <iant@google.com>
9048         * options.h (class General_options): Add --no case for
9049         --export-dynamic.
9051 2008-12-16  Cary Coutant  <ccoutant@google.com>
9053         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
9054         vector.
9055         (Plugin_manager::claim_file): Create plugin object even if
9056         plugin did not call the add_symbols callback.
9057         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
9058         asking for more symbols than were added.
9059         * testsuite/Makefile.am (plugin_test_1): Add test case with
9060         no global symbols.
9061         (empty.syms): New target.
9062         * testsuite/Makefile.in: Regenerate.
9063         * testsuite/plugin_test.c (claim_file_hook): Add new debug
9064         message. Don't call add_symbols if no globals.
9065         (all_symbols_read_hook): Don't provide replacement for empty
9066         claimed file.
9068 2008-12-12  Ian Lance Taylor  <iant@google.com>
9070         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
9071         r_type == 0 for a local symbol with r_sym == 0.
9072         (scan_relocatable_relocs): Pass r_sym to
9073         local_non_section_strategy.
9074         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
9075         r_sym parameter.
9077         * configure.ac: Update test for TLS descriptors: they are
9078         supported as of glibc 2.9.
9079         * configure: Rebuild.
9081 2008-12-11  Ian Lance Taylor  <iant@google.com>
9083         PR 7091
9084         * target-reloc.h (Default_scan_relocatable_relocs): For each
9085         function, map r_type == 0 to RELOC_DISCARD.
9087 2008-12-10  Cary Coutant  <ccoutant@google.com>
9089         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
9090         object to override a kept COMDAT group from a plugin object.
9092 2008-12-09  Ian Lance Taylor  <iant@google.com>
9094         PR 7088
9095         * yyscript.y (file_cmd): Handle INPUT.
9097         * testsuite/initpri1.c: Change all declarations to be full
9098         prototypes by adding void, to avoid compiler warnings.
9100 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
9102         * options.cc (General_options::parse_plugin_opt): New.
9103         (General_options::add_plugin): The argument now is just the filename.
9104         (General_options::add_plugin_option): New.
9105         * options.h (plugin_opt): New.
9106         (add_plugin): Change argument name.
9107         (add_plugin_option): New.
9108         * plugin.cc (Plugin::load): Don't parse the plugin option.
9109         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
9110         (Plugin::add_option): New.
9111         (Plugin::args_): Change type.
9112         (Plugin::filename_): New.
9113         (Plugin_manager::add_plugin_option): New.
9114         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
9115         * testsuite/Makefile.in: Regenerate.
9117 2008-12-05  Cary Coutant  <ccoutant@google.com>
9119         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
9120         Handle --strip-lto-sections option.
9121         * options.h (strip_lto_sections): New option.
9123 2008-12-01  Cary Coutant  <ccoutant@google.com>
9125         * plugin.cc (ld_plugin_message): Change format parameter to const.
9126         Fix mismatch between new[] and delete.
9128 2008-11-14  Cary Coutant  <ccoutant@google.com>
9130         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
9131         instead of -1U.
9133 2008-11-05  Craig Silverstein  <csilvers@google.com>
9135         * options.cc (General_options::parse_dynamic_list): New function.
9136         * options.h (General_options): New flags dynamic_list,
9137         dynamic_list_data, dynamic_list_cpp_new, and
9138         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
9139         (General_options::in_dynamic_list): New function.
9140         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
9141         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
9142         (Lex::can_continue_name): Likewise.
9143         (yylex): Likewise.
9144         (read_script_file): New parameter script_options.
9145         (read_dynamic_list): New function.
9146         (Script_options::define_dynamic_list): New function.
9147         (dynamic_list_keyword_parsecodes): New variable.
9148         (dynamic_list_keywords): New variable.
9149         * script.h (Script_options::define_dynamic_list): New function
9150         prototype.
9151         (read_dynamic_list): New function prototype.
9152         * symtab.cc (strprefix): New macro.
9153         (Symbol::should_add_dynsym_entry): Support dynamic_list,
9154         dynamic_list_data, dynamic_list_cpp_new, and
9155         dynamic_list_cpp_typeinfo.
9156         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
9157         (dynamic_list_expr): New rule.
9158         (dynamic_list_nodes): Likewise.
9159         (dynamic_list_node): Likewise.
9160         * testsuite/Makefile.am (dynamic_list): New test.
9161         * testsuite/Makefile.in: Regenerated.
9162         * testsuite/dynamic_list.t: New file.
9163         * testsuite/dynamic_list.sh: New file.
9165 2008-11-05  Craig Silverstein  <csilvers@google.com>
9167         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
9168         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
9169         (t11_last): Likewise.
9170         * testsuite/ver_test_6.c (main): Likewise.
9172 2008-10-07  Cary Coutant  <ccoutant@google.com>
9174         * options.c (General_options::finalize): Add check for -static and
9175         -shared.
9176         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
9177         is not empty.
9179 2008-10-02  Cary Coutant  <ccoutant@google.com>
9181         * plugin.cc (make_sized_plugin_object): Fix conditional
9182         compilation to work when not all targets are enabled.
9184 2008-09-29  Cary Coutant  <ccoutant@google.com>
9186         * archive.cc (Archive::get_file_and_offset): Use filename instead
9187         of name to get library path.
9188         (Archive::include_member): Unlock external member of a thin archive.
9190         * testsuite/Makefile.am (TEST_AR): New variable.
9191         (thin_archive_test_1): New test.
9192         (thin_archive_test_2): New test.
9193         * testsuite/Makefile.in: Regenerate.
9194         * testsuite/thin_archive_main.cc: New file.
9195         * testsuite/thin_archive_test_1.cc: New file.
9196         * testsuite/thin_archive_test_2.cc: New file.
9197         * testsuite/thin_archive_test_3.cc: New file.
9198         * testsuite/thin_archive_test_4.cc: New file.
9200 2008-09-29  Cary Coutant  <ccoutant@google.com>
9202         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
9203         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
9204         instead of -1U.
9205         (Sized_relobj::do_finalize_local_symbols): Likewise.
9206         (Sized_relobj::map_to_kept_section): Likewise.
9207         * object.h (Sized_relobj::invalid_address): New constant.
9208         (Sized_relobj::do_output_section_offset): Check for invalid_address
9209         and return -1ULL.
9210         * output.cc (Output_reloc::local_section_offset): Use constant
9211         invalid_address instead of -1U.
9212         (Output_reloc::get_address): Likewise.
9213         (Output_section::output_address): Change -1U to -1ULL.
9214         * output.h (Output_reloc::invalid_address): New constant.
9215         * reloc.cc (Sized_relobj::write_sections): Use constant
9216         invalid_address instead of -1U.
9217         (Sized_relobj::relocate_sections): Likewise.
9218         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
9219         values for merge sections.
9220         * target-reloc.h (relocate_for_relocatable): Use constant
9221         invalid_address instead of -1U.
9223 2008-09-19  Cary Coutant  <ccoutant@google.com>
9225         Add plugin functionality for link-time optimization (LTO).
9226         * configure.ac (plugins): Add --enable-plugins option.
9227         * configure: Regenerate.
9228         * config.in: Regenerate.
9229         * Makefile.am (LIBDL): New variable.
9230         (CCFILES): Add plugin.cc.
9231         (HFILES): Add plugin.h.
9232         (ldadd_var): Add LIBDL.
9233         * Makefile.in: Regenerate.
9235         * archive.cc: Include "plugin.h".
9236         (Archive::setup): Don't preread archive symbols when using a plugin.
9237         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
9238         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
9239         files.
9240         (Archive::include_member): Add symbols from plugin objects.
9241         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
9242         * descriptors.cc (Descriptors::open): Check for file descriptors
9243         abandoned by plugins.
9244         (Descriptors::claim_for_plugin): New function.
9245         * descriptors.h (Descriptors::claim_for_plugin): New function.
9246         (Open_descriptor::is_claimed): New field.
9247         (claim_descriptor_for_plugin): New function.
9248         * fileread.cc (File_read::claim_for_plugin): New function.
9249         * fileread.h (File_read::claim_for_plugin): New function.
9250         (File_read::descriptor): New function.
9251         * gold.cc: Include "plugin.h".
9252         (queue_initial_tasks): Add task to call plugin hooks for generating
9253         new object files.
9254         * main.cc: Include "plugin.h".
9255         (main): Load plugin libraries.
9256         * object.h (Pluginobj): Declare.
9257         (Object::pluginobj): New function.
9258         (Object::do_pluginobj): New function.
9259         (Object::set_target): New function.
9260         * options.cc: Include "plugin.h".
9261         (General_options::parse_plugin): New function.
9262         (General_options::General_options): Initialize plugins_ field.
9263         (General_options::add_plugin): New function.
9264         * options.h (Plugin_manager): Declare.
9265         (General_options): Add --plugin option.
9266         (General_options::has_plugins): New function.
9267         (General_options::plugins): New function.
9268         (General_options::add_plugin): New function.
9269         (General_options::plugins_): New field.
9270         * plugin.cc: New file.
9271         * plugin.h: New file.
9272         * readsyms.cc: Include "plugin.h".
9273         (Read_symbols::do_read_symbols): Check for archive before checking
9274         for ELF file.  Call plugin hooks to claim files.
9275         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
9276         from a real object file; force override when processing replacement
9277         files.
9278         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
9279         (Symbol::init_base_object): Likewise.
9280         (Symbol::init_base_output_data): Likewise.
9281         (Symbol::init_base_output_segment): Likewise.
9282         (Symbol::init_base_constant): Likewise.
9283         (Symbol::init_base_undefined): Likewise.
9284         (Symbol::output_section): Assert that object is not a plugin.
9285         (Symbol_table::add_from_pluginobj): New function.
9286         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
9287         undefined.
9288         (Symbol_table::sized_write_globals): Likewise.
9289         (Symbol_table::add_from_pluginobj): Instantiate template.
9290         * symtab.h (Sized_pluginobj): Declare.
9291         (Symbol::in_real_elf): New function.
9292         (Symbol::set_in_real_elf): New function.
9293         (Symbol::in_real_elf_): New field.
9294         (Symbol_table::add_from_pluginobj): New function.
9296         * testsuite/Makefile.am (AM_CFLAGS): New variable.
9297         (LIBDL): New variable.
9298         (LDADD): Add LIBDL.
9299         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
9300         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
9301         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
9302         (MOSTLYCLEANFILES): Likewise.
9303         * testsuite/Makefile.in: Regenerate.
9304         * testsuite/plugin_test.c: New file.
9305         * testsuite/plugin_test_1.sh: New file.
9306         * testsuite/plugin_test_2.sh: New file.
9308 2008-09-16  Ian Lance Taylor  <iant@google.com>
9310         * target-reloc.h (relocate_section): Check whether a symbol is
9311         defined by the ABI before reporting an undefined symbol error.
9312         * target.h (Target::is_defined_by_abi): Make parameter const.
9313         (Target::do_is_defined_by_abi): Likewise.
9314         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
9315         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
9316         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
9317         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
9318         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
9319         * testsuite/Makefile.in: Rebuild.
9321         * fileread.cc (make_view): Add casts to avoid warning.
9323 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
9325         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
9326         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
9328 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
9330         * options.h (General_options::output_is_executable): New.
9331         (General_options::output_is_pie): New.
9332         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
9333         for shared libraries.
9334         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
9336 2008-09-11  Chris Demetriou  <cgd@google.com>
9338         * options.h (origin): New -z option.
9339         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
9340         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
9341         in DT_FLAGS_1.
9343 2008-09-05  Cary Coutant  <ccoutant@google.com>
9345         * fileread.cc (File_read::make_view): Add check for attempt to map
9346         beyond end of file.
9348 2008-09-05  Cary Coutant  <ccoutant@google.com>
9350         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
9351         explicit instantiations.
9353 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
9355         PR gold/6858
9356         * options.cc (General_options::finalize): Allow undefined symbols
9357         in shlibs if linking -shared.
9359         PR gold/6859
9360         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
9361         symbols as not needing a dynsym entry.
9363 2008-08-20  Craig Silverstein  <csilvers@google.com>
9365         * fileread.cc (File_read::open): Do not lock the file unless it
9366         was successfully opened.
9368 2008-08-14  Cary Coutant  <ccoutant@google.com>
9370         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
9371         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
9372         * testsuite/tls_test.cc (struct int128): 128-bit struct
9373         for testing TLS relocs with non-zero addend.
9374         (v12): New TLS variable.
9375         (t12): New test.
9376         (t_last): Add check for v12.
9377         * testsuite/tls_test.h (t12): New function.
9378         * testsuite/tls_test_main.cc (thread_routine): Call new test.
9380 2008-08-13  Ian Lance Taylor  <iant@google.com>
9382         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
9383         set tls_segment_ or relro_segment_.
9384         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
9385         when appropriate.
9386         * output.h (Output_section::clear_is_relro): New function.
9387         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
9388         sections specially even when output_data_ is empty.
9389         (Output_segment::maximum_alignment): When first section is relro,
9390         only force alignment for PT_LOAD segments.
9391         * script.cc (script_data_segment_align): New function.
9392         (script_data_segment_relro_end): New function.
9393         * script-c.h (script_data_segment_align): Declare.
9394         (script_data_segment_relro_end): Declare.
9395         * script-sections.h (class Script_sections): Declare
9396         data_segment_align and data_segment_relro_end.  Add fields
9397         segment_align_index_ and saw_relro_end_.
9398         * script-sections.cc (class Sections_element): Add set_is_relro
9399         virtual function.  Add new bool* parameter to place_orphan_here.
9400         Add get_output_section virtual function.
9401         (class Output_section_definition): Add set_is_relro.  Add new
9402         bool* parameter to place_orphan_here.  Add get_output_section.
9403         Add is_relro_ field.
9404         (Output_section_definition::Output_section_definition): Initialize
9405         evaluated_address_, evaluated_load_address, evaluated_addralign_,
9406         and is_relro_ fields.
9407         (Output_section_definition::place_orphan_here): Add is_relro
9408         parameter.
9409         (Output_section_definition::set_section_addresses): Set relro for
9410         output section.
9411         (Output_section_definition::alternate_constraint): Likewise.
9412         (class Orphan_output_section): Add new bool* parameter to
9413         place_orphan_here.  Add get_output_section.
9414         (Orphan_output_section::place_orphan_here): Add is_relro
9415         parameter.
9416         (Script_sections::Script_sections): Initialize
9417         data_segment_align_index_ and saw_relro_end_.
9418         (Script_sections::data_segment_align): New function.
9419         (Script_sections::data_segment_relro_end): New function.
9420         (Script_sections::place_orphan): Set or clear is_relro.
9421         (Script_sections::set_section_addresses): Force alignment of first
9422         TLS section.
9423         * yyscript.y (exp): Call script_data_segment_align and
9424         script_data_segment_relro_end.
9425         * testsuite/relro_script_test.t: New file.
9426         * testsuite/relro_test.cc (using_script): Declare.
9427         (t1, t2): Test using_script.
9428         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
9429         (relro_script_test_SOURCES): Define.
9430         (relro_script_test_DEPENDENCIES): Define.
9431         (relro_script_test_LDFLAGS): Define.
9432         (relro_script_test_LDADD): Define.
9433         (relro_script_test.so): New target.
9434         * testsuite/Makefile.in: Rebuild.
9436 2008-08-06  Cary Coutant <ccoutant@google.com>
9438         * archive.cc (Archive::total_archives, Archive::total_members)
9439         (Archive::total_members_loaded): New variables.
9440         (Archive::setup): Add parameter.  Add option to preread
9441         archive symbols.
9442         (Archive::read_armap): Add counter.
9443         (Archive::get_file_and_offset): New function.
9444         (Archive::get_elf_object_for_member): New function.
9445         (Archive::read_all_symbols): New function.
9446         (Archive::read_symbols): New function.
9447         (Archive::add_symbols): Add counters.
9448         (Archive::include_all_members): Use armap to find members if it's
9449         already built.
9450         (Archive::include_member): Skip reading symbols if already read.
9451         Factored code into Archive::get_file_and_offset and
9452         Archive::get_elf_object_for_member.  Changed call to
9453         Mapfile::report_include_archive_member.
9454         (Archive::print_stats): New function.
9455         * archive.h: Declare Object and Read_symbols_data classes.
9456         (Archive::Archive): Add initializers for new members.
9457         (Archive::setup): Add parameter.
9458         (Archive::print_stats): New function.
9459         (Archive::total_archives, Archive::total_members)
9460         (Archive::total_members_loaded): New variables.
9461         (Archive::get_file_and_offset): New function.
9462         (Archive::get_elf_object_for_member): New function.
9463         (Archive::read_all_symbols): New function.
9464         (Archive::read_symbols): New function.
9465         (Archive::Archive_member): New class.
9466         (Archive::members_): New member.
9467         (Archive::num_members_): New member.
9468         * main.cc: Include archive.h.
9469         (main): Call Archive::print_stats.
9470         * mapfile.cc (Mapfile::report_include_archive_member): Delete
9471         archive parameter; member_name is now the fully-decorated name.
9472         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
9473         * options.h: (General_options): Add --preread-archive-symbols option.
9474         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
9475         Archive::setup.
9477 2008-08-04  Ian Lance Taylor  <iant@google.com>
9479         * symtab.h (Symbol::use_plt_offset): New function.
9480         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
9481         * powerpc.cc (Relocate::relocate): Likewise.
9482         * sparc.cc (Relocate::relocate): Likewise.
9483         * x86_64.cc (Relocate::relocate): Likewise.
9484         * testsuite/weak_plt.sh: New test.
9485         * testsuite/weak_plt_main.cc: New test.
9486         * testsuite/weak_plt_shared.cc: New test.
9487         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
9488         (check_PROGRAMS): Add weak_plt.
9489         (check_DATA): Add weak_plt_shared.so.
9490         (weak_plt_main_pic.o, weak_plt): New targets.
9491         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
9492         * testsuite/Makefile.in: Rebuild.
9494         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
9495         gcctestdir/ld.
9496         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
9497         * testsuite/Makefile.in: Rebuild.
9499 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
9501         * Makefile.am (POTFILES.in): Set LC_ALL=C.
9502         * Makefile.in: Regenerate.
9503         * po/POTFILES.in: Regenerate.
9505 2008-07-29  Ian Lance Taylor  <iant@google.com>
9507         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
9508         symbols before other symbols.
9509         * testsuite/script_test_2.cc (test_addr): Declare.
9510         (test_addr_alias): Declare.
9511         (main): Check that test_addr and test_addr_alias have the right
9512         values.
9513         * testsuite/script_test_2.t: Define test_addr_alias and
9514         test_addr.
9516 2008-07-24  Ian Lance Taylor  <iant@google.com>
9518         PR 5990
9519         * descriptors.cc: New file.
9520         * descriptors.h: New file.
9521         * gold-threads.h (class Hold_optional_lock): New class.
9522         * fileread.cc: Include "descriptors.h".
9523         (File_read::~File_read): Release descriptor rather than closing
9524         it.
9525         (File_read::open) [file]: Call open_descriptor rather than open.
9526         Set is_descriptor_opened_.
9527         (File_read::open) [memory]: Assert that descriptor is not open.
9528         (File_read::reopen_descriptor): New function.
9529         (File_read::release): Release descriptor.
9530         (File_read::do_read): Make non-const.  Reopen descriptor.
9531         (File_read::read): Make non-const.
9532         (File_read::make_view): Reopen descriptor.
9533         (File_read::do_readv): Likewise.
9534         * fileread.h (class File_read): Add is_descriptor_opened_ field.
9535         Update declarations.
9536         * layout.cc: Include "descriptors.h".
9537         (Layout::create_build_id): Use open_descriptor rather than open.
9538         * output.cc: Include "descriptors.h".
9539         (Output_file::open): Use open_descriptor rather than open.
9540         * archive.cc (Archive::const_iterator): Change Archive to be
9541         non-const.
9542         (Archive::begin, Archive::end): Make non-const.
9543         (Archive::count_members): Likewise.
9544         * archive.h (class Archive): Update declarations.
9545         * object.h (Object::read): Make non-const.
9546         * Makefile.am (CCFILES): Add descriptors.cc.
9547         (HFILES): Add descriptors.h.
9548         * Makefile.in: Rebuild.
9550         PR 6716
9551         * gold.h: Always include <clocale>.  Add Solaris workarounds
9552         following code in binutils/sysdep.h.
9554         PR 6048
9555         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
9556         this->eh_frame_hdr_ is NULL before using it.
9558         * dynobj.cc (Versions::Versions): Update comment.
9560         * dynobj.cc (Versions::Versions): If there is an soname, use it as
9561         the base version name.
9563         * stringpool.cc (Stringpool_template::add_with_length): Set key to
9564         array size plus one.
9565         (Stringpool_template::set_string_offsets): Subtract one from key
9566         before using it as an array index.
9567         (Stringpool_template::get_offset_with_length): Likewise.
9568         (Stringpool_template::write_to_buffer): Likewise.
9569         * stringpool.h (Stringpool_template::get_offset_from_key):
9570         Likewise.
9572 2008-07-23  Ian Lance Taylor  <iant@google.com>
9574         PR 6658
9575         * object.h (Merged_symbol_value::value): Do our best to handle a
9576         negative addend.
9578         PR 6647
9579         * script.cc (Version_script_info::get_versions): Don't add empty
9580         version tag to return value.
9581         (Version_script_info::get_symbol_version_helper): Change return
9582         type to bool.  Add pversion parameter.  Change all callers.
9583         (script_register_vers_node): Don't require a non-NULL tag.
9584         * script.h (class Version_script_info): Update declarations.
9585         (Version_script_info::get_symbol_version): Change return type to
9586         bool.  Add version parameter.  Change all callers.
9587         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
9588         handling.  Handle an empty version from a version script.
9589         (Symbol_table::define_special_symbol): Likewise.
9590         * testsuite/ver_test_10.script: New file.
9591         * testsuite/ver_test_10.sh: New file.
9592         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
9593         (check_DATA): Add ver_test_10.syms.
9594         (ver_test_10.syms, ver_test_10.so): New target.
9595         * testsuite/Makefile.in: Rebuild.
9597 2008-07-23  Simon Baldwin  <simonb@google.com>
9599         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
9600         to zero for undefined symbols from dynamic libraries.
9602 2008-07-23  Ian Lance Taylor  <iant@google.com>
9604         * symtab.cc (Symbol_table::resolve): Remove version parameter.
9605         Change all callers.
9606         * symtab.h (class Symbol_table): Update declaration.
9607         * testsuite/ver_test_9.cc: New file.
9608         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
9609         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
9610         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
9611         (ver_test_9.so, ver_test_9.o): New targets.
9612         * testsuite/Makefile.in: Rebuild.
9614 2008-07-22  Ian Lance Taylor  <iant@google.com>
9616         * options.h (class General_options): Define --check-sections.
9617         * layout.cc (Layout::set_segment_offsets): Handle
9618         --check-sections.
9620         * options.h (class General_options): Define -n/--nmagic and
9621         -N/--omagic.
9622         * options.cc (General_options::finalize): For -n/--nmagic or
9623         -N/--omagic, set -static.
9624         * layout.cc (Layout::attach_allocated_section_to_segment): If
9625         -N/--omagic, don't put read-only and read-write sections in
9626         different segments.
9627         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
9628         finding a read-only segment.
9629         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
9630         don't set the minimum segment alignment to the common page size,
9631         and don't set the file offset to the address modulo the page size.
9632         * script-sections.cc (Script_sections::create_segments): If
9633         -n/--omagic, don't put read-only and read-write sections in
9634         different segments.
9636         * cref.cc: New file.
9637         * cref.h: New file.
9638         * options.h (class General_options): Add --print-symbol-counts.
9639         * main.cc (main): Issue defined symbol report if requested.
9640         * archive.cc (Archive::interpret_header): Make into a const member
9641         function.
9642         (Archive::add_symbols): Call Input_objects::archive_start and
9643         archive_stop.
9644         (Archive::const_iterator): Define new class.
9645         (Archive::begin, Archive::end): New functions.
9646         (Archive::include_all_members): Rewrite to use iterator.
9647         (Archive::count_members): New function.
9648         * archive.h (class Archive): Update declarations.
9649         (Archive::filename): New function.
9650         * object.cc: Include "cref.h".
9651         (Sized_relobj::Sized_relobj): Initialize defined_count_.
9652         (Sized_relobj::do_get_global_symbol_counts): New function.
9653         (Input_objects::add_object): Add object to cross-referencer.
9654         (Input_objects::archive_start): New function.
9655         (Input_objects::archive_stop): New function.
9656         (Input_objects::print_symbol_counts): New function.
9657         * object.h: Declare Cref and Archive.
9658         (Object::get_global_symbol_counts): New function.
9659         (Object::do_get_global_symbol_counts): New pure virtual function.
9660         (class Sized_relobj): Add defined_count_ field.  Update
9661         declarations.
9662         (class Input_objects): Add cref_ field.  Update constructor.
9663         Update declarations.
9664         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
9665         defined_count_.
9666         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
9667         symbol counts.
9668         (Sized_dynobj::do_get_global_symbol_counts): New function.
9669         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
9670         defined_count_.  Update declarations.  Define Symbols typedef.
9671         * symtab.cc (Symbol_table::add_from_relobj): Add defined
9672         parameter.  Change all callers.
9673         (Symbol_table::add_from_dynobj): Add sympointers and defined
9674         parameters.  Change all callers.
9675         * symtab.h (class Symbol_table): Update declarations.
9676         * Makefile.am (CCFILES): Add cref.cc.
9677         (HFILES): Add cref.h.
9678         * Makefile.in: Rebuild.
9680 2008-07-22  Simon Baldwin  <simonb@google.com>
9682         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
9683         to zero when writing undefined symbols.
9685 2008-07-22  Ian Lance Taylor  <iant@google.com>
9687         * output.cc (Output_section::add_input_section): Don't try to
9688         merge empty merge sections.
9690 2008-07-21  Craig Silverstein  <csilvers@google.com>
9692         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9693         Include symbol version in error message.
9695 2008-07-20  Chris Demetriou  <cgd@google.com>
9697         * configure.ac (gold_cv_c_random_seed): New configured variable.
9698         (RANDOM_SEED_CFLAGS): New substituted variable.
9699         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
9700         * configure: Rebuild.
9701         * Makefile.in: Likewise.
9702         * testsuite/Makefile.in: Likewise.
9704 2008-07-18  Ian Lance Taylor  <iant@google.com>
9706         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
9707         where we see NAME/NULL and NAME/VERSION  as separate symbols.
9708         * testsuite/ver_test_main.cc (main): Call t4.
9709         (t4, t4_2a): Define.
9710         * testsuite/ver_test_2.cc (t4_2): Define.
9711         * testsuite/ver_test_2.script: Put t4_2a in VER2.
9712         * testsuite/ver_test_4.cc (t4_2a): Define.
9713         * testsuite/ver_test_4.script: Put t4_2a in VER2.
9714         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
9716 2008-07-17  Ian Lance Taylor  <iant@google.com>
9718         * dynobj.cc (Versions::add_def): If we give an error about a
9719         missing version, go ahead and create the version anyhow.
9721 2008-07-10  Ian Lance Taylor  <iant@google.com>
9723         Handle output sections with more than 0x7fffffff bytes.
9724         * object.h (class Relobj): Change map_to_output_ to
9725         output_sections_, and just keep a section pointer.  Change all
9726         uses.  Move comdat group support to Sized_relobj.
9727         (Relobj::is_section_specially_mapped): Remove.
9728         (Relobj::output_section): Remove poff parameter.  Change all
9729         callers.
9730         (Relobj::output_section_offset): New function.
9731         (Relobj::set_section_offset): Rewrite.
9732         (Relobj::map_to_output): Remove.
9733         (Relobj::output_sections): New function.
9734         (Relobj::do_output_section_offset): New pure virtual function.
9735         (Relobj::do_set_section_offset): Likewise.
9736         (class Sized_relobj): Add section_offsets_ field.  Add comdat
9737         group support from Relobj.  Update declarations.
9738         (Sized_relobj::get_output_section_offset): New function.
9739         (Sized_relobj::do_output_section_offset): New function.
9740         (Sized_relobj::do_set_section_offset): New function.
9741         * object.cc (Relobj::output_section_address): Remove.
9742         (Sized_relobj::Sized_relobj): Initialize new fields.
9743         (Sized_relobj::include_section_group): Cast find_kept_object to
9744         Sized_relobj.
9745         (Sized_relobj::include_linkonce_section): Likewise.
9746         (Sized_relobj::do_layout): Use separate arrays for output section
9747         and output offset.
9748         (Sized_relobj::do_count_local_symbols): Change map_to_output to
9749         output_sections.
9750         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
9751         output_sections and section_offsets.
9752         (Sized_relobj::write_local_symbols): Likewise.
9753         (map_to_kept_section): Compute output address directly.
9754         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
9755         output_sections and section_offsets.
9756         (Sized_relobj::write_sections): Likewise.
9757         (Sized_relobj::relocate_sections): Likewise.
9758         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
9759         * output.h (class Output_reloc): Update declarations.  Change
9760         u2_.relobj to Sized_relobj*.
9761         (class Output_data_reloc): Change add functions to use
9762         Sized_relobj*.
9763         * output.cc (Output_reloc::Output_reloc): Change relobj to
9764         Sized_relobj*.
9765         (Output_reloc::local_section_offset): Change return type to
9766         Elf_Addr.  Use get_output_section_offset.
9767         (Output_reloc::get_address): Likewise.
9768         (Output_section::is_input_address_mapped): Don't call
9769         is_section_specially_mapped.
9770         (Output_section::output_offset): Likewise.
9771         (Output_section::output_address): Likewise.
9772         (Output_section::starting_output_address): Likewise.
9773         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
9774         parameter to Sized_relobj*.
9775         (Copy_relocs::need_copy_reloc): Likewise.
9776         (Copy_relocs::save): Likewise.
9777         * copy-relocs.h (class Copy_relocs): Update declarations.
9778         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
9779         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
9780         * target-reloc.h (relocate_for_relocatable): Change
9781         offset_in_output_section type to Elf_Addr.  Change code that uses
9782         it as well.
9783         * layout.cc (Layout::layout): Always set *off.
9784         * mapfile.cc (Mapfile::print_input_section): Use
9785         output_section_offset.
9786         * i386.cc (Target_i386::copy_reloc): Change object parameter to
9787         Sized_relobj*.
9788         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
9789         * sparc.cc (Target_sparc::copy_reloc): Likewise.
9790         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
9792 2008-07-03  Ian Lance Taylor  <iant@google.com>
9794         * layout.cc (Layout::include_section): Do not discard unrecognized
9795         SHT_STRTAB sections.
9797 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
9799         * script.cc (Lex::can_continue_name): Make '?' allowable in
9800         version-script names.
9801         * testsuite/version_script.map: Change glob pattern to use '?'
9803 2008-06-30  Manish Singh  <yosh@gimp.org>
9805         PR 6585
9806         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
9807         Correct typo.
9809 2008-06-30  Ian Lance Taylor  <iant@google.com>
9811         PR 6660
9812         PR 6682
9813         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
9814         versions]: Don't try to read the value in the contents, since we
9815         don't use it.  Use the template endianness when writing.
9817 2008-06-25  Cary Coutant  <ccoutant@google.com>
9819         * fileread.cc (File_read::make_view): Assert on zero-length view.
9820         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
9821         symbol table when there are no symbols to read.
9823 2008-06-23  Craig Silverstein  <csilvers@google.com>
9825         * version.cc (version_string): Bump to 1.7
9827 2008-06-18  Craig Silverstein  <csilvers@google.com>
9829         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
9830         constant 0xFFFF to type Valtype.
9831         (Powerpc_relocate_functions::rel16_ha): Likewise.
9833 2008-06-17  Ian Lance Taylor  <iant@google.com>
9835         * output.h (Output_section::Input_section): Initialize p2align_ to
9836         zero for Output_section_data constructors.
9837         (Output_section::Input_section::addralign): If not an input
9838         section, return the alignment of the Output_section_data.
9839         * testsuite/copy_test.cc: New file.
9840         * testsuite/copy_test_1.cc: New file.
9841         * testsuite/copy_test_2.cc: New file.
9842         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
9843         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
9844         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
9845         (copy_test_1_pic.o, copy_test_1.so): New targets.
9846         (copy_test_2_pic.o, copy_test_2.so): New targets.
9847         * testsuite/Makefile.in: Rebuild.
9849         * script-sections.cc (Script_sections::place_orphan): Initialize
9850         local variable exact.
9852 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
9854         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
9856 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
9857             David S. Miller  <davem@davemloft.net>
9859         * powerpc.cc: New file.
9860         * Makefile.am (TARGETSOURCES): Add powerpc.cc
9861         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
9862         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
9863         * Makefile.in: Rebuild.
9865 2008-06-09  Ian Lance Taylor  <iant@google.com>
9867         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
9868         <exception>.
9869         (throwing, orig_terminate): New static variables.
9870         (terminate_handler): New static function.
9871         (t2): Set terminate handler.
9873 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
9875         PR 6584
9876         * binary.cc (Binary_to_elf::sized_convert): Fix .data
9877         alignment.
9879 2008-05-30  Cary Coutant  <ccoutant@google.com>
9881         * archive.cc (Archive::include_all_members) Correct to step
9882         over symbol table and extended name table in thin archives.
9884 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
9886         PR 6407
9887         * target-reloc.h (relocate_for_relocatable): Fix new_offset
9888         calculation.
9890 2008-05-28  Caleb Howe  <cshowe@google.com>
9892         * reduced_debug_output.cc: New file.
9893         * reduced_debug_output.h: New file.
9894         * options.h (class General_options): Add --strip-debug-non-line.
9895         * options.cc (General_options::finalize): Add strip_debug_non_line
9896         to the strip heirarchy.
9897         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
9898         fields.
9899         * layout.cc: Include "reduced_debug_output.h".
9900         (Layout::Layout): Initialize new fields.
9901         (line_only_debug_sections): New static array.
9902         (is_lines_only_debug_sections): New static inline function.
9903         (Layout::include_section): Handle --strip-debug-non-line.
9904         (Layout::make_output_section): If --strip-debug-non-line, build
9905         new output sections for .debug_abbrev and .debug_info.
9906         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
9907         gold.  Warn about possible overflow.
9908         (read_signed_LEB_128): Likewise.
9909         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
9910         (read_signed_LEB_128): Declare.
9911         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
9912         (HFILES): Add reduced_debug_output.h.
9913         * Makefile.in: Rebuild.
9915 2008-05-21  Ian Lance Taylor  <iant@google.com>
9917         * mapfile.cc: New file.
9918         * mapfile.h: New file.
9919         * options.h (class General_options): Add -M/--print-map and -Map.
9920         * options.cc (General_options::finalize): Make -M equivalent to
9921         -Map -.
9922         * main.cc: Include <cstdio> and "mapfile.h".
9923         (main): Open mapfile if requested.
9924         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
9925         constructor.  Change caller.
9926         (queue_initial_tasks): Add mapfile parameter.  Change caller.
9927         (queue_middle_tasks): Likewise.
9928         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
9929         declarations.
9930         * archive.cc: Include "mapfile.h".
9931         (Archive::add_symbols): Add mapfile parameter.  Change all
9932         callers.  Pass mapfile, symbol, and reason to include_member.
9933         (Archive::include_all_members): Add mapfile parameter.  Change all
9934         callers.
9935         (Archive::include_member): Add mapfile, sym, and why parameters.
9936         Change all callers.  Report inclusion to map file.
9937         * archive.h: Include "fileread.h".
9938         (class Archive): Update declarations.
9939         (Archive::file): New const method.
9940         (class Add_archive_symbols): Add mapfile_ field.  Update
9941         constructor.  Change all callers.
9942         * readsyms.h (class Read_symbols): Likewise.
9943         (class Finish_group): Likewise.
9944         (class Read_script): Likewise.
9945         * common.cc: Include "mapfile.h".
9946         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
9947         all callers.
9948         (Symbol_table::do_allocate_commons): Likewise.
9949         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
9950         symbol allocation to mapfile.
9951         * common.h (class Allocate_commons_task): Add mapfile_ field.
9952         Update constructor.  Change all callers.
9953         * symtab.h (class Symbol_table): Update declarations.
9954         * layout.cc: Include "mapfile.h".
9955         (Layout_task_runner::run): Print information to mapfile.
9956         (Layout::create_gold_note): Change Output_data_fixed_space to
9957         Output_data_zero_fill.
9958         (Layout::create_build_id): Likewise.
9959         (Layout::print_to_mapfile): New function.
9960         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
9961         constructor.  Change caller.
9962         (class Layout): Declare print_to_mapfile.
9963         * output.cc (Output_section::Input_section::print_to_mapfile): New
9964         function.
9965         (Output_section::add_input_section): If producing a map, always
9966         add to input_sections_ list.
9967         (Output_section::do_print_to_mapfile): New function.
9968         (Output_segment::print_sections_to_mapfile): New function.
9969         (Output_segment::print_section_list_to_mapfile): New function.
9970         * output.h: Include "mapfile.h".
9971         (Output_data::print_to_mapfile): New function.
9972         (Output_data::do_print_to_mapfile): New virtual function.
9973         (Output_segment_headers::do_print_to_mapfile): New function.
9974         (Output_file_header::do_print_to_mapfile): New function.
9975         (Output_data_const::do_print_to_mapfile): New function.
9976         (class Output_data_const_buffer): Add map_name_ field.  Update
9977         constructor.  Change all callers.  Add do_print_to_mapfile
9978         function.
9979         (class Output_data_fixed_space): Likewise.
9980         (class Output_data_space): Likewise.
9981         (class Output_data_zero_fill): New class.
9982         (Output_data_strtab::do_print_to_mapfile): New function.
9983         (Output_data_reloc_base::do_print_to_mapfile): New function.
9984         (Output_relocatable_relocs::do_print_to_mapfile): New function.
9985         (Output_data_group::do_print_to_mapfile): New function.
9986         (Output_data_got::do_print_to_mapfile): New function.
9987         (Output_data_dynamic::do_print_to_mapfile): New function.
9988         (Output_symtab_xindex::do_print_to_mapfile): New function.
9989         (class Output_section): Declare do_print_to_mapflie.  Declare
9990         print_to_mapfile in Input_section.
9991         (class Output_segment): Declare new functions.
9992         * object.h (Sized_relobj::symbol_count): New function.
9993         * script-sections.cc
9994         (Output_section_element_dot_assignment::set_section_addresses):
9995         Change Output_data_fixed_space to Output_data_zero_fill.
9996         (Output_data_expression::do_print_to_mapfile): New function.
9997         * script.cc (read_input_script): Add mapfile parameter.  Change
9998         all callers.
9999         * script.h (read_input_script): Update declaration.
10000         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
10001         (Eh_frame::do_print_to_mapfile): New function.
10002         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
10003         (Output_merge_string::do_print_to_mapfile): New function.
10004         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
10005         function.
10006         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
10007         function.
10008         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
10009         function.
10010         * Makefile.am (CCFILES): Add mapfile.cc.
10011         (HFILES): Add mapfile.h.
10012         * Makefile.in: Rebuild.
10014 2008-05-19  Ian Lance Taylor  <iant@google.com>
10016         * options.h (class General_options): Add -z relro.
10017         * layout.cc (Layout::Layout): Initialize relro_segment_.
10018         (Layout::add_output_section_data): Return the output section.
10019         (Layout::make_output_section): Rcognize relro sections and mark
10020         them appropriately.
10021         (Layout::attach_allocated_section_to_segment): Put relro sections
10022         in a PT_GNU_RELRO segment.
10023         (Layout::create_initial_dynamic_sections): Mark the .dynamic
10024         section as relro.
10025         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
10026         PT_TLS segments.
10027         (Layout::linkonce_mapping): Map d.rel.ro.local to
10028         .data.rel.ro.local.
10029         (Layout::output_section_name): Us .data.rel.ro.local for any
10030         section which begins with that.
10031         * layout.h (class Layout): Update add_output_section_data
10032         declaration.  Add relro_segment_ field.
10033         * output.cc (Output_section::Output_section): Initialize is_relro_
10034         and is_relro_local_ fields.
10035         (Output_segment::add_output_section): Group relro sections.
10036         (Output_segment::is_first_section_relro): New function.
10037         (Output_segment::maximum_alignment): If there is a relro section,
10038         align the segment to the common page size.
10039         (Output_segment::set_section_addresses): Track whether we are
10040         looking at relro sections.  If the last section is a relro
10041         section, align to the common page size.
10042         (Output_segment::set_section_list_addresses): Add in_relro
10043         parameter.  Change all callers.  Align to the page size when
10044         moving from relro to non-relro section.
10045         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
10046         segment.
10047         * output.h (class Output_section): Add is_relro_ and
10048         is_relro_local_ fields.
10049         (Output_section::is_relro): New function.
10050         (Output_section::set_is_relro): New function.
10051         (Output_section::is_relro_local): New function.
10052         (Output_section::set_is_relro_local): New function.
10053         (class Output_segment): Update declarations.
10054         * i386.cc (Target_i386::got_section): Mark .got section as relro.
10055         * sparc.cc (Target_sparc::got_section): Likewise.
10056         * x86_64.cc (Target_x86_64::got_section): Likewise.
10057         * testsuite/relro_test_main.cc: New file.
10058         * testsuite/relro_test.cc: New file.
10059         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
10060         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
10061         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
10062         (relro_test.so, relro_test_pic.o): New targets.
10063         * testsuite/Makefile.in: Rebuild.
10065 2008-05-16  Ian Lance Taylor  <iant@google.com>
10067         * output.cc (Output_segment::add_output_section): Remove front
10068         parameter.
10069         * output.h (class Output_segment): Remove
10070         add_initial_output_section and overloaded add_output_section.
10071         Update declaration of remaining add_output_section.
10072         * layout.cc (Layout::create_interp): Call add_output_section
10073         rather than add_initial_output_section.
10074         (Layout::finish_dynamic_section): Likewise.
10076         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
10077         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
10078         know the dynamic type.
10079         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
10080         field.  Initialize it in constructor.
10081         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
10082         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
10083         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
10084         reloc.
10086         * output.cc (Output_reloc::get_address): Change return type to
10087         Elf_Addr.
10088         * output.h (class Output_reloc): Update get_address declaration.
10089         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
10090         for section addresses.
10092 2008-05-09  Ian Lance Taylor  <iant@google.com>
10094         PR 6493
10095         * gold.cc (gold_nomem): Use return value of write.
10097 2008-05-08  Ian Lance Taylor  <iant@google.com>
10099         * symtab.c (Symbol::init_base_output_data): Add version
10100         parameter.  Change all callers.
10101         (Symbol::init_base_output_segment): Likewise.
10102         (Symbol::init_base_constant): Likewise.
10103         (Symbol::init_base_undefined): Likewise.
10104         (Sized_symbol::init_output_data): Likewise.
10105         (Sized_symbol::init_output_segment): Likewise.
10106         (Sized_symbol::init_constant): Likewise.
10107         (Sized_symbol::init_undefined): Likewise.
10108         (Symbol_table::do_define_in_output_data): If the new symbol has a
10109         version, mark it as the default.
10110         (Symbol_table::do_define_in_output_segment): Likewise.
10111         (Symbol_table::do_define_as_constant): Likewise.
10112         * symtab.h (class Symbol): Update declarations.
10113         (class Sized_symbol): Likewise.
10114         * resolve.cc (Symbol::override_version): New function.
10115         (Symbol::override_base): Call override_version.
10116         (Symbol::override_base_with_special): Likewise.
10117         * testsuite/ver_script_8.script: New file.
10118         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
10119         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
10120         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
10121         (ver_test_8_1.so, ver_test_8_2.so): New targets.
10123 2008-05-06  Ian Lance Taylor  <iant@google.com>
10125         PR 6049
10126         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
10127         functions.
10128         (class General_options): Remove existing --undefined, and add
10129         --no-undefined instead.  Add new --undefined as synonym for -u.
10130         * archive.cc (Archive::add_symbols): Check whether symbol was
10131         named with -u.
10132         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
10133         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
10134         all uses.  Add IS_UNDEFINED.  Update declarations to split
10135         different versions of init_base.  Declare init_base_undefined.
10136         (Symbol::is_defined): Handle IS_UNDEFINED.
10137         (Symbol::is_undefined): Likewise.
10138         (Symbol::is_weak_undefined): Call is_undefined.
10139         (Symbol::is_absolute): Handle IS_CONSTANT.
10140         (class Sized_symbol): Update declarations to split different
10141         versions of init.  Declare init_undefined.
10142         (class Symbol_table): Declare new functions.
10143         * symtab.cc (Symbol::init_base_object): Rename from init_base.
10144         Change all callers.
10145         (Symbol::init_base_output_data): Likewise.
10146         (Symbol::init_base_output_segment): Likewise.
10147         (Symbol::init_base_constant): Likewise.
10148         (Symbol::init_base_undefined): New function.
10149         (Sized_symbol::init_object): Rename from init.  Change all
10150         callers.
10151         (Sized_symbol::init_output_data): Likewise.
10152         (Sized_symbol::init_output_segment): Likewise.
10153         (Sized_symbol::init_constant): Likewise.
10154         (Sized_symbol::init_undefined): New function.
10155         (Symbol_table::add_undefined_symbols_from_command_line): New
10156         function.
10157         (Symbol_table::do_add_undefined_symbols_from_command_line): New
10158         function.
10159         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
10160         (Symbol::output_section): Likewise.
10161         (Symbol::set_output_section): Likewise.
10162         (Symbol_table::sized_finalize_symbol): Likewise.
10163         (Symbol_table::sized_write_globals): Likewise.
10164         * resolve.cc (Symbol_table::should_override): Likewise.
10165         (Symbol::override_base_with_special): Likewise.
10167         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
10168         symbol, change it to have default visibility.
10169         * testsuite/protected_1.cc: New file.
10170         * testsuite/protected_2.cc: New file.
10171         * testsuite/protected_3.cc: New file.
10172         * testsuite/protected_main_1.cc: New file.
10173         * testsuite/protected_main_2.cc: New file.
10174         * testsuite/protected_main_3.cc: New file.
10175         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
10176         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
10177         (protected_1_LDFLAGS, protected_1_LDADD): Define.
10178         (protected_1.so): New target.
10179         (protected_1_pic.o, protected_2_pic.o): New targets.
10180         (protected_3_pic.o): New target.
10181         (check_PROGRAMS): Add protected_2.
10182         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
10183         (protected_2_LDFLAGS, protected_2_LDADD): Define.
10184         * testsuite/Makefile.in: Rebuild.
10186         * options.h (DEFINE_var): Add set_user_set_##varname__.
10187         (DEFINE_bool_alias): New macro.
10188         (class General_options): Define -Bstatic using DEFINE_bool_alias
10189         rather than DEFINE_special.  Add --undefined as an alias for -z
10190         defs.
10191         * options.cc (General_options::parse_Bstatic): Remove.
10193         * options.h (class General_options): Add --fatal-warnings.
10194         * main.cc (main): Implement --fatal-warnings.
10195         * errors.h (Errors::warning_count): New function.
10197         * options.h (class General_options): Add -Bsymbolic-functions.
10198         * symtab.h (Symbol::is_preemptible): Check for
10199         -Bsymbolic-functions.
10201 2008-05-05  Ian Lance Taylor  <iant@google.com>
10203         * options.h (DEFINE_bool): For DASH_Z, create the negative option
10204         as noVARNAME rather than no-VARNAME.
10205         (class General_options): Add option -z combreloc.
10206         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
10207         get_address.
10208         (Output_reloc::sort_before) [SHT_REL]: New function.
10209         (Output_reloc::sort_before) [SHT_RELA]: New function.
10210         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
10211         Sort_relocs_comparison.
10212         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
10213         parameter.  Change all callers.
10214         (Output_data_reloc::Output_data_reloc) [both versions]: Add
10215         sort_relocs parameter.  Change all callers.
10216         * output.cc (Output_reloc::get_address): New function, broken out
10217         of write_rel.
10218         (Output_reloc::write_rel): Call it.
10219         (Output_reloc::compare): New function.
10220         (Output_data_reloc_base::do_write): Optionally sort relocs.
10222         * configure.ac: If targ_extra_obj is set, link it in.
10223         * configure.tgt: Initialize all variables.
10224         (x86_64*): Set targ_extra_obj and targ_extra_size.
10225         * configure: Rebuild.
10227         * object.cc (Sized_relobj::include_section_group): Adjust section
10228         indexes read from group data.  Build vector to pass to
10229         layout_group.
10230         * layout.cc (Layout::layout_group): Add flags and shndxes
10231         parameters.  Remove contents parameter.  Change caller.  Update
10232         explicit instantiations.
10233         * layout.h (class Layout): Update layout_group declaration.
10234         * output.cc (Output_data_group::Output_data_group): Add flags and
10235         input_shndxes parameters.  Remove contents parameter.  Change
10236         caller.
10237         (Output_data_group::do_write): Change input_sections_ to
10238         input_shndxes_.
10239         * output.h (class Output_data_group): Update constructor
10240         declaration.  Rename input_sections_ to input_shndxes_.
10241         * testsuite/many_sections_test.cc: Add template.
10243 2008-04-30  Cary Coutant  <ccoutant@google.com>
10245         * target-reloc.h (relocate_section): Fix dead-pointer bug.
10247         * layout.cc (Layout::include_section): Refactored check for debug
10248         info section.
10249         (Layout::add_comdat): Add new parameters.  Change type
10250         of signature parameter.  Add object and shndx to signatures table.
10251         (Layout::find_kept_object): New function.
10252         * layout.h: Include <cstring>.
10253         (Layout::is_debug_info_section): New function.
10254         (Layout::add_comdat): Add new parameters.
10255         (Layout::find_kept_object): New function.
10256         (Layout::Kept_section): New struct.
10257         (Layout::Signatures): Change type of map range.
10258         * object.cc (Relobj::output_section_address): New function.
10259         (Sized_relobj::include_section_group): Add new parameters.  Change
10260         calls to Layout::add_comdat.  Change to build table of kept comdat
10261         groups and table mapping discarded sections to kept sections.
10262         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
10263         (Sized_relobj::do_layout): Change calls to include_section_group and
10264         include_linkonce_section.
10265         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
10266         value to zero when section is discarded.
10267         (Sized_relobj::map_to_kept_section): New function.
10268         * object.h (Relobj::output_section_address): New function.
10269         (Relobj::Comdat_group): New type.
10270         (Relobj::find_comdat_group): New function.
10271         (Relobj::Comdat_group_table): New type.
10272         (Relobj::Kept_comdat_section): New type.
10273         (Relobj::Kept_comdat_section_table): New type.
10274         (Relobj::add_comdat_group): New function.
10275         (Relobj::set_kept_comdat_section): New function.
10276         (Relobj::get_kept_comdat_section): New function.
10277         (Relobj::comdat_groups_): New field.
10278         (Relobj::kept_comdat_sections_): New field.
10279         (Symbol_value::input_value): Update comment.
10280         (Sized_relobj::map_to_kept_section) New function.
10281         (Sized_relobj::include_linkonce_section): Add new parameter.
10282         * target-reloc.h (Comdat_behavior): New type.
10283         (get_comdat_behavior): New function.
10284         (relocate_section): Add code to map a discarded section to the
10285         corresponding kept section when applying a relocation.
10287 2008-04-30  Craig Silverstein  <csilvers@google.com>
10289         * dwarf_reader.cc (next_generation_count): New static var.
10290         (Addr2line_cache_entry): New struct.
10291         (addr2line_cache): New static var.
10292         (Dwarf_line_info::one_addr2line): Added caching.
10293         (Dwarf_line_info::clear_addr2line_cache): New function.
10294         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
10295         cache-size parameter.
10296         (Dwarf_line_info::one_addr2line_cache): New function.
10297         * symtab.cc (Symbol_table::detect_odr_violations): Pass
10298         new cache-size argument to one_addr2line(), and clear cache.
10300 2008-04-28  Cary Coutant  <ccoutant@google.com>
10302         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
10303         R_386_PC8 relocations.
10305 2008-04-23  Ian Lance Taylor  <iant@google.com>
10307         * object.cc (Sized_relobj::include_section_group): Check for
10308         invalid section group.
10310         * object.cc (make_elf_object): Correct test for 64-bit ELF file
10311         header size.
10313         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
10314         than read for file header.
10315         * archive.cc (Archive::include_member): Likewise.
10317 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
10319         * aclocal.m4: Regenerate.
10320         * configure: Regenerate.
10322 2008-04-19  Ian Lance Taylor  <iant@google.com>
10324         * version.cc (version_string): Bump to 1.6.
10326         * testsuite/Makefile.am (many_sections_r_test): New target.
10327         (many_sections_r_test_SOURCES): Remove.
10328         (many_sections_r_test_DEPENDENCIES): Remove.
10329         (many_sections_r_test_LDFLAGS): Remove.
10330         (many_sections_r_test_LDADD): Remove.
10332         * object.cc (Sized_relobj::do_add_symbols): Always pass
10333         local_symbol_count_ to add_from_relobj.
10335         * testsuite/Makefile.am (many_sections_check.h): Only check one in
10336         every thousand variables.
10337         * testsuite/Makefile.in: Rebuild.
10339         * object.cc (Xindex::initialize_symtab_xindex): New function.
10340         (Xindex::read_symtab_xindex): New function.
10341         (Xindex::sym_xindex_to_shndx): New function.
10342         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
10343         available.
10344         (Sized_relobj::do_initialize_xindex): New function.
10345         (Sized_relobj::do_read_symbols): Adjust section links.
10346         (Sized_relobj::symbol_section_and_value): Add is_ordinary
10347         parameter.  Change all callers.
10348         (Sized_relobj::include_section_group): Adjust section links and
10349         symbol section indexes.
10350         (Sized_relobj::do_layout): Adjust section links.
10351         (Sized_relobj::do_count_local_symbols): Adjust section links and
10352         symbol section indexes.
10353         (Sized_relobj::do_finalize_local_symbols): Distinguish between
10354         ordinary and special symbols.
10355         (Sized_relobj::write_local_symbols): Add symtab_xindex and
10356         dynsym_xindex parameters.  Change all callers.  Adjust section
10357         links.  Use SHN_XINDEX when needed.
10358         (Sized_relobj::get_symbol_location_info): Adjust section links.
10359         Don't get fooled by special symbols.
10360         * object.h (class Xindex): Define.
10361         (class Object): Add xindex_ parameter.  Declare virtual functoin
10362         do_initialize_xindex.
10363         (Object::adjust_sym_shndx): New function.
10364         (Object::set_xindex): New protected function.
10365         (class Symbol_value): Add is_ordinary_shndx_ field.
10366         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
10367         (Symbol_value::value): Assert ordinary section.
10368         (Symbol_value::initialize_input_to_output_map): Likewise.
10369         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
10370         Change all callers.
10371         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
10372         all callers.
10373         (class Sized_relobj): Update declarations.
10374         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
10375         parameter.  Change all callers.
10376         (Sized_relobj::adjust_shndx): New function.
10377         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
10378         field.
10379         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
10380         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
10381         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
10382         (Sized_dynobj::read_dynsym_section): Adjust section links.
10383         (Sized_dynobj::read_dynamic): Likewise.
10384         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
10385         section links.
10386         (Sized_dynobj::do_initialize_xindex): New function.
10387         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
10388         do_initialize_xindex.
10389         (Sized_dynobj::adjust_shndx): New function.
10390         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
10391         dynsym_xindex_ fields.
10392         (Layout::finalize): Add a call to set_section_indexes before
10393         creating the symtab sections.
10394         (Layout::set_section_indexes): Don't do anything if the section
10395         already has a section index.
10396         (Layout::create_symtab_sections): Add shnum parameter.  Change
10397         caller.  Create .symtab_shndx section if needed.
10398         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
10399         caller.
10400         (Layout::allocated_output_section_count): New function.
10401         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
10402         needed.
10403         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
10404         fields.  Update declarations.
10405         (Layout::symtab_xindex): New function.
10406         (Layout::dynsym_xindex): New function.
10407         (class Write_symbols_task): Add layout_ field.
10408         (Write_symbols_task::Write_symbols_task): Add layout parameter.
10409         Change caller.
10410         * output.cc (Output_section_headers::Output_section_headers): Add
10411         shstrtab_section parameter.  Change all callers.
10412         (Output_section_headers::do_sized_write): Store overflow values
10413         for section count and section string table section index in
10414         section header zero.
10415         (Output_file_header::do_sized_write): Check for overflow of
10416         section count and section string table section index.
10417         (Output_symtab_xindex::do_write): New function.
10418         (Output_symtab_xindex::endian_do_write): New function.
10419         * output.h (class Output_section_headers): Add shstrtab_section_.
10420         Update declarations.
10421         (class Output_symtab_xindex): Define.
10422         (Output_section::has_out_shndx): New function.
10423         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
10424         field.
10425         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
10426         Change all callers.
10427         (Sized_symbol::init): Likewise.
10428         (Symbol::output_section): Check for ordinary symbol.
10429         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
10430         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
10431         callers.
10432         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
10433         Change all callers.  Simplify handling of symbols from sections
10434         not included in the link.
10435         (Symbol_table::add_from_dynobj): Handle ordinary symbol
10436         distinction.
10437         (Weak_alias_sorter::operator()): Assert that symbols are
10438         ordinary.
10439         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
10440         distinction.
10441         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
10442         parameters.  Change all callers.
10443         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
10444         symbol distinction.  Use SHN_XINDEX when needed.
10445         (Symbol_table::write_section_symbol): Add symtab_xindex
10446         parameter.  Change all callers.
10447         (Symbol_table::sized_write_section_symbol): Likewise.  Use
10448         SHN_XINDEX when needed.
10449         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
10450         declarations.
10451         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
10452         (Symbol::is_defined): Check is_ordinary.
10453         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
10454         (Symbol::is_absolute, Symbol::is_common): Likewise.
10455         (class Sized_symbol): Update declarations.
10456         (class Symbol_table): Update declarations.
10457         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
10458         parameters.  Change all callers.
10459         (Sized_symbol::override): Likewise.
10460         (Symbol_table::override): Likewise.
10461         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
10462         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
10463         is_ordinary, and orig_st_shndx parameters.  Change all callers.
10464         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
10465         to be in an ordinary section.
10466         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
10467         object and is_ordinary parameters.  Change all callers.
10468         (Sized_dwarf_line_info::read_relocs): Add object parameter.
10469         Change all callers.  Don't add undefined or non-ordinary symbols
10470         to reloc_map_.
10471         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
10472         Change all callers.
10473         * dwarf_reader.h (class Sized_dwarf_line_info): Update
10474         declarations.
10475         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
10476         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
10477         (Sized_relobj::relocate_sections): Likewise.
10478         * target-reloc.h (scan_relocs): Adjust section symbol index.
10479         (scan_relocatable_relocs): Likewise.
10480         * i386.cc (Scan::local): Check for ordinary symbols.
10481         * sparc.cc (Scan::local): Likewise.
10482         * x86_64.cc (Scan::local): Likewise.
10483         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
10484         to symbol_section_and_value.
10485         * testsuite/many_sections_test.cc: New file.
10486         * testsuite/Makefile.am (BUILT_SOURCES): Define.
10487         (check_PROGRAMS): Add many_sections_test.
10488         (many_sections_test_SOURCES): Define.
10489         (many_sections_test_DEPENDENCIES): Define.
10490         (many_sections_test_LDFLAGS): Define.
10491         (BUILT_SOURCES): Add many_sections_define.h.
10492         (many_sections_define.h): New target.
10493         (BUILT_SOURCES): Add many_sections_check.h.
10494         (many_sections_check.h): New target.
10495         (check_PROGRAMS): Add many_sections_r_test.
10496         (many_sections_r_test_SOURCES): Define.
10497         (many_sections_r_test_DEPENDENCIES): Define.
10498         (many_sections_r_test_LDFLAGS): Define.
10499         (many_sections_r_test_LDADD): Define.
10500         (many_sections_r_test.o): New target.
10501         * testsuite/Makefile.in: Rebuild.
10503 2008-04-17  Cary Coutant  <ccoutant@google.com>
10505         * errors.cc (Errors::info): New function.
10506         (gold_info): New function.
10507         * errors.h (Errors::info): New function.
10508         * gold.h (gold_info): New function.
10509         * object.cc (Input_objects::add_object): Print trace output.
10510         * options.cc (options::parse_set): New function.
10511         (General_options::parse_wrap): Deleted.
10512         (General_options::General_options): Deleted initializer.
10513         * options.h (options::String_set): New typedef.
10514         (options::parse_set): New function.
10515         (DEFINE_set): New macro.
10516         (General_options::wrap): Changed to use DEFINE_set. Changed
10517         callers of any_wrap_symbols and is_wrap_symbol.
10518         (General_options::trace, General_options::trace_symbol):
10519         New options.
10520         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
10521         (General_options::wrap_symbols_): Deleted.
10522         * symtab.cc (Symbol_table::add_from_object): Print trace output.
10524 2008-04-17  David S. Miller  <davem@davemloft.net>
10526         * options.cc (General_options::parse_V): New function.
10527         * options.h: Add entries for -V and -Qy.
10529 2008-04-17  Ian Lance Taylor  <iant@google.com>
10531         * common.cc (Symbol_table::allocate_commons): Remove options
10532         parameter.  Change caller.
10533         (Symbol_table::do_allocate_commons): Remove options parameter.
10534         Change caller.  Just call do_allocate_commons_list twice.
10535         (Symbol_table::do_allocate_commons_list): New function, broken out
10536         of do_allocate_commons.
10537         * common.h (class Allocate_commons_task): Remove options_ field.
10538         Update constructor.
10539         * symtab.cc (Symbol_table::Symbol_table): Initialize
10540         tls_commons_.
10541         (Symbol_table::add_from_object): Put TLS common symbols on
10542         tls_commons_ list.
10543         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
10544         which are IN_OUTPUT_DATA.
10545         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
10546         allocate_commons and do_allocate_commons declarations.  Declare
10547         do_allocate_commons_list.
10548         * gold.cc (queue_middle_tasks): Update creation of
10549         Allocate_commons_task to not pass options.
10550         * testsuite/Makefile.am (INCLUDES): Add -I.. .
10551         (TLS_TEST_C_FLAGS): New variable.
10552         (tls_test_c_pic.o): New target.
10553         (tls_test_shared.so): Link in tls_test_c_pic.o.
10554         (tls_test_c_pic_ie.o): New target.
10555         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
10556         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
10557         (tls_test_c.o): New target.
10558         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
10559         (tls_pic_test_LDADD): Likewise.
10560         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
10561         (tls_shared_gd_to_ie_test_LDADD): Likewise.
10562         (tls_test_c_gnu2.o): New target.
10563         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
10564         tls_test_c_gnu2.o.
10565         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
10566         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
10567         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
10568         * testsuite/tls_test.cc: Include "config.h".
10569         (t_last): Call t11_last.
10570         * testsuite/tls_test.h (t11, t11_last): Declare.
10571         * testsuite/tls_test_c.c: New file.
10572         * testsuite/tls_test_main.cc (thread_routine): Call t11.
10573         * configure.ac: Check for OpenMP support.
10574         * configure, config.in, Makefile.in: Rebuild.
10575         * testsuite/Makefile.in: Rebuild.
10577 2008-04-16  Cary Coutant  <ccoutant@google.com>
10579         * i386.cc (Target_i386::define_tls_base_symbol): New function.
10580         (Target_i386::tls_base_symbol_defined_): New field.
10581         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10582         (Target_i386::Scan::global): Likewise.
10583         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
10584         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
10585         (Target_x86_64::tls_base_symbol_defined_): New field.
10586         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10587         (Target_x86_64::Scan::global): Likewise.
10589 2008-04-16  Cary Coutant  <ccoutant@google.com>
10591         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
10592         (Symbol::needs_plt_entry): Allow weak undefined symbols.
10593         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
10594         building shared libraries.
10595         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
10596         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
10597         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
10598         * testsuite/Makefile.in: Rebuild.
10599         * testsuite/weak_undef.h: New file.
10600         * testsuite/weak_undef_file1.cc: Add extra test cases.
10601         * testsuite/weak_undef_file2.cc: Likewise.
10602         * testsuite/weak_undef_test.cc: Likewise.
10604 2008-04-16  David S. Miller  <davem@davemloft.net>
10606         * sparc.cc (Target_sparc::Scan): Change from struct to class.
10607         Add issued_non_pic_error_ field.  Declare check_non_pic.
10608         (Target_sparc::Scan::check_non_pic): New function.
10609         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
10610         (Target_sparc::Scan::global): Likewise.
10612         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
10613         * configure: Rebuild.
10615         * options.h (DEFINE_enable): New macro.
10616         (new_dtags): New enable option.
10617         (initfirst, interpose, loadfltr, nodefaultlib,
10618         nodelete, nodlopen, nodump): New -z options.
10619         * layout.cc (Layout:finish_dynamic_section): If new
10620         dtags enabled, emit DT_RUNPATH.  Also, emit a
10621         DT_FLAGS_1 containing any specified -z flags.
10623 2008-04-16  Ian Lance Taylor  <iant@google.com>
10625         * copy-relocs.cc: New file.
10626         * copy-relocs.h: New file.
10627         * reloc.cc: Remove Copy_relocs code.
10628         * reloc.h: Likewise.
10629         * reloc-types.h (struct Reloc_types) [both versions]: Add
10630         get_reloc_addend_noerror.
10631         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
10632         variants of add_global which take an addend which must be zero.
10633         * i386.cc: Include "copy-relocs.h".
10634         (class Target_i386): Change type of copy_relocs_ to variable,
10635         update initializer.
10636         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
10637         Change all callers.
10638         (Target_i386::do_finalize_sections): Change handling of
10639         copy_relocs_.
10640         * sparc.cc: Include "copy-relocs.h".
10641         (class Target_sparc): Change type of copy_relocs_ to variable,
10642         update initializer.
10643         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
10644         Change all callers.
10645         (Target_sparc::do_finalize_sections): Change handling of
10646         copy_relocs_.
10647         * x86_64.cc: Include "copy-relocs.h".
10648         (class Target_x86_64): Change type of copy_relocs_ to variable,
10649         update initializer.
10650         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
10651         class.  Change all callers.
10652         (Target_x86_64::do_finalize_sections): Change handling of
10653         copy_relocs_.
10654         * Makefile.am (CCFILES): Add copy-relocs.cc.
10655         (HFILES): Add copy-relocs.h.
10657         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
10659         * testsuite/script_test_4.sh: Permit leading zeroes.
10661 2008-04-15  Ian Lance Taylor  <iant@google.com>
10663         * script-sections.cc (Script_sections::create_segments): Use
10664         header_size_adjustment even when there is enough room for the
10665         headers.
10666         * testsuite/script_test_4.sh: New file.
10667         * testsuite/script_test_4.t: New file.
10668         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
10669         (check_DATA): Add script_test_4.stdout.
10670         (MOSTLYCLEANFILES): Likewise.
10671         (script_test_4): New target.
10672         (script_test_4.stdout): New target.
10673         * testsuite/Makefile.in: Rebuild.
10675         * sparc.cc: Add definitions for Output_data_plt_sparc class
10676         constants.
10678 2008-04-14  David S. Miller  <davem@davemloft.net>
10680         * sparc.cc: New file.
10681         * Makefile.am (TARGETSOURCES): Add sparc.cc
10682         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
10683         * configure.tgt: Document targ_extra_size and
10684         targ_extra_big_endian.  Add entries for sparc-* and
10685         sparc64-*.
10686         * configure.ac: Handle targ_extra_size and
10687         targ_extra_big_endian.
10688         * Makefile.in: Rebuild.
10689         * configure: Likewise.
10690         * po/POTFILES.in: Likewise.
10691         * po/gold.pot: Likewise.
10693 2008-04-14  Ian Lance Taylor  <iant@google.com>
10695         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
10696         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
10697         in the name/type/flags to section mapping.  Don't call
10698         allocate_output_section.
10699         (Layout::choose_output_section): Change parameter from adjust_name
10700         to is_input_section.  Don't permit input sections after sections
10701         are attached to segments.  Don't call allocate_output_section.
10702         (Layout::layout_eh_frame): Call update_flags_for_input_section,
10703         not write_enable_output_section.
10704         (Layout::make_output_section): Don't push to
10705         unattached_section_list_ nor call attach_to_segment.  Call
10706         attach_section_to_segment if sections are attached.
10707         (Layout::attach_sections_to_segments): New function.
10708         (Layout::attach_section_to_segment): New function.
10709         (Layout::attach_allocated_section_to_segment): Rename from
10710         attach_to_segment.  Remove flags parameter.
10711         (Layout::allocate_output_section): Remove function.
10712         (Layout::write_enable_output_section): Remove function.
10713         * layout.h (class Layout): Update for above changes.  Add new
10714         field sections_are_attached_.
10715         * output.h (Output_section::update_flags_for_input_section): New
10716         function.
10717         * output.cc (Output_section::add_input_section): Call
10718         update_flags_for_input_section.
10719         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
10721 2008-04-11  Cary Coutant  <ccoutant@google.com>
10723         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
10724         thought unnecessary.
10725         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
10727 2008-04-11  Ian Lance Taylor  <iant@google.com>
10729         * output.h (class Output_section_data): Remove inline definition
10730         of set_addralign.
10731         * output.cc (Output_section_data::set_addralign): New function.
10733 2008-04-11  Cary Coutant  <ccoutant@google.com>
10735         Add support for TLS descriptors for i386 and x86_64.
10736         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
10737         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
10738         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
10739         GOT_TYPE_TLS_DESC.
10740         (Target_i386::got_mod_index_entry): Remove unnecessary code.
10741         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
10742         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
10743         relocations.
10744         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
10745         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
10746         Fix problem with initial-exec relocations.
10747         (Target_i386::Relocate::relocate_tls): Likewise.
10748         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
10749         relaxation.
10750         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
10751         support for section-plus-offset dynamic table entries.
10752         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
10753         (Output_data_dynamic::Dynamic_entry): Add support for
10754         section-plus-offset dynamic table entries.
10755         (Output_data_dynamic::Classification): Likewise.
10756         (Output_data_dynamic::classification_): Renamed offset_.
10757         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
10758         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
10759         (Target_x86_64::make_plt_section): New function.
10760         (Target_x86_64::reserve_tlsdesc_entries): New function.
10761         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
10762         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
10763         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
10764         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
10765         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
10766         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
10767         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
10768         add extra PLT entry for TLS descriptors.
10769         (Output_data_plt_x86_64::got_): New field.
10770         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
10771         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
10772         fields.
10773         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
10774         descriptors.
10775         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
10776         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
10777         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
10778         R_386_TLS_DESC_CALL relocations.
10779         (Target_x86_64::Scan::global): Likewise.
10780         (Target_x86_64::do_finalize_sections): Add dynamic table entries
10781         for TLS descriptors.
10782         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
10783         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
10784         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
10785         GD-to-IE relaxation.
10786         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
10787         and TLS_DESCRIPTORS.
10788         * Makefile.in: Rebuild.
10789         * configure: Rebuild.
10790         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
10791         (tls_test_shared2.so): New target.
10792         (tls_shared_gd_to_ie_test_SOURCES): New variable.
10793         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
10794         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
10795         (tls_shared_gd_to_ie_test_LDADD): New variable.
10796         (tls_shared_gnu2_gd_to_ie_test): New target.
10797         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
10798         New targets.
10799         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
10800         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
10801         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
10802         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
10803         (tls_shared_gnu2_test): New target.
10804         (tls_test_gnu2_shared.so): New target.
10805         (tls_shared_gnu2_test_SOURCES): New variable.
10806         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
10807         (tls_shared_gnu2_test_LDFLAGS): New variable.
10808         (tls_shared_gnu2_test_LDADD): New variable.
10809         * testsuite/Makefile.in: Rebuild.
10810         * testsuite/Makefile.
10812 2008-04-11  Ian Lance Taylor  <iant@google.com>
10814         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
10815         justsyms.t.
10816         * testsuite/Makefile.in: Rebuild.
10818         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
10819         long.
10820         * testsuite/script_test_2.cc (main): Adjust test.
10822 2008-04-11  David S. Miller  <davem@davemloft.net>
10823             Ian Lance Taylor  <iant@google.com>
10825         * options.h (General_options): Add entries for '-Y' and
10826         '-relax'.
10827         * options.cc (General_options:finalize): If -Y was used, add those
10828         entries to the library path instead of the default "/lib" and
10829         "/usr/lib".
10831 2008-04-11  David S. Miller  <davem@davemloft.net>
10833         * testsuite/justsyms.t: Start at 0x100.
10834         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
10835         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
10836         long.
10837         * testsuite/script_test_2.cc: Adjust string and section length
10838         checks.
10840 2008-04-09  Ian Lance Taylor  <iant@google.com>
10842         PR gold/5996
10843         * script-sections.cc (Sections_element::allocate_to_segment): Add
10844         orphan parameter.
10845         (Output_section_definition::allocate_to_segment): Likewise.
10846         (Orphan_output_section::allocate_to_segment): Likewise.
10847         (Script_sections::attach_sections_using_phdrs_clause): Don't
10848         propagate non-PT_LOAD segments to orphan sections.
10849         * testsuite/Makefile.am (script_test_3.stdout): Generate using
10850         readelf rather than objdump.
10851         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
10852         .interp section and PT_INTERP segment are the same size.
10853         * testsuite/Makefile.in: Rebuild.
10855         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
10856         aliases for symbols defined in the same object.
10857         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
10858         (weak_alias_test_SOURCES): New variable.
10859         (weak_alias_test_DEPENDENCIES): New variable.
10860         (weak_alias_test_LDFLAGS): New variable.
10861         (weak_alias_test_LDADD): New variable.
10862         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
10863         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
10864         (weak_alias_test_3.o): New target.
10865         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
10866         * testsuite/weak_alias_test_main.cc: New file.
10867         * testsuite/weak_alias_test_1.cc: New file.
10868         * testsuite/weak_alias_test_2.cc: New file.
10869         * testsuite/weak_alias_test_3.cc: New file.
10871 2008-04-08  Ian Lance Taylor  <iant@google.com>
10873         * options.h (class General_options): Add --noinhibit-exec option.
10874         * main.cc (main): Check --noinhibit-exec.
10876         * options.h (class General_options): Define --wrap as a special
10877         option.  Add wrap_symbols_ field.
10878         (General_options::any_wrap_symbols): New function.
10879         (General_options::is_wrap_symbol): New function.
10880         * options.cc (General_options::parse_wrap): New function.
10881         (General_options::General_options): Initialize wrap_symbols_.
10882         * symtab.cc (Symbol_table::wrap_symbol): New function.
10883         (Symbol_table::add_from_object): Handle --wrap.
10884         * symtab.h (class Symbol_table): Declare wrap_symbol.
10885         * target.h (Target::wrap_char): New function.
10886         (Target::Target_info): Add wrap_char field.
10887         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
10888         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10889         * testsuite/testfile.cc (Target_test::test_target_info):
10890         Likewise.
10892         * errors.cc (Errors::undefined_symbol): Mention symbol version if
10893         there is one.
10895         * layout.h (class Layout): Add added_eh_frame_data_ field.
10896         * layout.cc (Layout::Layout): Initialize new field.
10897         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
10898         output section until we find a section we merged successfully.
10899         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
10900         that the size be non-zero.
10902         * merge.cc (Object_merge_map::get_output_offset): Remove inline
10903         qualifier.
10905 2008-04-08  Craig Silverstein  <csilvers@google.com>
10907         * configure.ac: Export new conditional variable HAVE_ZLIB.
10908         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
10909         on HAVE_ZLIB.
10910         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
10911         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10913 2008-04-07  Ian Lance Taylor  <iant@google.com>
10915         * version.cc (version_string): Set to "1.5".
10917         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
10918         Add issued_non_pic_error_ field.  Declare check_non_pic.
10919         (Target_x86_64::Scan::check_non_pic): New function.
10920         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
10921         (Target_x86_64::Scan::global): Likewise.
10923         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
10924         addend parameter.  Change caller.  Handle merge sections.
10925         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
10926         Address to Addend.  Don't add in the result of
10927         local_section_offset, pass down the addend and use the returned
10928         value.
10929         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
10930         Update declarations of local_section_offset and symbol_value.
10931         * testsuite/two_file_test_1.cc (t18): New function.
10932         * testsuite/two_file_test_2.cc (f18): New function.
10933         * testsuite/two_file_test_main.cc (main): Call t18.
10934         * testsuite/two_file_test.h (t18, f18): Declare.
10936         * configure.ac: Don't test for objdump, c++filt, or readelf.
10937         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
10938         conditionals.
10939         (TEST_READELF): New variable.
10940         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
10941         (check_PROGRAMS): Add two_file_strip_test.
10942         (two_file_strip_test): New target.
10943         (check_PROGRAMS): Add two_file_same_shared_strip_test.
10944         (two_file_same_shared_strip_test_SOURCES): New variable.
10945         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
10946         (two_file_same_shared_strip_test_LDFLAGS): New variable.
10947         (two_file_same_shared_strip_test_LDADD): New variable.
10948         (two_file_shared_strip.so): New target.
10949         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
10950         (ver_test_5.syms, ver_test_7.syms): Likewise.
10951         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
10952         (strip_test_3.stdout): Use TEST_OBJDUMP.
10953         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10955 2008-04-04  Cary Coutant  <ccoutant@google.com>
10957         * symtab.h (Symbol::is_weak_undefined): New function.
10958         (Symbol::is_strong_undefined): New function.
10959         (Symbol::is_absolute): New function.
10960         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
10961         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
10962         absolute symbols.
10963         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
10964         (weak_undef_test): New target.
10965         * testsuite/Makefile.in: Rebuild.
10966         * testsuite/weak_undef_file1.cc: New file.
10967         * testsuite/weak_undef_file2.cc: New file.
10968         * testsuite/weak_undef_test.cc: New file.
10970 2008-04-03  Craig Silverstein  <csilvers@google.com>
10972         * compressed_output.h (class Output_compressed_section): Use
10973         unsigned buffer.
10974         * compressed_output.cc (zlib_compress): Use unsigned buffers,
10975         add zlib header.
10976         (zlib_compressed_suffix): Removed.
10977         (Output_compressed_section::set_final_data_size): Use unsigned
10978         buffers.
10979         * testsuite/Makefile.am (flagstest_compress_debug_sections):
10980         Fix linker invocation.
10981         (flagstest_o_specialfile_and_compress_debug_sections):
10982         Likewise.
10983         * testsuite/Makefile.in: Regenerated.
10985 2008-04-02  David S. Miller  <davem@davemloft.net>
10987         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
10988         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
10990 2008-04-02  Craig Silverstein  <csilvers@google.com>
10992         * TODO: New file.
10994 2008-04-02  Ian Lance Taylor  <iant@google.com>
10996         * fileread.cc (File_read::find_view): Add byteshift and vshifted
10997         parameters.  Update for new key type to views_.  Change all
10998         callers.
10999         (File_read::read): Adjust for byteshift in returned view.
11000         (File_read::add_view): New function, broken out of
11001         find_and_make_view.
11002         (File_read::make_view): New function, broken out of
11003         find_and_make_view.
11004         (File_read::find_or_make_view): Add offset and aligned
11005         parameters.  Rewrite accordingly.  Change all callers.
11006         (File_read::get_view): Add offset and aligned parameters.  Adjust
11007         for byteshift in return value.
11008         (File_read::get_lasting_view): Likewise.
11009         * fileread.h (class File_read): Update declarations.
11010         (class File_read::View): Add byteshift_ field.  Add byteshift to
11011         constructor.  Add byteshift method.
11012         * archive.h (Archive::clear_uncached_views): New function.
11013         (Archive::get_view): Add aligned parameter.  Change all callers.
11014         * object.h (Object::get_view): Add aligned parameter.  Change all
11015         callers.
11016         (Object::get_lasting_view): Likewise.
11018         * fileread.cc (File_read::release): Don't call clear_views if
11019         there are multiple objects.
11020         * fileread.h (File_read::clear_uncached_views): New function.
11021         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
11022         on the archive.
11024 2008-03-31  Cary Coutant  <ccoutant@google.com>
11026         Add thin archive support.
11027         * archive.cc (Archive::armagt): New const.
11028         (Archive::setup): Remove task parameter and calls to unlock.
11029         (Archive::unlock_nested_archives): New function.
11030         (Archive::read_header): Add nested_off parameter. Change
11031         all callers.
11032         (Archive::interpret_header): Likewise.
11033         (Archive::include_all_members): Change to handle thin
11034         archives.
11035         (Archive::include_member): Likewise.
11036         * archive.h (Archive::Archive): Add new parameters and
11037         initializers.
11038         (Archive::armagt): New const.
11039         (Archive::setup): Remove task parameter.
11040         (Archive::unlock_nested_archives): New function.
11041         (Archive::read_header): Add nested_off parameter.
11042         (Archive::interpret_header): Likewise.
11043         (Archive::Nested_archive_table): New typedef.
11044         (Archive::is_thin_archive_): New field.
11045         (Archive::nested_archives_): New field.
11046         (Archive::options_): New field.
11047         (Archive::dirpath_): New field.
11048         (Archive::task_): New field.
11049         * readsyms.cc (Read_symbols::do_read_symbols): Add check
11050         for thin archives.  Pass additional parameters to
11051         Archive::Archive.  Unlock the archive file after calling
11052         Archive::setup.
11054 2008-03-29  Ian Lance Taylor  <iant@google.com>
11056         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
11057         version symbol to be local.
11058         * testsuite/ver_test_4.sh: New file.
11059         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
11060         (check_DATA): Add ver_test_4.syms.
11061         (ver_test_4.syms): New target.
11062         * testsuite/Makefile.in: Rebuild.
11064         * output.cc
11065         (Output_section::Input_section_sort_entry::has_priority): New
11066         function.
11067         (Output_section::Input_section_sort_entry::match_file_name): New
11068         function.
11069         (Output_section::Input_section_sort_entry::match_section_name):
11070         Remove.
11071         (Output_section::Input_section_sort_entry::match_section_name_prefix):
11072         Remove.
11073         (Output_section::Input_section_sort_entry::match_section_file):
11074         Remove.
11075         (Output_section::Input_section_sort_compare::operator()): Rewrite
11076         using new Input_section_sort_entry functions.  Sort crtbegin and
11077         crtend first.  Sort sections with no priority before sections with
11078         a priority.
11079         * testsuite/initpri1.c (d3): Check j != 4.
11080         (cd5): New constructor/destructor function.
11081         (main): Check j != 2.
11083         * symtab.cc (Symbol_table::add_from_object): If we don't use the
11084         new symbol when resolving, don't call set_is_default.
11085         * testsuite/ver_test_7.cc: New file.
11086         * testsuite/ver_test_7.sh: New file.
11087         * testsuite/Makefile.am (ver_test_7.so): New target.
11088         (ver_test_7.o): New target.
11089         (check_SCRIPTS): Add ver_test_7.sh.
11090         (check_DATA): Add ver_test_7.syms.
11091         (ver_test_7.syms): New target.
11093 2008-03-28  Ian Lance Taylor  <iant@google.com>
11095         * layout.cc (Layout::layout): If we see an input section with a
11096         name that needs sorting, set the must_sort flag for the output
11097         section.
11098         (Layout::make_output_section): If the name of the output section
11099         indicates that it might require sorting, set the may_sort flag.
11100         * output.h (Output_section::may_sort_attached_input_sections): New
11101         function.
11102         (Output_section::set_may_sort_attached_input_sections): New
11103         function.
11104         (Output_section::must_sort_attached_input_sections): New
11105         function.
11106         (Output_section::set_must_sort_attached_input_sections): New
11107         function.
11108         (class Output_section): Declare Input_section_sort_entry.  Define
11109         Input_section_sort_compare.  Declare
11110         sort_attached_input_sections.  Add new fields:
11111         may_sort_attached_input_sections_,
11112         must_sort_attached_input_sections_,
11113         attached_input_sections_are_sorted_.
11114         * output.cc (Output_section::Output_section): Initialize new
11115         fields.
11116         (Output_section::add_input_section): Add an entry to
11117         input_sections_ if may_sort or must_sort are true.
11118         (Output_section::set_final_data_size): Call
11119         sort_attached_input_sections if necessary.
11120         (Output_section::Input_section_sort_entry): Define new class.
11121         (Output_section::Input_section_sort_compare::operator()): New
11122         function.
11123         (Output_section::sort_attached_input_sections): New function.
11124         * configure.ac: Check whether the compiler supports constructor
11125         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
11126         * testsuite/initpri1.c: New file.
11127         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
11128         CONSTRUCTOR_PRIORITY.
11129         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
11130         (initpri1_LDFLAGS): New variable.
11131         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11133 2008-03-27  Ian Lance Taylor  <iant@google.com>
11135         * common.cc (Sort_commons::operator): Correct sorting algorithm.
11136         * testsuite/common_test_1.c: New file.
11137         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
11138         (common_test_1_SOURCES): New variable.
11139         (common_test_1_DEPENDENCIES): New variable.
11140         (common_test_1_LDFLAGS): New variable.
11142         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
11143         and commons_ correctly when NAME/VERSION does not override
11144         NAME/NULL.
11145         * testsuite/ver_test_6.c: New file.
11146         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
11147         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
11148         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
11150 2008-03-26  Ian Lance Taylor  <iant@google.com>
11152         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
11153         of an undefined symbol from a version script.
11154         * testsuite/Makefile.am (ver_test_5.so): New target.
11155         (ver_test_5.o): New target.
11156         (check_SCRIPTS): Add ver_test_5.sh.
11157         (check_DATA): Add ver_test_5.syms.
11158         (ver_test_5.syms): New target.
11159         * testsuite/ver_test_5.cc: New file.
11160         * testsuite/ver_test_5.script: New file.
11161         * testsuite/ver_test_5.sh: New file.
11162         * Makefile.in, testsuite/Makefile.in: Rebuild.
11164         PR gold/5986
11165         Fix problems building gold with gcc 4.3.0.
11166         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
11167         (gold_error_at_location, gold_warning_at_location): Use it.
11168         * configure.ac: Check whether we can compile and use a template
11169         function with a printf attribute.
11170         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
11171         when jumping over bytes.
11172         * object.cc: Instantiate Object::read_section_data.
11173         * debug.h: Include <cstring>
11174         * dwarf_reader.cc: Include <algorithm>
11175         * main.cc: Include <cstring>.
11176         * options.cc: Include <cstring>.
11177         * output.cc: Include <cstring>.
11178         * script.cc: Include <cstring>.
11179         * script.h: Include <string>.
11180         * symtab.cc: Include <cstring> and <algorithm>.
11181         * target-select.cc: Include <cstring>.
11182         * version.cc: Include <string>.
11183         * testsuite/testmain.cc: Include <cstdlib>.
11184         * configure, config.in: Rebuild.
11186 2008-03-25  Ian Lance Taylor  <iant@google.com>
11188         * options.cc: Include "../bfd/bfdver.h".
11189         (options::help): Print bug reporting address.
11191         * version.cc (print_version): Adjust output for current value of
11192         BFD_VERSION_STRING.
11194         * NEWS: New file.
11196         * options.cc (options::help): Print list of supported targets.
11197         * target-select.h: Include <vector>.
11198         (class Target_selector): Make machine_, size_, and is_big_endian_
11199         fields const.  Add bfd_name_ and instantiated_target_ fields.
11200         (Target_selector::Target_selector): Add bfd_name parameter.
11201         (Target_selector::recognize): Make non-virtual, call
11202         do_recognize.
11203         (Target_selector::recognize_by_name): Make non-virtual, call
11204         do_recognize_by_name.
11205         (Target_selector::supported_names): New function.
11206         (Target_selector::bfd_name): New function.
11207         (Target_selector::do_instantiate_target): New pure virtual
11208         function.
11209         (Target_selector::do_recognize): New virtual function.
11210         (Target_selector::do_recognize_by_name): New virtual function.
11211         (Target_selector::instantiate_target): New private function.
11212         (supported_target_names): Declare.
11213         * target-select.cc (Target_selector::Target_selector): Update for
11214         new parameter and fields.
11215         (select_target_by_name): Check that the name matches before
11216         calling recognize_by_name.
11217         (supported_target_names): New function.
11218         * i386.cc (class Target_selector_i386): Update Target_selector
11219         constructor call.  Remove recognize and recognize_by_name.  Add
11220         do_instantiate_target.
11221         * x86_64.cc (class Target_selector_x86_64): Likewise.
11222         * testsuite/testfile.cc (class Target_selector_test): Update for
11223         changes to Target_selector.
11225         * README: Rewrite, with some notes on unsupported features.
11227 2008-03-24  Cary Coutant  <ccoutant@google.com>
11229         * i386.cc (Target_i386::Got_type): New enum declaration.
11230         (Target_i386::Scan::local): Updated callers of Output_data_got
11231         member functions.
11232         (Target_i386::Scan::global): Likewise.
11233         (Target_i386::Relocate::relocate): Likewise.
11234         (Target_i386::Relocate::relocate_tls): Likewise.
11235         * object.h (Got_offset_list): New class.
11236         (Sized_relobj::local_has_got_offset): Added got_type parameter.
11237         (Sized_relobj::local_got_offset): Likewise.
11238         (Sized_relobj::set_local_got_offset): Likewise.
11239         (Sized_relobj::local_has_tls_got_offset): Removed.
11240         (Sized_relobj::local_tls_got_offset): Removed.
11241         (Sized_relobj::set_local_tls_got_offset): Removed.
11242         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
11243         * output.cc (Output_data_got::add_global): Added got_type parameter.
11244         (Output_data_got::add_global_with_rel): Likewise.
11245         (Output_data_got::add_global_with_rela): Likewise.
11246         (Output_data_got::add_global_pair_with_rel): New function.
11247         (Output_data_got::add_global_pair_with_rela): New function.
11248         (Output_data_got::add_local): Added got_type parameter.
11249         (Output_data_got::add_local_with_rel): Likewise.
11250         (Output_data_got::add_local_with_rela): Likewise.
11251         (Output_data_got::add_local_pair_with_rel): New function.
11252         (Output_data_got::add_local_pair_with_rela): New function.
11253         (Output_data_got::add_global_tls): Removed.
11254         (Output_data_got::add_global_tls_with_rel): Removed.
11255         (Output_data_got::add_global_tls_with_rela): Removed.
11256         (Output_data_got::add_local_tls): Removed.
11257         (Output_data_got::add_local_tls_with_rel): Removed.
11258         (Output_data_got::add_local_tls_with_rela): Removed.
11259         * output.h (Output_data_got::add_global): Added got_type parameter.
11260         (Output_data_got::add_global_with_rel): Likewise.
11261         (Output_data_got::add_global_with_rela): Likewise.
11262         (Output_data_got::add_global_pair_with_rel): New function.
11263         (Output_data_got::add_global_pair_with_rela): New function.
11264         (Output_data_got::add_local): Added got_type parameter.
11265         (Output_data_got::add_local_with_rel): Likewise.
11266         (Output_data_got::add_local_with_rela): Likewise.
11267         (Output_data_got::add_local_pair_with_rel): New function.
11268         (Output_data_got::add_local_pair_with_rela): New function.
11269         (Output_data_got::add_global_tls): Removed.
11270         (Output_data_got::add_global_tls_with_rel): Removed.
11271         (Output_data_got::add_global_tls_with_rela): Removed.
11272         (Output_data_got::add_local_tls): Removed.
11273         (Output_data_got::add_local_tls_with_rel): Removed.
11274         (Output_data_got::add_local_tls_with_rela): Removed.
11275         * resolve.cc (Symbol::override_base_with_special): Removed
11276         reference to has_got_offset_ field.
11277         * symtab.cc (Symbol::init_fields): Replaced initialization
11278         of got_offset_ with got_offsets_.  Removed initialization
11279         of has_got_offset_
11280         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
11281         (Symbol::got_offset): Likewise.
11282         (Symbol::set_got_offset): Likewise.
11283         (Symbol::has_tls_got_offset): Removed.
11284         (Symbol::tls_got_offset): Removed.
11285         (Symbol::set_tls_got_offset): Removed.
11286         (Symbol::got_offset_): Removed.
11287         (Symbol::tls_mod_got_offset_): Removed.
11288         (Symbol::tls_pair_got_offset_): Removed.
11289         (Symbol::got_offsets_): New field.
11290         (Symbol::has_got_offset): Removed.
11291         (Symbol::has_tls_mod_got_offset): Removed.
11292         (Symbol::has_tls_pair_got_offset): Removed.
11293         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
11294         (Target_x86_64::Scan::local): Updated callers of Output_data_got
11295         member functions.
11296         (Target_x86_64::Scan::global): Likewise.
11297         (Target_x86_64::Relocate::relocate): Likewise.
11298         (Target_x86_64::Relocate::relocate_tls): Likewise.
11300 2008-03-25  Ben Elliston  <bje@au.ibm.com>
11302         * yyscript.y: Fix spelling error in comment.
11304 2008-03-24  Ian Lance Taylor  <iant@google.com>
11306         * options.h (class General_options): Define build_id option.
11307         * layout.h (class Layout): Declare write_build_id, create_note,
11308         create_build_id.  Add build_id_note_ member.
11309         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
11310         "libiberty.h", "md5.h", "sha1.h".
11311         (Layout::Layout): Initialize eh_frame_data_,
11312         eh_frame_hdr_section_, and build_id_note_.
11313         (Layout::finalize): Call create_build_id.
11314         (Layout::create_note): New function, broken out of
11315         Layout::create_gold_note.
11316         (Layout::create_gold_note): Call create_note.
11317         (Layout::create_build_id): New function.
11318         (Layout::write_build_id): New function.
11319         (Close_task_runner::run): Call write_build_id.
11321         * x86_64.cc: Correct license to GPLv3.
11323 2008-03-23  Ian Lance Taylor  <iant@google.com>
11325         * options.cc: Include "demangle.h".
11326         (parse_optional_string): New function.
11327         (parse_long_option): Handle takes_optional_argument.
11328         (parse_short_option): Update dash_z initializer.  Handle
11329         takes_optional_argument.
11330         (General_options::General_options): Initialize do_demangle_.
11331         (General_options::finalize): Set do_demangle_.  Handle demangling
11332         style.
11333         * options.h (parse_optional_string): Declare.
11334         (struct One_option): Add optional_arg field.  Update constructor.
11335         Update call constructor calls.  Add takes_optional_argument
11336         function.
11337         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
11338         (DEFINE_optional_string): Define.
11339         (General_options::demangle): Change from DEFINE_bool to
11340         DEFINE_optional_string.
11341         (General_options::no_demangle): New function.
11342         (General_options::do_demangle): New function.
11343         (General_options::set_do_demangle): New function.
11344         (General_options::execstack_status_): Move definition to end of
11345         class definition.
11346         (General_options::static_): Likewise.
11347         (General_options::do_demangle_): New field.
11348         * object.cc (big_endian>::get_symbol_location_info): Call
11349         Options::do_demangle, not Options::demangle.
11350         * symtab.cc (demangle): Likewise.
11352 2008-03-22  Ian Lance Taylor  <iant@google.com>
11354         * gold.h: Include <cstddef> and <sys/types.h>
11355         * options.h: Include <cstring>.
11357 2008-03-21  Ian Lance Taylor  <iant@google.com>
11359         * Added source code to GNU binutils.