PR gold/12898
[external/binutils.git] / gold / ChangeLog
1 2011-06-28  Ian Lance Taylor  <iant@google.com>
2
3         PR gold/12898
4         * layout.cc (Layout::segment_precedes): Don't crash if a linker
5         script create indistinguishable segments.
6         (Layout::set_segment_offsets): Use stable_sort when sorting
7         segments.  Pass this to Compare_segments constructor.
8         * layout.h (class Layout): Make segment_precedes non-static.
9         (class Compare_segments): Change from struct to class.  Add
10         layout_ field.  Add constructor.
11         * script-sections.cc
12         (Script_sections::attach_sections_using_phdrs_clause): Rename
13         local orphan to is_orphan.  Don't report failure to put empty
14         section in segment.  On attachment failure, report name of
15         section, and attach to first PT_LOAD segment.
16
17 2011-06-28  Ian Lance Taylor  <iant@google.com>
18
19         PR gold/12934
20         * target-select.cc (Target_selector::Target_selector): Add
21         emulation parameter.  Change all callers.
22         (select_target_by_bfd_name): Rename from select_target_by_name.
23         Change all callers.
24         (select_target_by_emulation): New function.
25         (supported_emulation_names): New function.
26         * target-select.h (class Target_selector): Add emulation_ field.
27         Update declarations.
28         (Target_selector::recognize_by_bfd_name): Rename from
29         recognize_by_name.  Change all callers.
30         (Target_selector::supported_bfd_names): Rename from
31         supported_names.  Change all callers.
32         (Target_selector::recognize_by_emulation): New function.
33         (Target_selector::supported_emulations): New function.
34         (Target_selector::emulation): New function.
35         (Target_selector::do_recognize_by_bfd_name): Rename from
36         do_recognize_by_name.  Change all callers.
37         (Target_selector::do_supported_bfd_names): Rename from
38         do_supported_names.  Change all callers.
39         (Target_selector::do_recognize_by_emulation): New function.
40         (Target_selector::do_supported_emulations): New function.
41         (select_target_by_bfd_name): Change name in declaration.
42         (select_target_by_emulation): Declare.
43         (supported_emulation_names): Declare.
44         * parameters.cc (parameters_force_valid_target): Try to find
45         target based on emulation from -m option.
46         * options.h (class General_options): Change doc string for -m.
47         * options.cc (help): Print emulations.
48         (General_options::parse_V): Likewise.
49         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
50         Add emulation parameter.  Change all callers.
51
52 2011-06-28  Ian Lance Taylor  <iant@google.com>
53
54         * target.h (class Target): Add osabi_ field.
55         (Target::osabi): New function.
56         (Target::set_osabi): New function.
57         (Target::Target): Initialize osabi_.
58         (Target::do_adjust_elf_header): Make pure virtual.
59         (Sized_target::do_adjust_elf_header): Declare.
60         * target.cc (Sized_target::do_adjust_elf_header): New function.
61         (class Sized_target): Instantiate all versions.
62         * freebsd.h (class Target_freebsd): Remove.
63         (Target_selector_freebsd::do_recognize): Call set_osabi on
64         Target.
65         (Target_selector_freebsd::do_recognize_by_name): Likewise.
66         (Target_selector_freebsd::set_osabi): Remove.
67         * i386.cc (class Target_i386): Inherit from Sized_target rather
68         than Target_freebsd.
69         * x86_64.cc (class Target_x86_64): Likewise.
70
71 2011-06-28  Ian Lance Taylor  <iant@google.com>
72
73         * target.h (Target::can_check_for_function_pointers): Rewrite.
74         Make non-virtual.
75         (Target::can_icf_inline_merge_sections): Likewise.
76         (Target::section_may_have_icf_unsafe_poineters): Likewise.
77         (Target::Target_info): Add can_icf_inline_merge_sections field.
78         (Target::do_can_check_for_function_pointers): New virtual
79         function.
80         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
81         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
82         from can_check_for_function_pointers, move in file.
83         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
84         section_may_have_icf_unsafe_poineters, move in file.
85         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
86         * i386.cc (Target_i386::do_can_check_for_function_pointers):
87         Rename from can_check_for_function_pointers, move in file.
88         (Target_i386::can_icf_inline_merge_sections): Remove.
89         (Target_i386::i386_info): Initialize
90         can_icf_inline_merge_sections.
91         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
92         Initialize can_icf_inline_merge_sections.
93         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
94         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
95         Rename from can_check_for_function_pointers, move in file.
96         (Target_x86_64::can_icf_inline_merge_sections): Remove.
97         (Target_x86_64::x86_64_info): Initialize
98         can_icf_inline_merge_sections.
99         * testsuite/testfile.cc (Target_test::test_target_info):
100         Likewise.
101         * icf.cc (get_section_contents): Correct formatting.
102
103 2011-06-27  Ian Lance Taylor  <iant@google.com>
104
105         * symtab.cc (Symbol::versioned_name): New function.
106         (Symbol_table::add_to_final_symtab): Use versioned_name when
107         appropriate.
108         (Symbol_table::sized_write_symbol): Likewise.
109         * symtab.h (class Symbol): Declare versioned_name.
110         * stringpool.h (class Stringpool_template): Add variant of add
111         which takes a std::basic_string.
112         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
113         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
114         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
115         (ver_test_12.o): New target.
116         * testsuite/Makefile.in: Rebuild.
117
118 2011-06-27  Doug Kwan  <dougkwan@google.com>
119
120         * arm.cc (Arm_relocate_functions::thm_jump8,
121         Arm_relocate_functions::thm_jump11): Use a wider signed
122         type to compute offset.
123         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
124         arm_thm_jump8.
125         * testsuite/Makefile.in: Regenerate.
126         * testsuite/arm_branch_in_range.sh: Check test results of
127         arm_thm_jump11 and arm_thm_jump8.
128         * testsuite/arm_thm_jump11.s: New test source file.
129         * testsuite/arm_thm_jump11.t: New linker script.
130         * testsuite/arm_thm_jump8.s: New test source file.
131         * testsuite/arm_thm_jump8.t: New linker script.
132
133 2011-06-24  Ian Lance Taylor  <iant@google.com>
134
135         * layout.cc: Include "object.h".
136         (ctors_sections_in_init_array): New static variable.
137         (Layout::is_ctors_in_init_array): New function.
138         (Layout::layout): Add entry to ctors_sections_in_init_array if
139         appropriate.
140         * layout.h (class Layout): Declare is_ctors_in_init_array.
141         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
142         is_ctors_reverse_view is set.
143         (Sized_relobj_file::write_sections): Add layout parameter.  Change
144         all callers.  Set is_ctors_reverse_view field of View_size.
145         (Sized_relobj_file::reverse_words): New function.
146         * object.h (Sized_relobj_file::View_size): Add
147         is_ctors_reverse_view field.
148         (class Sized_relobj_file): Update declarations.
149         * testsuite/initpri3.c: New test.
150         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
151         initpri3b.
152         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
153         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
154         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
155         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
156         * testsuite/Makefile.in: Rebuild.
157
158 2011-06-24  Cary Coutant  <ccoutant@google.com>
159
160         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
161         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
162         (debug_msg_cdebug.err): New targets.
163         * testsuite/Makefile.in: Regenerate.
164         * testsuite/debug_msg.sh: Check output of link with compressed debug.
165         Fix checks for link with shared library.
166
167 2011-06-24  Doug Kwan  <dougkwan@google.com>
168
169         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
170         skip empty text sections.
171         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
172
173 2011-06-22  Ian Lance Taylor  <iant@google.com>
174
175         PR gold/12910
176         * options.h (class General_options): Add --ctors-in-init-array.
177         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
178         friends as SHT_PROGBITS for merging sections.
179         (Layout::layout): Remove special handling of .init_array and
180         friends.  Don't sort if doing relocatable link.  Sort for .ctors
181         and .dtors if ctors_in_init_array.
182         (Layout::make_output_section): Force correct section types for
183         .init_array and friends.  Don't sort if doing relocatable link,
184         Don't sort .ctors and .dtors if ctors_in_init_array.
185         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
186         (Layout::output_section_name): Add relobj parameter.  Change all
187         callers.  Handle .ctors. and .dtors. in code rather than table.
188         Handle .ctors and .dtors if ctors_in_init_array.
189         (Layout::match_file_name): New function, moved from output.cc.
190         * layout.h (class Layout): Update declarations.
191         * output.cc: Include "layout.h".
192         (Input_section_sort_entry::get_priority): New function.
193         (Input_section_sort_entry::match_file_name): Just call
194         Layout::match_file_name.
195         (Output_section::Input_section_sort_init_fini_compare::operator()):
196         Handle .ctors and .dtors.  Sort by explicit priority rather than
197         by name.
198         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
199         * testsuite/initpri2.c: New test.
200         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
201         (check_PROGRAMS): Add initpri2.
202         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
203         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
204         * configure, testsuite/Makefile.in: Rebuild.
205
206 2011-06-19  Ian Lance Taylor  <iant@google.com>
207
208         PR gold/12880
209         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
210         .interp section to a PT_INTERP segment even if we have seen a
211         --dynamic-linker option.  Don't do it if we have seen a PHDRS
212         clause in a linker script.
213         (Layout::finalize): Don't create a .interp section if we've
214         already create a PT_INTERP segment.
215         (Layout::create_interp): Always call choose_output_section (revert
216         patch of 2011-06-17).  Don't create PT_INTERP segment.
217         * script-sections.cc
218         (Script_sections::create_note_and_tls_segments): Add a .interp
219         section to a PT_INTERP segment even if we have seen a
220         --dynamic-linker option.
221
222 2011-06-18  Ian Lance Taylor  <iant@google.com>
223
224         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
225         merely because a non-PT_LOAD segment has a dynamic reloc.
226
227 2011-06-18  Ian Lance Taylor  <iant@google.com>
228
229         * layout.cc (Layout::finish_dynamic_section): Don't create
230         DT_FLAGS entry if not needed.
231
232 2011-06-18  Ian Lance Taylor  <iant@google.com>
233
234         PR gold/12745
235         * layout.cc (Layout::layout_eh_frame): Correct handling of
236         writable .eh_frame section.
237
238 2011-06-17  Ian Lance Taylor  <iant@google.com>
239
240         PR gold/12893
241         * resolve.cc (Symbol_table::resolve): Don't give an error if a
242         symbol is redefined with the exact same object and value.
243
244 2011-06-17  Ian Lance Taylor  <iant@google.com>
245
246         PR gold/12880
247         * layout.h (class Layout): Add interp_segment_ field.
248         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
249         (Layout::attach_allocated_section_to_segment): If making shared
250         library, put .interp section in PT_INTERP segment.
251         (Layout::finalize): Also call create_interp if -dynamic-linker
252         option was used.
253         (Layout::create_interp): Assert that there is no PT_INTERP
254         segment.  If not using a SECTIONS clause, use make_output_section.
255         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
256         * script-sections.cc
257         (Script_sections::create_note_and_tls_segments): If making shared
258         library, put .interp section in PT_INTERP segment.
259
260 2011-06-17  Ian Lance Taylor  <iant@google.com>
261
262         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
263         when making a shared library.
264
265 2011-06-17  Ian Lance Taylor  <iant@google.com>
266
267         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
268         parameter.  Change all callers.  Don't issue warning about PC32
269         against locally defined symbol.
270
271 2011-06-16  Ian Lance Taylor  <iant@google.com>
272
273         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
274         occurs in same object.
275
276 2011-06-14  Alan Modra  <amodra@gmail.com>
277
278         * po/POTFILES.in: Regenerate.
279
280 2011-06-09  Ian Lance Taylor  <iant@google.com>
281
282         * script-sections.cc
283         (Orphan_output_section::set_section_addresses): For a relocatable
284         link set address to 0.
285
286 2011-06-09  Cary Coutant  <ccoutant@google.com>
287
288         PR gold/12804
289         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
290         used with --compress-debug-sections.
291         * gold/object.cc (Sized_relobj_file::do_layout): Report
292         uncompressed size of compressed input sections.
293
294 2011-06-08  Cary Coutant  <ccoutant@google.com>
295
296         PR gold/12804
297         * testsuite/two_file_test_2_v1.cc: Change initialization of
298         v2 to keep it in .data.
299
300 2011-06-07  Cary Coutant  <ccoutant@google.com>
301
302         * common.cc (Symbol_table::do_allocate_commons_list): Call
303         gold_fallback.
304         * errors.cc (Errors::fatal): Adjust call to gold_exit.
305         (Errors::fallback): New function.
306         (gold_fallback): New function.
307         * errors.h (Errors::fallback): New function.
308         * gold.cc (gold_exit): Change status parameter to enum; adjust
309         all callers.
310         (queue_initial_tasks): Call gold_fallback.
311         * gold.h: Include cstdlib.
312         (Exit_status): New enum type.
313         (gold_exit): Change status parameter to enum.
314         (gold_fallback): New function.
315         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
316         (Layout::create_symtab_sections): Likewise.
317         (Layout::create_shdrs): Likewise.
318         * main.cc (main): Adjust call to gold_exit.
319         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
320         (Output_data_got::add_got_entry_pair): Likewise.
321         (Output_section::add_input_section): Likewise.
322         (Output_section::add_output_section_data): Likewise.
323         (Output_segment::set_section_list_addresses): Likewise.
324         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
325
326 2011-06-07  Cary Coutant  <ccoutant@google.com>
327
328         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
329         for incremental links.
330         * output.cc (Output_segment::set_section_list_addresses): Remove
331         FIXME and test for TLS or BSS.
332
333 2011-06-07  Cary Coutant  <ccoutant@google.com>
334
335         * testsuite/Makefile.am: Add incremental_copy_test,
336         incremental_common_test_1.
337         * testsuite/Makefile.in: Regenerate.
338         * testsuite/common_test_1_v1.c: New source file.
339         * testsuite/common_test_1_v2.c: New source file.
340         * testsuite/copy_test_v1.cc: New source file.
341
342 2011-06-07  Cary Coutant  <ccoutant@google.com>
343
344         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
345         update, allocate common from bss section's free list.
346         * incremental-dump.cc (dump_incremental_inputs): Print flag for
347         linker-defined symbols.
348         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
349         Skip GOT and PLT entries that are no longer referenced.
350         (Output_section_incremental_inputs::write_info_blocks): Mark
351         linker-defined symbols.
352         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
353         * output.cc (Output_section::allocate): New function.
354         * output.h (Output_section::allocate): New function.
355         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
356         linker-defined symbols.
357         (Symbol::override_base_with_special): Copy is_predefined_ flag.
358         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
359         (Symbol::init_base_output_data): Likewise.
360         (Symbol::init_base_output_segment): Likewise.
361         (Symbol::init_base_constant): Likewise.
362         (Sized_symbol::init_output_data): Likewise.
363         (Sized_symbol::init_output_segment): Likewise.
364         (Sized_symbol::init_constant): Likewise.
365         (Symbol_table::do_define_in_output_data): Likewise.
366         (Symbol_table::do_define_in_output_segment): Likewise.
367         (Symbol_table::do_define_as_constant): Likewise.
368         * symtab.h (Symbol::is_predefined): New function.
369         (Symbol::init_base_output_data): Add is_predefined parameter.
370         (Symbol::init_base_output_segment): Likewise.
371         (Symbol::init_base_constant): Likewise.
372         (Symbol::is_predefined_): New data member.
373         (Sized_symbol::init_output_data): Add is_predefined parameter.
374         (Sized_symbol::init_output_segment): Likewise.
375         (Sized_symbol::init_constant): Likewise.
376         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
377
378 2011-06-07  Cary Coutant  <ccoutant@google.com>
379
380         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
381         instead of emit_copy_reloc.
382         (Copy_relocs::emit_copy_reloc): Refactor.
383         (Copy_relocs::make_copy_reloc): New function.
384         (Copy_relocs::add_copy_reloc): Remove.
385         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
386         section.
387         (Copy_relocs::make_copy_reloc): New function.
388         (Copy_relocs::add_copy_reloc): Remove.
389         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
390         unchanged input files.
391         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
392         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
393         Reserve BSS space for COPY relocations.
394         (Sized_incremental_binary::do_emit_copy_relocs): New function.
395         (Output_section_incremental_inputs::write_info_blocks): Record
396         whether a symbol is copied from a shared object.
397         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
398         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
399         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
400         (Incremental_input_entry_reader::get_output_symbol_index): Add
401         is_copy parameter.
402         (Incremental_binary::emit_copy_relocs): New function.
403         (Incremental_binary::do_emit_copy_relocs): New function.
404         (Sized_incremental_binary::Sized_incremental_binary): Initialize
405         new data member.
406         (Sized_incremental_binary::add_copy_reloc): New function.
407         (Sized_incremental_binary::do_emit_copy_relocs): New function.
408         (Sized_incremental_binary::Copy_reloc): New struct.
409         (Sized_incremental_binary::Copy_relocs): New typedef.
410         (Sized_incremental_binary::copy_relocs_): New data member.
411         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
412         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
413         * target.h (Sized_target::emit_copy_reloc): New function.
414         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
415
416 2011-06-02  Cary Coutant  <ccoutant@google.com>
417
418         PR gold/12163
419         * gold/archive.cc (Archive::Archive): Initialize new data member.
420         (Archive::include_all_members): Return if archive has already been
421         included.
422         * gold/archive.h (Archive::include_all_members_): New data member.
423
424 2011-06-02  Nick Clifton  <nickc@redhat.com>
425
426         * dynobj.h: Fix spelling mistake in comment.
427         * output.cc: Likewise.
428
429 2011-05-31  Doug Kwan  <dougkwan@google.com>
430             Asier Llano
431
432         PR gold/12826
433         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
434         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
435         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
436         redundant arm_exidx_test.so.
437         * testsuite/Makefile.in: Regenerate.
438         (check_SCRIPTS): Add pr12826.sh
439         (check_DATA): Add pr12826.stdout
440         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
441         * testsuite/pr12826.sh: New file.
442         * testsuite/pr12826_1.s: Ditto.
443         * testsuite/pr12826_1.s: Ditto.
444
445 2011-05-30  Ian Lance Taylor  <iant@google.com>
446
447         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
448         sections.
449
450 2011-05-29  Ian Lance Taylor  <iant@google.com>
451
452         PR gold/12804
453         * testsuite/Makefile.am: Use different file name for two_file_test
454         temporary file for each incremental test.
455         * testsuite/Makefile.in: Rebuild.
456
457 2011-05-29  Ian Lance Taylor  <iant@google.com>
458
459         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
460         binary input file is empty.
461
462 2011-05-27  Ian Lance Taylor  <iant@google.com>
463
464         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
465         (ver_test_9.so): Likewise.
466         * testsuite/Makefile.in: Rebuild.
467
468 2011-05-26 Cary Coutant  <ccoutant@google.com>
469
470         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
471         * incremental.cc (Incremental_inputs::report_input_section): Fix
472         comment, indentation.
473         (Incremental_inputs::report_comdat_group): New function.
474         (Output_section_incremental_inputs::set_final_data_size): Adjust size
475         of data for incremental input file entry.
476         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
477         group count, COMDAT group signatures.
478         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
479         an unchanged input file.
480         * incremental.h (Incremental_object_entry::Incremental_object_entry):
481         Initialize new data member.
482         (Incremental_object_entry::add_comdat_group): New function.
483         (Incremental_object_entry::get_comdat_group_count): New function.
484         (Incremental_object_entry::get_comdat_signature_key): New function.
485         (Incremental_object_entry::groups_): New data member.
486         (Incremental_inputs::report_comdat_group): New function.
487         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
488         data for incremental input file entry.
489         (Incremental_input_entry_reader::get_comdat_group_count): New function.
490         (Incremental_input_entry_reader::get_input_section): Adjust size of
491         data for incremental input file entry.
492         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
493         (Incremental_input_entry_reader::get_comdat_group_signature): New
494         function.
495         * object.cc (Sized_relobj::include_section_group): Report kept
496         COMDAT groups for incremental links.
497
498 2011-05-24  David Meyer  <pdox@google.com>
499
500         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
501         with name parameter.  Add found_name parameter.
502         * fileread.cc (Input_file::find_file): Adjust code accordingly.
503         * dirsearch.h (class Dirsearch): Update declaration.
504
505 2011-05-24  Ian Lance Taylor  <iant@google.com>
506
507         * archive.cc (Library_base::should_include_member): Pull in object
508         from archive if it defines the entry symbol.
509         * parameters.cc (Parameters::entry): New function.
510         * parameters.h (class Parameters): Declare entry.
511         * output.h (class Output_file_header): Remove entry_ field.
512         * output.cc (Output_file_header::Output_file_header): Remove entry
513         parameter.  Change all callers.
514         (Output_file_header::entry): Use parameters->entry.
515         * gold.cc (queue_middle_tasks): Likewise.
516         * plugin.cc (Plugin_hook::run): Likewise.
517
518 2011-05-24 Cary Coutant  <ccoutant@google.com>
519
520         * gold.cc (queue_initial_tasks): Pass incremental base filename
521         to Output_file::open_base_file; don't print error message.
522         * incremental-dump.cc (main): Adjust call to
523         Output_file::open_for_modification.
524         * incremental-dump.cc (main): Likewise.
525         * incremental.cc (Incremental_inputs::report_command_line):
526         Ignore --incremental-base option when comparing command lines.
527         Ignore parameter when given as separate argument.
528         * options.h (class General_options): Add --incremental-base.
529         * output.cc (Output_file::Output_file):
530         (Output_file::open_base_file): Add base_name and writable parameters;
531         read base file into new file; print error message here.
532         (Output_file::map_no_anonymous): Add writable parameter; adjust all
533         callers.
534         * output.h (Output_file::open_for_modification): Rename to...
535         (Output_file::open_base_file): ...this; add base_name and
536         writable parameters; adjust all callers.
537         (Output_file::map_no_anonymous): Add writable parameter; adjust all
538         callers.
539         * testsuite/Makefile.am (incremental_test_4): Test
540         --incremental-base.
541         * testsuite/Makefile.in: Regenerate.
542
543 2011-05-24 Cary Coutant  <ccoutant@google.com>
544
545         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
546         incremental_test_4.
547         * testsuite/Makefile.in: Regenerate.
548         * testsuite/two_file_test_1_v1.cc: New test source file.
549         * testsuite/two_file_test_1b_v1.cc: New test source file.
550         * testsuite/two_file_test_2_v1.cc: New test source file.
551
552 2011-05-24 Cary Coutant  <ccoutant@google.com>
553
554         * dynobj.h (Dynobj::do_dynobj): New function.
555         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
556         flag and soname for shared objects.
557         * incremental.cc (Incremental_inputs::report_object): Make
558         either Incremental_object_entry or Incremental_dynobj_entry; add
559         soname to string table.
560         (Incremental_inputs::report_input_section): Add assertion.
561         (Output_section_incremental_inputs::set_final_data_size): Adjust
562         type of input file entry for shared libraries; adjust size of
563         shared library info entry.
564         (Output_section_incremental_inputs::write_input_files): Write
565         as_needed flag for shared libraries.
566         (Output_section_incremental_inputs::write_info_blocks): Adjust type
567         of input file entry for shared libraries; write soname.
568         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
569         soname from incremental info.
570         * incremental.h (enum Incremental_input_flags): Add
571         INCREMENTAL_INPUT_AS_NEEDED.
572         (Incremental_input_entry::Incremental_input_entry): Initialize new
573         data member.
574         (Incremental_input_entry::set_as_needed): New function.
575         (Incremental_input_entry::as_needed): New function.
576         (Incremental_input_entry::do_dynobj_entry): New function.
577         (Incremental_input_entry::as_needed_): New data member.
578         (Incremental_object_entry::Incremental_object_entry): Don't check
579         for shared library.
580         (Incremental_object_entry::do_type): Likewise.
581         (class Incremental_dynobj_entry): New class.
582         (Incremental_input_entry_reader::as_needed): New function.
583         (Incremental_input_entry_reader::get_soname): New function.
584         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
585         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
586         size of shared library info entry.
587         * layout.cc (Layout::finish_dynamic_section): Don't test for 
588         incremental link when adding DT_NEEDED entries.
589         * object.h (Object::Object): Initialize new data member.
590         (Object::dynobj): New function.
591         (Object::set_as_needed): New function.
592         (Object::as_needed): New function.
593         (Object::do_dynobj): New function.
594         (Object::as_needed_): New data member.
595
596 2011-05-24 Cary Coutant  <ccoutant@google.com>
597
598         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
599         info; adjust display of GOT entries.
600         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
601         vector of input objects; remove file_status_.
602         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
603         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
604         got_plt reader; call target hooks to reserve GOT entries.
605         (Output_section_incremental_inputs::set_final_data_size): Adjust size
606         of input file info header and GOT info entry.
607         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
608         relocation info.
609         (Got_plt_view_info::got_descriptor): Remove.
610         (Got_plt_view_info::sym_index): New data member.
611         (Got_plt_view_info::input_index): New data member.
612         (Local_got_offset_visitor::visit): Write input file index.
613         (Global_got_offset_visitor::visit): Write 0 for input file index.
614         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
615         with sym_index and input_index.
616         (Output_section_incremental_inputs::write_got_plt): Adjust size of
617         incremental info GOT entry; replace got_descriptor with input_index.
618         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
619         map from input file index to object.
620         (Sized_relobj_incr::do_layout): Replace direct data member reference
621         with accessor function.
622         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
623         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
624         Adjust size of input file info header.
625         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
626         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
627         (Incremental_input_entry_reader::get_input_section): Adjust size of
628         input file info header.
629         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
630         of incremental info GOT entry.
631         (Incremental_got_plt_reader::get_got_desc): Remove.
632         (Incremental_got_plt_reader::get_got_symndx): New function.
633         (Incremental_got_plt_reader::get_got_input_index): New function.
634         (Sized_incremental_binary::Sized_incremental_binary): Remove
635         file_status_; add input_objects_.
636         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
637         (Sized_incremental_binary::set_file_is_unchanged): Remove.
638         (Sized_incremental_binary::file_is_unchanged): Remove.
639         (Sized_incremental_binary::set_input_object): New function.
640         (Sized_incremental_binary::input_object): New function.
641         (Sized_incremental_binary::file_status_): Remove.
642         (Sized_incremental_binary::input_objects_): New data member.
643         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
644         references.
645         (Sized_relobj_incr::invalid_address): Move to base class.
646         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
647         class.
648         (Sized_relobj_incr::do_output_section_offset): Likewise.
649         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
650         (Sized_relobj_incr::section_offsets_): Likewise.
651         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
652         function.
653         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
654         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
655         with accessor function.
656         (Sized_relobj_file::do_layout): Likewise.
657         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
658         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
659         (Sized_relobj_file::compute_final_local_value): Replace refs to
660         section_offsets_ with accessor function.
661         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
662         * object.h (Relobj::Relobj): Initialize new data members.
663         (Relobj::add_dyn_reloc): New function.
664         (Relobj::first_dyn_reloc): New function.
665         (Relobj::dyn_reloc_count): New function.
666         (Relobj::first_dyn_reloc_): New data member.
667         (Relobj::dyn_reloc_count_): New data member.
668         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
669         references.
670         (Sized_relobj::Address): New typedef.
671         (Sized_relobj::invalid_address): Move here from child class.
672         (Sized_relobj::Sized_relobj): Initialize new data members.
673         (Sized_relobj::sized_relobj): New function.
674         (Sized_relobj::is_output_section_offset_invalid): Move here from
675         child class.
676         (Sized_relobj::get_output_section_offset): Likewise.
677         (Sized_relobj::local_has_got_offset): Likewise.
678         (Sized_relobj::local_got_offset): Likewise.
679         (Sized_relobj::set_local_got_offset): Likewise.
680         (Sized_relobj::do_for_all_local_got_entries): Likewise.
681         (Sized_relobj::clear_got_offsets): New function.
682         (Sized_relobj::section_offsets): Move here from child class.
683         (Sized_relobj::do_output_section_offset): Likewise.
684         (Sized_relobj::do_set_section_offset): Likewise.
685         (Sized_relobj::Local_got_offsets): Likewise.
686         (Sized_relobj::local_got_offsets_): Likewise.
687         (Sized_relobj::section_offsets_): Likewise.
688         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
689         references.
690         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
691         class.
692         (Sized_relobj_file::sized_relobj): New function
693         (Sized_relobj_file::local_has_got_offset): Move to base class.
694         (Sized_relobj_file::local_got_offset): Likewise.
695         (Sized_relobj_file::set_local_got_offset): Likewise.
696         (Sized_relobj_file::get_output_section_offset): Likewise.
697         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
698         (Sized_relobj_file::do_output_section_offset): Likewise.
699         (Sized_relobj_file::do_set_section_offset): Likewise.
700         (Sized_relobj_file::Local_got_offsets): Likewise.
701         (Sized_relobj_file::local_got_offsets_): Likewise.
702         (Sized_relobj_file::section_offsets_): Likewise.
703         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
704         (all constructors).
705         (set_needs_dynsym_index): Convert relobj to derived class pointer.
706         (Output_reloc::get_symbol_index): Likewise.
707         (Output_reloc::local_section_offset): Likewise.
708         (Output_reloc::get_address): Likewise.
709         (Output_reloc::symbol_value): Likewise.
710         (Output_data_got::reserve_slot): Move to class definition.
711         (Output_data_got::reserve_local): New function.
712         (Output_data_got::reserve_slot_for_global): Remove.
713         (Output_data_got::reserve_global): New function.
714         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
715         (all constructors, two instantiations).
716         (Output_reloc::get_relobj): New function (two instantiations).
717         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
718         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
719         (Output_data_reloc::add_global): Adjust type of relobj.
720         (Output_data_reloc::add_global_relative): Likewise.
721         (Output_data_reloc::add_symbolless_global_addend): Likewise.
722         (Output_data_reloc::add_local): Likewise.
723         (Output_data_reloc::add_local_relative): Likewise.
724         (Output_data_reloc::add_symbolless_local_addend): Likewise.
725         (Output_data_reloc::add_local_section): Likewise.
726         (Output_data_reloc::add_output_section): Likewise.
727         (Output_data_reloc::add_absolute): Likewise.
728         (Output_data_reloc::add_target_specific): Likewise.
729         (Output_data_got::reserve_slot): Move definition here.
730         (Output_data_got::reserve_local): New function.
731         (Output_data_got::reserve_global): New function.
732         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
733         section_offsets_ with accessor function.
734         (Sized_relobj_file::write_sections): Likewise.
735         (Sized_relobj_file::do_relocate_sections): Likewise.
736         * target.h (Sized_target::reserve_local_got_entry): New function.
737         (Sized_target::reserve_global_got_entry): New function.
738         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
739         (Target_x86_64::reserve_global_got_entry): New function.
740         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
741
742 2011-05-23 Cary Coutant  <ccoutant@google.com>
743
744         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
745         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
746         bit when checking got_type.
747         * incremental.cc (Sized_incremental_binary::setup_readers):
748         Store symbol table and string table locations; initialize bit vector
749         of file status flags.
750         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
751         unchanged files.
752         (Sized_incremental_binary::do_process_got_plt): New function.
753         (Sized_incremental_binary::get_symtab_view): Use stored locations.
754         (Output_section_incremental_inputs::set_final_data_size): Record
755         file index for each input file.
756         (Output_section_incremental_inputs::write_got_plt): Store file index
757         instead of input entry offset for each GOT entry.
758         * incremental.h
759         (Incremental_input_entry::Incremental_input_entry): Initialize new
760         data member.
761         (Incremental_input_entry::set_offset): Store file index.
762         (Incremental_input_entry::get_file_index): New function.
763         (Incremental_input_entry::file_index_): New data member.
764         (Incremental_binary::process_got_plt): New function.
765         (Incremental_binary::do_process_got_plt): New function.
766         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
767         data members.
768         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
769         (Sized_incremental_binary::set_file_is_unchanged): New function.
770         (Sized_incremental_binary::file_is_unchanged): New function.
771         (Sized_incremental_binary::do_process_got_plt): New function.
772         (Sized_incremental_binary::file_status_): New data member.
773         (Sized_incremental_binary::main_symtab_loc_): New data member.
774         (Sized_incremental_binary::main_strtab_loc_): New data member.
775         * output.cc (Output_data_got::Got_entry::write): Add case
776         RESERVED_CODE.
777         (Output_data_got::add_global): Call add_got_entry.
778         (Output_data_got::add_global_plt): Likewise.
779         (Output_data_got::add_global_with_rel): Likewise.
780         (Output_data_got::add_global_with_rela): Likewise.
781         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
782         (Output_data_got::add_global_pair_with_rela): Likewise.
783         (Output_data_got::add_local): Call add_got_entry.
784         (Output_data_got::add_local_plt): Likewise.
785         (Output_data_got::add_local_with_rel): Likewise.
786         (Output_data_got::add_local_with_rela): Likewise.
787         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
788         (Output_data_got::add_local_pair_with_rela): Likewise.
789         (Output_data_got::reserve_slot): New function.
790         (Output_data_got::reserve_slot_for_global): New function.
791         (Output_data_got::add_got_entry): New function.
792         (Output_data_got::add_got_entry_pair): New function.
793         (Output_section::add_output_section_data): Edit FIXME.
794         * output.h
795         (Output_section_data_build::Output_section_data_build): New
796         constructor with size parameter.
797         (Output_data_space::Output_data_space): Likewise.
798         (Output_data_got::Output_data_got): Initialize new data member; new
799         constructor with size parameter.
800         (Output_data_got::add_constant): Call add_got_entry.
801         (Output_data_got::reserve_slot): New function.
802         (Output_data_got::reserve_slot_for_global): New function.
803         (class Output_data_got::Got_entry): Add RESERVED_CODE.
804         (Output_data_got::add_got_entry): New function.
805         (Output_data_got::add_got_entry_pair): New function.
806         (Output_data_got::free_list_): New data member.
807         * target.h (Sized_target::init_got_plt_for_update): New function.
808         (Sized_target::register_global_plt_entry): New function.
809         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
810         Initialize new data member; call init; add constructor with PLT count.
811         (Output_data_plt_x86_64::init): New function.
812         (Output_data_plt_x86_64::add_relocation): New function.
813         (Output_data_plt_x86_64::reserve_slot): New function.
814         (Output_data_plt_x86_64::free_list_): New data member.
815         (Target_x86_64::init_got_plt_for_update): New function.
816         (Target_x86_64::register_global_plt_entry): New function.
817         (Output_data_plt_x86_64::add_entry): Allocate from free list for
818         incremental updates.
819         (Output_data_plt_x86_64::add_relocation): New function.
820         * testsuite/object_unittest.cc (Object_test): Set default options.
821
822 2011-05-16  Ian Lance Taylor  <iant@google.com>
823
824         * options.h (class General_options): Make -i a synonym for -r.
825
826 2011-05-16  Ian Lance Taylor  <iant@google.com>
827
828         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
829
830 2011-05-10 Cary Coutant  <ccoutant@google.com>
831
832         * object.cc (Sized_relobj::do_count_local_symbols): Check for
833         strip_all (-s).
834
835 2011-05-06  Ian Lance Taylor  <iant@google.com>
836
837         * layout.cc (Layout::layout): If the output section flags change,
838         update the ordering.
839
840 2011-04-25 Cary Coutant  <ccoutant@google.com>
841
842         * incremental-dump.cc (dump_incremental_inputs): Print local
843         symbol info for each input file.
844         * incremental.cc
845         (Output_section_incremental_inputs::set_final_data_size): Add local
846         symbol info to input file entries in incremental info.
847         (Output_section_incremental_inputs::write_info_blocks): Likewise.
848         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
849         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
850         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
851         implementation.
852         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
853         (Sized_incr_relobj::do_relocate): Write the local symbols.
854         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
855         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
856         Adjust size of input file header.
857         (Incremental_inputs_reader::get_local_symbol_offset): New function.
858         (Incremental_inputs_reader::get_local_symbol_count): New function.
859         (Incremental_inputs_reader::get_input_section): Adjust size of input
860         file header.
861         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
862         (Sized_incr_relobj::This): New typedef.
863         (Sized_incr_relobj::sym_size): New const data member.
864         (Sized_incr_relobj::Local_symbol): New struct.
865         (Sized_incr_relobj::do_output_local_symbol_count): New function.
866         (Sized_incr_relobj::do_local_symbol_offset): New function.
867         (Sized_incr_relobj::local_symbol_count_): New data member.
868         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
869         (Sized_incr_relobj::local_symbol_index_): New data member.
870         (Sized_incr_relobj::local_symbol_offset_): New data member.
871         (Sized_incr_relobj::local_dynsym_offset_): New data member.
872         (Sized_incr_relobj::local_symbols_): New data member.
873         * object.h (Relobj::output_local_symbol_count): New function.
874         (Relobj::local_symbol_offset): New function.
875         (Relobj::do_output_local_symbol_count): New function.
876         (Relobj::do_local_symbol_offset): New function.
877         (Sized_relobj::do_output_local_symbol_count): New function.
878         (Sized_relobj::do_local_symbol_offset): New function.
879
880 2011-04-22  Vladimir Simonov  <sv@sw.ru>
881
882         * descriptors.cc (set_close_on_exec): New function.
883         (Descriptors::open): Use set_close_on_exec.
884         * output.cc (S_ISLNK): Define if not defined.
885
886 2011-04-22 Cary Coutant  <ccoutant@google.com>
887
888         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
889         global symbol map.
890         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
891         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
892         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
893         relocations.
894         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
895         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
896         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
897         * incremental.h
898         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
899         function.
900         (Incremental_binary::apply_incremental_relocs): New function.
901         (Incremental_binary::do_apply_incremental_relocs): New function.
902         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
903         data member.
904         (Sized_incremental_binary::add_global_symbol): New function.
905         (Sized_incremental_binary::global_symbol): New function.
906         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
907         (Sized_incremental_binary::symbol_map_): New data member.
908         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
909         * target.h (Sized_target::apply_relocation): New function.
910         * target-reloc.h (apply_relocation): New function.
911         * x86_64.cc (Target_x86_64::apply_relocation): New function.
912
913 2011-04-22  Doug Kwan  <dougkwan@google.com>
914
915         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
916         flag of a SHT_ARM_EXIDX section.
917         * testsuite/Makefile.am (arm_exidx_test): New test rules.
918         * testsuite/Makefile.in: Regenerate.
919         * testsuite/arm_exidx_test.s: New file.
920         * testsuite/arm_exidx_test.sh: Same.
921
922 2011-04-20 Cary Coutant  <ccoutant@google.com>
923
924         PR gold/12689
925         * archive.h (Incremental_archive_entry::Archive_member):
926         Initialize arg_serial_ (second constructor).
927
928 2011-04-17  Ian Lance Taylor  <iant@google.com>
929
930         * object.cc (Relocate_info::location): Simplify location string.
931         * errors.cc (Errors::error_at_location): Don't print program
932         name.
933         (Errors::warning_at_location): Likewise.
934         (Errors::undefined_symbol): Likewise.
935         * testsuite/debug_msg.sh: Update accordingly.
936
937 2011-04-14 Cary Coutant  <ccoutant@google.com>
938
939         * gold/layout.cc (Layout::symtab_section_offset): New function.
940         * gold/layout.h (Layout::symtab_section_offset): New function.
941         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
942
943 2011-04-12  Ian Lance Taylor  <iant@google.com>
944
945         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
946         with MREMAP_MAYMOVE.
947         * output.h (class Output_file): Add map_is_allocated_ field.
948         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
949         not available, provide stubs.  If mremap is not available, #define
950         it to gold_mremap.
951         (MREMAP_MAYMOVE): Define if not defined.
952         (Output_file::Output_file): Initialize map_is_allocated_.
953         (Output_file::resize): Check map_is_allocated_.
954         (Output_file::map_anonymous): If mmap fails, use malloc.
955         (Output_file::unmap): Don't do anything for an anonymous map.
956         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
957         is not available, provide stubs.
958         (File_read::View::~View): Use free rather than delete[].
959         (File_read::make_view): Use malloc rather than new[].  If mmap
960         fails, use malloc.
961         (File_read::find_or_make_view): Use malloc rather than new[].
962         * gold.h: Remove HAVE_REMAP code.
963         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
964         exists.  Rename mremap to gold_mremap.  If mmap is not available
965         don't do anything.
966         * configure, config.in: Rebuild.
967
968 2011-04-11  Ian Lance Taylor  <iant@google.com>
969
970         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
971         initialize local variable v.
972
973 2011-04-11  Cary Coutant  <ccoutant@google.com>
974
975         * archive.cc (Archive::include_member): Adjust call to
976         report_object.
977         (Add_archive_symbols::run): Track argument serial numbers.
978         (Lib_group::include_member): Likewise.
979         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
980         * archive.h (Incremental_archive_entry::Archive_member):
981         Initialize arg_serial_.
982         (Archive_member::arg_serial_): New data member.
983         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
984         (Sized_dynobj::do_add_symbols): Track symbols when doing an
985         incremental link.
986         (Sized_dynobj::do_for_all_local_got_entries): New function.
987         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
988         function.
989         * fileread.cc (get_mtime): New function.
990         * fileread.h (get_mtime): New function.
991         * gold.cc (queue_initial_tasks): Check for incremental update.
992         (process_incremental_input): New function.
993         (queue_middle_tasks): Don't force valid target for incremental
994         update.
995         * incremental-dump.cc (find_input_containing_global): Adjust
996         size of symbol info entry.
997         (dump_incremental_inputs): Dump argument serial number and
998         in_system_directory flag; bias shndx by 1; print symbol names
999         when dumping per-file symbol lists; use new symbol info readers.
1000         * incremental.cc
1001         (Output_section_incremental_inputs:update_data_size): New function.
1002         (Sized_incremental_binary::setup_readers): Setup input readers
1003         for each input file; build maps for files added from libraries
1004         and scripts.
1005         (Sized_incremental_binary::check_input_args): New function.
1006         (Sized_incremental_binary::do_check_inputs): Build map of argument
1007         serial numbers to input arguments.
1008         (Sized_incremental_binary::do_file_has_changed): Rename
1009         do_file_is_unchanged to this; compare file modification times.
1010         (Sized_incremental_binary::do_init_layout): New function.
1011         (Sized_incremental_binary::do_reserve_layout): New function.
1012         (Sized_incremental_binary::do_get_input_reader): Remove.
1013         (Sized_incremental_binary::get_symtab_view): New function.
1014         (Incremental_checker::can_incrementally_link_output_file): Remove.
1015         (Incremental_inputs::report_command_line): Exclude --debug options.
1016         (Incremental_inputs::report_archive_begin): Add parameter; track
1017         argument serial numbers; don't put input file entry for archive
1018         before archive members.
1019         (Incremental_inputs::report_archive_end): Put input file entry
1020         for archive after archive members.
1021         (Incremental_inputs::report_object): Add parameter; track argument
1022         serial numbers and in_system_directory flag.
1023         (Incremental_inputs::report_script): Add parameter; track argument
1024         serial numbers.
1025         (Output_section_incremental_inputs::set_final_data_size): Adjust
1026         size of symbol info entry; check for forwarding symbols.
1027         (Output_section_incremental_inputs::write_input_files): Write
1028         in_system_directory flag and argument serial number.
1029         (Output_section_incremental_inputs::write_info_blocks): Map section
1030         indices between incremental info and original input file; store
1031         input section index for each symbol.
1032         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
1033         change operator() to visit().
1034         (class Global_got_offset_visitor): Likewise.
1035         (class Global_symbol_visitor_got_plt):
1036         (Output_section_incremental_inputs::write_got_plt): Use new visitor
1037         classes.
1038         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
1039         (Sized_incr_relobj::do_read_symbols): New function.
1040         (Sized_incr_relobj::do_layout): New function.
1041         (Sized_incr_relobj::do_layout_deferred_sections): New function.
1042         (Sized_incr_relobj::do_add_symbols): New function.
1043         (Sized_incr_relobj::do_should_include_member): New function.
1044         (Sized_incr_relobj::do_for_all_global_symbols): New function.
1045         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
1046         (Sized_incr_relobj::do_section_size): New function.
1047         (Sized_incr_relobj::do_section_name): New function.
1048         (Sized_incr_relobj::do_section_contents): New function.
1049         (Sized_incr_relobj::do_section_flags): New function.
1050         (Sized_incr_relobj::do_section_entsize): New function.
1051         (Sized_incr_relobj::do_section_address): New function.
1052         (Sized_incr_relobj::do_section_type): New function.
1053         (Sized_incr_relobj::do_section_link): New function.
1054         (Sized_incr_relobj::do_section_info): New function.
1055         (Sized_incr_relobj::do_section_addralign): New function.
1056         (Sized_incr_relobj::do_initialize_xindex): New function.
1057         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
1058         (Sized_incr_relobj::do_read_relocs): New function.
1059         (Sized_incr_relobj::do_gc_process_relocs): New function.
1060         (Sized_incr_relobj::do_scan_relocs): New function.
1061         (Sized_incr_relobj::do_count_local_symbols): New function.
1062         (Sized_incr_relobj::do_finalize_local_symbols): New function.
1063         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
1064         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
1065         (Sized_incr_relobj::do_relocate): New function.
1066         (Sized_incr_relobj::do_set_section_offset): New function.
1067         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
1068         (Sized_incr_dynobj::do_read_symbols): New function.
1069         (Sized_incr_dynobj::do_layout): New function.
1070         (Sized_incr_dynobj::do_add_symbols): New function.
1071         (Sized_incr_dynobj::do_should_include_member): New function.
1072         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
1073         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
1074         (Sized_incr_dynobj::do_section_size): New function.
1075         (Sized_incr_dynobj::do_section_name): New function.
1076         (Sized_incr_dynobj::do_section_contents): New function.
1077         (Sized_incr_dynobj::do_section_flags): New function.
1078         (Sized_incr_dynobj::do_section_entsize): New function.
1079         (Sized_incr_dynobj::do_section_address): New function.
1080         (Sized_incr_dynobj::do_section_type): New function.
1081         (Sized_incr_dynobj::do_section_link): New function.
1082         (Sized_incr_dynobj::do_section_info): New function.
1083         (Sized_incr_dynobj::do_section_addralign): New function.
1084         (Sized_incr_dynobj::do_initialize_xindex): New function.
1085         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
1086         (make_sized_incremental_object): New function.
1087         (Incremental_library::copy_unused_symbols): New function.
1088         (Incremental_library::do_for_all_unused_symbols): New function.
1089         * incremental.h (enum Incremental_input_flags): New type.
1090         (class Incremental_checker): Remove.
1091         (Incremental_input_entry::Incremental_input_entry): Add argument
1092         serial number.
1093         (Incremental_input_entry::arg_serial): New function.
1094         (Incremental_input_entry::set_is_in_system_directory): New function.
1095         (Incremental_input_entry::is_in_system_directory): New function.
1096         (Incremental_input_entry::arg_serial_): New data member.
1097         (Incremental_input_entry::is_in_system_directory_): New data member.
1098         (class Script_info): Move here from script.h.
1099         (Script_info::Script_info): Add filename parameter.
1100         (Script_info::filename): New function.
1101         (Script_info::filename_): New data member.
1102         (Incremental_script_entry::Incremental_script_entry): Add argument
1103         serial number.
1104         (Incremental_object_entry::Incremental_object_entry): Likewise.
1105         (Incremental_object_entry::add_input_section): Build list of input
1106         sections with map to original shndx.
1107         (Incremental_object_entry::get_input_section_index): New function.
1108         (Incremental_object_entry::shndx_): New data member.
1109         (Incremental_object_entry::name_key_): Rename; adjust all refs.
1110         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
1111         (Incremental_archive_entry::Incremental_archive_entry): Add argument
1112         serial number.
1113         (Incremental_inputs::report_archive_begin): Likewise.
1114         (Incremental_inputs::report_object): Likewise.
1115         (Incremental_inputs::report_script): Likewise.
1116         (class Incremental_global_symbol_reader): New class.
1117         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
1118         and store flags and input file type.
1119         (Incremental_input_entry_reader::arg_serial): New function.
1120         (Incremental_input_entry_reader::type): Extract type from flags.
1121         (Incremental_input_entry_reader::is_in_system_directory): New function.
1122         (Incremental_input_entry_reader::get_input_section_count): Call
1123         accessor function for type.
1124         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
1125         function for type; adjust size of global symbol entry.
1126         (Incremental_input_entry_reader::get_global_symbol_count): Call
1127         accessor function for type.
1128         (Incremental_input_entry_reader::get_object_count): Likewise.
1129         (Incremental_input_entry_reader::get_object_offset): Likewise.
1130         (Incremental_input_entry_reader::get_member_count): Likewise.
1131         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
1132         (Incremental_input_entry_reader::get_member_offset): Likewise.
1133         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
1134         (Incremental_input_entry_reader::Global_symbol_info): Remove.
1135         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
1136         (Incremental_input_entry_reader::get_global_symbol_reader): New
1137         function.
1138         (Incremental_input_entry_reader::get_output_symbol_index): New
1139         function.
1140         (Incremental_input_entry_reader::type_): Remove.
1141         (Incremental_input_entry_reader::flags_): New data member.
1142         (Incremental_inputs_reader::input_file_offset): New function.
1143         (Incremental_inputs_reader::input_file_index): New function.
1144         (Incremental_inputs_reader::input_file): Call input_file_offset.
1145         (Incremental_inputs_reader::input_file_at_offset): New function.
1146         (Incremental_relocs_reader::get_r_type): Reformat.
1147         (Incremental_relocs_reader::get_r_shndx): Reformat.
1148         (Incremental_relocs_reader::get_r_offset): Reformat.
1149         (Incremental_relocs_reader::data): New function.
1150         (Incremental_binary::Incremental_binary): Initialize new data members.
1151         (Incremental_binary::check_inputs): Add cmdline parameter.
1152         (Incremental_binary::file_is_unchanged): Remove.
1153         (Input_reader::arg_serial): New function.
1154         (Input_reader::get_unused_symbol_count): New function.
1155         (Input_reader::get_unused_symbol): New function.
1156         (Input_reader::do_arg_serial): New function.
1157         (Input_reader::do_get_unused_symbol_count): New function.
1158         (Input_reader::do_get_unused_symbol): New function.
1159         (Incremental_binary::input_file_count): New function.
1160         (Incremental_binary::get_input_reader): Change signature to use
1161         index instead of filename.
1162         (Incremental_binary::file_has_changed): New function.
1163         (Incremental_binary::get_input_argument): New function.
1164         (Incremental_binary::get_library): New function.
1165         (Incremental_binary::get_script_info): New function.
1166         (Incremental_binary::init_layout): New function.
1167         (Incremental_binary::reserve_layout): New function.
1168         (Incremental_binary::output_file): New function.
1169         (Incremental_binary::do_check_inputs): New function.
1170         (Incremental_binary::do_file_is_unchanged): Remove.
1171         (Incremental_binary::do_file_has_changed): New function.
1172         (Incremental_binary::do_init_layout): New function.
1173         (Incremental_binary::do_reserve_layout): New function.
1174         (Incremental_binary::do_input_file_count): New function.
1175         (Incremental_binary::do_get_input_reader): Change signature.
1176         (Incremental_binary::input_args_map_): New data member.
1177         (Incremental_binary::library_map_): New data member.
1178         (Incremental_binary::script_map_): New data member.
1179         (Sized_incremental_binary::Sized_incremental_binary): Initialize
1180         new data members.
1181         (Sized_incremental_binary::output_section): New function.
1182         (Sized_incremental_binary::inputs_reader): Add const.
1183         (Sized_incremental_binary::symtab_reader): Add const.
1184         (Sized_incremental_binary::relocs_reader): Add const.
1185         (Sized_incremental_binary::got_plt_reader): Add const.
1186         (Sized_incremental_binary::get_symtab_view): New function.
1187         (Sized_incremental_binary::Inputs_reader): New typedef.
1188         (Sized_incremental_binary::Input_entry_reader): New typedef.
1189         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
1190         (Sized_incremental_binary::do_file_is_unchanged): Remove.
1191         (Sized_incremental_binary::do_file_has_changed): New function.
1192         (Sized_incremental_binary::do_init_layout): New function.
1193         (Sized_incremental_binary::do_reserve_layout): New function.
1194         (Sized_input_reader::Inputs_reader): Remove.
1195         (Sized_input_reader::Input_entry_reader): Remove.
1196         (Sized_input_reader::do_arg_serial): New function.
1197         (Sized_input_reader::do_get_unused_symbol_count): New function.
1198         (Sized_input_reader::do_get_unused_symbol): New function.
1199         (Sized_incremental_binary::do_input_file_count): New function.
1200         (Sized_incremental_binary::do_get_input_reader): Change signature;
1201         use index instead of filename.
1202         (Sized_incremental_binary::section_map_): New data member.
1203         (Sized_incremental_binary::input_entry_readers_): New data member.
1204         (class Sized_incr_relobj): New class.
1205         (class Sized_incr_dynobj): New class.
1206         (make_sized_incremental_object): New function.
1207         (class Incremental_library): New class.
1208         * layout.cc (Free_list::num_lists): New static data member.
1209         (Free_list::num_nodes): New static data member.
1210         (Free_list::num_removes): New static data member.
1211         (Free_list::num_remove_visits): New static data member.
1212         (Free_list::num_allocates): New static data member.
1213         (Free_list::num_allocate_visits): New static data member.
1214         (Free_list::init): New function.
1215         (Free_list::remove): New function.
1216         (Free_list::allocate): New function.
1217         (Free_list::dump): New function.
1218         (Free_list::print_stats): New function.
1219         (Layout_task_runner::run): Resize output file for incremental updates.
1220         (Layout::Layout): Initialize new data members.
1221         (Layout::set_incremental_base): New function.
1222         (Layout::init_fixed_output_section): New function.
1223         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
1224         incremental updates.
1225         (Layout::create_gold_note): Do not create gold note section for
1226         incremental updates.
1227         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
1228         for incremental updates.
1229         (Layout::set_section_offsets): For incremental updates, allocate space
1230         from free list.
1231         (Layout::create_symtab_sections): Layout with offsets relative to
1232         start of section; for incremental updates, allocate space from free
1233         list.
1234         (Layout::create_shdrs): For incremental updates, allocate space from
1235         free list.
1236         (Layout::finish_dynamic_section): For incremental updates, do not
1237         check --as-needed (fixed in subsequent patch).
1238         * layout.h (class Free_list): New class.
1239         (Layout::set_incremental_base): New function.
1240         (Layout::incremental_base): New function.
1241         (Layout::init_fixed_output_section): New function.
1242         (Layout::allocate): New function.
1243         (Layout::incremental_base_): New data member.
1244         (Layout::free_list_): New data member.
1245         * main.cc (main): Print Free_list statistics.
1246         * object.cc (Relobj::finalize_incremental_relocs): Add
1247         clear_counts parameter; clear counts only when clear_counts is set.
1248         (Sized_relobj::Sized_relobj): Initialize new base class.
1249         (Sized_relobj::do_layout): Don't report special sections.
1250         (Sized_relobj::do_for_all_local_got_entries): New function.
1251         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
1252         symtab_off to all symbol table offsets.
1253         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
1254         * object.h (class Got_offset_list): Move to top of file.
1255         (Object::Object): Allow case where input_file == NULL.
1256         (Object::~Object): Likewise.
1257         (Object::input_file): Assert that input_file != NULL.
1258         (Object::lock): Allow case where input_file == NULL.
1259         (Object::unlock): Likewise.
1260         (Object::is_locked): Likewise.
1261         (Object::token): Likewise.
1262         (Object::release): Likewise.
1263         (Object::is_incremental): New function.
1264         (Object::get_mtime): New function.
1265         (Object::for_all_local_got_entries): New function.
1266         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
1267         (Object::set_is_in_system_directory): New function.
1268         (Object::is_in_system_directory): New function.
1269         (Object::do_is_incremental): New function.
1270         (Object::do_get_mtime): New function.
1271         (Object::do_for_all_local_got_entries): New function.
1272         (Object::is_in_system_directory_): New data member.
1273         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
1274         (class Sized_relobj_base): New class.
1275         (class Sized_relobj): Derive from Sized_relobj_base.
1276         (class Sized_relobj::Symbols): Redeclare from base class.
1277         (class Sized_relobj::local_got_offset_list): Remove.
1278         (class Sized_relobj::Output_sections): Redeclare from base class.
1279         (class Sized_relobj::do_for_all_local_got_entries): New function.
1280         (class Sized_relobj::write_local_symbols): Add offset parameter.
1281         (class Sized_relobj::local_symbol_offset_): Update comment.
1282         (class Sized_relobj::local_dynsym_offset_): Update comment.
1283         * options.cc (Input_arguments::add_file): Remove const.
1284         * options.h (Input_file_argument::Input_file_argument):
1285         Initialize arg_serial_ (all constructors).
1286         (Input_file_argument::set_arg_serial): New function.
1287         (Input_file_argument::arg_serial): New function.
1288         (Input_file_argument::arg_serial_): New data member.
1289         (Input_arguments::Input_arguments): Initialize file_count_.
1290         (Input_arguments::add_file): Remove const.
1291         (Input_arguments::number_of_input_files): New function.
1292         (Input_arguments::file_count_): New data member.
1293         (Command_line::number_of_input_files): Call
1294         Input_arguments::number_of_input_files.
1295         * output.cc (Output_segment_headers::Output_segment_headers):
1296         Set current size.
1297         (Output_section::Input_section::current_data_size): New function.
1298         (Output_section::Output_section): Initialize new data members.
1299         (Output_section::add_input_section): Don't do merge sections for
1300         an incremental link; allocate space from free list for an
1301         incremental update.
1302         (Output_section::add_output_section_data): Allocate space from
1303         free list for an incremental update.
1304         (Output_section::update_data_size): New function.
1305         (Output_section::set_fixed_layout): New function.
1306         (Output_section::reserve): New function.
1307         (Output_segment::set_section_addresses): Remove const.
1308         (Output_segment::set_section_list_addresses): Remove const; allocate
1309         space from free list for an incremental update.
1310         (Output_segment::set_offset): Adjust size of RELRO segment for an
1311         incremental update.
1312         * output.h (Output_data::current_data_size): Move here from
1313         child classes.
1314         (Output_data::pre_finalize_data_size): New function.
1315         (Output_data::update_data_size): New function.
1316         (Output_section_headers::update_data_size): new function.
1317         (Output_section_data_build::current_data_size): Move to Output_data.
1318         (Output_data_strtab::update_data_size): New function.
1319         (Output_section::current_data_size): Move to Output_data.
1320         (Output_section::set_fixed_layout): New function.
1321         (Output_section::has_fixed_layout): New function.
1322         (Output_section::reserve): New function.
1323         (Output_section::update_data_size): New function.
1324         (Output_section::has_fixed_layout_): New data member.
1325         (Output_section::free_list_): New data member.
1326         (Output_segment::set_section_addresses): Remove const.
1327         (Output_segment::set_section_list_addresses): Remove const.
1328         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
1329         New function.
1330         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
1331         New function.
1332         * readsyms.cc (Read_symbols::do_read_symbols): Add library
1333         parameter when calling Add_symbols constructor; store argument
1334         serial number for members of a lib group.
1335         (Add_symbols::locks): Allow case where token == NULL.
1336         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
1337         (Read_member::~Read_member): New function.
1338         (Read_member::is_runnable): New function.
1339         (Read_member::locks): New function.
1340         (Read_member::run): New function.
1341         (Check_script::~Check_script): New function.
1342         (Check_script::is_runnable): New function.
1343         (Check_script::locks): New function.
1344         (Check_script::run): New function.
1345         (Check_library::~Check_library): New function.
1346         (Check_library::is_runnable): New function.
1347         (Check_library::locks): New function.
1348         (Check_library::run): New function.
1349         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
1350         (Add_symbols::library_): New data member.
1351         (class Read_member): New class.
1352         (class Check_script): New class.
1353         (class Check_library): New class.
1354         * reloc.cc (Read_relocs::is_runnable): Allow case where
1355         token == NULL.
1356         (Read_relocs::locks): Likewise.
1357         (Scan_relocs::locks): Likewise.
1358         (Relocate_task::locks): Likewise.
1359         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
1360         to clear counters.
1361         (Sized_relobj::incremental_relocs_scan): Fix comment.
1362         (Sized_relobj::do_relocate): Pass output file offset to
1363         write_local_symbols.
1364         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
1365         from class declaration.
1366         * script.cc (read_input_script): Allocate Script_info; pass
1367         argument serial number to report_script.
1368         * script.h (class Script_info): Move to incremental.h.
1369         * symtab.cc (Symbol_table::add_from_incrobj): New function.
1370         * symtab.h (Symbol_table::add_from_incrobj): New function.
1371         (Symbol_table::set_file_offset): New function.
1372
1373 2011-04-05  Cary Coutant  <ccoutant@google.com>
1374
1375         * incremental-dump.cc (dump_incremental_inputs): Change signature
1376         to take a Sized_incremental_binary; change caller.  Use readers
1377         in Sized_incremental_binary.
1378         * incremental.cc
1379         (Sized_incremental_binary::find_incremental_inputs_sections):
1380         Rename do_find_incremental_inputs_sections to this.
1381         (Sized_incremental_binary::setup_readers): New function.
1382         (Sized_incremental_binary::do_check_inputs): Check
1383         has_incremental_info_ flag; move setup code to setup_readers;
1384         use input readers.
1385         (Sized_incremental_binary::do_file_is_unchanged): New function.
1386         (Sized_incremental_binary::do_get_input_reader): New function.
1387         * incremental.h (class Incremental_binary): Move to end of file.
1388         (Incremental_binary::file_is_unchanged): New function.
1389         (Incremental_binary::do_file_is_unchanged): New function.
1390         (Incremental_binary::Input_reader): New class.
1391         (Incremental_binary::get_input_reader): New function.
1392         (class Sized_incremental_binary): Move to end of file.
1393         (Sized_incremental_binary::Sized_incremental_binary): Setup the
1394         input section reader classes.
1395         (Sized_incremental_binary::has_incremental_info): New function.
1396         (Sized_incremental_binary::inputs_reader): New function.
1397         (Sized_incremental_binary::symtab_reader): New function.
1398         (Sized_incremental_binary::relocs_reader): New function.
1399         (Sized_incremental_binary::got_plt_reader): New function.
1400         (Sized_incremental_binary::do_file_is_unchanged): New function.
1401         (Sized_incremental_binary::Sized_input_reader): New class.
1402         (Sized_incremental_binary::get_input_reader): New function.
1403         (Sized_incremental_binary::find_incremental_inputs_sections):
1404         Rename do_find_incremental_inputs_sections to this.
1405         (Sized_incremental_binary::setup_readers): New function.
1406         (Sized_incremental_binary::has_incremental_info_): New data member.
1407         (Sized_incremental_binary::inputs_reader_): New data member.
1408         (Sized_incremental_binary::symtab_reader_): New data member.
1409         (Sized_incremental_binary::relocs_reader_): New data member.
1410         (Sized_incremental_binary::got_plt_reader_): New data member.
1411         (Sized_incremental_binary::current_input_file_): New data member.
1412
1413 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
1414
1415         PR gold/12640
1416         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
1417         violation.
1418
1419 2011-03-30  Cary Coutant  <ccoutant@google.com>
1420
1421         * archive.cc (Archive::include_member): Adjust call to report_object.
1422         (Add_archive_symbols::run): Add script_info to call to
1423         report_archive_begin.
1424         (Lib_group::include_member): Adjust call to report_object.
1425         (Add_lib_group_symbols::run): Adjust call to report_object.
1426         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
1427         blocks.  Add object count for script input files.
1428         * incremental.cc (Incremental_inputs::report_archive_begin): Add
1429         script_info parameter; change all callers.
1430         (Incremental_inputs::report_object): Add script_info parameter;
1431         change all callers.
1432         (Incremental_inputs::report_script): Store backpointer to
1433         incremental info entry.
1434         (Output_section_incremental_inputs::set_final_data_size): Record
1435         additional information for scripts.
1436         (Output_section_incremental_inputs::write_info_blocks): Likewise.
1437         * incremental.h (Incremental_script_entry::add_object): New function.
1438         (Incremental_script_entry::get_object_count): New function.
1439         (Incremental_script_entry::get_object): New function.
1440         (Incremental_script_entry::objects_): New data member; adjust
1441         constructor.
1442         (Incremental_inputs::report_archive_begin): Add script_info parameter.
1443         (Incremental_inputs::report_object): Add script_info parameter.
1444         (Incremental_inputs_reader::get_object_count): New function.
1445         (Incremental_inputs_reader::get_object_offset): New function.
1446         * options.cc (Input_arguments::add_file): Return reference to
1447         new input argument.
1448         * options.h (Input_argument::set_script_info): New function.
1449         (Input_argument::script_info): New function.
1450         (Input_argument::script_info_): New data member; adjust all
1451         constructors.
1452         (Input_file_group::add_file): Return reference to new input argument.
1453         (Input_file_lib::add_file): Likewise.
1454         (Input_arguments::add_file): Likewise.
1455         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
1456         * script.cc (Parser_closure::Parser_closure): Add script_info
1457         parameter; adjust all callers.
1458         (Parser_closure::script_info): New function.
1459         (Parser_closure::script_info_): New data member.
1460         (read_input_script): Report scripts earlier to incremental info.
1461         (script_add_file): Set script_info in Input_argument.
1462         (script_add_library): Likewise.
1463         * script.h (Script_options::Script_info): Rewrite class.
1464
1465 2011-03-29  Cary Coutant  <ccoutant@google.com>
1466
1467         * archive.cc (Library_base::should_include_member): Move
1468         method here from class Archive.
1469         (Archive::Archive): Initialize base class.
1470         (Archive::should_include_member): Move to base class.
1471         (Archive::do_for_all_unused_symbols): New function.
1472         (Add_archive_symbols::run): Remove redundant access to
1473         incremental_inputs.
1474         (Lib_group::Lib_group): Initialize base class.
1475         (Lib_group::do_filename): New function.
1476         (Lib_group::include_member): Pass pointer to Lib_group to
1477         report_object.
1478         (Lib_group::do_for_all_unused_symbols): New function.
1479         (Add_lib_group_symbols::run): Report archive information for
1480         incremental links.
1481         * archive.h (class Library_base): New base class.
1482         (class Archive): Derive from Library_base.
1483         (Archive::filename): Move to base class.
1484         (Archive::set_incremental_info): Likewise.
1485         (Archive::incremental_info): Likewise.
1486         (Archive::Should_include): Likewise.
1487         (Archive::should_include_member): Likewise.
1488         (Archive::Armap_entry): Remove.
1489         (Archive::Unused_symbol_iterator): Remove.
1490         (Archive::unused_symbols_begin): Remove.
1491         (Archive::unused_symbols_end): Remove.
1492         (Archive::do_filename): New function.
1493         (Archive::do_get_mtime): New function.
1494         (Archive::do_for_all_unused_symbols): New function.
1495         (Archive::task_): Move to base class.
1496         (Archive::incremental_info_): Likewise.
1497         (class Lib_group): Derive from Library_base.
1498         (Lib_group::do_filename): New function.
1499         (Lib_group::do_get_mtime): New function.
1500         (Lib_group::do_for_all_unused_symbols): New function.
1501         (Lib_group::task_): Move to base class.
1502         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
1503         function.
1504         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
1505         function.
1506         * incremental.cc (Incremental_inputs::report_archive_begin):
1507         Use Library_base; call library's get_mtime; add incremental inputs
1508         entry before members.
1509         (class Unused_symbol_visitor): New class.
1510         (Incremental_inputs::report_archive_end): Use Library_base; use
1511         visitor class to record unused symbols; don't add incremental inputs
1512         entry after members.
1513         (Incremental_inputs::report_object): Use Library_base.
1514         * incremental.h
1515         (Incremental_archive_entry::Incremental_archive_entry): Remove
1516         unused Archive parameter.
1517         (Incremental_inputs::report_archive_begin): Use Library_base.
1518         (Incremental_inputs::report_archive_end): Likewise.
1519         (Incremental_inputs::report_object): Likewise.
1520         * object.cc (Sized_relobj::do_for_all_global_symbols): New
1521         function.
1522         * object.h (Object::for_all_global_symbols): New function.
1523         (Object::do_for_all_global_symbols): New function.
1524         (Sized_relobj::do_for_all_global_symbols): New function.
1525         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
1526         function.
1527         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
1528         function.
1529
1530 2011-03-27  Ian Lance Taylor  <iant@google.com>
1531
1532         * archive.cc (Archive::interpret_header): Return -1 if something
1533         goes wrong.  Change callers accordingly.
1534
1535 2011-03-25  Cary Coutant  <ccoutant@google.com>
1536
1537         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
1538         * testsuite/Makefile.in: Regenerate.
1539
1540 2010-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
1541
1542         * plugin.cc (get_view): New.
1543         (Plugin::load): Pass get_view to the plugin.
1544         (Plugin_manager::get_view): New.
1545
1546 2011-03-21  Ian Lance Taylor  <iant@google.com>
1547
1548         * testsuite/final_layout.sh: Rewrite to not use dc.
1549         * testsuite/relro_test.sh: Fail if dc is not present.
1550
1551 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
1552
1553         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
1554         Change == to -eq.
1555         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
1556         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
1557         Change == to -eq.
1558         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
1559         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
1560
1561 2011-03-14  Ian Lance Taylor  <iant@google.com>
1562
1563         * script-sections.cc (Sort_output_sections::script_compare):
1564         Rename from is_before, change return type.
1565         (Sort_output_sections::operator()): Adjust accordingly.
1566
1567 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
1568
1569         PR gold/12572
1570         * testsuite/odr_violation2.cc: Add comment to make all error line
1571         numbers double digits.
1572         * testsuite/debug_msg.sh: Adjust expected errors.
1573
1574 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
1575
1576         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
1577         but mark earlier ones as non-canonical
1578         (offset_to_iterator): Update search target and example
1579         (do_addr2line): Return extra lines in a vector*
1580         (format_file_lineno): Extract from do_addr2line
1581         (one_addr2line): Add vector* out-param
1582         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
1583         when a lineno entry appeared last for its instruction
1584         (Dwarf_line_info): Add vector* out-param
1585         * object.cc (Relocate_info): Pass NULL for the vector* out-param
1586         * symtab.cc (Odr_violation_compare): Include the lineno in the
1587         comparison again.
1588         (linenos_from_loc): New. Combine the canonical line for an
1589         address with its other lines.
1590         (True_if_intersect): New. Helper functor to make
1591         std::set_intersection a query.
1592         (detect_odr_violations): Compare sets of lines instead of just
1593         one line for each function. This became less deterministic, but
1594         has fewer false positives.
1595         * symtab.h: Declarations.
1596         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
1597         mix an optimized and non-optimized object in the same binary
1598         (odr_violation2.so): Same.
1599         * testsuite/Makefile.in: Regenerate from Makefile.am.
1600         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
1601         * testsuite/debug_msg.sh: Update line numbers and add
1602         assertions.
1603         * testsuite/odr_violation1.cc: Use OdrDerived, in a
1604         non-optimized context.
1605         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
1606         isn't inlined, and use OdrDerived in an optimized context.
1607         * testsuite/odr_header1.h: Defines OdrDerived, where
1608         optimization will change the
1609         first-instruction-in-the-destructor's file and line number.
1610         * testsuite/odr_header2.h: Defines OdrBase.
1611
1612 2011-03-09  Ian Lance Taylor  <iant@google.com>
1613
1614         * fileread.cc (File_read::clear_views): Don't delete the whole
1615         file view.
1616
1617 2011-03-08  Ian Lance Taylor  <iant@google.com>
1618
1619         PR gold/12525
1620         * fileread.cc: #include <climits>.
1621         (GOLD_IOV_MAX): Define.
1622         (File_read::read_multiple): Limit number of entries by iov_max.
1623         * fileread.h (class File_read): Always set max_readv_entries to
1624         128.
1625
1626 2011-03-07  Ian Lance Taylor  <iant@google.com>
1627
1628         PR gold/12525
1629         * options.h (class General_options): Add -dy and -dn.
1630
1631 2011-03-02  Cary Coutant  <ccoutant@google.com>
1632
1633         * testsuite/script_test_9.t: Add TLS segment.
1634
1635 2011-03-02  Simon Baldwin  <simonb@google.com>
1636
1637         * configure.ac: Add check for gnu_indirect_function support in
1638         the toolchain building binutils.
1639         * configure: Rebuild.
1640
1641 2010-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
1642
1643         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
1644         plugin only symbols.
1645         (Symbol_table::sized_finalize_symbol) Mark symbol only present
1646         in plugin files as not needed in the symbol table.
1647
1648 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
1649
1650         * output.cc (Output_section::add_input_section): Delay fill
1651         generation for section ordering.
1652
1653 2011-02-09  Ian Lance Taylor  <iant@google.com>
1654
1655         PR gold/12316
1656         * object.h (class Sized_relobj): Remove clear_local_symbols.
1657         * reloc.cc (Sized_relobj::do_relocate): Don't call
1658         clear_local_symbols.
1659
1660 2010-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
1661
1662         * plugin.cc (is_visible_from_outside): Return true for symbols
1663         in the -u option.
1664
1665 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
1666
1667         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
1668         filename.
1669
1670 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
1671
1672         * icf.h (is_section_foldable_candidate): Change type of parameter
1673         to std::string.
1674         * icf.cc (Icf::find_identical_sections): Change type of local variable
1675         section_name to be std::string.
1676         (is_function_ctor_or_dtor): Change type of parameter to std::string.
1677
1678 2011-01-25  Ian Lance Taylor  <iant@google.com>
1679
1680         * script.cc (script_add_extern): Rewrite to use
1681         add_symbol_reference.
1682
1683 2011-01-25  Doug Kwan  <dougkwan@google.com>
1684
1685         * icf.cc (get_section_contents): Always lock section's object.
1686
1687 2011-01-24  Ian Lance Taylor  <iant@google.com>
1688
1689         * options.h (class General_options): Accept
1690         --no-detect-odr-violations.
1691
1692 2011-01-24  Ian Lance Taylor  <iant@google.com>
1693
1694         * version.cc (version_string): Bump to 1.11.
1695
1696 2011-01-24  Ian Lance Taylor  <iant@google.com>
1697
1698         * plugin.cc (class Plugin_rescan): Define new class.
1699         (Plugin_manager::claim_file): Set any_claimed_.
1700         (Plugin_manager::save_archive): New function.
1701         (Plugin_manager::save_input_group): New function.
1702         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
1703         necessary.
1704         (Plugin_manager::new_undefined_symbol): New function.
1705         (Plugin_manager::rescan): New function.
1706         (Plugin_manager::rescannable_defines): New function.
1707         (Plugin_manager::add_input_file): Set any_added_.
1708         * plugin.h (class Plugin_manager): define new fields rescannable_,
1709         undefined_symbols_, any_claimed_, and any_added_.  Declare
1710         Plugin_rescan as friend.  Declare new functions.
1711         (Plugin_manager::Rescannable): Define type.
1712         (Plugin_manager::Rescannable_list): Define type.
1713         (Plugin_manager::Undefined_symbol_list): Define type.
1714         (Plugin_manager::Plugin_manager): Initialize new fields.
1715         * archive.cc (Archive::defines_symbol): New function.
1716         (Add_archive_symbols::run): Pass archive to plugins if any.
1717         * archive.h (class Archive): Declare defines_symbol.
1718         * readsyms.cc (Input_group::~Input_group): New function.
1719         (Finish_group::run): Pass input_group to plugins if any.
1720         * readsyms.h (class Input_group): Declare destructor.
1721         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
1722         any.
1723
1724 2011-01-10  Ian Lance Taylor  <iant@google.com>
1725
1726         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
1727         section as relro.
1728         (Layout::set_segment_offsets): Reset increase_relro before calling
1729         set_section_addresses a second time.
1730
1731 2011-01-04  Cary Coutant  <ccoutant@google.com>
1732
1733         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
1734         sections before NOBITS sections.
1735
1736 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
1737
1738         * version.cc (print_version): Update copyright to 2011.
1739
1740 2010-12-23  Cary Coutant  <ccoutant@google.com>
1741
1742         * output.h (Output_data_reloc::add_output_section): Pass OD instead
1743         of OS to this->add.  Add OD parameter to second form of the function.
1744
1745 2010-12-20  Ian Lance Taylor  <iant@google.com>
1746
1747         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
1748         second of two consecutive entries with same offset.
1749
1750 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
1751
1752         * testsuite/Makefile.am (ifuncmain2static_LDADD)
1753         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
1754         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
1755         to avoid unneeded links against $(LDADD).
1756         * testsuite/Makefile.in: Regenerate.
1757
1758 2010-12-15  Ian Lance Taylor  <iant@google.com>
1759
1760         PR gold/12324
1761         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
1762         for R_X86_64_32 and R_X86_64_PC32.
1763         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
1764         ver_matching_def_pic.o.
1765         (ver_matching_def_pic.o): New target.
1766
1767 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
1768
1769         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
1770         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
1771         Move definition before File_read::View member definitions.
1772         (File_read::View::~View): Initialize and hold lock before
1773         updating current_mapped_bytes.
1774
1775 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
1776
1777         * dwarf_reader.cc: Remove outdated comment.
1778         * gold-threads.cc: Fix typo in error message.
1779         * archive.cc: Fix typos in comments.
1780         * archive.h: Likewise.
1781         * arm-reloc-property.cc: Likewise.
1782         * arm-reloc-property.h: Likewise.
1783         * arm-reloc.def: Likewise.
1784         * arm.cc: Likewise.
1785         * attributes.h: Likewise.
1786         * cref.cc: Likewise.
1787         * ehframe.cc: Likewise.
1788         * fileread.h: Likewise.
1789         * gold.h: Likewise.
1790         * i386.cc: Likewise.
1791         * icf.cc: Likewise.
1792         * incremental.h: Likewise.
1793         * int_encoding.cc: Likewise.
1794         * layout.h: Likewise.
1795         * main.cc: Likewise.
1796         * merge.h: Likewise.
1797         * object.cc: Likewise.
1798         * object.h: Likewise.
1799         * options.cc: Likewise.
1800         * readsyms.cc: Likewise.
1801         * reduced_debug_output.cc: Likewise.
1802         * reloc.cc: Likewise.
1803         * script-sections.cc: Likewise.
1804         * sparc.cc: Likewise.
1805         * symtab.h: Likewise.
1806         * target-reloc.h: Likewise.
1807         * target.cc: Likewise.
1808         * target.h: Likewise.
1809         * timer.cc: Likewise.
1810         * timer.h: Likewise.
1811         * x86_64.cc: Likewise.
1812
1813 2010-12-09  Cary Coutant  <ccoutant@google.com>
1814
1815         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
1816         stack.
1817         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
1818         parameter; change all callers.
1819         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
1820         * options.h (warn_execstack): New option.
1821
1822 2010-12-07  Doug Kwan  <dougkwan@google.com>
1823
1824         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
1825         like function call relocations.
1826
1827 2010-12-07  Ian Lance Taylor  <iant@google.com>
1828
1829         * archive.cc (Archive::get_elf_object_for_member): Permit
1830         punconfigured to be NULL.
1831         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
1832         (Archive::include_member): Pass NULL to get_elf_object_for_member
1833         if we searched for the archive and this is the first included
1834         object.
1835
1836 2010-12-01  Ian Lance Taylor  <iant@google.com>
1837
1838         * dwarf_reader.h (class Sized_dwarf_line_info): Add
1839         track_relocs_type_ field.
1840         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1841         Set track_relocs_type_.
1842         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
1843         contents when using RELA relocs.
1844         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
1845         reloc_map_.
1846         * reloc.cc (Track_relocs::next_addend): New function.
1847         * reloc.h (class Track_relocs): Declare next_addend.
1848
1849 2010-12-01  Ian Lance Taylor  <iant@google.com>
1850
1851         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
1852         virtual destructor.
1853
1854 2010-12-01  Ian Lance Taylor  <iant@google.com>
1855
1856         * README: Update compilers known to work and fail.
1857
1858 2010-11-23  Matthias Klose  <doko@ubuntu.com>
1859
1860         * configure.in: For --enable-gold, handle value `default' instead of
1861         `both*'.  Always install ld as ld.bfd, install as ld if gold is
1862         not the default.
1863         * configure: Regenerate.
1864
1865 2010-11-18  Doug Kwan  <dougkwan@google.com>
1866
1867         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
1868         and right_alignment to be zero.  Store result alignment only if it is
1869         greater than existing alignment.
1870
1871 2010-11-16  Cary Coutant  <ccoutant@google.com>
1872
1873         PR gold/12220
1874         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1875         Check for ".zdebug_line".
1876
1877 2010-11-16  Doug Kwan  <dougkwan@google.com>
1878             Cary Coutant  <ccoutant@google.com>
1879
1880         * output.h (Output_segment::set_section_addresses): Pass increase_relro
1881         by reference; adjust all callers.
1882         * output.cc (Output_segment::set_section_addresses): Adjust references
1883         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
1884         list is empty.
1885         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
1886         end at page boundary.
1887
1888 2010-11-16  Cary Coutant  <ccoutant@google.com>
1889
1890         PR gold/12220
1891         * layout.cc (Layout::choose_output_section): Transform names of
1892         compressed sections even when using a script with a SECTIONS clause.
1893         (Layout::output_section_name): Remove code to transform
1894         compressed debug section names.
1895         * output.cc (Output_section::add_input_section): Use uncompressed
1896         section size when tracking input sections.
1897
1898 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
1899
1900         * symtab.h (Symbol::NON_PIC_REF): Remove.
1901         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
1902         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
1903         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
1904         (Symbol::use_plt_offset): Take a flags argument and pass it
1905         directly to needs_dynamic_reloc.  Restrict check for undefined
1906         weak symbols to function calls.
1907         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
1908         (Target_arm::Scan::global): Use it.
1909         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
1910         (Target_arm::Relocate::relocate): Likewise.
1911         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
1912         parameter with an r_type parameter.  Use get_reference_flags
1913         to get the flags.
1914         (Target_arm::Relocate::relocate): Update accordingly.
1915         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
1916         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
1917         (Target_i386::Scan::global): Likewise.
1918         (Target_i386::Relocate::relocate): Likewise.
1919         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
1920         parameter with an r_type parameter.  Use get_reference_flags
1921         to get the flags.
1922         (Target_i386::Relocate::relocate): Update accordingly.
1923         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
1924         (Target_powerpc::Scan::global): Use it.
1925         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
1926         (Target_powerpc::Relocate::relocate): Likewise.
1927         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
1928         (Target_sparc::Scan::global): Use it.
1929         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
1930         (Target_sparc::Relocate::relocate): Likewise.
1931         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
1932         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
1933         (Target_x86_64::Scan::global): Likewise.
1934         (Target_x86_64::Relocate::relocate): Likewise.
1935
1936 2010-11-08  Doug Kwan  <dougkwan@google.com>
1937             Cary Coutant  <ccoutant@google.com>
1938
1939         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
1940         (Arm_exidx_merge_section::section_contents_): New data member.
1941         (Arm_input_section::Arm_input_section): Initialize original_contents_.
1942         (Arm_input_section::~Arm_input_section): De-allocate memory.
1943         (Arm_input_section::original_contents_): New data member.       
1944         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
1945         in parameters instead of calling Object::section_contents without
1946         locking.
1947         (Arm_output_section::group_section): New parameter TASK.  Pass it
1948         to callees that need locking objects.
1949         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
1950         to lock EXIDX input sections.  Fix a formatting issue.  Call
1951         Arm_exidx_merged_section::build_contents to create merged section
1952         contents.
1953         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
1954         to lock object of stub table owner.
1955         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
1956         TEXT_SIZE to initialize data member TEXT_SIZE_.
1957         (Arm_exidx_input_section::addralign): Fix typo in comment.
1958         (Arm_exidx_input_section::text_size): New method.
1959         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
1960         that require locking objects.  Lock objects before scanning for stubs
1961         and updating local symbols.
1962         (Arm_input_section<big_endian>::init): Copy contents of original
1963         input section.
1964         (Arm_input_section<big_endian>::do_write): Use saved contents of
1965         original input section instead of calling Object::section_contents
1966         without locking.
1967         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
1968         size without calling Object::section_size().
1969         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
1970         for size.  Allocate a buffer for merged EXIDX entries.
1971         (Arm_exidx_merged_section::build_contents): New method.
1972         (Arm_exidx_merged_section::do_write): Move merge section contents
1973         building code to Arm_exidx_merged_section::build_contetns.  Write
1974         out contetns in buffer instead of building it on the fly.
1975         (Arm_relobj::make_exidx_input_section): Also pass text section size
1976         to Arm_exidx_input_section constructor.
1977         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
1978         (Arm_dynobj::do_read_symbols): Fix memory leak.
1979         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
1980         * target.h: (class Task): Add forward declaration.
1981         (Target::relax): Add new parameter TASK and pass it to
1982         Target::do_relax().
1983         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
1984
1985 2010-11-05  Cary Coutant  <ccoutant@google.com>
1986
1987         PR gold/10708
1988         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
1989         object when reading from the file.
1990         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
1991         second layout pass.
1992         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
1993         when reading section contents.
1994         (get_section_contents): Likewise.
1995         (icf::find_identical_sections): Likewise.
1996         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
1997         object when reading from the file.
1998         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
1999         the object when doing deferred section layout.
2000
2001 2010-11-03  Nick Clifton  <nickc@redhat.com>
2002
2003         PR gold/12001
2004         * script.h (class Symbol_assignment: name): New member.  Returns
2005         the name of the symbol.
2006         * scrfipt.cc (Script_options::is_pending_assignment): New member.
2007         Returns true if the given symbol name is on the list of
2008         assignments wating to be processed.
2009         * archive.cc (should_incldue_member): If the symbol is undefined,
2010         check to see if it is on the list of symbols pending assignment.
2011
2012 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
2013
2014         * script-sections.cc (Script_sections::find_memory_region): Check
2015         for a NULL output section pointer.
2016
2017 2010-10-29  Doug Kwan  <dougkwan@google.com>
2018
2019         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
2020         Output_section::add_relaxed_input_section.
2021         * output.cc (Output_section::add_relaxed_input_section): Add new
2022         arguments LAYOUT and NAME.  Set section order index.
2023         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
2024         Copy section order index.
2025         * output.h (Output_section::add_relaxed_input_section): Add new
2026         arguments LAYOUT and NAME.
2027
2028 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2029
2030         * testsuite/Makefile.am: Move gcctestdir/ld rule to
2031         NATIVE_OR_CROSS_LINKER.
2032         * testsuite/Makefile.in: Regenerate.
2033
2034 2010-10-20  Doug Kwan  <dougkwan@google.com>
2035
2036         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
2037         without SHF_LINK_ORDER flags.
2038         * layout.cc (Layout::choose_output_section): Do not filter
2039         SHF_LINK_ORDER flag in a relocatable link.
2040
2041 2010-10-17  Cary Coutant  <ccoutant@google.com>
2042
2043         * output.h (Output_segment::set_section_addresses): Change function
2044         signature.  Update all callers.
2045         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
2046         sections.
2047         (Output_segment::set_section_addresses): Align after last TLS
2048         section.  Add padding before last relro section instead of after.
2049
2050 2010-10-17  Doug Kwan  <dougkwan@google.com>
2051
2052         * gold/arm.cc (Target_arm::got_section): Use correct order and set
2053         GOT output section to be writable.
2054
2055 2010-10-14  Cary Coutant  <ccoutant@google.com>
2056
2057         * debug.h (DEBUG_INCREMENTAL): New flag.
2058         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
2059         * gold.cc (queue_initial_tasks): Check parameters for incremental link
2060         mode.
2061         * incremental.cc (report_command_line): Ignore all forms of
2062         --incremental.
2063         * layout.cc (Layout::Layout): Check parameters for incremental link
2064         mode.
2065         * options.cc (General_options::parse_incremental): New function.
2066         (General_options::parse_no_incremental): New function.
2067         (General_options::parse_incremental_full): New function.
2068         (General_options::parse_incremental_update): New function.
2069         (General_options::incremental_mode_): New data member.
2070         (General_options::finalize): Check incremental_mode_.
2071         * options.h (General_options): Update help text for --incremental.
2072         Add --no-incremental, --incremental-full, --incremental-update.
2073         (General_options::Incremental_mode): New enum type.
2074         (General_options::incremental_mode): New function.
2075         (General_options::incremental_mode_): New data member.
2076         * parameters.cc (Parameters::incremental_mode_): New data member.
2077         (Parameters::set_options): Set incremental_mode_.
2078         (Parameters::set_incremental_full): New function.
2079         (Parameters::incremental): New function.
2080         (Parameters::incremental_update): New function.
2081         (set_parameters_incremental_full): New function.
2082         * parameters.h (Parameters::set_incremental_full): New function.
2083         (Parameters::incremental): New function.
2084         (Parameters::incremental_update): New function.
2085         (Parameters::incremental_mode_): New data member.
2086         (set_parameters_incremental_full): New function.
2087         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
2088         incremental link mode.
2089         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
2090         (Sized_relobj::do_relocate_sections): Likewise.
2091         * testsuite/Makefile.am (incremental_test): Use --incremental-full
2092         option.
2093         * testsuite/Makefile.in: Regenerate.
2094         * testsuite/incremental_test.sh: Filter all forms of --incremental.
2095
2096 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2097
2098         * script-sections.h (class Script_sections): Make
2099         Sections_elements typedef public.
2100         * script-sections.cc (class Sort_output_sections): Add elements_
2101         field.  Add constructor which sets it; change all callers.
2102         (Sort_output_sections::is_before): New function.
2103         (Sort_output_sections::operator()): Call is_before.
2104         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
2105         conditional.
2106         * testsuite/script_test_10.sh: New test. Test script section
2107         order.
2108         * testsuite/script_test_10.t: Likewise.
2109         * testsuite/script_test_10.s: Likewise.
2110         * testsuite/Makefile.am: Wrap the cross linker tests and the
2111         common tests into NATIVE_OR_CROSS_LINKER.
2112         (check_SCRIPTS): Add script_test_10.sh.
2113         (check_DATA): Add script_test_10.stdout.
2114         (script_test_10.o, script_test_10): New targets.
2115         (script_test_10.stdout): New target.
2116         * configure, testsuite/Makefile.in: Regenerate.
2117
2118 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2119
2120         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
2121         error for the deprecated relocations.
2122         (Target_arm::Scan::global): Likewise.
2123         (Target_arm::Relocate::relocate): Likewise.
2124
2125 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
2126
2127         * fileread.cc (Input_file::find_file): Initialize *found_name
2128         and *namep when using the fallback search for case 4.
2129
2130 2010-10-11  Cary Coutant  <ccoutant@google.com>
2131
2132         * options.h (class General_options): Redefine -z lazy as an alias for
2133         the negation of -z now.
2134
2135 2010-10-11  Ian Lance Taylor  <iant@google.com>
2136
2137         * resolve.cc (symbol_to_bits): Report the value of the unsupported
2138         binding.
2139
2140 2010-10-06  Nick Clifton  <nickc@redhat.com>
2141
2142         * script-sections.cc(class Memory_region): Remove
2143         current_lma_offset_ field.  Rename current_vma_offset_ to
2144         current_offset_.  Add last_section_ field.
2145         (Memory_region::get_current_vma_address): Rename to
2146         get_current_address.
2147         (Memory_region::get_current_lma_address): Delete.
2148         (Memory_region::increment_vma_offset): Rename to
2149         increment_offset.
2150         (Memory_region::increment_lma_offset): Delete.
2151         (Memory_region::attributes_compatible): New method.  Returns
2152         true if the provided section is compatible with the region.
2153         (Memory_region::get_last_section): New method.  Returns the last
2154         section to use the region.
2155         (Memory_region::set_last_section): New method.  Stores the last
2156         section to use the region.
2157         (Script_sections::block_in_region): New method.  Returns true if
2158         a block of memory is contained within a region.
2159         (Script_sections::find_memory_region): New method.  Locates a
2160         memory region to be used to set a VMA or LMA address.
2161         (Output_section_definition::set_section_addresses): Add code to
2162         check for addresses set by memory regions.
2163         (Output_segment::set_section_addresses): Remove memory region
2164         walking code.
2165         (Script_sections::create_segment): Add a warning if a header
2166         segment is created outside of any region.
2167         * script-sections.h (class Script_sections): Add prototypes for
2168         find_memory_region and block_in_region methods.
2169         * testsuite/memory_test.s: Use .long instead of .word.
2170         * testsuite/memory_test.t: Add some more output sections.
2171         * testsuite/memory_test.sh: Update expected output.
2172
2173 2010-10-02  Doug Kwan  <dougkwan@google.com>
2174
2175         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
2176         defintion to symtab.h
2177         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
2178         declaration to defintion.
2179
2180 2010-10-01  Nick Clifton  <nickc@redhat.com>
2181
2182         * expression.cc (eval): Replace dummy argument with NULL.
2183         (eval_maybe_dot): Check for a NULL result section pointer.
2184         (Symbol_expression::value): Likewise.
2185         (Dot_expression::value): Likewise.
2186         (BINARY_EXPRESSION): Likewise.
2187         (Max_expression::value): Likewise.
2188         (Min_expression::value): Likewise.
2189         (Absolute_expression::value): Likewise.
2190         (Addr_expression::value_from_output_section): Likewise.
2191         (Loaddddr_expression::value_from_output_section): Likewise.
2192         (Segment_start_expression::value): Likewise.
2193         * script-sections.cc
2194         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
2195         argument with NULL.
2196         (Sections_elememt_dot_assignment::set_section_addresses):
2197         Likewise.
2198         (Output_data_expression::do_write_to_buffer): Likewise.
2199         (Output_section_definition::finalize_symbols): Likewise.
2200         (Output_section_definition::set_section_addresses): Likewise.
2201
2202 2010-09-30  Doug Kwan  <dougkwan@google.com>
2203
2204         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
2205
2206 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
2207
2208         * target.h (Target::can_icf_inline_merge_sections): New virtual
2209         function.
2210         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
2211         virtual function.
2212         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
2213         virtual function.
2214         * icf.cc (get_section_contents): Inline merge sections only when
2215         target allows it.
2216
2217 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2218
2219         * configure: Regenerate.
2220
2221 2010-09-17  Ian Lance Taylor  <iant@google.com>
2222
2223         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
2224         * testsuite/Makefile.am (memory_test.o): New target.
2225         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
2226         memory_test.t.
2227         * testsuite/Makefile.in: Rebuild.
2228
2229 2010-09-17  Doug Kwan  <dougkwan@google.com>
2230
2231         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
2232         defintion if relocation uses GOT entries of the symbol.
2233         * testsuite/icf_safe_test.sh: Fix test.
2234         * testsuite/icf_safe_so_test.sh: Fix test.
2235
2236 2010-09-16  Cary Coutant  <ccoutant@google.com>
2237
2238         * script_sections.cc (class Memory_region): Remove "NULL" from
2239         vector initializations.
2240
2241 2010-09-15  Cary Coutant  <ccoutant@google.com>
2242
2243         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
2244         Resolve forwarding symbols.
2245
2246 2010-09-15  Doug Kwan  <dougkwan@google.com>
2247
2248         * gold/testsuite/script_test_3.t: Add ARM special sections.
2249         * gold/testsuite/script_test_4.t: Same.
2250         * gold/testsuite/script_test_5.t: Same.
2251         * gold/testsuite/script_test_6.t: Same.
2252         * gold/testsuite/script_test_7.t: Same.
2253         * gold/testsuite/script_test_7.t: Same.
2254         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
2255
2256 2010-09-14  Cary Coutant  <ccoutant@google.com>
2257
2258         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
2259         (Target_x86_64::Relocate::relocate_tls): Replace check for
2260         saw_tls_block_reloc_ with test for executable section.
2261
2262 2010-09-12  Cary Coutant  <ccoutant@google.com>
2263
2264         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
2265         position-independent executables to shared libraries need dynamic
2266         relocations.
2267         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
2268         position-independent executables.
2269         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
2270         * testsuite/Makefile.in: Regenerate.
2271
2272 2010-09-10  Nick Clifton  <nickc@redhat.com>
2273
2274         PR gold/11997
2275         * testsuite/memory_test.t: Discard any sections that are not
2276         needed.
2277
2278 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
2279
2280         PR gold/11996
2281         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
2282         "This::" to work around a bug in gcc 4.2.
2283
2284         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
2285
2286 2010-09-09  Rafael Espindola  <espindola@google.com>
2287
2288         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
2289         sections with different PF_X flags in the same segment.
2290         (Layout::find_first_load_seg): Search all segments to find the first
2291         one.
2292         * options.h (rosegment): New.
2293
2294 2010-09-08  Rafael Espindola  <espindola@google.com>
2295
2296         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
2297
2298 2010-09-08  Doug Kwan  <dougkwan@google.com>
2299
2300         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
2301         (Arm_relobj::do_relocate_sections): Add new parameter for output
2302         file to match the parent.
2303         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
2304         of local symbols instead of input values.  Update code to track
2305         changes in gold::relocate_section.
2306         * object.cc (Sized_relobj::compute_final_local_value): New methods.
2307         (Sized_relobj::compute_final_local_value_internal): New methods.
2308         (Sized_relobj::do_finalize_local_symbols): Move code from loop
2309         body into private version of Sized_relobj::compute_final_local_value.
2310         Call the inline method.
2311         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
2312         merged symbol value if there is one.
2313         (Symbol_value::has_output_value): New method defintiion.
2314         (Sized_relobj::Compute_final_local_value_status): New enum type.
2315         (Sized_relobj::compute_final_local_value): New methods.
2316         (Sized_relobj::compute_final_local_value_internal): New methods.
2317         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
2318         and arm_cortex_a8.sh.
2319         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
2320         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
2321         New tests.
2322         * Makefile.in: Regenerate.
2323         * testsuite/arm_bl_out_of_range.s: Update test.
2324         * testsuite/thumb_bl_out_of_range.s: Ditto.
2325         * testsuite/thumb_blx_out_of_range.s: Ditto.
2326         * testsuite/arm_branch_out_of_range.sh: New file.
2327         * testsuite/arm_cortex_a8.sh: Ditto.
2328         * testsuite/arm_cortex_a8_b.s: Ditto.
2329         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
2330         * testsuite/arm_cortex_a8_b_local.s: Ditto.
2331         * testsuite/arm_cortex_a8_bl.s: Ditto.
2332         * testsuite/arm_cortex_a8_blx.s: Ditto.
2333         * testsuite/arm_cortex_a8_local.s: Ditto.
2334         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
2335         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
2336
2337 2010-09-08  Rafael Espindola  <espindola@google.com>
2338
2339         * Makefile.am (memory_test.stdout): Run readelf with -W.
2340         * Makefile.in: Regenerate.
2341         * testsuite/memory_test.sh: Make the regexps accept both 32 and
2342         64 bit output.
2343
2344 2010-09-08  Rafael Espindola  <espindola@google.com>
2345
2346         * script-sections.cc (Script_sections::add_memory_region): Convert
2347         field precision to int.
2348         * script.cc (script_set_section_region, script_set_section_region):
2349         Convert field precision to int.
2350
2351 2010-09-08  Rafael Espindola  <espindola@google.com>
2352
2353         * arm.cc (do_finalize_sections): Create the __exidx_start and
2354         __exdix_end symbols even when the section is missing.
2355
2356 2010-09-08  Nick Clifton  <nickc@redhat.com>
2357
2358         * README: Remove claim that MEMORY is not supported.
2359         * expression.cc (script_exp_function_origin)
2360         (script_exp_function_length): Move from here to ...
2361         * script.cc: ... here.
2362         (script_set_section_region, script_add_memory)
2363         (script_parse_memory_attr, script_include_directive): New
2364         functions.
2365         * script-sections.cc
2366         (class Memory_region): New class.
2367         (class Output_section_definition): Add set_memory_region,
2368         set_section_vma, set_section_lma and get_section_name methods.
2369         (class Script_Sections): Add add_memory_region,
2370         find_memory_region, find_memory_region_origin,
2371         find_memory_region_length and set_memory_region methods.
2372         Have set_section_addresses method walk the list of set memory
2373         regions.
2374         Extend the print methos to display memory regions.
2375         * script-sections.h: Add prototypes for new methods.
2376         Add enum for MEMORY region attributes.
2377         * yyscript.y: Add support for parsing MEMORY regions.
2378         * script-c.h: Add prototypes for new functions.
2379         * testsuite/Makefile.am: Add test of MEMORY region functionality.
2380         * testsuite/Makefile.in: Regenerate.
2381         * testsuite/memory_test.sh: New script.
2382         * testsuite/memory_test.s: New assembler source file.
2383         * testsuite/memory_test.t: New linker script.
2384
2385 2010-08-27  Doug Kwan  <dougkwan@google.com>
2386
2387         * gold/resolve.cc (Symbol_table::should_override): Let a weak
2388         reference override an existing dynamic weak reference.
2389         * testsuite/Makefile.am: Add new test dyn_weak_ref.
2390         * testsuite/Makefile.in: Regenerate.
2391         * testsuite/dyn_weak_ref.sh: New file.
2392         * testsuite/dyn_weak_ref_1.c: Ditto.
2393         * testsuite/dyn_weak_ref_2.c: Ditto.
2394
2395 2010-08-27  Ian Lance Taylor  <iant@google.com>
2396
2397         * incremental.h (class Incremental_input_entry): Add virtual
2398         destructor.
2399
2400 2010-08-27  Ian Lance Taylor  <iant@google.com>
2401
2402         * testsuite/start_lib_test_3.c: Mark t3 as used.
2403
2404 2010-08-27  Nick Clifton  <nickc@redhat.com>
2405
2406         * options.cc (version_script): Fix small typo in previous
2407         whitespace tidyup.
2408
2409 2010-08-25  Nick Clifton  <nickc@redhat.com>
2410
2411         * archive.cc: Formatting fixes: Remove whitespace between
2412         typename and following asterisk.  Remove whitespace between
2413         function name and opening parenthesis.
2414         * archive.h: Likewise.
2415         * arm.cc: Likewise.
2416         * attributes.cc: Likewise.
2417         * attributes.h: Likewise.
2418         * common.cc: Likewise.
2419         * copy-relocs.cc: Likewise.
2420         * dirsearch.h: Likewise.
2421         * dynobj.cc: Likewise.
2422         * ehframe.cc: Likewise.
2423         * ehframe.h: Likewise.
2424         * expression.cc: Likewise.
2425         * fileread.cc: Likewise.
2426         * fileread.h: Likewise.
2427         * gc.h: Likewise.
2428         * gold-threads.cc: Likewise.
2429         * gold.cc: Likewise.
2430         * i386.cc: Likewise.
2431         * icf.h: Likewise.
2432         * incremental-dump.cc: Likewise.
2433         * incremental.cc: Likewise.
2434         * layout.cc: Likewise.
2435         * layout.h: Likewise.
2436         * main.cc: Likewise.
2437         * merge.cc: Likewise.
2438         * merge.h: Likewise.
2439         * object.cc: Likewise.
2440         * object.h: Likewise.
2441         * options.cc: Likewise.
2442         * options.h: Likewise.
2443         * output.cc: Likewise.
2444         * output.h: Likewise.
2445         * plugin.cc: Likewise.
2446         * plugin.h: Likewise.
2447         * powerpc.cc: Likewise.
2448         * reloc.cc: Likewise.
2449         * script-c.h: Likewise.
2450         * script-sections.cc: Likewise.
2451         * script.cc: Likewise.
2452         * stringpool.cc: Likewise.
2453         * symtab.cc: Likewise.
2454         * symtab.h: Likewise.
2455         * target.cc: Likewise.
2456         * timer.cc: Likewise.
2457         * timer.h: Likewise.
2458         * version.cc: Likewise.
2459         * x86_64.cc: Likewise.
2460
2461 2010-08-24  Nick Clifton  <nickc@redhat.com>
2462
2463         PR 11899
2464         * layout.cc (segment_precedes): Sort segments by their physical
2465         addresses, if they have been set.
2466
2467 2010-08-23  Cary Coutant  <ccoutant@google.com>
2468
2469         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
2470         symbols data.
2471         (Lib_group::include_member): Unlock object after deleting its
2472         symbols data.
2473         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
2474         the bug fixed here.
2475
2476 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
2477             Cary Coutant  <ccoutant@google.com>
2478
2479         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
2480         constructor, and set_blocker.
2481         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
2482         readsyms_blocker_.
2483         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
2484         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
2485         * testsuite/Makefile.am (start_lib_test): New test case.
2486         * testsuite/Makefile.in: Regenerate.
2487         * testsuite/start_lib_test_main.c: New file.
2488         * testsuite/start_lib_test_1.c: New file.
2489         * testsuite/start_lib_test_2.c: New file.
2490         * testsuite/start_lib_test_3.c: New file.
2491
2492 2010-08-19  Ian Lance Taylor  <iant@google.com>
2493
2494         * Makefile.in: Rebuild with automake 1.11.1.
2495         * aclocal.m4: Likewise.
2496         * testsuite/Makefile.in: Likewise.
2497
2498 2010-08-19  Ian Lance Taylor  <iant@google.com>
2499
2500         PR 10893
2501         * i386.cc (class Output_data_plt_i386): Update declarations.
2502         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
2503         local_ifuncs_ fields.
2504         (Target_i386::do_plt_section_for_global): New function.
2505         (Target_i386::do_plt_section_for_local): New function.
2506         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
2507         parameter; change all callers.  Initialize global_ifuncs_ and
2508         local_ifuncs_.  If doing a static link define __rel_iplt_start and
2509         __rel_iplt_end.
2510         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
2511         (Output_data_plt_i386::add_local_ifunc_entry): New function.
2512         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
2513         symbols.
2514         (Target_i386::make_plt_section): New function, broken out of
2515         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
2516         (Target_i386::make_plt_entry): Call make_plt_section.
2517         (Target_i386::make_local_ifunc_plt_entry): New function.
2518         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
2519         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
2520         R_386_IRELATIVE to switch.
2521         (Target_i386::Scan::global): Likewise.
2522         (Target_i386::Relocate::relocate): Likewise.
2523         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
2524         switch.
2525         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
2526         (Target_x86_64::do_plt_section_for_global): New function.
2527         (Target_x86_64::do_plt_section_for_local): New function.
2528         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
2529         parameter; change all callers.  If doing a static link define
2530         __rela_iplt_start and __rela_iplt_end.
2531         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
2532         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
2533         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
2534         to point to .plt.
2535         (Target_x86_64::make_local_ifunc_plt_entry): New function.
2536         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
2537         switch.
2538         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
2539         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
2540         R_X86_64_IRELATIVE to switch.
2541         (Target_x86_64::Scan::global): Likewise.
2542         (Target_x86_64::Relocate::relocate): Likewise.
2543         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
2544         switch.
2545         * target.h (class Target): Add plt_section_for_global and
2546         plt_section_for_local functions.  Add do_plt_section_for_global
2547         and do_plt_section_for_local virtual functions.
2548         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
2549         clarifying comments.
2550         (Symbol::use_plt_offset): Handle IFUNC symbol.
2551         * object.cc (Sized_relobj::Sized_relobj): Initialize
2552         local_plt_offsets_.
2553         (Sized_relobj::local_has_plt_offset): New function.
2554         (Sized_relobj::local_plt_offset): New function.
2555         (Sized_relobj::set_local_plt_offset): New function.
2556         (Sized_relobj::do_count): Handle IFUNC symbol.
2557         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
2558         a bit away from input_shndx_ field.  Add set_is_func_symbol and
2559         is_ifunc_symbol functions.
2560         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
2561         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
2562         local_plt_offsets_ field.
2563         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
2564         * output.h (class Output_section_data): Add non-const
2565         output_section function.
2566         (class Output_data_got): Update declarations.
2567         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
2568         Add use_plt_offset parameter to global and local constructors.
2569         Change all callers.  Change local_sym_index_ field to 31 bits.
2570         Change GSYM_CODE and CONSTANT_CODE accordingly.
2571         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
2572         doing a static link don't set sh_link field.
2573         (Output_data_got::Got_entry::write): Use PLT offset if
2574         appropriate.
2575         (Output_data_got::add_global_plt): New function.
2576         (Output_data_got::add_local_plt): New function.
2577         * target-reloc.h (relocate_section): Handle IFUNC symbol.
2578         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
2579         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
2580         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
2581         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
2582         IFUNC conditional.
2583         * testsuite/ifunc-sel.h: New file.
2584         * testsuite/ifuncmain1.c: New file.
2585         * testsuite/ifuncmain1vis.c: New file.
2586         * testsuite/ifuncmod1.c: New file.
2587         * testsuite/ifuncdep2.c: New file.
2588         * testsuite/ifuncmain2.c: New file.
2589         * testsuite/ifuncmain3.c: New file.
2590         * testsuite/ifuncmod3.c: New file.
2591         * testsuite/ifuncmain4.c: New file.
2592         * testsuite/ifuncmain5.c: New file.
2593         * testsuite/ifuncmod5.c: New file.
2594         * testsuite/ifuncmain6pie.c: New file.
2595         * testsuite/ifuncmod6.c: New file.
2596         * testsuite/ifuncmain7.c: New file.
2597         * configure, testsuite/Makefile.in: Rebuild.
2598
2599 2010-08-18  Ian Lance Taylor  <iant@google.com>
2600
2601         * incremental.cc
2602         (Output_section_incremental_inputs::write_input_files): Add cast
2603         to avoid signed/unsigned comparison warning.
2604         (Output_section_incremental_inputs::write_info_blocks): Likewise.
2605
2606 2010-08-12  Cary Coutant  <ccoutant@google.com>
2607
2608         * common.cc (Sort_commons::operator()): Remove unnecessary code.
2609
2610 2010-08-13  Ian Lance Taylor  <iant@google.com>
2611
2612         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
2613
2614 2010-08-12  Cary Coutant  <ccoutant@google.com>
2615             Doug Kwan  <dougkwan@google.com>
2616
2617         * resolve.cc (Symbol_table::should_override): When a weak dynamic
2618         defintion overrides non-weak undef, remember that the original undef
2619         is not weak.
2620         * symtab.cc (Symbol_table::sized_write_global): For undef without
2621         an original weak binding, set binding to global in output.
2622         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
2623         * testsuite/Makefile.in: Regenerate.
2624         * testsuite/strong_ref_weak_def.sh: New file.
2625         * testsuite/strong_ref_weak_def_1.c: Ditto.
2626         * testsuite/strong_ref_weak_def_2.c: Ditto.
2627
2628 2010-08-12  Cary Coutant  <ccoutant@google.com>
2629
2630         * testsuite/incremental_test.sh: Rewrite.
2631         * testsuite/incremental_test_1.c: Rewrite.
2632         * testsuite/incremental_test_2.c: Rewrite.
2633
2634 2010-08-12  Cary Coutant  <ccoutant@google.com>
2635
2636         * arm.cc (Target_arm::got_size): Add const.
2637         (Target_arm::got_entry_count): New function.
2638         (Target_arm::plt_entry_count): New function.
2639         (Target_arm::first_plt_entry_offset): New function.
2640         (Target_arm::plt_entry_size): New function.
2641         (Output_data_plt_arm::entry_count): New function.
2642         (Output_data_plt_arm::first_plt_entry_offset): New function.
2643         (Output_data_plt_arm::get_plt_entry_size): New function.
2644         * i386.cc (Target_i386::got_size): Add const.
2645         (Target_i386::got_entry_count): New function.
2646         (Target_i386::plt_entry_count): New function.
2647         (Target_i386::first_plt_entry_offset): New function.
2648         (Target_i386::plt_entry_size): New function.
2649         (Output_data_plt_i386::entry_count): New function.
2650         (Output_data_plt_i386::first_plt_entry_offset): New function.
2651         (Output_data_plt_i386::get_plt_entry_size): New function.
2652         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
2653         find_incremental_inputs_sections.  Dump incremental_got_plt section.
2654         * incremental.cc: Include target.h.
2655         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
2656         parameter.  Adjust all callers.  Find incremental_got_plt section.
2657         (Incremental_inputs::create_data_sections): Create incremental_got_plt
2658         section.
2659         (Output_section_incremental_inputs::set_final_data_size): Calculate
2660         size of incremental_got_plt section.
2661         (Output_section_incremental_inputs::do_write): Write the
2662         incremental_got_plt section.
2663         (Got_plt_view_info): New struct.
2664         (Local_got_offset_visitor): New class.
2665         (Global_got_offset_visitor): New class.
2666         (Global_symbol_visitor_got_plt): New class.
2667         (Output_section_incremental_inputs::write_got_plt): New function.
2668         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
2669         Add parameter.  Adjust all callers.
2670         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2671         (Incremental_inputs::got_plt_section): New function.
2672         (Incremental_inputs::got_plt_section_): New data member.
2673         (Incremental_got_plt_reader): New class.
2674         * layout.cc (Layout::create_incremental_info_sections): Add the
2675         incremental_got_plt section.
2676         * object.h (Got_offset_list::get_list): New function.
2677         (Got offset_list::for_all_got_offsets): New function.
2678         (Sized_relobj::local_got_offset_list): New function.
2679         * powerpc.cc (Target_powerpc::got_size): Add const.
2680         (Target_powerpc::got_entry_count): New function.
2681         (Target_powerpc::plt_entry_count): New function.
2682         (Target_powerpc::first_plt_entry_offset): New function.
2683         (Target_powerpc::plt_entry_size): New function.
2684         (Output_data_plt_powerpc::entry_count): New function.
2685         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
2686         (Output_data_plt_powerpc::get_plt_entry_size): New function.
2687         * sparc.cc (Target_sparc::got_size): Add const.
2688         (Target_sparc::got_entry_count): New function.
2689         (Target_sparc::plt_entry_count): New function.
2690         (Target_sparc::first_plt_entry_offset): New function.
2691         (Target_sparc::plt_entry_size): New function.
2692         (Output_data_plt_sparc::entry_count): New function.
2693         (Output_data_plt_sparc::first_plt_entry_offset): New function.
2694         (Output_data_plt_sparc::get_plt_entry_size): New function.
2695         * symtab.h (Symbol::got_offset_list): New function.
2696         (Symbol_table::for_all_symbols): New function.
2697         * target.h (Sized_target::got_entry_count): New function.
2698         (Sized_target::plt_entry_count): New function.
2699         (Sized_target::plt_entry_size): New function.
2700         * x86_64.cc (Target_x86_64::got_size): Add const.
2701         (Target_x86_64::got_entry_count): New function.
2702         (Target_x86_64::plt_entry_count): New function.
2703         (Target_x86_64::first_plt_entry_offset): New function.
2704         (Target_x86_64::plt_entry_size): New function.
2705         (Output_data_plt_x86_64::entry_count): New function.
2706         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
2707         (Output_data_plt_x86_64::get_plt_entry_size): New function.
2708
2709 2010-08-12  Cary Coutant  <ccoutant@google.com>
2710
2711         * archive.cc: Include incremental.h.
2712         (Archive::Archive): Initialize incremental_info_.
2713         (Archive::include_member): Record archive members in incremental info.
2714         (Add_archive_symbols::run): Record begin and end of an archive in
2715         incremental info.
2716         (Lib_group::include_member): Record objects in incremental info.
2717         * archive.h (Incremental_archive_entry): Forward declaration.
2718         (Archive::set_incremental_info): New member function.
2719         (Archive::incremental_info): New member function.
2720         (Archive::Unused_symbol_iterator): New class.
2721         (Archive::unused_symbols_begin): New member function.
2722         (Archive::unused_symbols_end): New member function.
2723         (Archive::incremental_info_): New data member.
2724         * incremental-dump.cc (find_input_containing_global): New function.
2725         (dump_incremental_inputs): Dump new incremental info sections.
2726         * incremental.cc: Include symtab.h.
2727         (Output_section_incremental_inputs): New class.
2728         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
2729         new incremental info sections.
2730         (Sized_incremental_binary::do_check_inputs): Likewise.
2731         (Incremental_inputs::report_archive): Remove.
2732         (Incremental_inputs::report_archive_begin): New function.
2733         (Incremental_inputs::report_archive_end): New function.
2734         (Incremental_inputs::report_object): New function.
2735         (Incremental_inputs::finalize_inputs): Remove.
2736         (Incremental_inputs::report_input_section): New function.
2737         (Incremental_inputs::report_script): Rewrite.
2738         (Incremental_inputs::finalize): Do nothing but finalize string table.
2739         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2740         (Incremental_inputs::sized_create_inputs_section_data): Remove.
2741         (Incremental_inputs::create_data_sections): New function.
2742         (Incremental_inputs::relocs_entsize): New function.
2743         (Output_section_incremental_inputs::set_final_data_size): New function.
2744         (Output_section_incremental_inputs::do_write): New function.
2745         (Output_section_incremental_inputs::write_header): New function.
2746         (Output_section_incremental_inputs::write_input_files): New function.
2747         (Output_section_incremental_inputs::write_info_blocks): New function.
2748         (Output_section_incremental_inputs::write_symtab): New function.
2749         * incremental.h (Incremental_script_entry): Forward declaration.
2750         (Incremental_object_entry): Forward declaration.
2751         (Incremental_archive_entry): Forward declaration.
2752         (Incremental_inputs): Forward declaration.
2753         (Incremental_inputs_header_data): Remove.
2754         (Incremental_inputs_header): Remove.
2755         (Incremental_inputs_header_write): Remove.
2756         (Incremental_inputs_entry_data): Remove.
2757         (Incremental_inputs_entry): Remove.
2758         (Incremental_inputs_entry_write): Remove.
2759         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
2760         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
2761         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2762         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
2763         Likewise.
2764         (Incremental_input_entry): New class.
2765         (Incremental_script_entry): New class.
2766         (Incremental_object_entry): New class.
2767         (Incremental_archive_entry): New class.
2768         (Incremental_inputs::Incremental_inputs): Initialize new data members.
2769         (Incremental_inputs::report_inputs): Remove.
2770         (Incremental_inputs::report_archive): Remove.
2771         (Incremental_inputs::report_archive_begin): New function.
2772         (Incremental_inputs::report_archive_end): New function.
2773         (Incremental_inputs::report_object): Change prototype.
2774         (Incremental_inputs::report_input_section): New function.
2775         (Incremental_inputs::report_script): Change prototype.
2776         (Incremental_inputs::get_reloc_count): New function.
2777         (Incremental_inputs::set_reloc_count): New function.
2778         (Incremental_inputs::create_data_sections): New function.
2779         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2780         (Incremental_inputs::inputs_section): New function.
2781         (Incremental_inputs::symtab_section): New function.
2782         (Incremental_inputs::relocs_section): New function.
2783         (Incremental_inputs::get_stringpool): Add const.
2784         (Incremental_inputs::command_line): Add const.
2785         (Incremental_inputs::inputs): Remove.
2786         (Incremental_inputs::command_line_key): New function.
2787         (Incremental_inputs::input_file_count): New function.
2788         (Incremental_inputs::input_files): New function.
2789         (Incremental_inputs::relocs_entsize): New function.
2790         (Incremental_inputs::sized_create_inputs_section_data): Remove.
2791         (Incremental_inputs::finalize_inputs): Remove.
2792         (Incremental_inputs::Input_info): Remove.
2793         (Incremental_inputs::lock_): Remove.
2794         (Incremental_inputs::inputs_): Change type.
2795         (Incremental_inputs::inputs_map_): Remove.
2796         (Incremental_inputs::current_object_entry_): New data member.
2797         (Incremental_inputs::inputs_section_): New data member.
2798         (Incremental_inputs::symtab_section_): New data member.
2799         (Incremental_inputs::relocs_section_): New data member.
2800         (Incremental_inputs::reloc_count_): New data member.
2801         (Incremental_inputs_reader): New class.
2802         (Incremental_symtab_reader): New class.
2803         (Incremental_relocs_reader): New class.
2804         * layout.cc (Layout::finalize): Move finalization of incremental info
2805         and creation of incremental info sections to follow finalization of
2806         symbol table.  Set offsets for postprocessing sections.
2807         (Layout::create_incremental_info_sections): Call
2808         Incremental_inputs::create_data_sections.  Add incremental symtab
2809         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
2810         sections to layout after input sections.
2811         * layout.h (struct Timespec): Forward declaration.
2812         (Layout::incremental_inputs): Add const.
2813         (Layout::create_incremental_info_sections): Add parameter.
2814         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
2815         * object.cc: Include incremental.h.
2816         (Relobj::finalize_incremental_relocs): New function.
2817         (Sized_relobj::do_layout): Record input sections in incremental info.
2818         * object.h (Object::output_section): New function.
2819         (Object::output_section_offset): Moved from Relobj.
2820         (Object::get_incremental_reloc_base): New function.
2821         (Object::get_incremental_reloc_count): New function.
2822         (Object::do_output_section): New function.
2823         (Object::do_output_section_offset): Moved from Relobj.
2824         (Object::do_get_incremental_reloc_base): New function.
2825         (Object::do_get_incremental_reloc_count): New function.
2826         (Object::Object): Initialize new data members.
2827         (Relobj::output_section): Renamed do_output_section and moved to
2828         protected.
2829         (Relobj::output_section_offset): Moved to Object.
2830         (Relobj::do_get_incremental_reloc_base): New function.
2831         (Relobj::do_get_incremental_reloc_count): New function.
2832         (Relobj::allocate_incremental_reloc_counts): New function.
2833         (Relobj::count_incremental_reloc): New function.
2834         (Relobj::finalize_incremental_relocs): New function.
2835         (Relobj::next_incremental_reloc_index): New function.
2836         (Relobj::reloc_counts_): New data member.
2837         (Relobj::reloc_bases_): New data member.
2838         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
2839         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
2840         (Sized_relobj::incremental_relocs_scan): New function.
2841         (Sized_relobj::incremental_relocs_scan_reltype): New function.
2842         (Sized_relobj::incremental_relocs_write): New function.
2843         (Sized_relobj::incremental_relocs_write_reltype): New function.
2844         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
2845         incremental link.
2846         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
2847         archives and object files elsewhere.
2848         (Add_symbols::run): Report object files here.
2849         (Finish_group::run): Report end of archive at end of group.
2850         * reloc.cc: Include layout.h, incremental.h.
2851         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
2852         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
2853         (Sized_relobj::incremental_relocs_scan): New function.
2854         (Sized_relobj::incremental_relocs_scan_reltype): New function.
2855         (Sized_relobj::do_relocate_sections): Write incremental relocations.
2856         (Sized_relobj::incremental_relocs_write): New function.
2857         (Sized_relobj::incremental_relocs_write_reltype): New function.
2858         * script.cc (read_input_script): Rewrite test for incremental link.
2859         Change call to Incremental_inputs::report_script.
2860         * symtab.h (Symbol_table::first_global_index): New function.
2861         (Symbol_table::output_count): New function.
2862
2863 2010-08-12  Doug Kwan  <dougkwan@google.com>
2864
2865         * arm.cc (Target_arm::merge_object_attributes): Check command line
2866         options --no-wchar-size-warning and --no-enum-size-warning.
2867         * options.h (General_options): Add ld-compatible options
2868         --no-enum-size-warning and --no-wchar-size-warning.
2869
2870 2010-08-04  Ian Lance Taylor  <iant@google.com>
2871
2872         * x86_64.cc (Target_x86_64::Scan::local): Use
2873         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
2874         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
2875         (Target_x86_64::Scan::global): Likewise.
2876         (Target_x86_64::Relocate::relocate): Likewise.
2877         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
2878         Likewise.
2879
2880 2010-08-03  Cary Coutant  <ccoutant@google.com>
2881
2882         * merge.cc (Output_merge_string::do_add_input_section): Count strings
2883         to reserve space in merged_strings vector. Keep total input size
2884         for stats.
2885         (Output_merge_string::do_print_merge_stats): Print total input size.
2886         * merge.h (Output_merge_string): Add input_size_ field.
2887         * stringpool.cc (Stringpool_template::string_length): Move
2888         implementations out of Stringpool_template class and place in
2889         stringpool.h.
2890         * stringpool.h (string_length): Move out of Stringpool_template.
2891
2892 2010-08-03  Ian Lance Taylor  <iant@google.com>
2893
2894         PR 11712
2895         * layout.cc (relaxation_loop_body): If address of load segment is
2896         set, adjust address to include headers if possible.
2897
2898 2010-08-03  Ian Lance Taylor  <iant@google.com>
2899
2900         * version.cc (version_string): Bump to 1.10.
2901
2902 2010-08-03  Ian Lance Taylor  <iant@google.com>
2903
2904         PR 11805
2905         * layout.h (enum Output_section_order): Define.
2906         (class Layout): Update declarations.
2907         * layout.cc (Layout::get_output_section): Add order parameter.
2908         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
2909         is_first_non_relro parameters.  Change all callers.
2910         (Layout::choose_output_section): Likewise.
2911         (Layout::add_output_section_data): Likewise.
2912         (Layout::make_output_section): Likewise.  Set order.
2913         (Layout::default_section_order): New function.
2914         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
2915         * output.cc (Output_section::Output_section): Initialize order_.
2916         Don't initialize deleted fields.
2917         (Output_segment::Output_segment): Don't initialize deleted
2918         fields.
2919         (Output_segment::add_output_section_to_load): New function
2920         replacing add_output_section.  Change all callers to call this or
2921         add_output_section_to_nonload.
2922         (Output_segment::add_output_section_to_nonload): New function.
2923         (Output_segment::remove_output_section): Rewrite.
2924         (Output_segment::add_initial_output_data): Likewise.
2925         (Output_segment::has_any_data_sections): Likewise.
2926         (Output_segment::is_first_section_relro): Likewise.
2927         (Output_segment::maximum_alignment): Likewise.
2928         (Output_segment::has_dynamic_reloc): New function replacing
2929         dynamic_reloc_count.  Change all callers.
2930         (Output_segment::has_dynamic_reloc_list): New function replacing
2931         dynamic_reloc_count_list.  Change all callers.
2932         (Output_segment::set_section_addresses): Rewrite.
2933         (Output_segment::set_offset): Rewrite.
2934         (Output_segment::find_first_and_last_list): Remove.
2935         (Output_segment::set_tls_offsets): Rewrite.
2936         (Output_segment::first_section_load_address): Likewise.
2937         (Output_segment::output_section_count): Likewise.
2938         (Output_segment::section_with_lowest_load_address): Likewise.
2939         (Output_segment::write_section_headers): Likewise.
2940         (Output_segment::print_sections_to_map): Likewise.
2941         * output.h (class Output_data): Remove dynamic_reloc_count_
2942         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
2943         (Output_data::add_dynamic_reloc): Rewrite.
2944         (Output_data::has_dynamic_reloc): New function.
2945         (Output_data::dynamic_reloc_count): Remove.
2946         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
2947         is_last_relro_, is_first_non_relro_, is_interp_,
2948         is_dynamic_linker_section_ fields.  Add order and set_order
2949         functions.  Remove is_relro_local, set_is_relro_local,
2950         is_last_relro, set_is_last_relro, is_first_non_relro,
2951         set_is_first_non_relro functions, is_interp, set_is_interp,
2952         is_dynamic_linker_section, and set_is_dynamic_linker_section
2953         functions.
2954         (class Output_segment): Change Output_data_list from std::list to
2955         std:;vector.  Add output_lists_ field.  Remove output_data_ and
2956         output_bss_ fields.  Update declarations.
2957
2958 2010-08-02  Ian Lance Taylor  <iant@google.com>
2959
2960         * arm.cc (Target_arm::gc_process_relocs): Use typename.
2961         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
2962         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
2963
2964 2010-08-02  Ian Lance Taylor  <iant@google.com>
2965
2966         PR 11855
2967         * script.cc (Script_options::Script_options): Initialize
2968         symbol_definitions_ and symbol_references_.
2969         (Script_options::add_symbol_assignment): Update
2970         symbol_definitions_ and symbol_references_.
2971         (Script_options::add_symbol_reference): New function.
2972         (script_symbol): New function.
2973         * script.h (class Script_options): Add symbol_definitions_ and
2974         symbol_references_ fields.
2975         (Script_options::referenced_const_iterator): New type.
2976         (Script_options::referenced_begin): New function.
2977         (Script_options::referenced_end): New function.
2978         (Script_options::is_referenced): New function.
2979         (Script_options::any_unreferenced): New function.
2980         * script-c.h (script_symbol): Declare.
2981         * yyscript.y (exp): Call script_symbol.
2982         * symtab.cc: Include "script.h".
2983         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
2984         Change all callers.  Check symbols referenced by scripts.
2985         (Symbol_table::add_undefined_symbols_from_command_line): Add
2986         layout parameter.  Change all callers.
2987         (Symbol_table::do_add_undefined_symbols_from_command_line):
2988         Likewise.  Break out loop body.  Check symbols referenced by
2989         scripts.
2990         (Symbol_table::add_undefined_symbol_from_command_line): New
2991         function broken out of
2992         do_add_undefined_symbols_from_command_line.
2993         * symtab.h (class Symbol_table): Update declarations.
2994         * archive.cc: Include "layout.h".
2995         (Archive::should_include_member): Add layout parameter.  Change
2996         all callers.  Check for symbol mentioned in expression.
2997         * archive.h (class Archive): Update declaration.
2998         * object.cc (Sized_relobj::do_should_include_member): Add layout
2999         parameter.
3000         * object.h (Object::should_include_member): Add layout parameter.
3001         Change all callers.
3002         (Object::do_should_include_member): Add layout parameter.
3003         (class Sized_relobj): Update declaration.
3004         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
3005         parameter.
3006         * dynobj.h (class Sized_dynobj): Update declaration.
3007         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
3008         layout parameter.
3009         * plugin.h (class Sized_pluginobj): Update declaration.
3010
3011 2010-08-02  Ian Lance Taylor  <iant@google.com>
3012
3013         PR 11866
3014         * output.cc (Output_segment::set_offset): Search for the first and
3015         last sections rather than assuming that the list is in order.
3016         (Output_segment::find_first_and_last_list): New function.
3017         * output.h (class Output_segment): Update declarations.
3018         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
3019         (relro_strip_test_SOURCES): New variable.
3020         (relro_strip_test_DEPENDENCIES): New variable.
3021         (relro_strip_test_LDFLAGS): New variable.
3022         (relro_strip_test_LDADD): New variable.
3023         (relro_strip_test.so): New target.
3024
3025 2010-08-02  Ian Lance Taylor  <iant@google.com>
3026
3027         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
3028         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
3029         (Target_i386::got_tlsdesc_section): New function.
3030         (Target_i386::got_section): Create space for GOT entries for
3031         TLSDESC relocations.
3032         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
3033         R_386_TLS_GOTDESC.
3034         (Target_i386::Scan::global): Likewise.
3035         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
3036         using TLSDESC GOT.
3037         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
3038         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
3039         (Target_x86_64::got_tlsdesc_section): New function.
3040         (Target_x86_64::got_section): Create space for GOT entries for
3041         TLSDESC relocations.
3042         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
3043         R_386_TLS_GOTDESC.
3044         (Target_x86_64::Scan::global): Likewise.
3045         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
3046         using TLSDESC GOT.
3047
3048 2010-08-02  Ian Lance Taylor  <iant@google.com>
3049
3050         * testsuite/final_layout.sh: Use dc to convert from hex to
3051         decimal.
3052
3053 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
3054
3055         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
3056         paramter to the call to gold::gc_process_relocs.
3057         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
3058         paramter to the call to gold::gc_process_relocs.
3059         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
3060         parameter to the call to gold::gc_process_relocs.
3061         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
3062         template parameter to the call to gold::gc_process_relocs.
3063         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
3064         paramter to the call to gold::gc_process_relocs.
3065         * gc.h (get_embedded_addend_size): New function.
3066         (gc_process_relocs): Save the size of the reloc for use by ICF.
3067         * icf.cc (get_section_contents): Get the addend from the text section
3068         for SHT_REL relocation sections.
3069         * icf.h (Icf::Reloc_addend_size_info): New typedef.
3070         (Icf::Reloc_info): Add new member reloc_addend_size_info.
3071         * int_encoding.h (read_from_pointer): New overloaded function.
3072         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
3073         * testsuite/icf_sht_rel_addend_test.sh: New file.
3074         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
3075         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
3076
3077 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3078
3079         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
3080         * Makefile.in: Regenerate.
3081         * testsuite/Makefile.in: Regenerate.
3082
3083 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
3084
3085         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
3086         * gold/testsuite/debug_msg.cc: Likewise.
3087         * gold/testsuite/odr_violation1.cc
3088         * gold/testsuite/odr_violation2.cc
3089
3090 2010-07-21  Cary Coutant  <ccoutant@google.com>
3091
3092         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
3093         string, and length fields.
3094         (Output_merge_string::Merged_strings_list): New type.
3095         (Output_merge_string::Merged_strings_lists): New typedef.
3096         (Output_merge_string): Replace merged_strings_ with
3097         merged_strings_lists_.
3098         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
3099         Merged_strings_list per input object and section.  Don't store pointer
3100         to the string.  Don't store length with each merged string entry.
3101         (Output_merge_string::finalize_merged_data): Loop over list of merged
3102         strings lists.  Recompute length of each merged string.
3103
3104 2010-07-15  Cary Coutant  <ccoutant@google.com>
3105
3106         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
3107         here.
3108
3109 2010-07-14  Ian Lance Taylor  <iant@google.com>
3110
3111         * descriptors.cc (Descriptors::open): Report correct name in error
3112         message.
3113
3114 2010-07-13  Doug Kwan  <dougkwan@google.com>
3115
3116         * arm.cc (Arm_input_section::Arm_input_section): For a
3117         SHT_ARM_EXIDX section, always keeps the input sections.
3118         (Arm_input_section::set_exidx_section_link): New method.
3119         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
3120         has_errors_ to false.
3121         (Arm_exidx_input_section::has_errors,
3122         Arm_exidx_input_section::set_has_errors): New methods.
3123         (Arm_exidx_input_section::has_errors_): New data member.
3124         (Arm_relobj::get_exidx_shndx_list): New method.
3125         (Arm_output_section::append_text_sections_to_list): Do not skip
3126         section without SHF_EXECINSTR.
3127         (Arm_output_section::fix_exidx_coverage): Skip input sections with
3128         errors.
3129         (Arm_relobj::make_exidx_input_section): Add new parameter for text
3130         section header.  Make error messages more verbose.  Check for
3131         a non-executable section linked to an EXIDX section.
3132         (Arm_relobj::do_read_symbols): Remove error checking, which has been
3133         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
3134         check that there is no deferred EXIDX section if we exit early.
3135         Instead of not making an EXIDX section in case of an error, make one
3136         and set the has_errors flag of it.
3137         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
3138         in a relocatable link.
3139         (Target_arm::do_relax): Look for the EXIDX output section instead of
3140         assuming that it is called .ARM.exidx.
3141         (Target_arm::fix_exidx_coverage): Add a new parameter for input
3142         section list.  Do not check for SHF_EXECINSTR section flags but
3143         skip any input section with errors.
3144         * output.cc (Output_section::Output_section): Initialize
3145         always_keeps_input_sections_ to false.
3146         (Output_section::add_input_section): Check for
3147         always_keeps_input_sections_.
3148         *  output.h (Output_section::always_keeps_input_sections,
3149         Output_section::set_always_keeps_input_sections): New methods.
3150         (Output_section::always_keeps_input_sections): New data member.
3151
3152 2010-07-13  Rafael Espindola  <espindola@google.com>
3153
3154         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
3155         * fileread.h (Input_file): Add try_extra_search_path and find_file.
3156
3157 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
3158             Ian Lance Taylor  <iant@google.com>
3159
3160         * output.h (Output_section_lookup_maps::add_merge_section):
3161         Correct check of whether value was inserted.
3162         (Output_section_lookup_maps::add_merge_input_section): Likewise.
3163         (Output_section_lookup_maps::add_relaxed_input_section):
3164         Likewise.
3165         * arm.cc (Target_arm::got_section): Remove used local os.
3166         * i386.cc (Target_i386::got_section): Likewise.
3167         * x86_64.cc (Target_x86_64::got_section): Likewise.
3168         * sparc.cc (Target_sparc::got_section): Likewise.
3169         (Target_sparc::relocate): Remove unused local have_got_offset.
3170         * powerpc.cc (Target_powerpc::relocate): Likewise.
3171
3172 2010-07-13  Ian Lance Taylor  <iant@google.com>
3173
3174         * compressed_output.cc (zlib_decompress): Fix signature in
3175         !HAVE_ZLIB_H case.
3176
3177         * archive.cc (Archive::include_member): Unlock an external member
3178         of a thin archive.  Don't bother to delete an object we know is
3179         NULL.
3180
3181 2010-07-12  Cary Coutant  <ccoutant@google.com>
3182
3183         * compressed_output.cc (zlib_decompress): New function.
3184         (get_uncompressed_size): New function.
3185         (decompress_input_section): New function.
3186         * compressed_output.h (get_uncompressed_size): New function.
3187         (decompress_input_section): New function.
3188         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
3189         Handle compressed debug sections.
3190         * layout.cc (is_compressed_debug_section): New function.
3191         (Layout::output_section_name): Map compressed section names to
3192         canonical names.
3193         * layout.h (is_compressed_debug_section): New function.
3194         (is_debug_info_section): Recognize compressed debug sections.
3195         * merge.cc: Include compressed_output.h.
3196         (Output_merge_data::do_add_input_section): Handle compressed
3197         debug sections.
3198         (Output_merge_string::do_add_input_section): Handle compressed
3199         debug sections.
3200         * object.cc: Include compressed_output.h.
3201         (Sized_relobj::Sized_relobj): Initialize new data members.
3202         (build_compressed_section_map): New function.
3203         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
3204         * object.h (Object::section_is_compressed): New method.
3205         (Object::do_section_is_compressed): New method.
3206         (Sized_relobj::Compressed_section_map): New type.
3207         (Sized_relobj::do_section_is_compressed): New method.
3208         (Sized_relobj::compressed_sections_): New data member.
3209         * output.cc (Output_section::add_input_section): Handle compressed
3210         debug sections.
3211         * reloc.cc: Include compressed_output.h.
3212         (Sized_relobj::write_sections): Handle compressed debug sections.
3213
3214 2010-07-08  Cary Coutant  <ccoutant@google.com>
3215
3216         * resolve.cc (Symbol_table::resolve): Remember whether undef was
3217         weak when resolving to a dynamic def.
3218         (Symbol_table::should_override): Add adjust_dyndef flag; set it
3219         for weak undef/dynamic def cases. Adjust callers.
3220         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
3221         undef_binding_weak_.
3222         (Symbol_table::sized_write_globals): Adjust symbol binding.
3223         (Symbol_table::sized_write_symbol): Add binding parameter.
3224         * symtab.h (Symbol::set_undef_binding): New method.
3225         (Symbol::is_undef_binding_weak): New method.
3226         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
3227         (Symbol_table::should_override): Add new parameter.
3228         (Symbol_table::sized_write_symbol): Add new parameter.
3229
3230         * testsuite/weak_undef_file1.cc: Add new test case.
3231         * testsuite/weak_undef_file2.cc: Fix header comment.
3232         * testsuite/weak_undef_test.cc: Add new test case.
3233
3234 2010-06-29  Doug Kwan  <dougkwan@google.com>
3235
3236         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
3237         Initialize USE_SYMBOL_.
3238         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
3239         definition.
3240         (Arm_reloc_property::uses_symbol_): New data member declaration.
3241         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
3242         uses symbol value and symbol is undefined but not weakly undefined.
3243
3244 2010-06-28  Rafael Espindola  <espindola@google.com>
3245
3246         * plugin.cc (Plugin::load): Use dlerror.
3247
3248 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
3249
3250         * symtab.cc (detect_odr_violations): When reporting an ODR
3251         violation, report an object where the symbol is defined.
3252
3253 2010-06-25  Doug Kwan  <dougkwan@google.com>
3254
3255         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
3256         (Target_arm::section_may_have_icf_unsafe_pointers): New method
3257         definition.
3258         (Target_arm::Scan::local_reloc_may_be_function_pointer,
3259         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
3260         target hook to detect function points.
3261         (Target_arm::Scan::possible_function_pointer_reloc): New method.
3262         * icf.h (Icf::check_section_for_function_pointers): Change type of
3263         parameter SECTION_NAME to const reference to std::string.  Use
3264         target hook to determine if section may have unsafe pointers.
3265         * target.h (Target::section_may_have_icf_unsafe_pointers): New
3266         method definition.
3267
3268 2010-06-21  Rafael Espindola  <espindola@google.com>
3269
3270         * fileread.cc (Input_file::find_fie): New
3271         (Input_file::open): Use Input_file::find_fie.
3272         * fileread.h (Input_file::find_fie): New
3273         * plugin.cc (set_extra_library_path): New.
3274         (Plugin::load): Add set_extra_library_path to the transfer vector.
3275         (Plugin_manager::set_extra_library_path): New.
3276         (Plugin_manager::add_input_file): Use the extra search path if set.
3277         (set_extra_library_path(): New.
3278         * plugin.h (Plugin_manager): Add set_extra_library_path and
3279         extra_search_path_.
3280
3281 2010-06-19  Cary Coutant  <ccoutant@google.com>
3282
3283         * layout.cc (gdb_sections): Add .debug_types.
3284         (lines_only_debug_sections): Likewise.
3285
3286 2010-06-18  Rafael Espindola  <espindola@google.com>
3287
3288         * plugin.cc (add_input_file,add_input_library)
3289         (Plugin_manager::add_input_file): Make filename arguments const.
3290         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
3291         const.
3292
3293 2010-06-16  Doug Kwan  <dougkwan@google.com>
3294
3295         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
3296         .ARM.attributes section if we have not merged any input
3297         attributes sections.
3298
3299 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3300
3301         * arm.cc: Allow combining objects with no EABI version
3302         information.
3303
3304 2010-06-15  Rafael Espindola  <espindola@google.com>
3305
3306         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
3307
3308 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3309
3310         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
3311         (struct iovec): Correct !HAVE_READV definition.
3312
3313 2010-06-10  Cary Coutant  <ccoutant@google.com>
3314
3315         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
3316         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
3317         reloc sections.
3318         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
3319
3320         PR 11683
3321         * symtab.h (Symbol::is_placeholder): New member function.
3322         * target-reloc.h (relocate_section): Check for placeholder symbols.
3323
3324         * testsuite/Makefile.am (plugin_test_8): New test.
3325         (plugin_test_9): New test.
3326         * testsuite/Makefile.in: Regenerate.
3327
3328 2010-06-09  Nick Clifton  <nickc@redhat.com>
3329
3330         * yyscript.y (input_list_element): Allow strings prefixed with
3331         the '-' character.  Treat these as libraries.
3332         * script.cc (script_add_library): New function.  Adds a library
3333         specified by "-l<name>" found in an input script.
3334         * script-c.h: Add prototype for script_add_library.
3335
3336 2010-06-07  Doug Kwan  <dougkwan@google.com>
3337
3338         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
3339         Restrict stub-group size to be within long conditional branch
3340         range when working around cortex-A8 erratum.
3341
3342 2010-06-07  Damien Diederen  <dd@crosstwine.com>
3343
3344         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
3345         #ifdef typo.
3346
3347 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
3348
3349         PR gold/11658
3350         * output.cc
3351         (Output_section::Input_section_sort_entry::compare_section_ordering):
3352         Change to return non-zero correctly.
3353         (Output_section::Input_section_sort_section_order_index_compare
3354         ::operator()): Change to fix ambiguity in comparisons.
3355
3356 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
3357
3358         * gold.h (is_wildcard_string): New function.
3359         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
3360         (Layout::layout_eh_frame): Ditto.
3361         (Layout::find_section_order_index): New method.
3362         (Layout::read_layout_from_file): New method.
3363         * layout.h (Layout::find_section_order_index): New method.
3364         (Layout::read_layout_from_file): New method.
3365         (Layout::input_section_position_): New private member.
3366         (Layout::input_section_glob_): New private member.
3367         * main.cc (main): Call read_layout_from_file here.
3368         * options.h (--section-ordering-file): New option.
3369         * output.cc (Output_section::input_section_order_specified_): New
3370         member.
3371         (Output_section::Output_section): Initialize new member.
3372         (Output_section::add_input_section): Add new parameter.
3373         Keep input sections when --section-ordering-file is used.
3374         (Output_section::set_final_data_size): Sort input sections when
3375         section ordering file is specified.
3376         (Output_section::Input_section_sort_entry): Add new parameter.
3377         Check sorting type.
3378         (Output_section::Input_section_sort_entry::compare_section_ordering):
3379         New method.
3380         (Output_section::Input_section_sort_compare::operator()): Change to
3381         consider section_order_index.
3382         (Output_section::Input_section_sort_init_fini_compare::operator()):
3383         Change to consider section_order_index.
3384         (Output_section::Input_section_sort_section_order_index_compare
3385         ::operator()): New method.
3386         (Output_section::sort_attached_input_sections): Change to sort
3387         according to section order when specified.
3388         (Output_section::add_input_section<32, true>): Add new parameter.
3389         (Output_section::add_input_section<64, true>): Add new parameter.
3390         (Output_section::add_input_section<32, false>): Add new parameter.
3391         (Output_section::add_input_section<64, false>): Add new parameter.
3392         * output.h (Output_section::add_input_section): Add new parameter.
3393         (Output_section::input_section_order_specified): New
3394         method.
3395         (Output_section::set_input_section_order_specified): New method.
3396         (Input_section::Input_section): Initialize section_order_index_.
3397         (Input_section::section_order_index): New method.
3398         (Input_section::set_section_order_index): New method.
3399         (Input_section::section_order_index_): New member.
3400         (Input_section::Input_section_sort_section_order_index_compare): New
3401         struct.
3402         (Output_section::input_section_order_specified_): New member.
3403         * script-sections.cc (is_wildcard_string): Delete and move modified
3404         method to gold.h.
3405         (Output_section_element_input::Output_section_element_input): Modify
3406         call to is_wildcard_string.
3407         (Output_section_element_input::Input_section_pattern
3408         ::Input_section_pattern): Ditto.
3409         (Output_section_element_input::Output_section_element_input): Ditto.
3410         * testsuite/Makefile.am (final_layout): New test case.
3411         * testsuite/Makefile.in: Regenerate.
3412         * testsuite/final_layout.cc: New file.
3413         * testsuite/final_layout.sh: New file.
3414
3415 2010-06-01  Rafael Espindola  <espindola@google.com>
3416
3417         * plugin.cc (Plugin::load): Pass the output name to the plugin.
3418
3419 2010-06-01  Rafael Espindola  <espindola@google.com>
3420
3421         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
3422         visibility of symbols.
3423
3424 2010-05-27  Doug Kwan  <dougkwan@google.com>
3425
3426         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
3427         from start of output section instead of address for a local symbol
3428         in a merged or relaxed section when doing a relocatable link.
3429
3430 2010-05-26  Rafael Espindola  <espindola@google.com>
3431
3432        PR 11604
3433         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
3434         adding sections the garbage collector removed.
3435         * gold/testsuite/Makefile.am: Add test.
3436         * gold/testsuite/Makefile.in: Regenerate.
3437         * gold/testsuite/plugin_test_7.sh: New.
3438         * gold/testsuite/plugin_test_7_1.c: New.
3439         * gold/testsuite/plugin_test_7_2.c: New.
3440
3441 2010-05-26  Rafael Espindola  <espindola@google.com>
3442
3443         * script-sections.cc (Output_section_definition::set_section_addresses):
3444         Check for --section-start.
3445
3446 2010-05-26  Doug Kwan  <dougkwan@google.com>
3447
3448         * arm.cc (Arm_scan_relocatable_relocs): New class.
3449         (Target_arm::relocate_special_relocatable): New method.
3450         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
3451         (Arm_relocate_functions::thumb_branch_common): Same.
3452         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
3453         instead of Default_scan_relocatable_relocs.
3454         * target-reloc.h (relocate_for_relocatable): Let target handle
3455         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
3456         * target.h (Sized_target::relocate_special_relocatable): New method.
3457
3458 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3459
3460         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
3461
3462 2010-05-23  Doug Kwan  <dougkwan@google.com>
3463
3464         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
3465         instead of a cast.
3466         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
3467         with a direct branch, not a conditional branch, to a stub.
3468         * merge.cc (Output_merge_base::record_input_section): New method
3469         defintion.
3470         (Output_merge_data::do_add_input_section): Record input section if
3471         keeps-input-sections flag is set.
3472         (Output_merge_string::do_add_input_section): Ditto.
3473         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
3474         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
3475         INPUT_SECTIONS_.
3476         (Output_merge_base::keeps_input_sections,
3477         Output_merge_base::set_keeps_input_sections,
3478         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
3479         method definitions.
3480         (Output_merge_base::Input_sections): New type declaration.
3481         (Output_merge_base::input_sections_begin,
3482         Output_merge_base::input_sections_end,
3483         Output_merge_base::do_set_keeps_input_sections): New method definitions.
3484         (Output_merge_base::bool keeps_input_sections_,
3485         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
3486         Output_merge_base::input_sections_): New data members.
3487         (Output_merge_data::do_set_keeps_input_sections): New method
3488         defintion.
3489         (Output_merge_string::do_set_keeps_input_sections): Ditto.
3490         * output.cc (Output_section::Input_section::relobj): Move method
3491         defintion from class declaration to here and handle merge sections.
3492         (Output_section::Input_section::shndx): Ditto.
3493         (Output_section::Output_section): Remove initializations of removed
3494         data members and initialize new data member LOOKUP_MAPS_.
3495         (Output_section::add_input_section): Set keeps-input-sections flag
3496         for a newly created merge output section as appropriate.  Adjust code
3497         to use Output_section_lookup_maps class.
3498         (Output_section::add_relaxed_input_section): Adjst code for lookup
3499         maps code refactoring.
3500         (Output_section::add_merge_input_section): Add a new parameter
3501         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
3502         class.  If adding input section to a newly created merge output
3503         section fails, remove the new merge section.
3504         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
3505         Adjust code for use of the Output_section_lookup_maps class.
3506         (Output_section::find_merge_section): Ditto.
3507         (Output_section::build_lookup_maps): New method defintion.
3508         (Output_section::find_relaxed_input_section): Adjust code to use
3509         Output_section_lookup_maps class.
3510         (Output_section::get_input_sections): Export merge sections.  Adjust
3511         code to use Output_section_lookup_maps class.
3512         (Output_section:::add_script_input_section): Adjust code to use
3513         Output_section_lookup_maps class.  Update lookup maps for merge
3514         sections also.
3515         (Output_section::discard_states): Use Output_section_lookup_maps.
3516         (Output_section::restore_states): Same.
3517         * output.h (Merge_section_properties): Move class defintion out of
3518         Output_section.
3519         (Output_section_lookup_maps): New class.
3520         (Output_section::Input_section::is_merge_section): New method
3521         defintion.
3522         (Output_section::Input_section::relobj): Move defintion out of class
3523         defintion.  Declare method only.
3524         (Output_section::Input_section::shndx): Ditto.
3525         (Output_section::Input_section::output_merge_base): New method defintion.
3526         (Output_section::Input_section::u2_.pomb): New union field.
3527         (Output_section::Merge_section_by_properties_map,
3528         Output_section::Output_section_data_by_input_section_map,
3529         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
3530         Remove types.
3531         (Output_section::add_merge_input_section): Add new parameter
3532         KEEPS_INPUT_SECTIONS.
3533         (Output_section::build_lookup_maps): New method declaration.
3534         (Output_section::merge_section_map_,
3535         Output_section::merge_section_by_properties_map_,
3536         Output_section::relaxed_input_section_map_,
3537         Output_section::is_relaxed_input_section_map_valid_): Remove data
3538         members.
3539         (Output_section::lookup_maps_): New data member.
3540
3541 2010-05-21  Doug Kwan  <dougkwan@google.com>
3542
3543         PR gold/11619
3544         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
3545         avoid a compilation error.
3546
3547 2010-05-19  Rafael Espindola  <espindola@google.com>
3548
3549         * script-sections.cc (Output_section_definition::allocate_to_segment):
3550         Update the phdrs_list even when the output section is NULL.
3551         * testsuite/Makefile.am: Add test.
3552         * testsuite/Makefile.in: Regenerate.
3553         * testsuite/script_test_9.cc: New.
3554         * testsuite/script_test_9.sh: New.
3555         * testsuite/script_test_9.t: New.
3556
3557 2010-05-19  Doug Kwan  <dougkwan@google.com>
3558
3559         * arm.cc (Arm_input_section::original_size): New method.
3560         (Arm_input_section::do_addralign): Add a cast.
3561         (Arm_input_section::do_output_offset): Remove static cast.
3562         (Arm_input_section::original_addralign,
3563          Arm_input_section::original_size_): Change type to uint32_t.
3564         (Arm_input_section::init): Add safe casts for section alignment
3565         and size.
3566         (Arm_input_section::set_final_data_size): Do not set address and
3567         offset of stub table.
3568         (Arm_output_section::fix_exidx_coverage): Change use of of
3569         Output_section::Simple_input_section to that of
3570         Output_section::Input_section.
3571         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
3572         except for the first pass.
3573         * output.cc (Output_section::get_input_sections): Change type of
3574         input_sections to std::list<Input_section>.
3575         (Output_section::add_script_input_section): Rename from
3576         Output_section::add_simple_input_section.  Change type of SIS
3577         parameter from Simple_input_section to Input_section.
3578         * output.h (Output_section::Simple_input_section): Remove class.
3579         (Output_section::Input_section): Change class visibility to public.
3580         (Output_section::Input_section::addralign): Use stored alignments
3581         for special input sections if set.
3582         (Output_section::Input_section::set_addralign): New method.
3583         (Output_section::get_input_sections): Change parameter type from
3584         list of Simple_input_section to list of Input_section.
3585         (Output_section::add_script_input_section): Rename from
3586         Output_section::add_simple_input_section. Change first parameter's
3587         type from Simple_input_section to Input_section and remove the
3588         second and third parameters.
3589         * script-sections.cc (Input_section::Input_section_list): Change
3590         type to list of Output_section::Input_section/
3591         (Input_section_info::Input_section_info): Change parameter type of
3592         INPUT_SECTION to Output_section::Input_section.
3593         (Input_section_info::input_section): Change return type.
3594         (Input_section_info::input_section_): Change type to
3595         Output_section::Input_section.
3596         (Output_section_element_input::set_section_addresses): Adjust code
3597         to use Output_section::Input_section instead of
3598         Output_section::Simple_input_section.  Adjust code for renaming
3599         of Output_section::add_simple_input_section.
3600         (Orphan_output_section::set_section_addresses): Ditto.
3601
3602 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3603
3604         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
3605         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
3606
3607 2010-05-18  Rafael Espindola  <espindola@google.com>
3608
3609         * options.cc (General_options::finalize): Handle -nostdlib.
3610         * options.h (nostdlib): New option.
3611         * script.cc (script_add_search_dir): Handle -nostdlib.
3612
3613 2010-05-12  Doug Kwan  <dougkwan@google.com>
3614
3615         * arm.cc (Target_arm::do_finalize_sections): Create an empty
3616         attributes section only if there no attributes section after merging.
3617         (Target_arm::merge_object_attributes): Move value of
3618         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
3619         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
3620         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
3621         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
3622         and arm_attr_merge_7.stdout.
3623         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
3624         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
3625         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
3626         arm_attr_merge_7b.o): New rules.
3627         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
3628         arm_attr_merge_7
3629         * testsuite/Makefile.in: Regenerate.
3630         * testsuite/arm_attr_merge.sh: New file.
3631         * testsuite/arm_attr_merge_[67][ab].s: Same.
3632
3633 2010-05-05  Nick Clifton  <nickc@redhat.com>
3634
3635         * po/es.po: Updated Spanish translation.
3636
3637 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
3638
3639         * Makefile.am (install-exec-local): Properly install gold as
3640         default cross linker.
3641         * Makefile.in: Regenerated.
3642
3643 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
3644             Nick Clifton  <nickc@redhat.com>
3645
3646         * configure.ac (install_as_default): Define and set to false
3647         unless --enable-gold or --enable-gold=both/gold has been
3648         specified.
3649         * configure: Regenerate.
3650
3651         * Makefile.am (install-exec-local): Install the executable as
3652         'ld.gold'.  If install_as_default is true then also install it as
3653         'ld'.
3654         * Makefile.in: Regenerated.
3655
3656 2010-04-24  Ian Lance Taylor  <iant@google.com>
3657
3658         * layout.cc (Layout::layout_reloc): In relocatable link don't
3659         combine reloc sections for grouped sections.
3660
3661 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
3662
3663         * gc.h (gc_process_relocs): Pass information on relocs pointing to
3664         sections that are not ordinary to icf.
3665         * icf.cc (get_section_contents): Handle relocation pointing to section
3666         with no object or shndx information.
3667         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
3668         * testsuite/Makefile.in: Regenerate.
3669         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
3670         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
3671
3672 2010-04-22  Ian Lance Taylor  <iant@google.com>
3673
3674         * expression.cc (Expression::Expression_eval_info): Add
3675         result_alignment_pointer field.
3676         (Expression::eval_with_dot): Add result_alignment_pointer
3677         parameter.  Change all callers.
3678         (Expression::eval_maybe_dot): Likewise.
3679         (class Binary_expression): Add alignment_pointer parameter to
3680         left_value and right_value.  Change all callers.
3681         (BINARY_EXPRESSION): Set result alignment.
3682         (class Trinary_expression): Add alignment_pointer parameter to
3683         arg2_value and arg3_value.  Change all callers.
3684         (Trinary_cond::value): Set result alignment.
3685         (Max_expression::value, Min_expression::value): Likewise.
3686         (Align_expression::value): Likewise.
3687         * script-sections.cc (class Sections_element): Add dot_alignment
3688         parameter to set_section_addresses virtual function.  Update
3689         instantiations.
3690         (class Output_section_element): Likewise.
3691         (Script_sections::create_segments): Add dot_alignment parameter.
3692         Change all callers.
3693         (Script_sections::create_segments_from_phdrs_clause): Likewise.
3694         (Script_sections::set_phdrs_clause_addresses): Likewise.
3695         * script-sections.h: Update declarations.
3696         * script.h: Update declarations.
3697         * output.h (Output_segment::set_minimum_p_align): Don't decrease
3698         min_p_align.
3699         * testsuite/script_test_3.t: Set large alignment.
3700         * testsuite/script_test_3.sh: Make sure that at least one LOAD
3701         segment has expected alignment.
3702
3703 2010-04-22  Nick Clifton  <nickc@redhat.com>
3704
3705         * po/gold.pot: Updated by the Translation project.
3706         * po/vi.po: Updated Vietnamese translation.
3707
3708 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
3709
3710         * testsuite/Makefile.am (check_PROGRAMS): Add
3711         icf_virtual_function_folding_test.
3712         * testsuite/Makefile.in: Regenerated.
3713
3714 2010-04-15  Andrew Haley  <aph@redhat.com>
3715
3716         * options.h (merge_exidx_entries): New option.
3717         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
3718         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
3719         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
3720         (Target_arm::merge_exidx_entries): New function.
3721         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
3722         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
3723         to Arm_exidx_fixup constructor.
3724         Add new arg, merge_exidx_entries.
3725         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
3726         Arm_output_section::fix_exidx_coverage.
3727
3728 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
3729
3730         * icf.cc (get_section_contents): Check for preemptible functions.
3731         Ignore addend when appropriate.
3732         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
3733         section folded.
3734         (add_from_relobj): Check for section folded.
3735         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
3736         * symtab.h (should_add_dynsym_entry): Add new parameter.
3737         * target-reloc.h (scan_relocs): Check for section folded.
3738         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
3739         Check reloc types for function pointers in shared objects.
3740         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
3741         case.
3742         (icf_preemptible_functions_test): New test case.
3743         (icf_string_merge_test): New test case.
3744         * testsuite.Makefile.in: Regenerate.
3745         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
3746         bar_glob.  Refactor code.
3747         * testsuite/icf_preemptible_functions_test.cc: New file.
3748         * testsuite/icf_preemptible_functions_test.sh: New file.
3749         * testsuite/icf_string_merge_test.cc: New file.
3750         * testsuite/icf_string_merge_test.sh: New file.
3751         * testsuite/icf_virtual_function_folding_test.cc: New file.
3752         * testsuite/icf_virtual_function_folding_test.sh: New file.
3753
3754 2010-04-14  Doug Kwan  <dougkwan@google.com>
3755
3756         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
3757         for local symbol recounting if we remove a section due to ICF.
3758         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
3759         there are no regular objects in input.
3760
3761 2010-04-13  Doug Kwan  <dougkwan@google.com>
3762
3763         * arm.cc (Arm_input_section::set_final_data_size): Compute
3764         accurate final data size instead of using current data size.
3765
3766 2010-04-09  Doug Kwan  <dougkwan@google.com>
3767
3768         * layout.cc (Layout::choose_output_section): Handle script section
3769         types.
3770         (Layout::make_output_section_for_script): Add section type parameter.
3771         Handle script section types.
3772         * layout.h (Layout::make_output_section_for_script): Add section
3773         type parameter.
3774         * output.cc (Output_section::Output_section): Initialize data member
3775         is_noload_.
3776         (Output_section::do_reset_address_and_file_offset): Do not set address
3777         to 0 if section is a NOLOAD section.
3778         * output.h (Output_section::is_noload): New method.
3779         (Output_section::set_is_noload): Ditto.
3780         (Output_section::is_noload_): New data member.
3781         * script-c.h (Script_section_type): New enum type.
3782         (struct Parser_output_section_header): Add new file section_type.
3783         * script-sections.cc (Sections_element::output_section_name): Add
3784         parameter for returning script section type.
3785         (Output_section_definition::output_section_name): Ditto.
3786         (Output_section_definition::section_type)P; New method.
3787         (Output_section_definiton::script_section_type_name): Ditto.
3788         (Output_section_definition::script_section_type_): New data member.
3789         (Output_section_definition::Output_section_definition): Initialize
3790         data member Output_section_definition::script_section_type_.
3791         (Output_section_definition::create_sections): Pass script section type
3792         to Layout::make_output_section_for_script.
3793         (Output_section_definition::output_section_name): Return script
3794         section type to caller.
3795         (Output_section_definition::set_section_address): Do not advance
3796         dot value and load address if section type is NOLOAD.  Set address
3797         of NOLOAD sections regardless of section flags.
3798         (Output_section_definition::print): Print section type if it is
3799         not SCRIPT_SECTION_TYPE_NONE.
3800         (Output_section_definition::section_type): New method.
3801         (Output_section_definition::script_section_type_name): Ditto.
3802         (Script_sections::output_section_name): Add new parameter
3803         PSECTION_TYPE for returning script section type.  Pass it to
3804         section elements.  Handle discard sections.
3805         (Sort_output_sections::operator()): Handle NOLOAD sections.
3806         * script-sections.h (Script_sections::Section_type): New enum type.
3807         (Script_sections::output_section_name): Add a new parameter for
3808         returning script section type.
3809         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
3810         INFO and NOLOAD.
3811         * yyscript.y (union): Add new field SECTION_TYPE.
3812         (COPY, DSECT, INFO, NOLOAD): New tokens.
3813         (opt_address_and_section_type): Change type to output_section_header.
3814         (section_type): New non-terminal
3815         (section_header): Handle section type.
3816         (opt_address_and_section_type): Return section type value.
3817
3818 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
3819
3820         * testsuite/plugin_common_test_1.c (foo): Add prototype.
3821         * testsuite/plugin_common_test_2.c (foo): Likewise.
3822
3823 2010-04-08  Doug Kwan  <dougkwan@google.com>
3824
3825         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
3826         Output_merge_data.
3827         * output.cc (Output_section::add_merge_input_section): Simplify
3828         code and return status of Output_merge_base::add_input_section.
3829         Update merge section map only if Output_merge_base::add_input_section
3830         returns true.
3831
3832 2010-04-07  Doug Kwan  <dougkwan@google.com>
3833
3834         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
3835         if section is marked as containing instructions but has no mapping
3836         symbols.
3837         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
3838         correct section index.
3839         (Arm_relobj::find_linked_text_section): Ditto.
3840
3841 2010-04-07  Cary Coutant  <ccoutant@google.com>
3842
3843         * archive.cc (include_member): Destroy Read_symbols_data object before
3844         releasing file.
3845         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
3846         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
3847         (Read_symbols_data::~Read_symbols_data) New destructor.
3848         (Section_relocs::Section_relocs) New constructor.
3849         (Section_relocs::~Section_relocs) New destructor.
3850         (Read_relocs_data::Read_relocs_data) New constructor.
3851         (Read_relocs_data::~Read_relocs_data) New destructor.
3852         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
3853         pointers to NULL after deleting.
3854
3855 2010-04-07  Doug Kwan  <dougkwan@google.com>
3856
3857         * arm.cc: Replace "endianity" with "endianness" in comments.
3858         (Arm_exidx_cantunwind): Ditto.
3859         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
3860         (Arm_relobj::merge_flags_and_attributes): New method.
3861         (Arm_relobj::merge_flags_and_attributes_): New data member.
3862         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
3863         (Arm_relobj::scan_sections_for_stubs): Ditto.
3864         (Arm_relobj::do_read_symbols): Check to see if we really want to
3865         merge processor-specific flags and attributes.  Exit early if
3866         an object is empty except for section names and the undefined symbol.
3867         (Target_arm::do_finalize_sections): Move check for ELF format to
3868         Arm_relobj::do_read_symbols.  Merge processor specific flags and
3869         attributes from a regular object only when we have determined that
3870         it is aapropriate.  Do not create an .ARM.attributes section in
3871         output if there is no regular input object.
3872         (Target_arm::merge_processor_specific_flags): Check
3873         --warn-mismatch before printing any error.
3874         (Target_arm::merge_object_attributes): Ditto.
3875         * gold.cc (queue_middle_tasks): Handle the case in which there is
3876         no regular object in input.
3877         * options.cc (General_options::parse_EB): New method.
3878         (General_options::parse_EL): Same.
3879         (General_options::General_options): Initialize endianness_.
3880         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
3881         New options.
3882         (General_options::Endianness): New enum.
3883         (General_options::endianness): New method.
3884         (General_options::endianness_): New data member.
3885         * parameters.cc (Parameters::set_options): Check target endianness.
3886         (Parameters::set_target_once): Ditto.
3887         (Parameters::check_target_endianness): New method.
3888         (parameters_force_valid_target): If either -EL or -EB is specified,
3889         use it to define endianness of default target.
3890         * parameters.h (Parameters::check_target_endianness): New method
3891         declaration.
3892         * target.h (class Target): Change "endianity" to "endianness"
3893         in comments.
3894
3895 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3896
3897         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
3898         * configure: Regenerate.
3899         * Makefile.in: Regenerate.
3900         * testsuite/Makefile.in: Regenerate.
3901
3902 2010-04-06  Cary Coutant  <ccoutant@google.com>
3903
3904         gcc PR lto/42757
3905         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
3906         prevailing definitions of common symbols.
3907         * testsuite/plugin_test_6.sh: New test case.
3908         * testsuite/plugin_common_test_1.c: New test case.
3909         * testsuite/plugin_common_test_2.c: New test case.
3910         * testsuite/Makefile.am (plugin_test_6): New test case.
3911         * testsuite/Makefile.in: Regenerate.
3912
3913 2010-04-06  Nick Clifton  <nickc@redhat.com>
3914
3915         * po/vi.po: New Vietnamese translation.
3916
3917 2010-03-30  Doug Kwan  <dougkwan@google.com>
3918
3919         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
3920
3921 2010-03-25  Doug Kwan  <dougkwan@google.com>
3922
3923         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
3924         to avoid a conversion warning on a 32-bit host.
3925
3926 2010-03-24  Ian Lance Taylor  <iant@google.com>
3927
3928         * testsuite/script_test_3.t: Add a TLS segment.
3929         * testsuite/Makefile.am (check_PROGRAMS): Add
3930         tls_phdrs_script_test.
3931         (tls_phdrs_script_test_SOURCES): Define.
3932         (tls_phdrs_script_test_DEPENDENCIES): Define.
3933         (tls_phdrs_script_test_LDFLAGS): Define.
3934         (tls_phdrs_script_test_LDADD): Define.
3935         * testsuite/Makefile.in: Rebuild.
3936
3937 2010-03-23  Cary Coutant  <ccoutant@google.com>
3938
3939         * fileread.cc (find_or_make_view): Fix comment.
3940
3941 2010-03-23  Ian Lance Taylor  <iant@google.com>
3942
3943         * script-sections.cc (class Orphan_section_placement): Define
3944         PLACE_TLS and PLACE_TLS_BSS.
3945         (Orphan_section_placement::Orphan_section_placement): Initialize
3946         new places.
3947         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
3948         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
3949         (tls_script_test_SOURCES): Define.
3950         (tls_script_test_DEPENDENCIES): Define.
3951         (tls_script_test_LDFLAGS): Define.
3952         (tls_script_test_LDADD): Define.
3953         * testsuite/Makefile.in: Rebuild.
3954
3955 2010-03-22  Doug Kwan  <dougkwan@google.com>
3956
3957         * arm.cc (Arm_relocate_functions::abs8,
3958         Arm_relocate_functions::abs16): Use correct check for overflow
3959         specified in the ARM ELF specs.
3960         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
3961         target of a BLX instruction specially.
3962         (Reloc_stub::stub_type_for_reloc): Ditto.
3963         (Relocate::relocate): Use symbolic names instead of numeric relocation
3964         codes to report error.
3965         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
3966         workaround.
3967         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
3968         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
3969         thumb2_blx_out_of_range.stdout
3970         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
3971         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
3972         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
3973         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
3974         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
3975         thumb2_blx_in_range, thumb2_blx_in_range.o,
3976         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
3977         thumb2_blx_out_of_range.o): New rules.
3978         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
3979         thumb2_blx_in_range and thumb2_blx_out_of_range.
3980         * testsuite/Makefile.in: Regenerate.
3981         * arm_branch_in_range.sh: Add tests for THUMB BLX.
3982         * testsuite/thumb_blx_in_range.s: New file.
3983         * testsuite/thumb_blx_out_of_range.s: New file.
3984
3985 2010-03-22  Rafael Espindola  <espindola@google.com>
3986
3987         * archive.cc (Should_include): Move to archive.h.
3988         (should_include_member): Make it a member of Archive.
3989         (Lib_group): New.
3990         (Add_lib_group_symbols): New.
3991         * archive.h: Include options.h.
3992         (Archive_member): Moved from Archive.
3993         (Should_include): Moved from archive.cc.
3994         (Lib_group): New.
3995         (Add_lib_group_symbols): New.
3996         * dynobj.cc (do_should_include_member): New.
3997         * dynobj.h (do_should_include_member): New.
3998         * gold.cc (queue_initial_tasks): Update call to queue.
3999         * main.cc (main): Print lib group stats.
4000         * object.cc (do_should_include_member): New.
4001         * object.h: Include archive.h.
4002         (Object::should_include_member): New.
4003         (Object::do_should_include_member): New.
4004         (Sized_relobj::do_should_include_member): New.
4005         * options.cc (General_options::parse_start_lib): New.
4006         (General_options::parse_end_lib): New.
4007         (Input_arguments::add_file): Handle lib groups.
4008         (Input_arguments::start_group): Check we are not in a lib.
4009         (Input_arguments::start_lib): New.
4010         (Input_arguments::end_lib): New.
4011         * options.h (General_options): Add start_lib and end_lib.
4012         (Input_argument::lib_): New.
4013         (Input_argument::lib): New.
4014         (Input_argument::is_lib): New.
4015         (Input_file_lib): New.
4016         (Input_arguments::in_lib_): New.
4017         (Input_arguments::in_lib): New.
4018         (Input_arguments::start_lib): New.
4019         (Input_arguments::end_lib_): New.
4020         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
4021         in unused members as preempted.
4022         (Sized_pluginobj::do_should_include_member): New.
4023         * plugin.h (Sized_pluginobj::do_should_include_member): New.
4024         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
4025         return the blocker.
4026         (Read_symbols::do_whole_lib_group): New.
4027         (Read_symbols::do_lib_group): New.
4028         (Read_symbols::do_read_symbols): Handle lib groups.
4029         (Read_symbols::get_name): Handle lib groups.
4030         * readsyms.h (Read_symbols): Add an archive member pointer.
4031         (Read_symbols::do_whole_lib_group): New.
4032         (Read_symbols::do_lib_group): New.
4033         (Read_symbols::member_): New.
4034         * script.cc (read_input_script): Update call to queue_soon.
4035
4036 2010-03-19  Doug Kwan  <dougkwan@google.com>
4037
4038         * arm.cc (Stub_table::Stub_table): Initialize new data members
4039         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
4040         (Stub_table::add_reloc_stub): Assign stub offset and update
4041         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
4042         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
4043         New data members.
4044         (Stub_table::update_data_size_and_addralign): Use
4045         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
4046         instead of going over all reloc stubs.
4047         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
4048         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
4049         Stringpool_template::offset_ to size of Stringpool_char.
4050         (Stringpool_template::new_key_offset): Remove code to initialize
4051         Stringpool_template::offset_.
4052         * stringpool.h (Stringpool_template::set_no_zero_null): Set
4053         Stringpool_template::offset_ to zero.
4054
4055 2010-03-15  Doug Kwan  <dougkwan@google.com>
4056
4057         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
4058         offset_.
4059         (Stringpool_template::new_key_offset): New method.
4060         (Stringpool_template::add_string): Assign offsets when adding new
4061         strings.
4062         (Stringpool_template::set_string_offsets): Do not set string offsets
4063         when not optimizing.
4064         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
4065         member size_.
4066         (Chunked_vector::clear): Clear size_.
4067         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
4068         (Chunked_vector::size): Return size_.
4069         (Chunked_vector::push_back): Use size_ to find insert position.
4070         (Chunked_vector::size_): New data member.
4071         (Stringpool_template::set_no_zero_null): Assert string set is empty.
4072         (Stringpool_template::new_key_offset): New method declaration.
4073         (Stringpool_template::offset_): New data member.
4074
4075 2010-03-15   Rafael Espindola  <espindola@google.com>
4076
4077         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
4078         Add_symbols' constructor.
4079         * readsyms.h (Add_symbols): Remove the input_group member.
4080
4081 2010-03-10  Ian Lance Taylor  <iant@google.com>
4082
4083         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
4084         target to ask whether a reference to a symbol requires a stack
4085         split.
4086         * target.h (Target::is_call_to_non_split): New function.
4087         (Target::do_is_call_to_non_split): Declare virtual function.
4088         * target.cc: Include "symtab.h".
4089         (Target::do_is_call_to_non_split): New function.
4090         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
4091
4092 2010-03-10  Cary Coutant  <ccoutant@google.com>
4093
4094         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
4095         (File_read::open[1]): Remove initial mapping of whole_file_view_.
4096         (File_read::open[2]): Add whole_file_view_ to list of views.
4097         (File_read::make_view): Remove test of whole_file_view_.
4098         (File_read::find_or_make_view): Create whole_file_view_ if
4099         necessary.
4100         (File_read::clear_views): Replace bool parameter with enum;
4101         adjust all callers.  Don't delete views with permanent data;
4102         do delete cached views and views from archives if
4103         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
4104         if clearing the corresponding view.
4105         * fileread.h (File_read::Clear_views_mode): New enum.
4106         (File_read::View::is_permanent_view): New method.
4107         (File_read::clear_views): Replace bool parameter
4108         with enum; adjust all callers.
4109         * options.h (General_options): Change keep_files_mapped option;
4110         add map_whole_files.
4111         * readsyms.cc (Add_symbols::run): Delete sd_ object before
4112         releasing the file.
4113         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
4114         the file.
4115
4116 2010-03-10  David S. Miller  <davem@davemloft.net>
4117
4118         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
4119
4120 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
4121
4122         * icf.cc (get_section_contents): Add '@' marker after processing the
4123         merge reloc.
4124
4125 2010-03-08  Doug Kwan  <dougkwan@google.com>
4126
4127         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
4128         due to a conversion warning.
4129         (Arm_relobj::update_output_local_symbol_count): Check for local
4130         symbol with unset output index.
4131
4132 2010-03-05  Ian Lance Taylor  <iant@google.com>
4133
4134         * options.h (class General_options): Add --spare-dynamic-tags.
4135         * output.cc (Output_data_dynamic::set_final_data_size): Implement
4136         --spare-dynamic-tags.
4137
4138 2010-03-05  Ian Lance Taylor  <iant@google.com>
4139
4140         * incremental.cc: Include "libiberty.h".
4141
4142 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
4143
4144         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
4145         function, is_info_ member.
4146         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
4147         (Versions::Versions): Update caller.
4148         (Versions::define_base_version): Likewise.
4149         (Versions::add_def): Likewise.
4150
4151 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
4152
4153         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
4154         (Scan::possible_function_pointer_reloc): New function.
4155         (Scan::local_reloc_may_be_function_pointer): Change to call
4156         possible_function_pointer_reloc.
4157         (Scan::global_reloc_may_be_function_pointer): Ditto.
4158         * icf.h (Icf::check_section_for_function_pointers): Change to reject
4159         relocations in ".data.rel.ro._ZTV" section.
4160         * testsuite/icf_safe_so_test.sh: Change to pass i386.
4161         * testsuite/icf_safe_so_test.cc: Ditto.
4162         * testsuite/icf_safe_test.cc: Ditto.
4163         * testsuite/icf_safe_test.sh: Ditto.
4164
4165 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4166             Ian Lance Taylor  <iant@google.com>
4167
4168         * target-reloc.h (relocate_section): Check the symbol table index
4169         for -1U before setting the local symbol index.
4170         (scan_relocatable_relocs): If copying the relocation, record that
4171         the local symbol is required.
4172         * object.h (Symbol_value::is_output_symtab_index_set): New
4173         function.
4174         (Symbol_value::may_be_discarded_from_output_symtab): New
4175         function.
4176         (Symbol_value::has_output_symtab_entry): New function.
4177         (Symbol_value::needs_output_symtab_entry): Remove.
4178         (Symbol_value::output_symtab_index): Make sure the symbol index is
4179         set.
4180         (Symbol_value::set_output_symtab_index): Make sure the symbol
4181         index is not set.  Make sure the new index is valid.
4182         (Symbol_value::set_must_have_output_symtab_entry): New function.
4183         (Symbol_value::has_output_dynsym_entry): New function.
4184         (Symbol_value::set_output_dynsym_index): Make sure the new index
4185         is valid.
4186         (Sized_relobj::set_must_have_output_symtab_entry): New function.
4187         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
4188         local symbol if permitted.
4189         (Sized_relobj::do_finalize_local_symbols): Call
4190         is_output_symtab_index_set rather than needs_output_symtab_entry.
4191         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
4192         rather than needs_output_symtab_entry.  Call
4193         has_output_dynsym_entry rather than needs_output_dynsym_entry.
4194         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
4195         is_output_symtab_index_set rather than needs_output_symtab_entry.
4196         * testsuite/discard_locals_relocatable_test.c: New file.
4197         * testsuite/discard_locals_test.sh: Test -r.
4198         * testsuite/Makefile.am (check_DATA): Add
4199         discard_locals_relocatable_test1.syms,
4200         discard_local_relocatable_test2.syms.
4201         (MOSTLYCLEANFILES): Likewise.  Also add
4202         discard_locals_relocatable_test1.lout and
4203         discard_locals_relocatable_test2.out.
4204         (discard_locals_relocatable_test1.syms): New target.
4205         (discard_locals_relocatable_test.o): New target.
4206         (discard_locals_relocatable_test1.out): New target.
4207         (discard_locals_relocatable_test2.syms): New target.
4208         (discard_locals_relocatable_test2.out): New target.
4209         (various): Add missing ../ld-new dependencies.
4210         * testsuite/Makefile.in: Rebuild.
4211
4212 2010-03-03  Nick Clifton  <nickc@redhat.com>
4213
4214         * po/fi.po: New Finnish translation.
4215
4216 2010-03-01  Doug Kwan  <dougkwan@google.com>
4217
4218         * layout.cc (Layout::Layout): Force section types of .init_array*,
4219         .preinit_array* and .fini_array* sections.
4220         * output.cc (Output_section::Input_section_sort_entry::has_priority):
4221         Fix check of return value of std::string::find.().
4222         (Output_section::Input_section_sort_compare::operator()): Remove
4223         comment about .init_array.
4224         (Output_section::Input_section_sort_init_fini_compare::operator()):
4225         New method.
4226         (Output_section::sort_attached_input_sections): Handle .init_array
4227         and .fini_array specially.
4228         * output.h (Output_section::Inut_section_sort_compare): Update
4229         comment.
4230         (Output_section::Input_section_sort_init_fini_compare): New struct.
4231
4232 2010-02-26  Doug Kwan  <dougkwan@google.com>
4233
4234         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
4235         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
4236         * testsuite/debug_msg.sh: Avoid matching source line number for
4237         use of global variable undef_int.
4238
4239 2010-02-26  Doug Kwan  <dougkwan@google.com>
4240
4241         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
4242         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
4243         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
4244         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
4245         * options.cc (General_options::General_options): Initialize member
4246         fix_v4bx_.
4247         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
4248         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
4249         and rm_no_fix_v4bx.stdout
4250         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
4251         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
4252         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
4253         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
4254         and arm_no_fix_v4bx.
4255         * Makefile.in: Regenerate.
4256         * testsuite/arm_fix_v4bx.s: New file.
4257         * testsuite/arm_fix_v4bx.sh: Ditto.
4258
4259 2010-02-24  Doug Kwan  <dougkwan@google.com>
4260
4261         * arm.cc (Target_arm::got_section): Make the .got section the first
4262         non RELRO section in the data segment.
4263         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
4264         suffixes of section names.
4265
4266 2010-02-24  Doug Kwan  <dougkwan@google.com>
4267
4268         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
4269         flags and attributes merging if an input file is a binary file.
4270         * fileread.cc (Input_file::open): Record format of original file.
4271         * fileread.h (Input_file::Format): New enum type.
4272         (Input_file::Input_file): Initialize data member format_.
4273         (Input_file::format): New method definition.
4274         (Input_file::format_):: New data member.
4275
4276 2010-02-24  Doug Kwan  <dougkwan@google.com>
4277
4278         * arm.cc (Arm_output_data_got): New class.
4279         (ARM_TCB_SIZE): New constant
4280         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
4281         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
4282         If user uses a script with a SECTIONS clause, issue only a warning
4283         for a misplaced EXIDX input section.  Otherwise, issue an error.
4284         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
4285         garbage collection.
4286         (Target_arm::got_mode_index_entry): Handle static linking.
4287         (Target_arm::Scan::local): Ditto.
4288         (Target_arm::Scan::global): Ditto.
4289         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
4290         all incorrectly implemented relocations.
4291         (Target_arm::fix_exidx_coverage): Pass layout to
4292         Arm_output_section::fix_exidx_coverage.
4293         * layout.cc (Layout::section_name_mapping): Remove trailing dots
4294         from ".ARM.exidx." and ".ARM.extab.".
4295
4296 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4297
4298         * arm.cc (Target_arm::do_finalize_sections): Create attribute
4299         section if it does not already exist.
4300         * attributes.cc (Attributes_section_data::Attributes_section_data):
4301         Don't crash if size is zero.
4302
4303 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4304             Ian Lance Taylor  <iant@google.com>
4305
4306         * gold.cc (queue_middle_tasks): If no input files were opened,
4307         exit.
4308         * workqueue.h (Task_function::Task_function): Assert that there is
4309         a blocker.
4310
4311 2010-02-22  Doug Kwan  <dougkwan@google.com>
4312
4313         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
4314         * icf.cc (get_section_contents): Cast snprintf arguments to long long
4315         types to avoid warnings due to different uint64_t implementations
4316         on different hosts.
4317
4318 2010-02-21  Doug Kwan  <dougkwan@google.com>
4319
4320         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
4321         handling of the maximum backward branch offset.
4322         (Arm_relocate_functions::thumb_branch_common): Ditto.
4323         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
4324         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
4325         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
4326         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
4327         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
4328         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
4329         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
4330         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
4331         thumb_bl_out_of_range thumb_bl_out_of_range.o,
4332         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
4333         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
4334         thumb2_bl_out_of_range.o): New rules.
4335         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
4336         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
4337         thumb2_bl_out_of_range
4338         * testsuite/Makefile.in: Regenerate.
4339         * testsuite/arm_bl_in_range.s: New file.
4340         * testsuite/arm_bl_out_of_range.s: Ditto.
4341         * testsuite/arm_branch_in_range.sh: Ditto.
4342         * testsuite/arm_branch_range.t: Ditto.
4343         * testsuite/thumb2_branch_range.t: Ditto.
4344         * testsuite/thumb_bl_in_range.s: Ditto.
4345         * testsuite/thumb_bl_out_of_range.s: Ditto.
4346         * testsuite/thumb_branch_range.t: Ditto.
4347
4348 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
4349
4350         * gc.h (gc_process_relocs): Change vectors to point to the new list.
4351         Add reloc offset information.
4352         * icf.cc (get_section_contents): Change iterators to point to the new
4353         vectors. Add reloc offset information to the contents.
4354         * icf.h (Icf::Sections_reachable_info): New typedef.
4355         (Icf::Sections_reachable_list): New typedef.
4356         (Icf::Offset_info): New typedef.
4357         (Icf::Reloc_info): New struct typedef.
4358         (Icf::Reloc_info_list): New typedef.
4359         (Icf::symbol_reloc_list): Delete method.
4360         (Icf::addend_reloc_list): Delete method.
4361         (Icf::section_reloc_list): Delete method.
4362         (Icf::reloc_info_list): New method.
4363         (Icf::reloc_info_list_): New member.
4364
4365 2010-02-19  Doug Kwan  <dougkwan@google.com>
4366
4367         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
4368         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
4369         * arm.cc (Arm_relocation_functions): New forward declaration.
4370         (Target_arm::Target_arm): Initialize new data members
4371         got_mod_index_offset_ and tls_base_symbol_defined_.
4372         (Target_arm::Relocate::relocate_tls): New method.
4373         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
4374          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
4375         New methods.
4376         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
4377         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
4378         (Target_arm::got_mod_index_offset_,
4379         Target_arm::tls_base_symbol_defined_): New data members.
4380         (Target_arm::Scan::local, Target::Scan::global,
4381         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
4382         relocations.
4383
4384 2010-02-18  Doug Kwan  <dougkwan@google.com>
4385
4386         * arm.cc (Arm_relobj::find_linked_text_section): New method.
4387         (Arm_relobj::make_exidx_input_section): Pass section index of linked
4388         text section as a parameter becuase some broken tools may not set
4389         the link in section header.
4390         (Target_arm::has_got_section): New method.
4391         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
4392         without any mapping symbol as data only.  Remove warning.
4393         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
4394         link in its section header, try to discover the link by inspecting the
4395         REL31 relocation at the beginning of the section.
4396         (Target_arm::Scan::check_non_pic): Report name of offending relocation
4397         in error message.
4398         (Target_arm::Scan::global): Treat any reference to the symbol
4399         _GLOBAL_OFFSET_TABLE_ as a GOT access.
4400
4401 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
4402
4403         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
4404         (Scan::global_reloc_may_be_function_pointer): New function.
4405         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
4406         (Scan::global_reloc_may_be_function_pointer): New function.
4407         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
4408         (Scan::global_reloc_may_be_function_pointer): New function.
4409         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
4410         (Scan::global_reloc_may_be_function_pointer): New function.
4411         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
4412         (Scan::global_reloc_may_be_function_pointer): New function.
4413         (Scan::possible_function_pointer_reloc): New function.
4414         (Target_x86_64::can_check_for_function_pointers): New function.
4415         * gc.h (gc_process_relocs): Scan relocation types to determine if
4416         function pointers were taken for targets that support it.
4417         * icf.cc (Icf::find_identical_sections): Include functions for
4418         folding in safe ICF whose pointer is not taken.
4419         * icf.h (Secn_fptr_taken_set): New typedef.
4420         (fptr_section_id_): New member.
4421         (section_has_function_pointers): New function.
4422         (set_section_has_function_pointers): New function.
4423         (check_section_for_function_pointers): New function.
4424         * options.h: Fix comment for safe ICF option.
4425         * target.h (can_check_for_function_pointers): New function.
4426         * testsuite/Makefile.am: Add icf_safe_so_test test case.
4427         Modify icf_safe_test for X86-64.
4428         * testsuite/Makefile.in: Regenerate.
4429         * testsuite/icf_safe_so_test.cc: New file.
4430         * testsuite/icf_safe_so_test.sh: New file.
4431         * testsuite/icf_safe_test.cc (kept_func_3): New function.
4432         (main): Change to take pointer to function kept_func_3.
4433         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
4434         folding is done correctly for X86-64.
4435
4436 2010-02-12  David S. Miller  <davem@davemloft.net>
4437
4438         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
4439         is_symbolless parameter.
4440         (Output_reloc<SHT_REL>::is_symbolless): New.
4441         (Output_reloc<SHT_REL>::is_symbolless_): New.
4442         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
4443         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
4444         (Output_reloc<SHT_RELA>::is_symbolless): New.
4445         (Output_data_reloc::add_global): Handle is_symbolless.
4446         (Output_data_reloc::add_global_relative): Likewise.
4447         (Output_data_reloc::add_local): Likewise.
4448         (Output_data_reloc::add_local_relative): Likewise.
4449         (Output_data_reloc::add_symbolless_global_addend): New.
4450         (Output_data_reloc::add_symbolless_local_addend): New.
4451         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
4452         is_symbolless.
4453         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
4454         instead of ->is_relative_
4455         (Output_reloc::write): Likewise.
4456         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
4457         (Output_reloc::write_rel): Simplify.
4458
4459         * sparc.cc (Target_sparc::Scan::local): Use
4460         ->add_symbolless_local_addend as needed.
4461         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
4462         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
4463         based upon relocation offset.
4464
4465 2010-02-11  Doug Kwan  <dougkwan@google.com>
4466
4467         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
4468         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
4469         beginning of function.
4470         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
4471         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
4472         parameter is_32bit in calls to should_apply_static_reloc.
4473         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
4474         (check_DATA): Add arm_abs_global.stdout.
4475         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
4476         arm_abs_global.stdout): New rules.
4477         (MOSTLLYCLEANFILES): Add arm_abs_global
4478         * Makefile.in: Regenerate.
4479         * testsuite/arm_abs_global.s: New file.
4480         * testsuite/arm_abs_global.sh: Ditto.
4481         * testsuite/arm_abs_lib.s: Ditto.
4482
4483 2010-02-11  Ian Lance Taylor  <iant@google.com>
4484
4485         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
4486         Read_relocs task.
4487         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
4488         Allocate_commons_task first.
4489         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
4490         task, rather than symtab_lock_.
4491         (Gc_process_relocs::~Gc_process_relocs): New function.
4492         (Gc_process_relocs::is_runnable): Check this_blocker_.
4493         (Gc_process_relocs::locks): Use next_blocker_ rather than
4494         blocker_.
4495         (Scan_relocs::~Scan_relocs): New function.
4496         (Scan_relocs::is_runnable): Check this_blocker_ rather than
4497         symtab_lock_.
4498         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
4499         next_blocker_.
4500         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
4501         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
4502         constructor accordingly.
4503         (class Gc_process_relocs): Likewise.
4504         (class Scan_relocs): Likewise.
4505         * common.h (class Allocate_commons_task): Remove symtab_lock_
4506         field, and corresponding constructor parameter.
4507         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
4508         symtab_lock_.
4509         (Allocate_commons_task::locks): Likewise.
4510
4511 2010-02-11  Ian Lance Taylor  <iant@google.com>
4512
4513         * gold-threads.h (class Once): Define.
4514         (class Initialize_lock): Rewrite as child of Once.
4515         * gold-threads.cc (class Once_initialize): Define.
4516         (once_pointer_control): New static variable.
4517         (once_pointer, once_arg): New static variables.
4518         (c_run_once): New static function.
4519         (Once::Once, Once::run_once, Once::internal_run): New functions.
4520         (class Initialize_lock_once): Remove.
4521         (initialize_lock_control): Remove.
4522         (initialize_lock_pointer): Remove.
4523         (initialize_lock_once): Remove.
4524         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
4525         (Initialize_lock::initialize): Rewrite.
4526         (Initialize_lock::do_run_once): New function.
4527         * archive.cc (Archive::interpret_header): Only clear name if it is
4528         not already empty.
4529         * fileread.cc: Include "gold-threads.h"
4530         (file_counts_lock): New static variable.
4531         (file_counts_initialize_lock): Likewise.
4532         (File_read::release): Only increment counts when using --stats.
4533         Use a lock around the increment.
4534         * parameters.cc (class Set_parameters_target_once): Define.
4535         (set_parameters_target_once): New static variable.
4536         (Parameters::Parameters): Move here from parameters.h.
4537         (Parameters::set_target): Rewrite.
4538         (Parameters::set_target_once): New function.
4539         (Parameters::clear_target): Move here and rewrite.
4540         * parameters.h (class Parameters): Update declarations.  Add
4541         set_parameters_target_once_ field.
4542         (Parameters::Parameters): Move to parameters.cc.
4543         (Parameters::clear_target): Likewise.
4544         * readsyms.cc (Read_symbols::do_group): Create a Start_group
4545         task.
4546         (Start_group::~Start_group): New function.
4547         (Start_group::is_runnable): New function.
4548         (Start_group::locks, Start_group::run): New functions.
4549         (Finish_group::run): Change saw_undefined to size_t.
4550         * readsyms.h (class Start_group): Define.
4551         (class Finish_group): Change saw_undefined_ field to size_t.
4552         (Finish_group::Finish_group): Remove saw_undefined and
4553         this_blocker parameters.  Change all callers.
4554         (Finish_group::set_saw_undefined): New function.
4555         (Finish_group::set_blocker): New function.
4556         * symtab.h (class Symbol_table): Change saw_undefined to return
4557         size_t.  Change saw_undefined_ field to size_t.
4558         * target-select.cc (Set_target_once::do_run_once): New function.
4559         (Target_selector::Target_selector): Initialize set_target_once_
4560         field.  Don't initialize lock_ and initialize_lock_ fields.
4561         (Target_selector::instantiate_target): Rewrite.
4562         (Target_selector::set_target): New function.
4563         * target-select.h (class Set_target_once): Define.
4564         (class Target_selector): Update declarations.  Make
4565         Set_target_once a friend.  Remove lock_ and initialize_lock_
4566         fields.  Add set_target_once_ field.
4567
4568 2010-02-10  Ian Lance Taylor  <iant@google.com>
4569
4570         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
4571         queueing any tasks.
4572         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
4573         (queue_middle_tasks): Add all blockers before queueing any tasks.
4574         (queue_final_tasks): Likewise.
4575         * token.h (Task_token::add_blockers): New function.
4576         * object.h (Input_objects::number_of_relobjs): New function.
4577
4578 2010-02-10  Ian Lance Taylor  <iant@google.com>
4579
4580         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
4581         shared, not if not position independent.
4582         * x86_64.cc (Relocate::relocate_tls): Likewise.
4583         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
4584         (tls_pie_pic_test): New target.
4585         * testsuite/Makefile.in: Rebuild.
4586
4587         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
4588         (tls_test_main_pie.o, tls_test_pie.o): New targets.
4589         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
4590         * testsuite/Makefile.in: Rebuild.
4591
4592 2010-02-09  David S. Miller  <davem@davemloft.net>
4593
4594         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
4595         R_SPARC_RELATIVE using ->add_local_relative().
4596         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
4597
4598         * output.h (Output_data_dynamic::add_section_size): New method
4599         that takes two Output_data objects.
4600         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
4601         entry param.  Handle it in initializers.
4602         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
4603         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
4604         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
4605         arg.
4606         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
4607         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
4608         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
4609         for dynrel_includes_plt.
4610         * i386.cc (Target_i386::do_finalize_sections): Likewise.
4611         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4612         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
4613         before .rela.plt
4614         (Target_sparc::do_finalize_sections): Update to pass true for
4615         dynrel_includes_plt.
4616         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
4617         output before .rela.plt
4618         (Target_powerpc::do_finalize_sections): Update to pass true for
4619         dynrel_includes_plt when 32-bit.
4620
4621 2010-02-08  Doug Kwan  <dougkwan@google.com>
4622
4623         * arm.cc (Arm_relobj::simple_input_section_output_address): New
4624         method.
4625         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
4626         Arm_relobj::scan_section_for_cortex_a8_stubs,
4627         Arm_relobj::do_relocation_section): Instead of calling
4628         Output_section::output_address, use faster
4629         Arm_relobj::simple_input_section_output_address.
4630
4631 2010-02-08  David S. Miller  <davem@davemloft.net>
4632
4633         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
4634         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
4635         relocation helper function.
4636
4637         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
4638         just like R_SPARC_GOT{10,13,22}.
4639         (Target_sparc::Scan::local): Likewise.
4640         (Target_sparc::Relocate:relocate): Likewise.
4641
4642 2010-02-06  Ian Lance Taylor  <iant@google.com>
4643
4644         * configure.ac: Rewrite targetobjs duplicate removal code to use
4645         only shell constructs.
4646         * configure: Rebuild.
4647
4648 2010-02-05  Doug Kwan  <dougkwan@google.com>
4649
4650         PR 11247
4651         * arm.cc (Arm_relobj::section_is_scannable): New method.
4652         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
4653         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
4654
4655 2010-02-04  Doug Kwan  <dougkwan@google.com>
4656
4657         PR 11247
4658         * arm-reloc-property.cc (cstdio): Include.
4659         * configure.ac (targetobjs): Remove duplicates.
4660         * configure: Regenerate.
4661         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
4662         big and little endian version for a given address size.
4663
4664 2010-02-03  Doug Kwan  <dougkwan@google.com>
4665
4666         * arm-reloc-property.cc
4667         (Arm_reloc_property_table::reloc_name_in_error_message): New method
4668         definition.
4669         * arm-reloc-property.h
4670         (Arm_reloc_property_table::get_implemented_static_reloc_property):
4671         New method definition.
4672         (Arm_reloc_property_table::reloc_name_in_error_message): New method
4673         declaration.
4674         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
4675         overflow to N.
4676         (GOT_PREL): Change implemented to Y.
4677         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
4678         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
4679         (Arm_relocate_functions::movw_abs_nc): Remove method.
4680         (Arm_relocate_functions::movt_abs): Ditto.
4681         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
4682         (Arm_relocate_functions::thm_movt_abs): Ditto.
4683         (Arm_relocate_functions::movw_rel_nc): Ditto.
4684         (Arm_relocate_functions::movw_rel): Ditto.
4685         (Arm_relocate_functions::movt_rel): Ditto.
4686         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
4687         (Arm_relocate_functions:thm_movw_rel): Ditto.
4688         (Arm_relocate_functions:thm_movt_rel): Ditto.
4689         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
4690         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
4691         New method definitions.
4692         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
4693         (Arm_relocation_functions::arm_grp_ldr): Ditto.
4694         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
4695         (Arm_relocation_functions::arm_grp_ldc): Ditto.
4696         (Target_arm::Relocate::relocate): Check for non-static or
4697         unimplemented relocation code and exit early.  Change calls to
4698         Target_arm::reloc_uses_thumb_bit and
4699         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
4700         instead.  Refactor code to handle similar relocations to increase
4701         code sharing.  Remove check for unsupported relocation code in switch
4702         statement.
4703         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
4704         relocation property table to find out size.  Change error message to
4705         print out the name of a relocation code instead of the numeric value.
4706         (Target_arm::scan_reloc_for_stub): Use relocation property table
4707         instead of calling Target_arm::reloc_uses_thumb_bit().
4708
4709 2010-02-02  Doug Kwan  <dougkwan@google.com>
4710
4711         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
4712         types of relaxed input section.
4713
4714 2010-02-02  Doug Kwan  <dougkwan@google.com>
4715
4716         * Makefile.am (HFILES): Add arm-reloc-property.h.
4717         (DEFFILES): New.
4718         (TARGETSOURCES): Add arm-reloc-property.cc
4719         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
4720         (libgold_a_SOURCES): $(DEFFILES)
4721         * Makefile.in: Regenerate.
4722         * arm-reloc-property.cc: New file.
4723         * arm-reloc-property.h: New file.
4724         * arm-reloc.def: New file.
4725         * arm.cc: Update comments.
4726         (arm-reloc-property.h): New included header.
4727         (arm_reloc_property_table): New global variable.
4728         (Target_arm::do_select_as_default_target): New method definition.
4729         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
4730         arm-reloc-property to targ_extra_obj.
4731         * parameters.cc (set_parameters_target): Call
4732         Target::select_as_default_target().
4733         * target.h (Target::select_as_default_target): New method definition.
4734         (Target::do_select_as_default_target): Same.
4735
4736 2010-02-01  Doug Kwan  <dougkwan@google.com>
4737
4738         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
4739         first_output_text_section_.
4740         (Arm_exidx_fixup::first_output_text_section): New method definition.
4741         (Arm_exidx_fixup::first_output_text_section_): New data member.
4742         (Arm_exidx_fixup::process_exidx_section): Record the first text
4743         output section seen.
4744         (Arm_output_section::fix_exidx_coverage): Set correct linked section
4745         and entsize in output section header.
4746
4747 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4748
4749         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
4750         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
4751         (Arm_relocate_functions::thm_alu11): New Method.
4752         (Arm_relocate_functions::thm_pc8): New Method.
4753         (Arm_relocate_functions::thm_pc12): New Method.
4754         (Target_arm::Scan::local): Handle the relocations.
4755         (Target_arm::Scan::global): Likewise.
4756         (Target_arm::Relocate::relocate): Likewise.
4757         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
4758
4759 2010-01-29  Doug Kwan  <dougkwan@google.com>
4760
4761         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
4762         of relocation types as ld.
4763
4764 2010-01-29  Doug Kwan  <dougkwan@google.com>
4765
4766         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
4767         to public.
4768         (Arm_relocate_functions::thumb_branch_common): Ditto.
4769         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
4770         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
4771         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
4772         Arm_relocate_functions::jump24): Remove.
4773         (Target_arm::Relocate::relocate): Adjust code to call
4774         Arm_relocation_functions::arm_branch_common and
4775         Arm_relocation_functions::thumb_branch_common instead of their removed
4776         wrappers.  Merge switch-cases together to reduce source code size.
4777
4778 2010-01-29  Doug Kwan  <dougkwan@google.com>
4779
4780         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
4781         output_local_symbol_count_needs_update_.
4782         (Arm_relobj::output_local_symbol_count_needs_update,
4783          Arm_relobj::set_output_local_symbol_count_needs_update,
4784          Arm_relobj::update_output_local_symbol_count): New methods.
4785         (Arm_relobj::output_local_symbol_count_needs_update_): New data
4786         member.
4787         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
4788         of pointed function as in a R_ARM_PREL31 relocation.
4789         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
4790         for output local symbol count updating.
4791         (Target_arm::do_relax): Update output local symbol counts in objects
4792         if necessary.
4793         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
4794
4795 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4796
4797         * arm.cc: Added support for the ARM relocations:
4798         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
4799         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
4800         (Arm_relocate_functions::movw_rel_nc): Renamed (was
4801         movw_prel_nc).
4802         (Arm_relocate_functions::movw_rel): New method.
4803         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
4804         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
4805         thm_movw_prel_nc).
4806         (Arm_relocate_functions::thm_movw_rel): New method.
4807         (Arm_relocate_functions::thm_movt_rel): Renamed (was
4808         thm_movt_prel).
4809         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
4810         relocations.
4811         (Target_arm::Scan::global): Likewise.
4812         (Target_arm::Relocate::relocate): Likewise.
4813         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4814         Likewise.
4815
4816 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4817
4818         * arm.cc: Added support for ARM group relocations.
4819         (Target_arm::reloc_needs_sym_origin): New method.
4820         (Arm_relocate_functions::calc_grp_kn): New method.
4821         (Arm_relocate_functions::calc_grp_residual): New method.
4822         (Arm_relocate_functions::calc_grp_gn): New method.
4823         (Arm_relocate_functions::arm_grp_alu): New Method.
4824         (Arm_relocate_functions::arm_grp_ldr): New Method.
4825         (Arm_relocate_functions::arm_grp_ldrs): New Method.
4826         (Arm_relocate_functions::arm_grp_ldc): New Method.
4827         (Target_arm::Scan::local): Handle the ARM group relocations.
4828         (Target_arm::Scan::global): Likewise.
4829         (Target_arm::Relocate::relocate): Likewise.
4830         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4831         Likewise.
4832
4833 2010-01-26  Doug Kwan  <dougkwan@google.com>
4834
4835         * arm.cc (set): Include.
4836         (class Arm_exidx_fixup): Change type of last_input_section_ to const
4837         pointer type.
4838         (Arm_output_section::Text_section_list): New type.
4839         (Arm_output_section::append_text_sections_to_list): New method.
4840         (Arm_output_section::fix_exidx_coverage): Ditto.
4841         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
4842         (Arm_relobj::convert_input_section_to_relaxed_section): Use
4843         Relobj::set_section_offset() instead of
4844         Sized_relobj::invalidate_section_offset().
4845         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
4846         parameter for section headers. Ignore relocation sections for
4847         unallocated sections and EXIDX sections.
4848         (Target_arm::fix_exidx_coverage): New method.
4849         (Target_arm::output_section_address_less_than): New type.
4850         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
4851         linked text section instead of the EXIDX section.
4852         (Arm_output_section::create_stub_group): Add an assertion to check
4853         that this is not an EXIDX output section.
4854         (Arm_output_section::append_text_sections_to_list): New method.
4855         (Arm_output_section::fix_exidx_coverage): Ditto.
4856         (Arm_relobj::scan_sections_for_stubs): Adjust call to
4857         Arm_relobj::section_needs_reloc_stub_scanning.
4858         (Target_arm::do_relax): Fix EXIDX output section coverage in the
4859         first pass.
4860         (Target_arm::fix_exidx_coverage): New method.
4861         * object.h (Relobj::set_output_section): New method.
4862         (Sized_relobj::invalidate_section_offset): Remove method.
4863         (Sized_relobj::do_invalidate_section_offset): Remove method.
4864         (Sized_relobj::do_set_section_offset): Handle offset value -1.
4865
4866 2010-01-25  Doug Kwan  <dougkwan@google.com>
4867
4868         * arm.cc (Arm_exidx_merged_section::do_output_offset):
4869         Fix warning due to signed and unsigned comparison on a 32-bit host.
4870
4871 2010-01-22  Doug Kwan  <dougkwan@google.com>
4872
4873         * arm.cc (Target_arm::do_relax): Record an output section for section
4874         offset adjustment it contains any stub table that has changed.
4875         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
4876         offsets in an output section if necessary.
4877         * output.cc (Output_section::Output_section): Initialize
4878         section_offsets_need_adjustments_.
4879         (Output_section::add_input_section_for_script): Renamed to
4880         Output_section::add_simple_input_section.
4881         (Output_section::save_states): Add a comment.
4882         (Output_section::discard_states): New method defintion.
4883         (Output_section::adjust_section_offsets): Same.
4884         * output.h (Output_section::add_input_section_for_script): Renamed to
4885         Output_section::add_simple_input_section.
4886         (Output_section::discard_states): New method declaration.
4887         (Output_section::adjust_section_offsets): Same.
4888         (Output_section::section_offsets_need_adjustment,
4889         Output_section::set_section_offsets_need_adjustment): New method
4890         definitions.
4891         (Output_section::section_offsets_need_adjustment_): New data member.
4892         * script-sections.cc
4893         (Output_section_element_input::set_section_address): Adjust code for
4894         renaming of Output_section::add_input_section_for_script.
4895         (Orphan_output_section::set_section_address): Same.
4896
4897 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4898
4899         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
4900         Fix_v4bx enum values .
4901         * gold/options.h (General_options): New option definitions.
4902         (General_options::fix_v4bx): New method.
4903         (General_options::Fix_v4bx): New enum.
4904         * gold/options.cc (General_options::parse_fix_v4bx): New method.
4905         (General_options::parse_fix_v4bx_interworking): New method.
4906
4907 2010-01-22  Doug Kwan  <dougkwan@google.com>
4908
4909         * arm.cc (Arm_exidx_fixup): New class.
4910
4911 2010-01-21  Doug Kwan  <dougkwan@google.com>
4912
4913         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
4914         classes.
4915         (Arm_exidx_section_offset_map): New type.
4916
4917 2010-01-21  Doug Kwan  <dougkwan@google.com>
4918
4919         * arm.cc (Arm_exidx_input_section): New class.
4920         (Arm_relobj::exidx_input_section_by_link,
4921         Arm_relobj::exidx_input_section_by_shndx,
4922         Arm_relobj::make_exidx_input_section): New methods.
4923         (read_arm_attributes_section): Remove.
4924         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
4925         information about them.
4926         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
4927         to here.
4928
4929 2010-01-20  Doug Kwan  <dougkwan@google.com>
4930
4931         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
4932         Input_section_specifier to Section_id.
4933         (Target_arm::new_arm_input_section: Adjust code for change of key
4934         type.
4935         (Target_arm::find_arm_input_section): Ditto.
4936         * gc.h (object.h): Include for Section_id nand Section_id_hash.
4937         (Section_id): Remove.
4938         (Garbage_collection::Section_id_hash): Remove.
4939         * icf.h (object.h): Include for Section_id nand Section_id_hash.
4940         (Section_id): Remove.
4941         (Icf::Section_id_hash): Remove.
4942         * object.h (Section_id, Const_section_id, Section_id_hash,
4943         Const_section_id_hash): New type definitions.
4944         * output.cc (Output_section::add_relaxed_input_section): Change to
4945         use Const_section_id instead of Input_section_specifier as key type.
4946         (Output_section::add_merge_input_section): Ditto.
4947         (Output_section::build_relaxation_map): Change to use Section_id
4948         instead of Input_section_specifier as key type.
4949         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4950         Ditto.
4951         (Output_section::convert_input_sections_to_relaxed_sections): Change
4952         to use Const_section_id instead of Input_section_specifier as key type.
4953         (Output_section::find_merge_section): Ditto.
4954         (Output_section::find_relaxed_input_section): Ditto.
4955         * output.h (Input_section_specifier): Remove class.
4956         (Output_section::Output_section_data_by_input_section_map): Change
4957         key type to Const_section_id.
4958         (Output_section::Output_relaxed_input_section_by_input_section_map):
4959         Ditto.
4960         (Output_section::Relaxation_map): Change key type to Section_id.
4961
4962 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4963
4964         * gold/arm.cc: Added support for R_ARM_V4BX relocation
4965         (class Arm_v4bx_stub): New class.
4966         (DEF_STUBS): Updated definition to support v4_veneer_bx.
4967         (Stub_factory::make_arm_v4bx_stub): New method.
4968         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
4969         (Stub_table::empty): Handle v4bx stubs.
4970         (Stub_table::add_arm_v4bx_stub): New method.
4971         (Stub_table::find_arm_v4bx_stub): New method.
4972         (Arm_relocate_functions::v4bx): New method.
4973         (Target_arm::fix_v4bx): New method.
4974         (Target_arm::Target_arm): Handle R_ARM_V4BX.
4975         (Stub_table::relocate_stubs): Likewise.
4976         (Stub_table::do_write): Likewise.
4977         (Stub_table::update_data_size_and_addralign): Likewise.
4978         (Stub_table::finalize_stubs):  Likewise.
4979         (Target_arm::Scan::local): Likewise.
4980         (Target_arm::Scan::global): Likewise.
4981         (Target_arm::do_finalize_sections): Likewise.
4982         (Target_arm::Relocate::relocate): Likewise.
4983         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4984         Likewise.
4985         (Target_arm::scan_reloc_for_stub): Likewise.
4986         (Target_arm::scan_reloc_section_for_stubs): Likewise.
4987
4988 2010-01-19  Ian Lance Taylor  <iant@google.com>
4989
4990         * output.cc (Output_section_headers::do_sized_write): Write large
4991         segment count to sh_info field.
4992         (Output_file_header::do_sized_write): For large segment count,
4993         write PN_XNUM to e_phnum field.
4994
4995 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4996
4997         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
4998         (Arm_relocate_functions::thm_jump8): New function.
4999         (Arm_relocate_functions::thm_jump11): New function.
5000         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
5001         R_ARM_THM_JUMP11.
5002         (Target_arm::Scan::global): Likewise.
5003         (Target_arm::Relocate::relocate): Likewise.
5004         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5005         Likewise.
5006
5007 2010-01-14  Doug Kwan  <dougkwan@google.com>
5008
5009         * arm.cc (map, utility): Include headers.
5010         (Target_arm::apply_cortex_a8_workaround): New method.
5011         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
5012         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
5013         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
5014         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
5015         the --[no-]fix-cortex-a8 command line options.
5016         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
5017         (Target_arm::relocate_stub): Use addend in instruction template.
5018         * options.h (DEFINE_bool): Set the user-set flag.
5019         (General_options): Add --[no-]-fix-cortex options.
5020         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
5021         : Update fast look-up map after conversion.
5022
5023 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
5024
5025         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
5026         in the first pass of do_layout.
5027
5028 2010-01-13  Doug Kwan  <dougkwan@google.com>
5029
5030         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
5031         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
5032         apparent compiler problem of not folding static constant integral
5033         data members of elfcpp::Elf_sizes<32>.
5034
5035 2010-01-13  Doug Kwan  <dougkwan@google.com>
5036
5037         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
5038         Arm_relobj::section_needs_cortex_a8_stub_scanning,
5039         Arm_relobj::scan_section_for_cortex_a8_erratum,
5040         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
5041         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
5042         sections to scan for relocation stubs into a new method
5043         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
5044         relocation and Cortex-A8 stub scanning.
5045         (Target_arm::do_relax): Force stubs to be after stubbed sections
5046         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
5047         the beginning of a new relaxation pass.  Update a comment.
5048         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
5049
5050 2010-01-12  Ian Lance Taylor  <iant@google.com>
5051
5052         * target-reloc.h (visibility_error): New inline function.
5053         (relocate_section): Call visibility_error.
5054         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
5055         (MOSTLYCLEANFILES): Likewise.
5056         (protected_4_pic.o, protected_3.err): New targets.
5057         * testsuite/protected_4.cc: New file.
5058
5059 2010-01-12  Doug Kwan  <dougkwan@google.com>
5060
5061         * arm.cc (Cortex_a8_reloc): New class.
5062         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
5063         and cortex_a8_relocs_info_.
5064         (Target_arm::fix_cortex_a8): New method definition.
5065         (Target_arm::Cortex_a8_relocs_info): New type.
5066         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
5067         New data member declarations.
5068         (Target_arm::scan_reloc_for_stub): Record information about
5069         relocations for THUMB branches that might be exempted from the
5070         Cortex-A8 workaround.
5071         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
5072         at the beginning of a relaxation pass.
5073
5074 2010-01-12  Doug Kwan  <dougkwan@google.com>
5075
5076         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
5077         (Arm_relobj::Mapping_symbol_position,
5078          Arm_reloj::Mapping_symbol_position_less,
5079          Arm_relobj::Mapping_symbols_info): New types.
5080         (Target_arm::is_mapping_symbol_name): New method definition.
5081         (Arm_relobj::do_count_local_symbols): Save information about mapping
5082         symbols.
5083
5084 2010-01-11  Doug Kwan  <dougkwan@google.com>
5085
5086         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
5087         Arm_relocate_functions::thumb32_branch_upper,
5088         Arm_relocate_functions::thumb32_branch_lower,
5089         Arm_relocate_functions::thumb32_cond_branch_offset,
5090         Arm_relocate_functions::thumb32_cond_branch_upper,
5091         Arm_relocate_functions::thumb32_cond_branch_lower,
5092         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
5093         branch offset encoding.
5094         (Arm_relocate_functions::thumb_branch_common): Use new branch
5095         offset encoding methods to avoid code duplication.
5096         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
5097         (Stub_addend_reader::operator()): Use new branch encoding method
5098         to avoid code duplication.
5099
5100 2010-01-11  Doug Kwan  <dougkwan@google.com>
5101
5102         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
5103         (Target_arm::do_finalize_sections): Define special EXIDX section
5104         symbols only if referenced.
5105         * gc.h (Garbage_collection::add_reference): New method.
5106         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
5107         code duplication.
5108
5109 2010-01-11  Ian Lance Taylor  <iant@google.com>
5110
5111         * script.cc (Version_script_info::build_expression_list_lookup):
5112         Change complaing about duplicate wildcard match from error to
5113         warning.
5114
5115         * script.cc (class Lazy_demangler): Recreate--revert part of patch
5116         of 2009-12-30.
5117         (Version_script_info::Version_script_info): Initialize globs_,
5118         default_version_, default_is_global_, and exact_.  Don't
5119         initialize globals_ or locals_.
5120         (Version_script_info::build_lookup_tables): Build local symbols
5121         first.
5122         (Version_script_info::unquote): New function.
5123         (Version_script_info::add_exact_match): New function.
5124         (Version_script_info::build_expression_list_lookup): Remove lookup
5125         parameter.  Add is_global parameter.  Change all callers.  Handle
5126         wildcard pattern specially.  Unquote pattern.  Call
5127         add_exact_match.
5128         (Version_script_info::get_name_to_match): New function.
5129         (Version_script_info::get_symbol_version): New function.
5130         (Version_script_info::get_symbol_version_helper): Remove.
5131         (Version_script_info::check_unmatched_names): Call unquote.
5132         * script.h (class Version_script_info): Change get_symbol_version
5133         to be non-inline and add is_global parameter; change all callers.
5134         Rewrite symbol_is_local.  Update declarations.  Define struct
5135         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
5136         Remove globals_ and locals_ members.  Add exact_, globs_,
5137         default_version_, is_global_.
5138         (Version_script_info::Glob): Remove pattern, add expression and
5139         is_global.  Update constructor.  Change all callers.
5140         * dynobj.cc (Versions::finalize): Mark the version symbol as the
5141         default version.
5142         (Versions::symbol_section_contents): If a symbol is undefined, or
5143         defined in a dynamic object, set the version index to
5144         VER_NDX_LOCAL.
5145         * symtab.cc (Symbol_table::add_from_relobj): Don't call
5146         symbol_is_local.
5147         (Symbol_table::add_from_pluginobj): Likewise.
5148         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
5149
5150 2010-01-11  Doug Kwan  <dougkwan@google.com>
5151
5152         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
5153         (incremental_dump_LDADD): Add linking option for libintl.
5154         * Makefile.in: Regenerate.
5155
5156 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
5157
5158         PR gold/11144
5159         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
5160         instead of -Ds.
5161         * testsuite/Makefile.in: Regenerated.
5162
5163 2010-01-10  Doug Kwan  <dougkwan@google.com>
5164
5165         * options.h (DEFINE_var): Use parentheses around argument varname__
5166         in macro body to avoid any unintended subsequent substitutions.
5167
5168 2010-01-10  Ian Lance Taylor  <iant@google.com>
5169
5170         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
5171         candidates before doing symbol resolution.
5172
5173         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
5174         ODR candidates if only one is weak.
5175
5176 2010-01-08  Ian Lance Taylor  <iant@google.com>
5177
5178         * script.cc (Version_script_info::build_expression_list_lookup):
5179         Don't warn about ambiguous version, just record the ambiguity.
5180         (Version_script_info::get_symbol_version_helper): Give error if
5181         version is ambiguous.
5182
5183 2010-01-08  Doug Kwan  <dougkwan@google.com>
5184
5185         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
5186           prev_data_size_ and prev_addralign_.  Remove initializer for
5187           deleted data member has_been_changed_.
5188           (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
5189           to determine if the table is empty.
5190           (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
5191           Remove.
5192           (Stub_table::add_reloc_stub): Define method in class definition
5193           instead of just declaring it there.
5194           (Stub_table::add_cortex_a8_stub): New method definition.
5195           (Stub_table::update_data_size_and_addralign): Ditto.
5196           (Stub_table::finalize_stubs): Ditto.
5197           (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
5198           (Stub_table::do_addralign_): Return address alignment in the
5199           (Stub_table::do_reset_address_and_file_offset): Define method in
5200           class definition instead of declaring it there.  Set current data
5201           size to be the data size of the previous pass.
5202           (Stub_table::set_final_data_size): Use current data size as the
5203           final data size.
5204           (Stub_table::relocate_stub): Change parameter type of stub from
5205           Reloc_stub pointer to Stub pointer.
5206           (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
5207           (Stub_table::Cortex_a8_stub_list): New typedef.
5208           (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
5209            Stub_table::prev_addralign_): New data member.
5210           (Arm_relobj::Arm_relobj): Initialize data member
5211           section_has_cortex_a8_workaround_.
5212           (Arm_relobj::section_has_cortex_a8_workaround,
5213            Arm_relobj::mark_section_for_cortex_a8_workaround): New method
5214            definitions.
5215           (Arm_relobj::section_has_cortex_a8_workaround_): New data member
5216           declarations.
5217           (Target_arm::relocate_stub): Change parameter type of stub from
5218           Reloc_stub pointer to Stub pointer.
5219           (Insn_template::size, Insn_template::alignment): Handle
5220           THUMB16_SPECIAL_TYPE.
5221           (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
5222            Stub_table::update_data_size_and_addralign,
5223            Stub_table::apply_cortex_a8_workaround_to_address_range): New method
5224           definitions.
5225           (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
5226           (Stub_table::do_write): Ditto.
5227           (Target_arm::do_relax): Adjust code for changes in Stub_table.
5228
5229 2010-01-08  Ian Lance Taylor  <iant@google.com>
5230
5231         PR 11108
5232         * symtab.h (class Symbol): Remove fields is_target_special_ and
5233         has_plt_offset_.  Add field is_defined_in_discarded_section_.
5234         (Symbol::is_defined_in_discarded_section): New function.
5235         (Symbol::set_is_defined_in_discarded_section): New function.
5236         (Symbol::has_plt_offset): Rewrite.
5237         (Symbol::set_plt_offset): Verify that new offset is not -1U.
5238         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
5239         Don't initialize is_target_special_ or has_plt_offset_.
5240         Initialize is_defined_in_discarded_section_.
5241         (Symbol_table::add_from_relobj): If appropriate, set
5242         is_defined_in_discarded_section.
5243         * resolve.cc (Symbol::override_base_with_special): Don't test
5244         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
5245         * target-reloc.h (relocate_section): Do special handling for
5246         symbols defined in discarded sections for global symbols as well
5247         as local symbols.
5248
5249 2010-01-08  Ian Lance Taylor  <iant@google.com>
5250
5251         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
5252         the SHT_SYMTAB case.
5253
5254 2010-01-08  Ian Lance Taylor  <iant@google.com>
5255
5256         * object.cc (Sized_relobj::do_layout): Don't get confused if
5257         layout_eh_frame returns NULL.
5258
5259 2010-01-08  Ian Lance Taylor  <iant@google.com>
5260
5261         PR 11084
5262         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
5263         dynamic symbol table, use the normal symbol table.
5264         (Sized_dynobj::do_read_symbols): Remove assertion about type of
5265         symbol table.
5266
5267 2010-01-08  Ian Lance Taylor  <iant@google.com>
5268
5269         PR 11072
5270         * layout.cc (Layout::include_section): Remove .gnu_debuglink
5271         sections.
5272
5273 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
5274
5275         * version.cc (print_version): Change to "Copyright 2010".
5276
5277 2010-01-08  Ian Lance Taylor  <iant@google.com>
5278
5279         PR 10287
5280         PR 11063
5281         * i386.cc (class Target_i386): Change return type of plt_section
5282         to be non-const.
5283         (class Output_data_plt_i386): Add tls_desc_rel_ field.
5284         (Output_data_plt_i386::Output_data_plt_i386): Initialize
5285         tls_desc_rel_ field.
5286         (Output_data_plt_i386::rel_tls_desc): New function.
5287         (Target_i386::rel_tls_desc_section): New function.
5288         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
5289         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
5290         R_386_TLS_DESC reloc in rel_tls_desc_section.
5291         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
5292         Define struct Tlsdesc_info.
5293         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
5294         (Target_x86_64::do_reloc_symbol_index): New function.
5295         (Target_x86_64::add_tlsdesc_info): New function.
5296         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
5297         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
5298         tlsdesc_rel_ field.
5299         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
5300         all callers.
5301         (Output_data_plt_x86_64::rela_tlsdesc): New function.
5302         (Target_x86_64::rela_tlsdesc_section): New function.
5303         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
5304         handling.
5305         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
5306         (Target_x86_64::do_reloc_addend): New function.
5307         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
5308         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
5309         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
5310         (Output_reloc::type): New function.
5311         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
5312         (Output_reloc::is_target_specific): New function.
5313         (Output_reloc::target_arg): New function.
5314         (class Output_reloc) [SHT_RELA]: Add four new constructors for
5315         absolute relocs and target specific relocs.
5316         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
5317         add_target_specific.
5318         (class Output_data_reloc) [SHT_RELA]: Likewise.
5319         * output.cc (Output_reloc::Output_reloc): Add four new versions
5320         for absolute relocs and target specific relocs.
5321         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
5322         (Output_reloc::get_symbol_index): Likewise.
5323         (Output_reloc::local_section_offset): Check that local_sym_index_
5324         is not TARGET_CODE or 0.
5325         (Output_reloc::symbol_value): Likewise.
5326         (Output_reloc::write) [SHT_RELA]: Call target for target specific
5327         reloc.
5328         * target.h (class Target): Add reloc_symbol_index and reloc_addend
5329         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
5330         functions.
5331         * layout.cc (add_target_dynamic_tags): Use output section for
5332         DT_PLTRELSZ and DT_JMPREL.
5333
5334 2010-01-07  Ian Lance Taylor  <iant@google.com>
5335
5336         PR 11061
5337         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
5338         function.
5339         (class Output_data_reloc_generic): Define.
5340         (class Output_data_reloc_base): Change base class to
5341         Output_data_reloc_generic.  Change add() method to call
5342         bump_relative_reloc_count for a relative reloc.  Remove
5343         sort_relocs_ field.
5344         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
5345         to sort_relocs().
5346         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
5347         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
5348         appropriate.
5349         * layout.h (class Layout): Update declaration.
5350
5351 2010-01-07  Ian Lance Taylor  <iant@google.com>
5352
5353         * output.h (class Output_data): Add const version of
5354         output_section and do_output_section.
5355         (class Output_section_data): Add const version of
5356         do_output_section.
5357         (class Output_section): Likewise.
5358         * layout.cc (Layout::add_target_dynamic_tags): New function.
5359         * layout.h (class Layout): Update declarations.
5360         * arm.cc (Target_arm::do_finalize_sections): Use
5361         add_target_dynamic_tags.
5362         * i386.cc (Target_i386::do_finalize_sections): Likewise.
5363         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
5364         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
5365         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5366
5367 2010-01-07  Ian Lance Taylor  <iant@google.com>
5368
5369         PR 11042
5370         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
5371         object as needed.
5372
5373 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
5374             Ian Lance Taylor  <iant@google.com>
5375
5376         PR 11019
5377         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
5378         Xindex::read_symtab_xindex.
5379
5380 2010-01-07  Doug Kwan  <dougkwan@google.com>
5381
5382         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
5383         (Insn_template::thumb16_bcond_insn): New method declaration.
5384         (Insn_template): Fix spelling.
5385         (Stub::thumb16_special): New method declaration.
5386         (Stub::do_write): Define virtual method which was previously pure
5387         virtual.
5388         (Stub::do_thumb16_special): New method declaration.
5389         (Stub::do_fixed_endian_write): New template member.
5390         (Reloc_stub::do_write): Remove.
5391         (Reloc_stub::do_fixed_endian_write): Remove.
5392         (Cortex_a8_stub): New class definition.
5393         (Stub_factory::make_cortex_a8_stub): New method definition.
5394         (Stub_factory::Stub_factory): Add missing static storage class
5395         qualifier for elf32_arm_stub_a8_veneer_blx.
5396
5397 2010-01-07  Ian Lance Taylor  <iant@google.com>
5398
5399         PR 10980
5400         * options.h (class General_options): Add --warn-unresolved-symbols
5401         and --error-unresolved-symbols.
5402         * errors.cc (Errors::undefined_symbol): Implement
5403         --warn-unresolved-symbols.
5404
5405         * options.h (class General_options): Add -z text and -z textoff.
5406         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
5407
5408 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
5409
5410         * gc.h (Garbage_collection::Cident_section_map): New typedef.
5411         (Garbage_collection::cident_sections): New function.
5412         (Garbage_collection::add_cident_section): New function.
5413         (Garbage_collection::cident_sections_): New member.
5414         (gc_process_relocs): Add references to sections whose names are C
5415         identifiers.
5416         * gold.h (cident_section_start_prefix): New constant.
5417         (cident_section_stop_prefix): New constant.
5418         (is_cident): New function.
5419         * layout.cc (Layout::define_section_symbols): Replace string constants
5420         with the newly defined constants.
5421         * object.cc (Sized_relobj::do_layout): Track sections whose names are
5422         C identifiers.
5423         * testsuite/Makefile.am: Add gc_orphan_section_test.
5424         * testsuite/Makefile.in: Regenerate.
5425         * testsuite/gc_orphan_section_test.cc: New file.
5426         * testsuite/gc_orphan_section_test.sh: New file.
5427
5428 2010-01-06  Ian Lance Taylor  <iant@google.com>
5429
5430         PR 10980
5431         * options.h (class General_options): Add --warn-shared-textrel.
5432         * layout.cc (Layout::finish_dynamic_section): Implement
5433         --warn-shared-textrel.
5434
5435         PR 10980
5436         * options.h (class General_options): Add --warn-multiple-gp.
5437
5438 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5439
5440         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
5441         $(THREADSLIB) and $(LIBDL).
5442         * Makefile.in: Rebuild.
5443
5444 2010-01-06  Ian Lance Taylor  <iant@google.com>
5445
5446         PR 10980
5447         * options.cc (General_options::parse_section_start): New function.
5448         (General_options::section_start): New function.
5449         (General_options::General_options): Initialize all members.
5450         * options.h: Include <map>
5451         (class General_options): Add --section-start.  Add section_starts_
5452         member.
5453         * layout.cc (Layout::attach_allocated_section_to_segment): If
5454         --section-start was used, set the address of the segment.  Remove
5455         local sort_sections.
5456         (Layout::relaxation_loop_body): If the address of the load segment
5457         has been set by --section-start, don't use it.
5458         * output.h (Output_segment::update_flags_for_output_section): New
5459         function.
5460         * output.cc (Output_segment::add_output_section): Call
5461         update_flags_for_output_section.
5462
5463 2010-01-05  Ian Lance Taylor  <iant@google.com>
5464
5465         PR 10980
5466         * options.h (class General_options): Add --undefined-version.
5467         * script.cc (struct Version_expression): Add was_matched_by_symbol
5468         field.
5469         (Version_script_info::matched_symbol): New function.
5470         (Version_script_info::get_symbol_version_helper): Call
5471         matched_symbol.
5472         (Version_script_info::check_unmatched_names): New function.
5473         * script.h (class Version_script_info): Update declarations.
5474         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
5475
5476         * options.h (class General_options): Use DEFINE_bool_alias for
5477         allow_multiple_definition.
5478         * resolve.cc (Symbol_table::should_override): Don't test
5479         allow_multiple_definition.
5480
5481         PR 10980
5482         * options.h (class General_options): Add --cref.
5483         * main.cc (main): Print cref table if --cref.  Don't close mapfile
5484         until after printing cref table.
5485         * cref.cc: Include "symtab.h".
5486         (class Cref_inputs): Define Cref_table_compare and Cref_table.
5487         (Cref_table_compare::operator()): New function.
5488         (Cref_inputs::gather_cref): New function.
5489         (filecol): New static const.
5490         (Cref_inputs::print_cref): New function.
5491         (Cref::print_cref): New function.
5492         * cref.h: Include <cstdio>.
5493         (class Cref): Update declarations.
5494         * mapfile.h (Mapfile::file): New function.
5495         * object.h (class Object): Define Symbols.  Declare virtual
5496         do_get_global_symbols.
5497         (Object::get_global_symbols): New function.
5498         * object.cc (Input_objects::add_object): Pass object to cref_ if
5499         --cref.
5500         (Input_objects::archive_start): Likewise.
5501         (Input_objects::archive_stop): Likewise.
5502         (Input_objects::print_cref): New function.
5503         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
5504         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
5505         --cref.
5506         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
5507         function.
5508         * plugin.h (class Sized_pluginobj): Update declarations.
5509
5510 2010-01-05  Ian Lance Taylor  <iant@google.com>
5511
5512         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
5513         to is_default_version.  Rename insdef to insdefault.
5514         (Symbol_table::add_from_relobj): Rename def to is_default_version
5515         and local to is_forced_local.
5516         (Symbol_table::add_from_pluginobj): Likewise.
5517         (Symbol_table::add_from_dynobj): Likewise.
5518         (Symbol_table::define_special_symbol): Rename insdef to
5519         insdefault.
5520
5521 2010-01-04  Ian Lance Taylor  <iant@google.com>
5522
5523         PR 10980
5524         * options.h (class General_options): Add
5525         --allow-multiple-definition and -z muldefs.
5526         * resolve.cc (Symbol_table::should_override): Don't warn about a
5527         multiple symbol definition if --allow-multiple-definition or -z
5528         muldefs.
5529
5530         PR 10980
5531         * options.h (class General_options): Add --add-needed and
5532         --copy-dt-needed-entries.  Tweak --as-needed help entry.
5533         * object.cc (Input_objects::check_dynamic_dependencies): Give an
5534         error if --copy-dt-needed-entries aka --add-needed is used and
5535         would cause a change in behaviour.
5536
5537         PR 10980
5538         * options.h (class General_options): Add -G as a short version of
5539         --shared.  Add no-op options -assert, -g, and -i.
5540
5541 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
5542
5543         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
5544         check for .text or .gnu.linkonce.t sections.
5545         * icf.cc (Icf::find_identical_sections): Ditto.
5546         Change the detection for mangled function name within the section
5547         name.
5548         * icf.h (is_section_foldable_candidate): New function.
5549
5550 2009-12-30  Ian Lance Taylor  <iant@google.com>
5551
5552         PR 10980
5553         * options.h (class General_options): Permit two dashes with
5554         --retain-symbols-file.
5555
5556 2009-12-30  Ian Lance Taylor  <iant@google.com>
5557
5558         PR 10979
5559         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
5560         don't put the file header and segment headers in the text
5561         segment.
5562
5563         PR 10979
5564         * common.cc (Sort_commons::operator()): Stabilize sort when both
5565         entries are NULL.
5566         (Symbol_table::do_allocate_commons_list): When allocating common
5567         symbols, skip a symbol which is no longer common.
5568         * symtab.h (Symbol::is_common): Test whether the symbol comes from
5569         an object before checking its type.
5570         * testsuite/common_test_2.c: New file.
5571         * testsuite/common_test_3.c: New file.
5572         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
5573         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
5574         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
5575         (common_test_2_pic.o, common_test_2.so): New targets.
5576         (common_test_3_pic.o, common_test_3.so): New targets.
5577         * testsuite/Makefile.in: Rebuild.
5578
5579         PR 10979
5580         * script.cc (read_input_script): If we see a new SECTIONS clause,
5581         and we have added an input section, give an error.
5582         * layout.h (class Layout): Add have_added_input_section function.
5583         Add have_added_input_section_ field.
5584         * layout.cc (Layout::Layout): Initialize
5585         have_added_input_section_.
5586         (Layout::layout): Set have_added_input_section_.
5587         (Layout::layout_eh_frame): Likewise.
5588
5589 2009-12-30  Ian Lance Taylor  <iant@google.com>
5590
5591         PR 10931
5592         * options.h (class General_options): Add --sort-common option.
5593         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
5594         * common.cc (Sort_common): Add sort_order parameter to
5595         constructor.  Add sort_order_ field.
5596         (Sort_commons::operator): Check sort_order_.
5597         (Symbol_table::allocate_commons): Determine the sort order.
5598         (Symbol_table::do_allocate_commons): Add sort_order parameter.
5599         Change all callers.
5600         (Symbol_table::do_allocate_commons_list): Likewise.
5601
5602 2009-12-30  Ian Lance Taylor  <iant@google.com>
5603
5604         PR 10916
5605         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
5606         symbols from this object, don't change the visibility of an
5607         undefined symbol.
5608         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
5609
5610 2009-12-30  Ian Lance Taylor  <iant@google.com>
5611
5612         PR 10861
5613         * script.h (class Version_script_info): Define Language enum.
5614         Update declarations.  Define Glob, Exact, and Lookup types.  Add
5615         new fields globals_, locals_, and is_finalized_.
5616         * script.cc: Various formatting fixes.
5617         (class Parser_closure): Change language_stack_ from a vector of
5618         std::string to one of Version_script_info::Language.  Adjust all
5619         uses accordingly.
5620         (class Lazy_demangler): Remove.
5621         (struct Version_expression): Change language from std::string to
5622         Version_script_info::Language.
5623         (Version_script_info::Version_script_info): New function.
5624         (Version_script_info::~Version_script_info): Don't call clear.
5625         (Version_script_info::finalize): New function.
5626         (Version_script_info::build_lookup_tables): New function.
5627         (Version_script_info::build_expression_list_lookup): New
5628         function.
5629         (Version_script_info::get_symbol_version_helper): Rewrite to use
5630         lookup tables.
5631         (Version_script_info::print_expression_list): Adjust to use
5632         Version_script_info::Language.
5633         (script_push_lex_into_version_mode): Check that the version script
5634         has not been finalized.
5635         (version_script_push_lang): Change language string to
5636         Version_script_info::Language.
5637         * options.cc (Command_line::version_script): New function.
5638         * options.h (class General_options): Add finalize_dynamic_list
5639         function.  Change version_script from declaration to definition.
5640         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
5641         * testsuite/version_script.map: Remove duplicate def of foo.
5642         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
5643         version_script.map.
5644         * testsuite/Makefile.in: Rebuild.
5645
5646 2009-12-30  Ian Lance Taylor  <iant@google.com>
5647
5648         PR 10843
5649         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
5650         if the input symbol index is 0, make the output symbol index 0.
5651
5652 2009-12-30  Ian Lance Taylor  <iant@google.com>
5653
5654         PR 10670
5655         * options.h (class General_options): Add -x/--discard-all.
5656         * object.cc (Sized_relobj::do_count_local_symbols): Handle
5657         --discard-all.  If the local symbol needs a dynamic entry, check
5658         that before handling --discard-locals.
5659
5660 2009-12-30  Ian Lance Taylor  <iant@google.com>
5661
5662         PR 10450
5663         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
5664         flags to PF_R.
5665         (Output_segment::add_output_section): Don't change the flags if
5666         the type is PT_TLS.
5667
5668         PR 10450
5669         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
5670         GNU hash table if they need a dynamic value.  Otherwise, don't add
5671         them if they are defined in a dynamic object or are forced local.
5672
5673 2009-12-29  Ian Lance Taylor  <iant@google.com>
5674
5675         PR 10450
5676         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
5677         .gnu.hash table for a 32-bit target.
5678
5679         PR 10450
5680         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
5681         regular and a dynamic object only needs a dynamic symbol table
5682         entry if it is externally visible.
5683
5684         PR 10450
5685         * i386.cc (class Target_i386): Initialize global_offset_table_ in
5686         constructor.  Add global_offset_table_ field.
5687         (Target_i386::got_section): Set global_offset_table_.
5688         (Target_i386::do_finalize_sections): Set global_offset_table_
5689         size.
5690         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
5691         in constructor.  Add global_offset_table_ field.
5692         (Target_x86_64::got_section): Set global_offset_table_.
5693         (Target_x86_64::do_finalize_sections): Set global_offset_table_
5694         size.
5695
5696         * layout.cc (Layout::Layout): Initialize increase_relro_.
5697         (Layout::get_output_section): Add is_relro, is_last_relro, and
5698         is_first_non_relro parameters.  Change all callers.
5699         (Layout::choose_output_section): Likewise.
5700         (Layout::add_output_section_data): Likewise.
5701         (Layout::make_output_section): Likewise.
5702         (Layout::set_segment_offsets): Clear increase_relro when using a
5703         linker script.
5704         * layout.h (class Layout): Add increase_relro method.  Add
5705         increase_relro_ field.  Update declarations.
5706         * output.cc (Output_section::Output_section): Initialize
5707         is_last_relro_ and is_first_non_relro_.
5708         (Output_segment::add_output_section): Group relro sections is
5709         do_sort is true.  Handle is_last_relro and is_first_non_relro.
5710         (Output_segment::maximum_alignment): Remove relro handling.
5711         (Output_segment::set_section_addresses): Add increase_relro
5712         parameter.  Change all callers.  Add initial alignment to align
5713         relro sections on separate page.  Remove old relro handling.
5714         (Output_segment::set_section_list_addresses): Remove in_relro
5715         parameter.  Change all callers.
5716         (Output_segment::set_offset): Add increase parameter.  Change all
5717         callers.  Remove old relro handling.
5718         * output.h (class Output_section): Add new methods: is_last_relro,
5719         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
5720         Add is_last_relro_ and is_first_non_relro_ fields.
5721         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
5722         Create separate .got.plt section.  Call increase_relro.
5723         * x86_64.cc (Target_x86_64::got_section): Likewise.
5724         * testsuite/relro_script_test.t: Add .got.plt.
5725
5726         PR 10450
5727         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
5728         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
5729         (Layout::finalize): Call set_dynamic_symbol_size.
5730         (Layout::set_dynamic_symbol_size): New function.
5731         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
5732         set_dynamic_symbol_size.
5733
5734         PR 10450
5735         * output.h (class Output_section): Add is_entsize_zero_ field.
5736         * output.cc (Output_section::Output_section): Initialize
5737         is_entsize_zero_.
5738         (Output_section::set_entsize): If two different entsizes are
5739         requested, force it to zero.
5740         (Output_section::add_input_section): Set flags for .debug_str
5741         before updating section flags.  Set entsize.
5742         (Output_section::update_flags_for_input_section): Set SHF_MERGE
5743         and SHF_STRING if all input sections have those flags.
5744
5745 2009-12-29   Rafael Espindola  <espindola@google.com>
5746
5747         * main.cc (main): Fix the sys time reporting.
5748         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
5749         reporting.
5750
5751 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
5752
5753         * options.cc (General_options::parse_version): Allow -v to exit
5754         without an error if there is nothing to link.
5755
5756 2009-12-29  Ian Lance Taylor  <iant@google.com>
5757
5758         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
5759         using a version of gcc before 4.1.
5760         * configure: Rebuild.
5761
5762 2009-12-28  Chris Demetriou  <cgd@google.com>
5763
5764         * attributes.cc (Output_attributes_section_data::do_write): Use
5765         std::vector::front rather than std::vector::data.
5766
5767 2009-12-28  Ian Lance Taylor  <iant@google.com>
5768
5769         * symtab.h (class Symbol_table): Add enum Defined.
5770         * resolve.cc (Symbol_table::should_override): Add defined
5771         parameter.  Change all callers.  Test whether object is NULL
5772         before calling a method on it.
5773         (Symbol_table::report_resolve_problem): Add defined parameter.
5774         Change all callers.
5775         (Symbol_table::should_override_with_special): Likewise.
5776         * symtab.cc (Symbol_table::define_in_output_data): Add defined
5777         parameter.  Change all callers.
5778         (Symbol_table::do_define_in_output_data): Likewise.
5779         (Symbol_table::define_in_output_segment): Likewise.
5780         (Symbol_table::do_define_in_output_segment): Likewise.
5781         (Symbol_table::define_as_constant): Likewise.
5782         (Symbol_table::do_define_as_constant): Likewise.
5783         * script.h (class Symbol_assignment): Add is_defsym parameter to
5784         constructor; change all callers.
5785         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
5786         parameter.  Change all callers.  Add is_defsym_ field.
5787         (class Parser_closure): Add parsing_defsym parameter to
5788         constructor; change all callers.  Add parsing_defsym accessor
5789         function.  Add parsing_defsym_ field.
5790
5791 2009-12-28  Ian Lance Taylor  <iant@google.com>
5792
5793         * gold.cc (queue_middle_tasks): Fix formatting.
5794         * object.cc (Relobj::is_section_name_included): Likewise.
5795
5796 2009-12-23  Ian Lance Taylor  <iant@google.com>
5797
5798         * i386.cc (Target_i386::do_calls_non_split): Recognize
5799         -fsplit-stack prologue for a function with a static chain.
5800         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
5801         -fsplit-stack prologue when using %r11.
5802
5803 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
5804
5805         * options.cc (General_options::parse_version): Make -v continue and do
5806         the link like GNU ld does.
5807
5808 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
5809
5810         * Makefile.am (CCFILES): Add timer.cc.
5811         (HFILES): Add timer.h.
5812         * configure.ac: Check for sysconf and times.
5813         * main.cc: include timer.h.
5814         (main): Use Timer instead of get_run_time.
5815         * timer.cc: New.
5816         * timer.h: New.
5817         * workqueue.cc: include timer.h.
5818         (Workqueue::find_and_run_task):
5819         Report user, sys and wall time.
5820         * Makefile.in: Regenerate.
5821         * config.in: Regenerate.
5822         * configure: Regenerate.
5823
5824 2009-12-16  Doug Kwan  <dougkwan@google.com>
5825
5826         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
5827         sections.
5828         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
5829         relaxed input sections.
5830         * output.cc (Output_section::find_relaxed_input_section): Change
5831         return type to Output_relaxed_input_section pointer.  Adjust code
5832         for new type of relaxed_input_section_map_.
5833         * output.h (Output_section::find_relaxed_input_section): Change
5834         return type to Output_relaxed_input_section pointer.
5835         (Output_section::Output_relaxed_input_section_by_input_section_map):
5836         New type.
5837         (Output_section::relaxed_input_section_map_): Change type to
5838         Output_section::Output_relaxed_input_section_by_input_section_map.
5839         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
5840         input section.
5841
5842 2009-12-15  Ian Lance Taylor  <iant@google.com>
5843
5844         * layout.cc (Layout::create_shstrtab): Only write out after input
5845         sections if we are compressing debug sections.
5846
5847 2009-12-15  Ian Lance Taylor  <iant@google.com>
5848
5849         * archive.cc (Archive::add_symbols): Only look up a symbol without
5850         a version if there is, in fact, a version.
5851
5852 2009-12-14  Ian Lance Taylor  <iant@google.com>
5853
5854         Revert -Wshadow changes, all changes from:
5855         2009-12-11  Doug Kwan  <dougkwan@google.com>
5856         2009-12-11  Nick Clifton  <nickc@redhat.com>
5857         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
5858
5859 2009-12-11  Doug Kwan  <dougkwan@google.com>
5860
5861         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
5862         due to -Wshadow.
5863         * attributes.cc (Object_attribute::size): Ditto.
5864         (Attributes_section_data::size): Ditto.
5865         (Attributes_section_data::Attributes_section_data): Ditto.
5866         (Output_attributes_section_data::do_write): Ditto.
5867         * attributes.h (Object_attribute::set_type): Ditto.
5868         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
5869
5870 2009-12-11  Nick Clifton  <nickc@redhat.com>
5871
5872         * archive.cc: Fix shadowed variable warnings.
5873         * arm.cc: Likewise.
5874         * compressed_output.cc: Likewise.
5875         * compressed_output.h: Likewise.
5876         * configure: Likewise.
5877         * dwarf_reader.cc: Likewise.
5878         * dynobj.cc: Likewise.
5879         * dynobj.h: Likewise.
5880         * ehframe.cc: Likewise.
5881         * ehframe.h: Likewise.
5882         * errors.cc: Likewise.
5883         * expression.cc: Likewise.
5884         * fileread.cc: Likewise.
5885         * fileread.h: Likewise.
5886         * freebsd.h: Likewise.
5887         * i386.cc: Likewise.
5888         * icf.cc: Likewise.
5889         * incremental.h: Likewise.
5890         * layout.cc: Likewise.
5891         * layout.h: Likewise.
5892         * mapfile.cc: Likewise.
5893         * merge.cc: Likewise.
5894         * merge.h: Likewise.
5895         * object.cc: Likewise.
5896         * object.h: Likewise.
5897         * options.h: Likewise.
5898         * output.cc: Likewise.
5899         * output.h: Likewise.
5900         * parameters.cc: Likewise.
5901         * plugin.cc: Likewise.
5902         * powerpc.cc: Likewise.
5903         * reduced_debug_output.cc: Likewise.
5904         * reduced_debug_output.h: Likewise.
5905         * reloc.cc: Likewise.
5906         * reloc.h: Likewise.
5907         * resolve.cc: Likewise.
5908         * script-sections.cc: Likewise.
5909         * script.cc: Likewise.
5910         * script.h: Likewise.
5911         * sparc.cc: Likewise.
5912         * symtab.cc: Likewise.
5913         * symtab.h: Likewise.
5914         * target-select.cc: Likewise.
5915         * target-select.h: Likewise.
5916         * token.h: Likewise.
5917         * workqueue.cc: Likewise.
5918         * workqueue.h: Likewise.
5919         * x86_64.cc: Likewise.
5920
5921 2009-12-10  Doug Kwan  <dougkwan@google.com>
5922
5923         * arm.cc (attributes.h): New include.
5924         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
5925         (Arm_relobj::~Arm_relobj): Delete object pointed by
5926         attributes_section_data_.
5927         (Arm_relobj::attributes_section_data): New method definition.
5928         (Arm_relobj::attributes_section_data_): New data member declaration.
5929         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
5930         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
5931         attributes_section_data_.
5932         (Arm_dynobj::attributes_section_data): New method definition.
5933         (Arm_dynobj::attributes_section_data_): New data member declaration.
5934         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
5935         initialization value of may_use_blx_ to false.
5936         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
5937         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
5938         object attributes to compute results instead of hard-coding.
5939         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
5940         Target_arm::get_secondary_compatible_arch,
5941         Target_arm::set_secondary_compatible_arch
5942         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5943         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
5944         New method declarations.
5945         (Target_arm::get_aeabi_object_attribute): New method definition.
5946         (Target_arm::attributes_section_data_): New data member declaration.
5947         (read_arm_attributes_section): New template definition.
5948         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
5949         (Arm_dynobj::do_read_symbols): Ditto.
5950         (Target_arm::do_finalize_sections): Merge attributes sections from
5951         input.  Check for BLX use after attributes section merging.
5952         Fix __exidx_start and __exidx_end visibility.  Create an
5953         .ARM.attributes section if necessary.
5954         (Target_arm::get_secondary_compatible_arch,
5955         Target_arm::set_secondary_compatible_arch,
5956         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5957         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
5958         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
5959         New method definitions.
5960
5961 2009-12-09  Ian Lance Taylor  <iant@google.com>
5962
5963         * plugin.cc (Plugin::load): Don't cast from void* to a function
5964         pointer.
5965
5966 2009-12-09  Ian Lance Taylor  <iant@google.com>
5967
5968         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
5969         information fields.
5970
5971 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
5972
5973         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
5974         Replace two_file_shared_1.so with two_file_shared_2.so.
5975         * testsuite/Makefile.in: Regenerated.
5976
5977 2009-12-08  Doug Kwan  <dougkwan@google.com>
5978
5979         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
5980         (HFILES): Add attributes.h and int_encoding.h.
5981         * Makefile.in: Regenerate.
5982         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
5983         function definitions to int_encoding.cc
5984         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
5985         prototypes to int_encoding.h
5986         * reduced_debug_output.cc (int_encoding.h): New include.
5987         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
5988         function definitions to int_encoding.cc
5989         (insert_into_vector, read_from_pointer): Move template definitions to
5990         int_encoding.h
5991         * attributes.cc: New file.
5992         * attributes.h: New file.
5993         * int_encoding.cc: New file.
5994         * int_encoding.h: New file.
5995
5996 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
5997
5998         PR gold/11055
5999         * incremental-dump.cc (dump_incremental_inputs): New.
6000         (main): Use dump_incremental_inputs.
6001
6002 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
6003
6004         PR gold/10893
6005         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
6006         checking elfcpp::STT_FUNC.
6007         (Target_i386::Relocate::relocate): Likewise.
6008         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
6009
6010         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
6011         symbols from shared libraries into normal FUNC symbols.
6012
6013         * symtab.h (Symbol): Add is_func and use it.
6014
6015 2009-12-05  Doug Kwan  <dougkwan@google.com>
6016
6017         * arm.cc (Target_arm::arm_info): Initialize new fields
6018         attributes_section and attributes_vendor.
6019         * i386.cc (Target_i386::i386_info): Same.
6020         * object.cc (Sized_relobj::do_layout): Skip attribute section.
6021         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
6022         fields attributes_section and attributes_vendor.
6023         * sparc.cc (Target_sparc::sparc_info): Same.
6024         * target.h (Target::attributes_section, Target::attributes_vendor,
6025         Target::is_attributes_section, Target::attribute_arg_type,
6026         Target::attributes_order): New method definitions.
6027         (Target::Target_info::attributes_section,
6028         Target::Target_info::attributes_vendor): New fields.
6029         (Target::do_attribute_arg_type, Target::do_attributes_order): New
6030         virtual method definitions.
6031         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
6032         attributes_section and attributes_vendor.
6033         * testsuite/testfile.cc (Target_test::test_target_info): Same.
6034
6035 2009-12-05  Doug Kwan  <dougkwan@google.com>
6036
6037         * arm.cc: Update comments about interworking and stub generation.
6038         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
6039         considered as non-PIC.
6040         (Arm_relocate_functions::base_abs): Fix formatting.
6041         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
6042         of function to use GOT entry address instead of offset.
6043         (Target_arm::Scan::global): Issue an error if a symbol would need a
6044         PLT does not get one because it is untyped.  Remove code to create
6045         dynamic symbols for relative branches.
6046         (Target_arm::Relocate::relocate: Use 0 instead of false since function
6047         takes unsigned integer instead of boolean.
6048
6049 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
6050
6051         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
6052         (two_file_test_LDADD): Likewise.
6053         (common_test_1_LDADD): Likewise.
6054         (exception_test_LDADD) Likewise.
6055         (weak_test_LDADD): Likewise.
6056         (many_sections_test_LDADD): Likewise.
6057         (initpri1_LDADD): Likewise.
6058         (script_test_1_LDADD): Likewise.
6059         (script_test_2_LDADD): Likewise.
6060         (justsyms_LDADD): Likewise.
6061         (binary_test_LDADD): Likewise.
6062         (large_LDADD): Likewise.
6063         * testsuite/Makefile.in: Regenerated.
6064
6065 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
6066
6067         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
6068         (Symbol_table::override_with_special): Likewise.
6069         (Symbol_table::add_from_object): Likewise.
6070
6071 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
6072
6073         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
6074         Don't set the data_offset twice.
6075
6076 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
6077
6078         * testsuite/Makefile.in: Regenerate.
6079
6080 2009-12-03  Doug Kwan  <dougkwan@google.com>
6081
6082         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
6083         (Target_arm::do_finalize_sections): Add parameter for symbol table
6084         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
6085         * i386.cc (Target_i386::do_finalize_sections): Add an additional
6086         parameter for symbol table pointer.
6087         * layout.cc (Layout::finalize): Call Target::finalize_sections with
6088         an additional parameter for a pointer to symbol table.
6089         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
6090         parameter for a symbol table pointer.
6091         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
6092         * target.h (Target::finalize_sections, Target::do_finalize_sections):
6093         Ditto.
6094         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
6095         parameter for a symbol table pointer.
6096
6097 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
6098
6099         * incremental.cc (Incremental_inputs_header)
6100         (Incremental_inputs_header_write, Incremental_inputs_entry)
6101         (Incremental_inputs_entry_write): Move ...
6102         * incremental.h (Incremental_inputs_header)
6103         (Incremental_inputs_header_write, Incremental_inputs_entry)
6104         (Incremental_inputs_entry_write): here.
6105
6106 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
6107
6108         * incremental.cc (make_sized_incremental_binary): Set the target.
6109         Error if it is incompatible.
6110         * output.h (Output_file): Add filename method.
6111
6112 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
6113
6114         * incremental.cc (Incremental_inputs_entry): Remove unused argument
6115         from the get_* methods.
6116
6117 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
6118
6119         * incremental-dump.cc (main): Check that the offeset of a script is 0.
6120         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
6121         Write 0 for the data_offset of scripts.
6122
6123 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
6124
6125         * testsuite/Makefile.am: Add the incremental_test.sh test.
6126         * testsuite/incremental_test.sh: New.
6127         * testsuite/incremental_test_1.c: New.
6128         * testsuite/incremental_test_2.c: New.
6129
6130 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
6131
6132        * incremental-dump.cc (main): Fix typos.
6133
6134 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
6135
6136         PR gold/11025
6137         * incremental-dump.cc (main): Use llu to print 64 bit values.
6138
6139 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
6140             H.J. Lu  <hongjiu.lu@intel.com>
6141
6142         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
6143         $(LIBDL).
6144         (incremental_dump_LDADD): Likewise.
6145         * Makefile.in: Regenerated.
6146
6147 2009-11-25  Doug Kwan  <dougkwan@google.com>
6148
6149         Revert:
6150
6151         2009-11-25  Doug Kwan  <dougkwan@google.com>
6152
6153                 * arm.cc (Target_arm::Target_arm): Move method definition
6154                 outside of class definition.  Add code to handle
6155                 --target1-rel, --target1-abs and --target2= options.
6156                 (Target_arm::get_reloc_reloc_type): Change method to be
6157                 non-static and const.
6158                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
6159                 New data member declaration.
6160                 (Target_arm::Scan::local, Target_arm::Scan::global,
6161                 Target_arm::Relocate::relocate,
6162                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6163                 Adjust call to Target_arm::get_real_reloc_type.
6164                 (Target_arm::get_real_reloc_type): Use command line options
6165                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
6166                 * options.h (--target1-rel, --target1-abs, --target2): New
6167                 ARM-only options.
6168
6169 2009-11-25  Doug Kwan  <dougkwan@google.com>
6170
6171         * arm.cc (Target_arm::Target_arm): Move method definition outside of
6172         class definition.  Add code to handle --target1-rel, --target1-abs
6173         and --target2= options.
6174         (Target_arm::get_reloc_reloc_type): Change method to be non-static
6175         and const.
6176         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
6177         member declaration.
6178         (Target_arm::Scan::local, Target_arm::Scan::global,
6179         Target_arm::Relocate::relocate,
6180         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
6181         call to Target_arm::get_real_reloc_type.
6182         (Target_arm::get_real_reloc_type): Use command line options to
6183         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
6184         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
6185         options.
6186
6187 2009-11-25  Doug Kwan  <dougkwan@google.com>
6188
6189         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
6190         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
6191         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
6192         formatting.
6193         (Arm_relocate_functions::thm_call): Replace body with a call to
6194         Arm_relocate_functions::thumb_branch_common.
6195         (Arm_relocate_functions::thm_jump24,
6196         Arm_relocate_functions::thm_xpc22): New method definitions.
6197         (Arm_relocate_functions::thumb_branch_common): New method definition.
6198         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
6199         operator.
6200         (Target_arm::Relocate::relocate): Adjust call to thm_call.
6201         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
6202
6203 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
6204
6205         * Makefile.am: Build incremental-dump
6206         * Makefile.in: Regenerate.
6207         * incremental-dump.cc: New.
6208         * incremental.cc (Incremental_inputs_header_data,
6209         Incremental_inputs_entry_data): Move to incremental.h
6210         * incremental.h: (Incremental_inputs_header_data,
6211         Incremental_inputs_entry_data): Move from incremental.cc
6212
6213 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
6214
6215         * incremental.cc (Incremental_inputs_header,
6216         Incremental_inputs_header_write, Incremental_inputs_entry,
6217         Incremental_inputs_entry_write): Add a typedef with the data type.
6218
6219 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
6220
6221         * incremental.cc (Incremental_inputs_header,
6222         Incremental_inputs_header_write, Incremental_inputs_entry,
6223         Incremental_inputs_entry_write): Update comment about which
6224         type has the filed descriptions.
6225
6226 2009-11-15  Doug Kwan  <dougkwan@google.com>
6227
6228         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
6229         (Arm_relocate_functions::arm_branch_common): Change method defintion
6230         in class definition to a method declaration and update list of formal
6231         parameters.
6232         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
6233         Arm_relocation_functions::jump24): Adjust call to
6234         Arm_relocate_functions::arm_branch_common.  Update list of formal
6235         parameters.
6236         (Arm_relocate_functions::xpc25): New method definition.
6237         (Arm_relocate_functions::arm_branch_common): Move method defintion
6238         out from class definition.  Use stubs for mode-switching and extending
6239         branch ranges.
6240         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
6241         specially.  Change code to enable use of stubs in ARM branches.
6242
6243 2009-11-10  Doug Kwan  <dougkwan@google.com>
6244
6245         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
6246         in method declaration.
6247         (Target_arm::relocate_stub): New method declaration.
6248         (Target_arm::default_target): Change to return a pointer instead of
6249         a const reference.
6250         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
6251         Target_arm::default_target.
6252         (Arm_Relobj::do_relocate_sections): Remove options paramater in
6253         method definition.
6254         (Target_arm::relocate_section): Adjust view.
6255         (Target_arm::relocate_stub): New method definition.
6256
6257 2009-11-10  Doug Kwan  <dougkwan@google.com>
6258
6259         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
6260         a format warning.
6261         * incremental.cc (open_incremental_binary): Initialized local
6262         variables to avoid warnings.
6263         * object.cc (make_elf_object): Ditto.
6264         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
6265         a format warning.
6266
6267 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
6268
6269         PR gold/10930
6270         * testsuite/plugin_test.c: Include "config.h".
6271
6272 2009-11-09  Doug Kwan  <dougkwan@google.com>
6273
6274         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
6275         (arm_symbol_value): Remove.
6276         (Arm_relocate_functions::arm_branch_common,
6277         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
6278         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
6279         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
6280         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
6281         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
6282         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
6283         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
6284         Arm_relocate_functions::thm_mobw_abs_nc,
6285         Arm_relocate_functions::thm_mov_abs,
6286         Arm_relocate_functions::movw_prel_nc,
6287         Arm_relocate_functions::thm_movt_abs,
6288         Arm_relocate_functions::movt_prel,
6289         Arm_relocate_functions::thm_movw_prel_nc,
6290         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
6291         (Target_arm::Relocate::relocate): Only decompose address into two
6292         parts if relocation type uses the thumb-bit and pass the actual
6293         bit instead of a flag indicating that the thumb-bit is used.  Adjust
6294         calls to methods in Arm_relocate_functions for this change.
6295
6296 2009-11-08  Ian Lance Taylor  <iant@google.com>
6297
6298         PR 10925
6299         * reloc.cc: Instantiate
6300         Sized_relobj::initialize_input_to_output_maps and
6301         Sized_relobj:free_input_to_output_maps.
6302
6303 2009-11-06  Ian Lance Taylor  <iant@google.com>
6304
6305         PR 10876
6306         * defstd.cc (in_segment): Set only_if_ref true for "end".
6307
6308 2009-11-06  Doug Kwan  <dougkwan@google.com>
6309
6310         * arm.cc (class Reloc_stub): Correct a comment.
6311         (Target_arm::Target_arm): Initialize arm_input_section_map_.
6312         (Target_arm::scan_section_for_stubs): New method declaration.
6313         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
6314         Change methods from private to protected.
6315         (Target_arm::do_may_relax): New method definition.
6316         (Target_arm::do_relax, Target_arm::group_sections,
6317         Target_arm::scan_reloc_for_stub,
6318         Target_arm::scan_reloc_section_for_stubs): New method declarations.
6319         (Target_arm::arm_input_section_map_): New data member declaration.
6320         (Target_arm::scan_reloc_for_stub,
6321         Target_arm::scan_reloc_section_for_stubs,
6322         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
6323         Target_arm::do_relax): New method definitions.
6324
6325 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
6326
6327         * configure.ac: Check for (struct stat)::st_mtim
6328         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
6329         * config.in: Regenerate.
6330         * configure: Regenerate.
6331
6332 2009-11-05  Ian Lance Taylor  <iant@google.com>
6333
6334         PR 10910
6335         * output.cc (Output_segment::add_output_section): Add missing
6336         return statement.
6337
6338 2009-11-04  Ian Lance Taylor  <iant@google.com>
6339
6340         PR 10880
6341         * object.h (class Object): Add is_needed and set_is_needed
6342         methods.  Add is_needed_ field.  Make bool fields into bitfields.
6343         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
6344         defined in a dynamic object and referenced by a regular object,
6345         set is_needed for the dynamic object.
6346         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
6347         if the file is marked with as_needed and it is not needed.
6348
6349 2009-11-04  Ian Lance Taylor  <iant@google.com>
6350
6351         PR 10887
6352         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
6353         tags if data is discarded by linker script.
6354         * i386.cc (Target_i386::do_finalize_sections): Likewise.
6355         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6356         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6357         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6358
6359 2009-11-04  Ian Lance Taylor  <iant@google.com>
6360
6361         * layout.cc (Layout::get_output_section): Add is_interp and
6362         is_dynamic_linker_section parameters.  Change all callers.
6363         (Layout::choose_output_section): Likewise.
6364         (Layout::make_output_section): Likewise.
6365         (Layout::add_output_section_data): Add is_dynamic_linker_section
6366         parameter.  Change all callers.
6367         * layout.h (class Layout): Update declarations.
6368         * output.h (class Output_section): Add is_interp, set_is_interp,
6369         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
6370         Add is_interp_, is_dynamic_linker_section_ fields.  Change
6371         generate_code_fills_at_write_ to a bitfield.
6372         * output.cc (Output_section::Output_sections): Initialize new
6373         fields.
6374         (Output_segment::add_output_section): Add do_sort parameter.
6375         Change all callers.
6376
6377 2009-11-03  Ian Lance Taylor  <iant@google.com>
6378
6379         PR 10860
6380         * options.h (class General_options): Add --warn-common.
6381         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
6382         merging two common symbols.
6383         (Symbol_table::should_override): Handle --warn-common when merging
6384         a common symbol with a defined symbol.  Use report_resolve_problem
6385         for multiple definitions.
6386         (Symbol_table::report_resolve_problem): New function.
6387         * symtab.h (class Symbol_table): Declare report_resolve_problem.
6388
6389 2009-11-03  Doug Kwan  <dougkwan@google.com>
6390
6391         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
6392         stub_factory_.
6393         (Target_arm::stub_factory): New method definition.
6394         (Target_arm::new_arm_input_section,
6395         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
6396         Target_arm::reloc_uses_thumb_bit): New method declarations.
6397         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
6398         New type definitions.
6399         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
6400         member declarations.
6401         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
6402         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
6403         New method definitions.
6404
6405 2009-11-03  Ian Lance Taylor  <iant@google.com>
6406
6407         * options.h (class General_options): Add --warn_constructors.
6408
6409 2009-11-03  Ian Lance Taylor  <iant@google.com>
6410
6411         PR 10893
6412         * defstd.cc (in_section): Add entries for __rel_iplt_start,
6413         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
6414
6415 2009-11-03  Ian Lance Taylor  <iant@google.com>
6416
6417         PR 10895
6418         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
6419         --msgid-bugs-address.
6420         (install-pdf): New target.
6421         (install-data_yes): Look up one directory to find mkinstalldirs.
6422
6423 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
6424
6425         * po/Make-in (.po.gmo): Don't generate .gmo files in source
6426         tree.
6427
6428 2009-10-30  Doug Kwan  <dougkwan@google.com>
6429
6430         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
6431
6432 2009-10-30  Doug Kwan  <dougkwan@google.com>
6433
6434         * arm.cc (Stub_addend_reader): New struct template definition
6435         and partial specializations.
6436         (Stub_addend_reader::operator()): New method definition for a
6437         partially specialized template.
6438
6439 2009-10-30  Doug Kwan  <dougkwan@google.com>
6440
6441         * arm.cc (Arm_relobj::processor_specific_flags): New method
6442         definition.
6443         (Arm_relobj::do_read_symbols): New method declaration.
6444         (Arm_relobj::processor_specific_flags_): New data member declaration.
6445         (Arm_dynobj): New class definition.
6446         (Target_arm::do_finalize_sections): Add input_objects parameter.
6447         (Target_arm::do_adjust_elf_header): New method declaration.
6448         (Target_arm::are_eabi_versions_compatible,
6449         (Target_arm::merge_processor_specific_flags): New method declaration.
6450         (Target_arm::do_make_elf_object): New overloaded method definitions
6451         and declaration.
6452         (Arm_relobj::do_read_symbols): New method definition.
6453         (Arm_dynobj::do_read_symbols): Ditto.
6454         (Target_arm::do_finalize_sections): Add input_objects parameters.
6455         Merge processor-specific flags from all input objects.
6456         (Target_arm::are_eabi_versions_compatible,
6457         Target_arm::merge_processor_specific_flags,
6458         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
6459         New method definitions.
6460         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
6461         Input_objects pointer type parameter.
6462         * layout.cc (Layout::finalize): Pass input objects to target's.
6463         finalize_sections function.
6464         * output.cc (Output_file_header::do_sized_write): Set ELF file
6465         header's processor-specific flags.
6466         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
6467         Input_objects pointer type parameter.
6468         * sparc.cc (Target_sparc::do_finalize_sections): Same.
6469         * target.h (Input_objects): New forward class declaration.
6470         (Target::processor_specific_flags,
6471         Target::are_processor_specific_flags_sect): New method definitions.
6472         (Target::finalize_sections): Add input_objects parameter.
6473         (Target::Target): Initialize processor_specific_flags_ and
6474         are_processor_specific_flags_set_.
6475         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
6476         parameter.
6477         (Target::set_processor_specific_flags): New method definition.
6478         (Target::processor_specific_flags_,
6479         Target::are_processor_specific_flags_set_): New data member
6480         declarations.
6481         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
6482         Input_objects pointer type parameter.
6483
6484 2009-10-30  Doug Kwan  <dougkwan@google.com>
6485
6486         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
6487
6488 2009-10-28  Ian Lance Taylor  <iant@google.com>
6489
6490         * object.h (class Relobj): Drop options parameter from
6491         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
6492         do_scan_relocs, do_relocate.  Change all callers.
6493         (class Sized_relobj): Drop options parameters from
6494         do_gc_process_relocs, do_scan_relocs, do_relocate,
6495         do_relocate_sections, relocate_sections, emit_relocs_scan,
6496         emit_relocs_scan_reltype.  Change all callers.
6497         (struct Relocate_info): Remove options field and all references to
6498         it.
6499         * reloc.h (class Read_relocs): Remove options constructor
6500         parameter and options_ field.  Change all callers.
6501         (class Gc_process_relocs, class Scan_relocs): Likewise.
6502         (class Relocate_task): Likewise.
6503         * target-reloc.h (scan_relocs): Remove options parameter.  Change
6504         all callers.
6505         (scan_relocatable_relocs): Likewise.
6506         * target.h (class Sized_target): Remove options parameter from
6507         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
6508         all callers.
6509         * gc.h (gc_process_relocs): Remove options parameter.  Change all
6510         callers.
6511         * arm.cc: Update functions to remove options parameters.
6512         * i386.cc: Likewise.
6513         * powerpc.cc: Likewise.
6514         * sparc.cc: Likewise.
6515         * x86_64.cc: Likewise.
6516         * testsuite/testfile.cc: Likewise.
6517
6518 2009-10-28  Doug Kwan  <dougkwan@google.com>
6519
6520         * arm.cc (Arm_relobj): New class definition.
6521         (Arm_relobj::scan_sections_for_stubs,
6522         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
6523         New method definitions.
6524
6525 2009-10-28  Cary Coutant  <ccoutant@google.com>
6526
6527         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
6528         (Plugin::cleanup_done_): New member.
6529         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
6530         (Plugin_manager::cleanup_done_): Remove.
6531         (Plugin_manager::add_input_file): Edit error message.
6532         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
6533         (Plugin_manager::cleanup): Remove use of cleanup_done_.
6534
6535 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
6536
6537         * fileread.cc: (File_read::View::~View): Use the new
6538         data_ownership_ filed.
6539         (File_read::~File_read): Dispose the new whole_file_view_.
6540         (File_read::open): Mmap the whole file if needed.
6541         (File_read::open): Use whole_file_view_ instead of contents_.
6542         (File_read::find_view): Use whole_file_view_ if applicable.
6543         (File_read::do_read): Use whole_file_view_ instead of contents_.
6544         (File_read::make_view): Use whole_file_view_ instead of contents_,
6545         update File_read::View::View call.
6546         (File_read::find_or_make_view): Update File_read::View::View
6547         call.
6548         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
6549         remove contents_
6550         (File_read::View::Data_ownership): New enum.
6551         (File_read::View::View): Replace bool mapped_ with Data_ownership
6552         argument.
6553         (File_read::View::mapped_): Remove (replaced by data_ownership_).
6554         (File_read::View::data_ownership_): New field.
6555         (File_read::contents_): Remove (replaced by whole_file_view_).
6556         (File_read::whole_file_view_): New field.
6557         * options.h (class General_options): Add --keep-files-mapped.
6558
6559 2009-10-27  Cary Coutant  <ccoutant@google.com>
6560
6561         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
6562         * testsuite/Makefile.am (plugin_test_5): New test case.
6563         * testsuite/Makefile.in: Regenerate.
6564
6565 2009-10-25  Doug Kwan  <dougkwan@google.com>
6566
6567         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
6568         from private to protected to allow access by child class.
6569         (Sized_relobj::do_relocate_sections): New method declaration.
6570         (Sized_relobj::relocate_sections): Virtualize.
6571         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
6572         Sized_relobj::relocate_sections.  Instantiate template explicitly
6573         for different target sizes and endianity.
6574
6575 2009-10-24  Doug Kwan  <dougkwan@google.com>
6576
6577         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
6578         (Arm_input_section::as_arm_input_section): New method.
6579         (Arm_output_section): New class definition.
6580         (Arm_output_section::create_stub_group,
6581         Arm_output_section::group_sections): New method definitions.
6582
6583 2009-10-22  Doug Kwan  <dougkwan@google.com>
6584
6585         * arm.cc (Arm_input_section): New class definition.
6586         (Arm_input_section::init, Arm_input_section:do_write,
6587         Arm_input_section::set_final_data_size,
6588         Arm_input_section::do_reset_address_and_file_offset): New method
6589         definitions.
6590
6591 2009-10-21  Doug Kwan  <dougkwan@google.com>
6592
6593         * arm.cc (Stub_table, Arm_input_section): New forward class
6594         declarations.
6595         (Stub_table): New class defintion.
6596         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
6597         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
6598         New method definition.
6599
6600 2009-10-21  Doug Kwan  <dougkwan@google.com>
6601
6602         * arm.cc: Update copyright comments.
6603         (Target_arm): New forward class template declaration.
6604         (Arm_address): New type.
6605         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
6606         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
6607         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
6608         constants.
6609         (Insn_template): Same.
6610         (DEF_STUBS): New macro.
6611         (Stub_type): New enum type.
6612         (Stub_template): New class definition.
6613         (Stub): Same.
6614         (Reloc_stub): Same.
6615         (Stub_factory): Same.
6616         (Target_arm::Target_arm): Initialize may_use_blx_ and
6617         should_force_pic_veneer_.
6618         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
6619         Target_arm::should_force_pic_veneer,
6620         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
6621         Target_arm::using_thumb_only, Target_arm:;default_target): New
6622         method defintions.
6623         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
6624         New data member declarations.
6625         (Insn_template::size, Insn_template::alignment): New method defintions.
6626         (Stub_template::Stub_template): New method definition.
6627         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
6628         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
6629         (Stub_factory::Stub_factory): New method definition.
6630         * gold.h (string_hash): New template.
6631         * output.h (Input_section_specifier::hash_value): Use
6632         gold::string_hash.
6633         (Input_section_specifier::string_hash): Remove.
6634         * stringpool.cc (Stringpool_template::string_hash): Use
6635         gold::string_hash.
6636
6637 2009-10-20  Doug Kwan  <dougkwan@google.com>
6638
6639         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
6640         symbols of relaxed input sections.
6641         * output.h (Output_section::find_relaxed_input_section): Make
6642         method public.
6643
6644 2009-10-16  Doug Kwan  <dougkwan@google.com>
6645
6646         * dynobj.cc (Versions::Versions): Initialize version_script_.
6647         Only insert base version symbol definition for a shared object
6648         if version script defines any version versions.
6649         (Versions::define_base_version): New method definition.
6650         (Versions::add_def): Check that base version is not needed.
6651         (Versions::add_need): Define base version lazily.
6652         * dynobj.h (Versions::define_base_version): New method declaration.
6653         (Versions::needs_base_version_): New data member declaration.
6654         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
6655         (check_DATA): Add no_version_test.stdout.
6656         (libno_version_test.so, no_version_test.o no_version_test.stdout):
6657         New make rules.
6658         * testsuite/Makefile.in: Regenerate.
6659         * testsuite/no_version_test.c: New file.
6660         * testsuite/no_version_test.sh: Ditto.
6661
6662 2009-10-16  Doug Kwan  <dougkwan@google.com>
6663
6664         * expression.cc (class Segment_start_expression): New class definition.
6665         (Segment_start_expression::value): New method definition.
6666         (script_exp_function_segment_start): Return a new
6667         Segment_start_expression.
6668         * gold/script-c.h (script_saw_segment_start_expression): New function
6669         prototype.
6670         * script-sections.cc (Script_sections::Script_sections): Initialize
6671         SAW_SEGMENT_START_EXPRESSION_ to false.
6672         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
6673         and -Tbbs options to specify section addresses if given in
6674         command line and no SEGMENT_START expression is seen in a script.
6675         * script-sections.h (Script_sections::saw_segment_start_expression,
6676         Script_sections::set_saw_segment_start_expression): New method
6677         definition.
6678         (Script_sections::saw_segment_start_expression_): New data member
6679         declaration.
6680         * script.cc (script_saw_segment_start_expression): New function.
6681         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
6682         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
6683         script_test_7.sh and script_test_8.sh.
6684         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
6685         script_test_8.stdout.
6686         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
6687         (script_test_6, script_test_6.stdout, script_test_7,
6688         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
6689         * Makefile.in: Regenerate.
6690         * testsuite/script_test_6.sh: New file.
6691         * testsuite/script_test_6.t: Same.
6692         * testsuite/script_test_7.sh: Same.
6693         * testsuite/script_test_7.t: Same.
6694         * testsuite/script_test_8.sh: Same.
6695
6696 2009-10-16  Doug Kwan  <dougkwan@google.com>
6697
6698         * output.cc (Output_segment::set_section_list_address): Cast
6699         expressions to unsigned long long type to avoid format warnings.
6700
6701 2009-10-15  Ian Lance Taylor  <iant@google.com>
6702
6703         * script.cc (Script_options::add_symbol_assignment): Always add a
6704         dot assignment to script_sections_.
6705         * script-sections.cc (Script_sections::add_dot_assignment):
6706         Initialize if necessary.
6707
6708         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
6709         program headers with no load segment if there is a linker script.
6710
6711         * layout.cc (Layout::set_segment_offsets): Align the file offset
6712         to the segment aligment for -N or -n with no load segment.
6713         * output.cc (Output_segment::add_output_section): Don't crash if
6714         the first section is a TLS section.
6715         (Output_segment::set_section_list_addresses): Print an error
6716         message if the address moves backward in a linker script.
6717         * script-sections.cc
6718         (Output_section_element_input::set_section_addresses): Don't
6719         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
6720         (Orphan_output_section::set_section_addresses): Likewise.
6721
6722 2009-10-15  Doug Kwan  <dougkwan@google.com>
6723
6724         * layout.cc (Layout::finish_dynamic_section): Generate tags
6725         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
6726         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
6727         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
6728
6729 2009-10-14  Ian Lance Taylor  <iant@google.com>
6730
6731         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
6732         fields.
6733         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
6734         data_shdr fields of relinfo.
6735         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
6736         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
6737         R_386_TLS_LDO_32, adjust based on section flags.
6738         (Target_i386::Relocate::fix_up_ldo): Remove.
6739
6740 2009-10-13  Ian Lance Taylor  <iant@google.com>
6741
6742         Add support for -pie.
6743         * options.h (class General_options): Add -pie and
6744         --pic-executable.
6745         (General_options::output_is_position_independent): Test -pie.
6746         (General_options::output_is_executable): Return true if not shared
6747         and not relocatable.
6748         (General_options::output_is_pie): Remove.
6749         * options.cc (General_options::finalize): Reject incompatible uses
6750         of -pie.
6751         * gold.cc (queue_middle_tasks): A -pie link is not static.
6752         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
6753         * symtab.cc (Symbol::final_value_is_known): Return false if
6754         output_is_position_independent.
6755         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
6756         output_is_position_independent.
6757         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
6758         output_is_position_independent.
6759         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
6760         output_is_position_independent.
6761         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
6762         two_file_pie_test.
6763         (basic_pie_test.o, basic_pie_test): New targets.
6764         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
6765         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
6766         (two_file_pie_test): New target.
6767         * testsuite/Makefile.in: Rebuild.
6768         * README: Remove note saying that -pie is not supported.
6769
6770 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
6771
6772         * options.h (class General_options): Add -init and -fini.
6773         * layout.cc (Layout::finish_dynamic_section): Emit
6774         given init and fini functions.
6775
6776 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
6777
6778         * gc.h (gc_process_relocs): Check if icf is enabled using new
6779         function.
6780         * gold.cc (queue_initial_tasks): Likewise.
6781         (queue_middle_tasks): Likewise.
6782         * object.cc (do_layout): Likewise.
6783         * symtab.cc (is_section_folded): Likewise.
6784         * main.cc (main): Likewise.
6785         * reloc.cc (Read_relocs::run): Likewise.
6786         (Sized_relobj::do_scan_relocs): Likewise.
6787         * icf.cc (is_function_ctor_or_dtor): New function.
6788         (Icf::find_identical_sections): Check if function is ctor or dtor when
6789         safe icf is chosen.
6790         * options.h (General_options::icf): Change option to be an enum.
6791         (Icf_status): New enum.
6792         (icf_enabled): New method.
6793         (icf_safe_folding): New method.
6794         (set_icf_status): New method.
6795         (icf_status_): New variable.
6796         * (options.cc) (General_options::finalize): Set icf_status_.
6797         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
6798         icf_test and icf_keep_unique_test to use the --icf enum flag.
6799         * testsuite/icf_safe_test.sh: New file.
6800         * testsuite/icf_safe_test.cc: New file.
6801
6802 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
6803
6804         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
6805         includes to gc.h and icf.h.
6806         * arm.cc: Include gc.h.
6807         * gold.cc: Likewise.
6808         * i386.cc: Likewise.
6809         * powerpc.cc: Likewise.
6810         * sparc.cc: Likewise.
6811         * x86_64.cc: Likewise.
6812         * gc.h: Include icf.h.
6813
6814 2009-10-11  Ian Lance Taylor  <iant@google.com>
6815
6816         * plugin.cc: Include "gold.h" before other header files.
6817
6818 2009-10-10  Chris Demetriou  <cgd@google.com>
6819
6820         * options.h (Input_file_argument::Input_file_type): New enum.
6821         (Input_file_argument::is_lib_): Replace with...
6822         (Input_file_argument::type_): New member.
6823         (Input_file_argument::Input_file_argument): Take Input_file_type
6824         'type' rather than boolean 'is_lib' as second argument.
6825         (Input_file_argument::is_lib): Use type_.
6826         (Input_file_argument::is_searched_file): New function.
6827         (Input_file_argument::may_need_search): Handle is_searched_file.
6828         * options.cc (General_options::parse_library): Support -l:filename.
6829         (General_options::parse_just_symbols): Update for Input_file_argument
6830         changes.
6831         (Command_line::process): Likewise.
6832         * archive.cc (Archive::get_file_and_offset): Likewise.
6833         * plugin.cc (Plugin_manager::release_input_file): Likewise.
6834         * script.cc (read_script_file, script_add_file): Likewise.
6835         * fileread.cc (Input_file::Input_file): Likewise.
6836         (Input_file::will_search_for): Handle is_searched_file.
6837         (Input_file::open): Likewise.
6838         * readsyms.cc (Read_symbols::get_name): Likewise.
6839         * testsuite/Makefile.am (searched_file_test): New test.
6840         * testsuite/Makefile.in: Regenerate.
6841         * testsuite/searched_file_test.cc: New file.
6842         * testsuite/searched_file_test_lib.cc: New file.
6843
6844 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6845             Ian Lance Taylor  <iant@google.com>
6846
6847         * descriptor.cc: Include <cstdio> and "binary-io.h".
6848         (Descriptors::open): Open the files in binary mode always.
6849         * script.cc (Lex::get_token): Treat \r as whitespace.
6850
6851 2009-10-09  Ian Lance Taylor  <iant@google.com>
6852
6853         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
6854
6855 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6856             Ian Lance Taylor  <iant@google.com>
6857
6858         * configure.ac: Check for readv function also.
6859         * fileread.cc (readv): Define if not HAVE_READV.
6860         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
6861         does not exist.
6862         * config.in: Regenerate.
6863         * configure: Regenerate.
6864
6865 2009-10-09  Doug Kwan  <dougkwan@google.com>
6866
6867         * layout.cc (Layout::make_output_section): Call target hook to make
6868         ordinary output section.
6869         (Layout::finalize): Adjust parameter list of call the
6870         Target::may_relax().
6871         * layout.h (class Layout::section_list): New method.
6872         * merge.h (Output_merge_base::entsize): Change visibility to public.
6873         (Output_merge_base::is_string, Output_merge_base::do_is_string):
6874         New methods.
6875         (Output_merge_string::do_is_string): New method.
6876         * object.cc (Sized_relobj::do_setup): renamed from
6877         Sized_relobj::set_up.
6878         * object.h (Sized_relobj::adjust_shndx,
6879         Sized_relobj::initializ_input_to_output_maps,
6880         Sized_relobj::free_input_to_output_maps): Change visibilities to
6881         protected.
6882         (Sized_relobj::setup): Virtualize.
6883         (Sized_relobj::do_setup): New method declaration.
6884         (Sized_relobj::invalidate_section_offset,
6885         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
6886         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
6887         * options.cc (parse_int): New function.
6888         * options.h (parse_int): New declaration.
6889         (DEFINE_int): New macro.
6890         (stub_group_size): New option.
6891         * output.cc (Output_section::Output_section): Initialize memebers
6892         merge_section_map_, merge_section_by_properties_map_,
6893         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
6894         (Output_section::add_input_section): Handled deferred code-fill
6895         generation and remove an old comment.
6896         (Output_section::add_relaxed_input_section): New method definition.
6897         (Output_section::add_merge_input_section): Use merge section by
6898         properties map to speed to search.  Update merge section maps
6899         as appropriate.
6900         (Output_section::build_relaxation_map): New method definition.
6901         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6902         Same.
6903         (Output_section::relax_input_section): Renamed to
6904         Output_section::convert_input_sections_to_relaxed_sections and change
6905         interface to take a vector of pointers to relaxed sections.
6906         (Output_section::find_merge_section,
6907         Output_section::find_relaxed_input_section): New method definitions.
6908         (Output_section::is_input_address_mapped,
6909         Output_section::output_offset, Output_section::output_address):
6910         Use output section data maps to speed up searching.
6911         (Output_section::find_starting_output_address): Add comments.
6912         (Output_section::do_write,
6913         Output_section::write_to_postprocessing_buffer): Do code-fill
6914         generation as appropriate.
6915         (Output_section::get_input_sections): Invalidate relaxed input section
6916         map.
6917         (Output_section::restore_states): Adjust type of checkpoint .
6918         Invalidate relaxed input section map.
6919         * output.h (Output_merge_base): New class declaration.
6920         (Input_section_specifier): New class defintion.
6921         (class Output_relaxed_input_section) Change base class to
6922         Output_section_data_build.
6923         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
6924         base class initializer.
6925         (Output_section::add_relaxed_input_section): New method declaration.
6926         (Output_section::Input_section): Change visibility to protected.
6927         (Output_section::Input_section::relobj,
6928         Output_section::Input_section::shndx): Handle relaxed input sections.
6929         Output_section::input_sections) Change visibility to protected.  Also
6930         define overload to return a non-const pointer.
6931         (Output_section::Merge_section_properties): New class defintion.
6932         (Output_section::Merge_section_by_properties_map,
6933         Output_section::Output_section_data_by_input_section_map,
6934         Output_section::Relaxation_map): New types.
6935         (Output_section::relax_input_section): Rename method to
6936         Output_section::convert_input_sections_to_relaxed_sections and change
6937         interface to take a vector of relaxed section pointers.
6938         (Output_section::find_merge_section,
6939         Output_section::find_relaxed_input_section,
6940         Output_section::build_relaxation_map,
6941         Output_section::convert_input_sections_in_list_to_relaxed_sections):
6942         New method declarations.
6943         (Output_section::merge_section_map_
6944         Output_section::merge_section_by_properties_map_,
6945         Output_section::relaxed_input_section_map_,
6946         Output_section::is_relaxed_input_section_map_valid_,
6947         Output_section::generate_code_fills_at_write_): New data members.
6948         * script-sections.cc
6949         (Output_section_element_input::set_section_addresses): Call
6950         current_data_size and addralign methods of relaxed input sections.
6951         (Orphan_output_section::set_section_addresses): Call current_data_size
6952         and addralign methods of relaxed input sections.
6953         * symtab.cc (Symbol_table::compute_final_value): Extract template
6954         from the body of Symbol_table::sized_finalize_symbol.
6955         (Symbol_table::sized_finalized_symbol): Call
6956         Symbol_table::compute_final_value.
6957         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
6958         (Symbol_table::compute_final_value): New templated method declaration.
6959         * target.cc (Target::do_make_output_section): New method defintion.
6960         * target.h (Target::make_output_section): New method declaration.
6961         (Target::relax): Add more parameters for input objects, symbol table
6962         and layout.  Adjust call to do_relax.
6963         (Target::do_make_output_section): New method declaration.
6964         (Target::do_relax): Add parameters for input objects, symbol table
6965         and layout.
6966
6967 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6968
6969         * pread.c: Include stdio.h.
6970
6971 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6972
6973         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
6974         defined.
6975
6976 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6977
6978         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6979         Change read_shndx type to unsigned int.
6980         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6981         int.
6982         (Sized_dwarf_line_info::read_line_mappings): Likewise.
6983         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
6984         Change read_shndx type to unsigned int.
6985         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6986         int.
6987         (Sized_dwarf_line_info::read_line_mappings): Likewise.
6988         * layout.cc (Layout::create_symtab_sections): Cast the result of
6989         local_symcount * symsize to off_t in the gold_assert.
6990
6991 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6992
6993         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
6994         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
6995         R_ARM_BASE_ABS.
6996         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
6997         (Arm_relocate_functions::thm_abs5): New function.
6998         (Arm_relocate_functions::abs12): New function.
6999         (Arm_relocate_functions::abs16): New function.
7000         (Arm_relocate_functions::base_abs): New function.
7001         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
7002         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
7003         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
7004         R_ARM_BASE_ABS.
7005         (Scan::global): Likewise.
7006         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
7007         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
7008         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
7009         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
7010         R_ARM_BASE_ABS.
7011
7012 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7013
7014         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
7015         (Arm_relocate_functions::movt_prel): New function.
7016         (Arm_relocate_functions::thm_movw_prel_nc): New function.
7017         (Arm_relocate_functions::thm_movt_prel): New function.
7018         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
7019         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
7020         (Scan::global, Relocate::relocate): Likewise.
7021         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7022
7023 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
7024
7025         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
7026         Incremental_checker.
7027         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
7028         unsigned int.
7029         (class Incremental_inputs_header): New class.
7030         (Incremental_inputs_header_writer): Edit comment.
7031         (Incremental_inputs_entry): New class.
7032         (Incremental_inputs_entry_writer): Edit comment.
7033         (Sized_incremental_binary::do_find_incremental_inputs_section):
7034         Add *strtab_shndx parameter, fill it.
7035         (Sized_incremental_binary::do_check_inputs): New method.
7036         (Incremental_checker::can_incrementally_link_output_file): Use
7037         Sized_incremental_binary::check_inputs.
7038         (Incremental_inputs::report_command_line): Save command line in
7039         command_line_.
7040         * incremental.h:
7041         (Incremental_binary::find_incremental_inputs_section): New
7042         method.
7043         (Incremental_binary::do_find_incremental_inputs_section): Add
7044         strtab_shndx parameter.
7045         (Incremental_binary::do_check_inputs): New pure virtual method.
7046         (Sized_incremental_binary::do_check_inputs): Declare.
7047         (Incremental_checker::Incremental_checker): Add incremental_inputs
7048         parameter, use it to initialize incremental_inputs_.
7049         (Incremental_checker::incremental_inputs_): New field.
7050         (Incremental_checker::command_line): New method.
7051         (Incremental_checker::inputs): New method.
7052         (Incremental_checker::command_line_): New field.
7053
7054 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
7055
7056         * incremental.cc: Include <cstdarg> and "target-select.h".
7057         (vexplain_no_incremental): New function.
7058         (explain_no_incremental): New function.
7059         (Incremental_binary::error): New method.
7060         (Sized_incremental_binary::do_find_incremental_inputs_section): New
7061         method.
7062         (make_sized_incremental_binary): New function.
7063         (open_incremental_binary): New function.
7064         (can_incrementally_link_file): Add checks if output is ELF and has
7065         inputs section.
7066         * incremental.h: Include "elfcpp_file.h" and "output.h".
7067         (Incremental_binary): New class.
7068         (Sized_incremental_binary): New class.
7069         (open_incremental_binary): Declare.
7070         * object.cc (is_elf_object): Use
7071         elfcpp::Elf_recognizer::is_elf_file.
7072         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
7073         * output.h (Output_file::filesize): New method.
7074
7075 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7076
7077         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
7078         New function.
7079         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
7080         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
7081         function.
7082         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
7083         function.
7084         (Arm_relocate_functions::movw_abs_nc): New function.
7085         (Arm_relocate_functions::movt_abs): New function.
7086         (Arm_relocate_functions::thm_movw_abs_nc): New function.
7087         (Arm_relocate_functions::thm_movt_abs): New function.
7088         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
7089         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
7090         (Scan::global): Likewise.
7091         (Relocate::relocate): Likewise.
7092         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7093
7094 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7095
7096         * arm.cc (Arm_relocate_functions::got_prel) New function.
7097         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
7098         (Relocate::relocate): Likewise.
7099         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7100
7101 2009-10-06  Ian Lance Taylor  <iant@google.com>
7102
7103         * options.h (class General_options): Define
7104         split_stack_adjust_size parameter.
7105         * object.h (class Object): Add uses_split_stack_ and
7106         has_no_split_stack_ fields.  Add uses_split_stack and
7107         has_no_split_stack accessor functions.  Declare
7108         handle_split_stack_section.
7109         (class Reloc_symbol_changes): Define.
7110         (class Sized_relobj): Define Function_offsets.  Declare
7111         split_stack_adjust, split_stack_adjust_reltype, and
7112         find_functions.
7113         * object.cc (Object::handle_split_stack_section): New function.
7114         (Sized_relobj::do_layout): Call handle_split_stack_section.
7115         * dynobj.cc (Sized_dynobj::do_layout): Call
7116         handle_split_stack_section.
7117         * reloc.cc (Sized_relobj::relocate_sections): Call
7118         split_stack_adjust for executable sections in split_stack
7119         objects.  Pass reloc_map to relocate_section.
7120         (Sized_relobj::split_stack_adjust): New function.
7121         (Sized_relobj::split_stack_adjust_reltype): New function.
7122         (Sized_relobj::find_functions): New function.
7123         * target-reloc.h: Include "object.h".
7124         (relocate_section): Add reloc_symbol_changes parameter.  Change
7125         all callers.
7126         * target.h (class Target): Add calls_non_split method.  Declare
7127         do_calls_non_split virtual method.  Declare match_view and
7128         set_view_to_nop.
7129         * target.cc: Include "elfcpp.h".
7130         (Target::do_calls_non_split): New function.
7131         (Target::match_view): New function.
7132         (Target::set_view_to_nop): New function.
7133         * gold.cc (queue_middle_tasks): Give an error if mixing
7134         split-stack and non-split-stack objects with -r.
7135         * i386.cc (Target_i386::relocate_section): Add
7136         reloc_symbol_changes parameter.
7137         (Target_i386::do_calls_non_split): New function.
7138         * x86_64.cc (Target_x86_64::relocate_section): Add
7139         reloc_symbol_changes parameter.
7140         (Target_x86_64::do_calls_non_split): New function.
7141         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
7142         parameter.
7143         * powerpc.cc (Target_powerpc::relocate_section): Add
7144         reloc_symbol_changes parameter.
7145         * sparc.cc (Target_sparc::relocate_section): Add
7146         reloc_symbol_changes parameter.
7147         * configure.ac: Call AM_CONDITIONAL for the default target.
7148         * configure: Rebuild.
7149         * testsuite/Makefile.am (TEST_AS): New variable.
7150         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
7151         (check_DATA): Add split_i386 and split_x86_64 files.
7152         (SPLIT_DEFSYMS): Define.
7153         (split_i386_[1234n].o): New targets.
7154         (split_i386_[124]): New targets.
7155         (split_i386_[1234r].stdout): New targets.
7156         (split_x86_64_[1234n].o): New targets.
7157         (split_x86_64_[124]): New targets.
7158         (split_x86_64_[1234r].stdout): New targets.
7159         (MOSTLYCLEANFILES): Add new executables.
7160         * testsuite/split_i386.sh: New file.
7161         * testsuite/split_x86_64.sh: New file.
7162         * testsuite/split_i386_1.s: New file.
7163         * testsuite/split_i386_2.s: New file.
7164         * testsuite/split_i386_3.s: New file.
7165         * testsuite/split_i386_4.s: New file.
7166         * testsuite/split_i386_n.s: New file.
7167         * testsuite/split_x86_64_1.s: New file.
7168         * testsuite/split_x86_64_2.s: New file.
7169         * testsuite/split_x86_64_3.s: New file.
7170         * testsuite/split_x86_64_4.s: New file.
7171         * testsuite/split_x86_64_n.s: New file.
7172         * testsuite/testfile.cc (Target_test): Update relocation_section
7173         function.
7174         * testsuite/Makefile.in: Rebuild.
7175
7176 2009-10-06  Ian Lance Taylor  <iant@google.com>
7177
7178         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
7179         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
7180         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
7181         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
7182         the address on ldo_addrs_.
7183         (Target_i386::Relocate::fix_up_ldo): New function.
7184
7185 2009-10-06   Rafael Espindola  <espindola@google.com>
7186
7187         * plugin.cc (add_input_library): New.
7188         (Plugin::load): Add add_input_library to tv.
7189         (Plugin_manager::add_input_file): Add the is_lib argument.
7190         (add_input_file): Update call to Plugin_manager::add_input_file.
7191         (add_input_library): New.
7192         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
7193
7194 2009-09-30  Doug Kwan  <dougkwan@google.com>
7195
7196         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
7197         symbol and call Symbol::may_need_copy_reloc to determine if
7198         a copy reloc is needed.
7199         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
7200         nocopyreloc is given in command line.
7201         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
7202         given in command line.
7203         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
7204         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
7205         of the removed Target_i386::may_need_copy_reloc.
7206         * options.h (copyreloc): New option with default value false.
7207         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
7208         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
7209         instead of the removed Target_powerpc::may_need_copy_reloc.
7210         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
7211         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
7212         instead of the removed Target_sparc::may_need_copy_reloc.
7213         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
7214         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
7215         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
7216         instead of the removed Target_x86_64::may_need_copy_reloc.
7217
7218 2009-09-30  Ian Lance Taylor  <iant@google.com>
7219
7220         * object.h (class Object): Remove target_ field, and target,
7221         sized_target, and set_target methods.
7222         (Object::sized_target): Remove.
7223         (class Sized_relobj): Update declarations.  Remove sized_target.
7224         * object.cc (Sized_relobj::setup): Remove target parameter.
7225         Change all callers.
7226         (Input_objects::add_object): Don't do anything with the target.
7227         (make_elf_sized_object): Add punconfigured parameter.  Change all
7228         callers.  Set or test parameter target.
7229         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
7230         Change all callers.
7231         * parameters.cc (Parameters::set_target): Change parameter type to
7232         be non-const.
7233         (Parameters::default_target): Remove.
7234         (set_parameters_target): Change parameter type to be non-const.
7235         (parameters_force_valid_target): New function.
7236         (parameters_clear_target): New function.
7237         * parameters.h (class Parameters): Update declarations.  Remove
7238         default_target method.  Add sized_target and clear_target
7239         methods.  Change target_ to be non-const.
7240         (set_parameters_target): Update declaration.
7241         (parameters_force_valid_target): Declare.
7242         (parameters_clear_target): Declare.
7243         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
7244         as NULL if we aren't searching.
7245         (Add_symbols::run): Don't check for compatible target.
7246         * fileread.cc (Input_file::open_binary): Call
7247         parameters_force_valid_target.
7248         * gold.cc (queue_middle_tasks): Likewise.
7249         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
7250         set_target on object.
7251         * dynobj.h (class Sized_dynobj): Update declarations.
7252         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
7253         make_elf_object returns NULL.
7254         (Archive::include_member): Don't check whether object target is
7255         compatible.
7256         * output.cc (Output_section::add_input_section): Get target from
7257         parameters.
7258         (Output_section::relax_input_section): Likewise.
7259         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
7260         parameters.
7261         (Sized_relobj::do_scan_relocs): Likewise.
7262         (Sized_relobj::relocate_sections): Likewise.
7263         * resolve.cc (Symbol_table::resolve): Likewise.
7264         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
7265         parameter.  Change all callers.
7266         (Symbol_table::add_from_object): Get target from parameters.
7267         (Symbol_table::add_from_relobj): Don't check object target.
7268         (Symbol_table::add_from_dynobj): Likewise.
7269         (Symbol_table::define_special_symbol): Get target from
7270         parameters.
7271         * symtab.h (class Symbol_table): Update declaration.
7272         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
7273         parameter.  Change all callers.  Clear parameter target.
7274         (Binary_test): Test target here.
7275         * testsuite/object_unittest.cc (gold_testsuite): Remove
7276         target_test_pointer parameter.  Change all callers.
7277         (Object_test): Test target here.
7278
7279 2009-09-26  Ian Lance Taylor  <iant@google.com>
7280
7281         * testsuite/initpri1.c: Don't try to use constructor priorities if
7282         compiling with gcc before 4.3.
7283
7284 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
7285
7286         * testsuite/retain_symbols_file_test.sh (check_present): Change
7287         output file name to retain_symbols_file_test.stdout.
7288         (check_absent): Likewise.
7289
7290 2009-09-18  Craig Silverstein  <csilvers@google.com>
7291
7292         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
7293         * options.cc: Include <cerrno> and <fstream>.
7294         (General_options::finalize): Parse -retain-symbols-file tag.
7295         * options.h: New flag.
7296         (General_options): New method should_retain_symbol, new
7297         variable symbols_to_retain.
7298         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
7299         should_retain_symbol map.
7300         * testsuite/Makefile.am (retain_symbols_file_test): New test.
7301         * testsuite/Makefile.in: Regenerate.
7302         * testsuite/retain_symbols_file_test.sh: New file.
7303
7304 2009-09-18  Nick Clifton  <nickc@redhat.com>
7305
7306         * po/es.po: Updated Spanish translation.
7307
7308 2009-09-17  Doug Kwan  <dougkwan@google.com>
7309
7310         * debug.h (DEBUG_RELAXATION): New constant.
7311         (DEBUG_ALL): Add DEBUG_RELAXATION.
7312         (debug_string_to_enum): Add relaxation debug option.
7313         * layout.cc
7314         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
7315         Layout::Relaxation_debug_check::read_sections,
7316         Layout::Relaxation_debug_check::read_sections): New method definitions.
7317         (Layout::Layout): Initialize data members
7318         record_output_section_data_from_scrips_,
7319         script_output_section_data_list_ and relaxation_debug_check_.
7320         (Layout::save_segments, Layout::restore_segments,
7321         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7322         Layout::relaxation_loop_body): New method definitions.
7323         (Layout::finalize): Support relaxation.  Move section layout code to
7324         Layout::relaxation_loop_body.
7325         (Layout::set_asection_address_from_script): Move code for orphan
7326         section placement out.
7327         (Layout::place_orphan_sections_in_script): New method definition.
7328         * layout.h (Output_segment_headers, Output_file_header):
7329         New forward class declarations.
7330         (Layout::~Layout): Define.
7331         (Layout::new_output_section_data_from_script): New method definition.
7332         (Layout::place_orphan_sections_in_script): New method declaration.
7333         (Layout::Segment_states): New type declaration.
7334         (Layout::save_segments, Layout::restore_segments,
7335         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7336         Layout::relaxation_loop_body): New method declarations.
7337         (Layout::Output_section_data_list): New type declaration.
7338         (Layout::Relaxation_debug_check): New class definition.
7339         (Layout::record_output_section_data_from_script_,
7340         Layout::script_output_section_data_list_, Layout::segment_states_,
7341         Layout::relaxation_debug_check_): New data members.
7342         * output.cc: (Output_section_headers::do_size): New method definition.
7343         (Output_section_headers::Output_section_headers): Move size
7344         computation to Output_section_headers::do_size.
7345         (Output_segment_headers::do_size): New method definition.
7346         (Output_file_header::Output_file_header): Move size computation to
7347         Output_file_header::do_size and call it.
7348         (Output_file_header::do_size): New method definition.
7349         (Output_data_group::Output_data_group): Adjust call to
7350         Output_section_data.
7351         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
7352         (Output_symtab_xindex::do_write): Add array bound check.
7353         (Output_section::Input_section::print_to_mapfile): Handle
7354         RELAXED_INPUT_SECTION_CODE.
7355         (Output_section::Output_section): Initialize data member checkpoint_.
7356         (Output_section::~Output_section): Delete checkpoint object pointed
7357         by checkpoint_.
7358         (Output_section::add_input_section): Always add an Input_section if
7359         relaxing.
7360         (Output_section::add_merge_input_section): Add assert.
7361         (Output_section::relax_input_section): New method definition.
7362         (Output_section::set_final_data_size): Set load address to zero for
7363         an unallocated section.
7364         (Output_section::do_address_and_file_offset_have_reset_values):
7365         New method definition.
7366         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
7367         Handle relaxed input section.
7368         (Output_section::sort_attached_input_sections): Checkpoint input
7369         section list lazily.
7370         (Output_section::get_input_sections): Change type of input_sections to
7371         list of Simple_input_section pointers.  Checkpoint input section list
7372         lazily.  Also handle relaxed input sections.
7373         (Output_section::add_input_section_for_script): Take a reference to
7374         a Simple_input_section object instead of Relobj pointer and section
7375         index as parameter.  Handle relaxed input sections.
7376         (Output_section::save_states, Output_section::restore_states): New
7377         method definitions.
7378         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
7379         (Output_data::is_data_size_fixed): New method definition.
7380         (Output_data::reset_addresss_and_file_offset): Do not reset data size
7381         if it is fixed.
7382         (Output_data::address_and_file_offset_have_reset_values): New method
7383         definition.
7384         (Output_data::do_address_and_file_offset_have_reset_values): New method
7385         definition.
7386         (Output_data::set_data_size): Check that data size is not fixed.
7387         (Output_data::fix_data_size): New method definition.
7388         (Output_data::is_data_size_fixed_): New data member.
7389         (Output_section_headers::set_final_data_size): New method definition.
7390         (Output_section_headers::do_size): New method declaration.
7391         (Output_segment_headers::set_final_data_size): New method definition.
7392         (Output_segment_headers::do_size): New method declaration.
7393         (Output_file_header::set_final_data_size)::New method definition.
7394         (Output_file_header::do_size)::New method declaration.
7395         (Output_section_data::Output_section_data): Add new parameter
7396         is_data_size_fixed and use it to fix data size.
7397         (Output_data_const::Output_data_const): Adjust call to base class
7398         constructor and fix data size.
7399         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
7400         base class constructor and fix data size.
7401         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
7402         base class constructor and fix data size.
7403         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
7404         class constructor and fix data size.
7405         (Output_data_group::set_final_data_size): New method definition.
7406         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
7407         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
7408         class constructor and fix data size.
7409         (Output_relaxed_input_section): New class definition.
7410         (Output_section::Simple_input_section): New class definition.
7411         (Output_section::get_input_sections): Adjust parameter list.
7412         (Output_section::add_input_section_for_script): Same.
7413         (Output_section::save_states, Output_section::restore_states,
7414         Output_section::do_address_and_file_offset_have_reset_values,
7415         (Output_section::Input_section::Input_section): Handle
7416         RELAXED_INPUT_SECTION_CODE.  Add new overload for
7417         Output_relaxed_input_section.
7418         (Output_section::Input_section::is_input_section,
7419         Output_section::Input_section::set_output_section): Handle relaxed
7420         input section.
7421         (Output_section::Input_section::is_relaxed_input_section,
7422         Output_section::Input_section::output_section_data,
7423         Output_section::Input_section::relaxed_input_section): New method
7424         definitions.
7425         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
7426         value.
7427         (Output_section::Input_section::u1_): Update comments.
7428         (Output_section::Input_section::u2_): Add new union member poris.
7429         (Output_section::Checkpoint_output_section): New classs definition.
7430         (Output_section::relax_input_section): New method declaration.
7431         (Output_section::checkpoint_): New data member.
7432         (Output_segment): Update comments.
7433         (Output_segment::Output_segment): Un-privatize copy constructor.
7434         (Output_segment::operator=): Un-privatize.
7435         * script-sections.cc (Output_section_element::Input_section_list):
7436         Change element type to Output_section::Simple_input_section.
7437         (Output_section_element_dot_assignment::set_section_addresses):
7438         Register output section data for relaxation clean up.
7439         (Output_data_exression::Output_data_expression): Adjust call to base
7440         constructor to fix data size.
7441         (Output_section_element_data::set_section_addresses): Register
7442         Output_data_expression object for relaxation clean up.
7443         (struct Input_section_info): Replace Relobj pointer and section index
7444         pair with Output_section::Simple_input_section and Convert struct to a
7445         class.
7446         (Input_section_sorter::operator()): Adjust access to
7447         Input_section_info data member to use accessors.
7448         (Output_section_element_input::set_section_addresses): Use layout
7449         parameter.  Adjust code to use Output_section::Simple_input_section
7450         and Input_secction_info classes.  Register filler for relaxation
7451         clean up.
7452         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
7453         and section index pair with Output_section::Simple_input_section
7454         class.  Adjust code accordingly.
7455         (Phdrs_element::release_segment): New method definition.
7456         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
7457         segment list.
7458         (Script_sections::release_segments): New method definition.
7459         * gold/script-sections.h (Script_sections::release_segments): New
7460         method declaration.
7461         * gold/target.h (Target::may_relax, Target::relax,
7462         Target::do_may_relax, Target::do_relax): New method definitions.
7463
7464 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7465
7466         * arm.cc (has_signed_unsigned_overflow): New function.
7467         (Arm_relocate_functions::abs8): New function.
7468         (Target_arm::Scan::local): Handle R_ARM_ABS8.
7469         (Target_arm::Scan::global): Likewise.
7470         (Target_arm::relocate::relocate): Likewise.
7471         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7472         Likewise.
7473
7474 2009-09-16  Cary Coutant  <ccoutant@google.com>
7475
7476         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
7477         * testsuite/Makefile.in: Regenerate.
7478
7479 2009-09-11  Nick Clifton  <nickc@redhat.com>
7480
7481         * po/gold.pot: Updated by the Translation project.
7482
7483 2009-09-08  Cary Coutant  <ccoutant@google.com>
7484
7485         * output.cc (Output_file::open): Add execute permission to empty file.
7486         * testsuite/Makefile.am (permission_test): New test.
7487         * testsuite/Makefile.in: Regenerate.
7488
7489 2009-09-02  Ian Lance Taylor  <iant@google.com>
7490
7491         * output.cc (Output_file::resize): Call map_no_anonymous rather
7492         than map.
7493
7494 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
7495
7496         * gold.cc: Include "incremental.h".
7497         (queue_initial_tasks): Call Incremental_checker methods.
7498         * incremental.cc: Include "output.h".
7499         (Incremental_checker::can_incrementally_link_output_file): New
7500         method.
7501         * incremental.h (Incremental_checker): New class.
7502
7503         * output.cc (Output_file::open_for_modification): New method.
7504         (Output_file::map_anonymous): Changed return type to bool.  Record
7505         map in base_ field.
7506         (Output_file::map_no_anonymous): New method, broken out of map.
7507         (Output_file::map): Use map_no_anonymous and map_anonymous.
7508         * output.h (class Output_file): Update declarations.
7509
7510 2009-08-24  Cary Coutant  <ccoutant@google.com>
7511
7512         * options.h (Command_line::Pre_options): New class.
7513         (Command_line::pre_options): New member.
7514         * options.cc (gold::options::ready_to_register): New variable.
7515         (One_option::register_option): Do nothing if not registering options.
7516         Assert if same short option registered twice.
7517         (General_options::General_options): Turn off option registration when
7518         done constructing.
7519         (Command_line::Pre_options::Pre_options): New constructor.
7520
7521 2009-08-24  Cary Coutant  <ccoutant@google.com>
7522
7523         * options.h (General_options::no_keep_memory): Remove incorrect
7524         short option.
7525
7526 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7527
7528         * Makefile.am (am__skiplex, am__skipyacc): New.
7529         * Makefile.in: Regenerate.
7530
7531 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7532
7533         * Makefile.am (AM_CPPFLAGS): Renamed from ...
7534         (INCLUDES): ... this.
7535         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
7536         (AM_CPPFLAGS): Renamed from ...
7537         (INCLUDE): ... this.
7538         * Makefile.in, testsuite/Makefile.in: Regenerate.
7539
7540         * Makefile.in: Regenerate.
7541         * aclocal.m4: Likewise.
7542         * config.in: Likewise.
7543         * configure: Likewise.
7544         * testsuite/Makefile.in: Likewise.
7545
7546         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7547         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7548         * Makefile.in: Regenerate.
7549         * testsuite/Makefile.in: Regenerate.
7550
7551 2009-08-19  Cary Coutant  <ccoutant@google.com>
7552
7553         * resolve.cc (Symbol_table::resolve): Don't complain about defined
7554         symbols in shared libraries overridden by hidden or internal symbols
7555         in the main program.
7556
7557 2009-08-19  Chris Demetriou  <cgd@google.com>
7558
7559         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
7560         checking source file names in error messages.
7561
7562 2009-08-18  Doug Kwan  <dougkwan@google.com>
7563
7564         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
7565         an elcpp::Ehdr as parameter.  Adjust call to set_target.
7566         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
7567         an elfcpp::Ehdr as parameter.
7568         * object.cc (Object::set_target): Remove the version that looks up
7569         a target and sets it.
7570         (Sized_relobj::setup): Take a Target object instead of
7571         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
7572         (make_elf_sized_object): Find target and ask target to
7573         make an ELF object.
7574         * object.h: (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.
7578         * target.cc: Include dynobj.h.
7579         (Target::do_make_elf_object_implementation): New.
7580         (Target::do_make_elf_object): New.
7581         * target.h (Target::make_elf_object): New template declaration.
7582         (Target::do_make_elf_object): New method declarations.
7583         (Target::do_make_elf_object_implementation): New template declaration.
7584
7585 2009-08-14  Ian Lance Taylor  <iant@google.com>
7586
7587         * gold.h (FUNCTION_NAME): Define.
7588         (gold_unreachable): Use FUNCTION_NAME.
7589
7590 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
7591
7592         * icf.cc (Icf::find_identical_sections): Issue a warning when a
7593         symbol in the --keep-unique list is not found.
7594
7595 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
7596
7597         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
7598         been maked as --keep-unique.
7599         (Icf::unfold_section): New function.
7600         * icf.h (Icf::unfold_section): New function.
7601         * options.h (General_options::keep_unique): New option.
7602         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
7603         * testsuite/Makefile.in: Regenerate.
7604         * testsuite/icf_keep_unique_test.sh: New file.
7605         * testsuite/icf_keep_unique_test.cc: New file.
7606
7607 2009-08-12  Cary Coutant  <ccoutant@google.com>
7608
7609         PR 10471
7610         * resolve.cc (Symbol_table::resolve): Check for references from
7611         dynamic objects to hidden and internal symbols.
7612         * testsuite/Makefile.am (hidden_test.sh): New test.
7613         * testsuite/Makefile.in: Regenerate.
7614         * testsuite/hidden_test.sh: New script.
7615         * testsuite/hidden_test_1.c: New test source.
7616         * testsuite/hidden_test_main.c: New test source.
7617
7618 2009-08-11  Doug Kwan  <dougkwan@google.com>
7619
7620         * arm.cc: Update comments.
7621         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
7622         segment to locate the .ARM.exidx section if present.
7623
7624 2009-08-09  Doug Kwan  <dougkwan@google.com>
7625
7626         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
7627         patch.
7628
7629 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
7630         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
7631         compiler warnings.
7632
7633 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
7634
7635         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
7636         valid tls_segment only for non-debug-section relocations.
7637         * testsuite/Makefile.am: Add gc_tls_test.
7638         * testsuite/Makefile.in: Regenerate.
7639         * testsuite/gc_tls_test.cc: New file.
7640         * testsuite/gc_tls_test.sh: New file.
7641
7642 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
7643
7644         * icf.cc: New file.
7645         * icf.h: New file.
7646         * Makefile.am (CCFILES): Add icf.cc.
7647         (HFILES): Add icf.h
7648         * Makefile.in: Regenerate.
7649         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
7650         * gc.h (gc_process_relocs): Populate lists used by icf to contain
7651         section, symbol and addend information for the relocs.
7652         * gold.cc (queue_middle_tasks): Call identical code folding.
7653         * gold.h: Add defines for multimap.
7654         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
7655         to the call of finalize_local_symbols.
7656         * main.cc (main): Create object of class Icf.
7657         * object.cc (Sized_relobj::do_layout): Allow this function to be
7658         called twice during icf.
7659         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
7660         to sections marked as identical by icf.
7661         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
7662         when available.
7663         (Sized_relobj::do_section_entsize): New function.
7664         * object.h (Object::section_entsize): New function.
7665         (Object::do_section_entsize): New pure virtual function.
7666         (Relobj::finalize_local_symbols): Add new parameter.
7667         (Relobj::do_section_entsize): New function.
7668         * options.h (General_options::icf): New option.
7669         (General_options::icf_iterations): New option.
7670         (General_options::print_icf_sections): New option.
7671         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
7672         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
7673         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
7674         icf.
7675         * symtab.cc (Symbol_table::is_section_folded): New function.
7676         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
7677         to sections marked as identical by icf.
7678         * symtab.h (Symbol_table::set_icf): New function.
7679         (Symbol_table::icf): New function.
7680         (Symbol_table::is_section_folded): New function.
7681         (Symbol_table::icf_): New data member.
7682         * target-reloc.h (relocate_section): Ignore sections folded by icf.
7683         * testsuite/Makefile.am: Add commands to build icf_test.
7684         * testsuite/Makefile.in: Regenerate.
7685         * testsuite/icf_test.sh: New file.
7686         * testsuite/icf_test.cc: New file.
7687
7688 2009-07-24  Chris Demetriou  <cgd@google.com>
7689
7690         * layout.cc (is_compressible_debug_section): Fix incorrect
7691         comment about compressed section names.
7692
7693 2009-07-20  Ian Lance Taylor  <ian@airs.com>
7694
7695         PR 10419
7696         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
7697
7698 2009-07-16  Ian Lance Taylor  <iant@google.com>
7699
7700         PR 10400
7701         * layout.h: #include <map>.
7702         (class Kept_section): Change from struct to class.  Add accessors
7703         and setters.  Add section size to Comdat_group mapping.  Change
7704         Comdat_group to std::map.  Add is_comdat_ field.  Add
7705         linkonce_size field in union.
7706         (class Layout): Update declaration of find_or_add_kept_section.
7707         Don't declare find_kept_object.
7708         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
7709         parameter.  Add object, shndx, is_comdat, and is_group_name
7710         parameters.  Change all callers.  Adjust for new Kept_section.
7711         (Layout::find_kept_object): Remove.
7712         * object.cc (Sized_relobj::include_section_group): Update use of
7713         Kept_section.  Rename secnum to shndx.  Only record
7714         Kept_comdat_section if sections are the same size.
7715         (Sized_relobj::include_linkonce_section): Update use of
7716         Kept_section.  Only record Kept_comdat_section if sections are the
7717         same size.  Set size of linkonce section.
7718         (Sized_relobj::map_to_kept_section): Update call to
7719         get_kept_comdat_section.
7720         * object.h (class Sized_relobj): Rename fields in
7721         Kept_comdat_section to drop trailing underscores; change object
7722         field to Relobj*.  Change Kept_comdat_section_table to store
7723         struct rather than pointer.
7724         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
7725         Add kept_object and kept_shndx parameters.  Change all callers.
7726         (Sized_relobj::get_kept_comdat_section): Change return type to
7727         bool.  Add kept_object and kept_shndx parameters.  Change all
7728         callers.
7729         * plugin.cc (Pluginobj::include_comdat_group): Update call to
7730         Layout::find_or_add_kept_section.
7731
7732 2009-07-09  Ian Lance Taylor  <iant@google.com>
7733
7734         * merge.cc (Object_merge_map::initialize_input_to_output_map):
7735         Reserve space in the hash table.
7736
7737 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
7738
7739         * fileread.cc (File_read::get_mtime): New method.
7740         * fileread.h (Timespec): New structure.
7741         (File_read::get_mtime): New method.
7742         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
7743         Renamed from timestamp_nsec.
7744         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
7745         Elf_Xword.
7746         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
7747         timestamp_nsec.
7748         (Incremental_inputs::report_archive): Save mtime; style fix.
7749         (Incremental_inputs::report_obejct): Save mtime; style fix.
7750         (Incremental_inputs::report_script): Save mtime; style fix.
7751         (Incremental_inputs::finalize_inputs): Style fix.
7752         (Incremental_inputs::finalize): Style fix.
7753         (Incremental_inputs::create_input_section_data): Store inputs
7754         mtime.
7755         * incremental.h (Incremental_inputs::report_script): Add mtime
7756         argument.
7757         (Incremental_inputs::Input_info::Input_info): Intialize only one
7758         union member.
7759         (Incremental_inputs::Input_info::archive): Move to nameless
7760         union.
7761         (Incremental_inputs::Input_info::obejct): Move to nameless union.
7762         (Incremental_inputs::Input_info::script): Move to nameless union.
7763         (Incremental_inputs::mtime): New field.
7764         * script.cc (read_input_script): Pass file mtime to
7765         Incremental_input.
7766         * script.h (Script_info::inputs): Style fix.
7767
7768 2009-07-01  Ian Lance Taylor  <ian@airs.com>
7769
7770         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
7771         instead of 32.
7772
7773 2009-06-24  Ian Lance Taylor  <iant@google.com>
7774
7775         PR 10156
7776         * layout.cc (Layout::choose_output_section): If we find an
7777         existing section, update the flags.
7778         (Layout::create_notes): New function, broken out of
7779         Layout::finalize.
7780         (Layout::finalize): Don't create note sections.
7781         (Layout::create_note): Don't crash if linker script discards
7782         section.
7783         (Layout::create_gold_note): Likewise.
7784         (Layout::create_build_id): Likewise.  Don't set
7785         after_input_sections on the section.
7786         (Layout::create_executable_stack_info): Remove target parameter.
7787         Change caller.
7788         * layout.h (class Layout): Declare create_notes.  Update
7789         declaration of create_executable_stack_info.
7790         * gold.cc (queue_middle_tasks): Call create_notes.
7791         * output.cc (Output_section::update_flags_for_input_section): Move
7792         here from output.h.  If SHF_ALLOC flag is newly set, mark address
7793         invalid.
7794         * output.h (Output_data::mark_address_invalid): New function.
7795         (class Output_section): Only declare, not define,
7796         update_flags_for_input_section.  Remove set_flags.
7797
7798 2009-06-24  Ian Lance Taylor  <iant@google.com>
7799
7800         * script-sections.cc (Output_section_definition::
7801         set_section_addresses): Rename shadowing local load_address to
7802         laddr.
7803
7804 2009-06-24  Ian Lance Taylor  <iant@google.com>
7805
7806         PR 10244
7807         * reloc.cc (relocate_sections): Skip empty relocation sections.
7808
7809 2009-06-23  Ian Lance Taylor  <iant@google.com>
7810
7811         PR 10156
7812         * layout.cc (Layout::create_note): Use choose_output_section
7813         rather than make_output_section.
7814
7815 2009-06-23  Ian Lance Taylor  <iant@google.com>
7816
7817         PR 10237
7818         * options.cc (General_options::parse_V): Set printed_version_.
7819         (General_options::General_options): Initialize printed_version_.
7820         * options.h (class General_options): Add printed_version_ field.
7821         * gold.cc (queue_initial_tasks): If there are no input files,
7822         don't give a fatal error if we printed the version information.
7823         (queue_middle_tasks): If using -r with a shared object, give a
7824         fatal error rather than an ordinary error.
7825
7826 2009-06-23  Ian Lance Taylor  <iant@google.com>
7827
7828         PR 10219
7829         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
7830         (Layout::make_output_section): Set have_stabstr_section_ if we see
7831         a .stab*str section.
7832         (Layout::finalize): Call link_stabs_sections.
7833         (Layout::link_stabs_sections): New file.
7834         * layout.h (class Layout): Add have_stabstr_section_ field.
7835         Declare link_stabs_sections.
7836
7837 2009-06-23  Doug Kwan  <dougkwan@google.com>
7838
7839         * Makefile.am (libgold_a_LIBADD): New.
7840         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
7841         * Makefile.in: Regenerate.
7842         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
7843         * configure: Regenerate.
7844         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
7845         * fileread.cc: Include sys/state.h
7846         * gold.h: Declare memmem and strndup if found missing.
7847         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
7848
7849 2009-06-23  Ian Lance Taylor  <iant@google.com>
7850
7851         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
7852         * configure: Rebuild.
7853
7854 2009-06-23  Ian Lance Taylor  <iant@google.com>
7855
7856         PR 10147
7857         * object.cc (Object::section_contents): Don't try to get a view if
7858         the section has length zero.
7859         (Object::handle_gnu_warning_section): If the section is empty, use
7860         the name of the section as the warning.
7861
7862 2009-06-23  Ian Lance Taylor  <iant@google.com>
7863
7864         PR 10133
7865         * stringpool.h (class Stringpool_template): Add optimize_ field.
7866         (Stringpool_template::set_optimize): New function.
7867         * stringpool.cc (Stringpool_template::Stringpool_template):
7868         Initialize optimize_ field.
7869         (Stringpool_template::set_string_offsets): Test local optimize
7870         fild rather than parameter.
7871         * layout.cc (Layout::Layout): Call set_optimize on the section
7872         name stringpool.
7873
7874 2009-06-22  Ian Lance Taylor  <iant@google.com>
7875
7876         PR 10030
7877         * yyscript.y: Parse TARGET.
7878         * script.cc (script_set_target): New function.
7879         * script-c.h (script_set_target): Declare.
7880         * options.cc (General_options::string_to_object_format): Rename
7881         from string_to_object_format in anonymous namespace.  Change
7882         callers.
7883         * options.h (class General_options): Declare
7884         string_to_object_format.
7885
7886 2009-06-22  Ian Lance Taylor  <iant@google.com>
7887
7888         * script-sections.cc (Script_sections::create_segments): Don't put
7889         program headers in a PT_LOAD segment if -n or -N.
7890
7891 2009-06-22  Ian Lance Taylor  <iant@google.com>
7892
7893         PR 10141
7894         * options.h (class General_options): Add -z lazy and -z now.  Sort
7895         -z options into alphabetical order.
7896         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
7897
7898 2009-06-21  Ian Lance Taylor  <iant@google.com>
7899
7900         * layout.cc (Layout::make_output_section): Call
7901         Target::new_output_section.
7902         (Layout::attach_allocated_section_to_segment): Put large section
7903         sections in a separate load segment with the large segment flag
7904         set.
7905         (Layout::segment_precedes): Sort large data segments after other
7906         load segments.
7907         (align_file_offset): New static function.
7908         (Layout::set_segment_offsets): Use align_file_offset.
7909         * output.h (class Output_section): Add is_small_section_ and
7910         is_large_section_ fields.
7911         (Output_section::is_small_section): New function.
7912         (Output_section::set_is_small_section):  New function.
7913         (Output_section::is_large_section): New function.
7914         (Output_section::set_is_large_section): New function.
7915         (Output_section::is_large_data_section): New function.
7916         (class Output_segment): Add is_large_data_segment_ field.
7917         (Output_segment::is_large_data_segment): New function.
7918         (Output_segment::set_is_large_data_segment): New function.
7919         * output.cc (Output_section::Output_section): Initialize new
7920         fields.
7921         (Output_segment::Output_segment): Likewise.
7922         (Output_segment::add_output_section): Add assertion that large
7923         data sections always go in large data segments.  Force small data
7924         sections to the end of the list of data sections.  Force small BSS
7925         sections to the start of the list of BSS sections.  For large BSS
7926         sections to the end of the list of BSS sections.
7927         * symtab.h (class Symbol): Declare is_common_shndx.
7928         (Symbol::is_defined): Check Symbol::is_common_shndx.
7929         (Symbol::is_common): Likewise.
7930         (class Symbol_table): Define enum Commons_section_type.  Update
7931         declarations.  Add small_commons_ and large_commons_ fields.
7932         * symtab.cc (Symbol::is_common_shndx): New function.
7933         (Symbol_table::Symbol_table): Initialize new fields.
7934         (Symbol_table::add_from_object): Put small and large common
7935         symbols in the right list.
7936         (Symbol_table::sized_finalized_symbol): Check
7937         Symbol::is_common_shndx.
7938         (Symbol_table::sized_write_globals): Likewise.
7939         * common.cc (Symbol_table::do_allocate_commons): Allocate new
7940         common symbol lists.  Don't call do_allocate_commons_list if the
7941         list is empty.
7942         (Symbol_table::do_allocate_commons_list): Remove is_tls
7943         parameter.  Add comons_section_type parameter.  Change all
7944         callers.  Handle small and large common symbols.
7945         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
7946         Symbol::is_common_shndx.
7947         * resolve.cc (symbol_to_bits): Likewise.
7948         * target.h (Target::small_common_shndx): New function.
7949         (Target::small_common_section_flags): New function.
7950         (Target::large_common_shndx): New function.
7951         (Target::large_common_section_flags): New function.
7952         (Target::new_output_section): New function.
7953         (Target::Target_info): Add small_common_shndx, large_common_shndx,
7954         small_common_section_flags, and large_common_section_flags
7955         fields.
7956         (Target::do_new_output_section): New virtual function.
7957         * arm.cc (Target_arm::arm_info): Initialize new fields.
7958         * i386.cc (Target_i386::i386_info): Likewise.
7959         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
7960         Likewise.
7961         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
7962         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
7963         (Target_x86_64::do_new_output_section): New function.
7964         * configure.ac: Define conditional MCMODEL_MEDIUM.
7965         * testsuite/Makefile.am (check_PROGRAMS): Add large.
7966         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
7967         (large_LDFLAGS): Define.
7968         * testsuite/large.c: New file.
7969         * testsuite/testfile.cc (Target_test::test_target_info):
7970         Initialize new fields.
7971         * configure, testsuite/Makefile.in: Rebuild.
7972
7973 2009-06-05  Doug Kwan  <dougkwan@google.com>
7974
7975         * Makefile.am (CCFILES): Add target.cc.
7976         * Makefile.in: Regenerate.
7977         * i386.cc (class Target_i386): Define new virtual method to
7978         override do_is_local_label_name in parent.
7979         * object.cc (Sized_relobj::do_count_local_symbols): Discard
7980         local symbols if --discard-locals or -X is given.
7981         * options.h (class General_options): Declare new options
7982         '--discard-locals' and '-X' for discarding locals.
7983         * target.h (class Target): Define new methods is_local_label_name.
7984         Declare new virtual method do_is_local_label_name.
7985         * target.cc: New file.
7986         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
7987         (check_SCRIPTS): Add discard_locals_test.sh.
7988         (check_DATA): Add discard_local_tests.syms.
7989         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
7990         (discard_local_tests.syms, discard_locals_test.o): New make rules.
7991         * testsuite/Makefile.in: Regenerate.
7992         * testsuite/discard_locals_test.c: New file.
7993         * testsuite/discard_locals_test.sh: Same.
7994
7995 2009-06-05  Doug Kwan  <dougkwan@google.com>
7996
7997         * object.cc (Sized_relobj::Sized_relobj): Initialize
7998         discarded_eh_frame_shndx_ to -1U.
7999         (Sized_relobj::do_layout): Record index of a discard .eh_frame
8000         section.
8001         (Sized_relobj::do_count_local_symbols): Skip local symbols in
8002         a discarded .eh_frame section.
8003         (Sized_relobj::do_finalize_local_symbols): Ditto.
8004         * object.h (class Sized_relobj): Declare new member
8005         discarded_eh_frame_shndx_.
8006         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
8007         (local_labels_test.o, local_labels_test): New rules.
8008         * testsuite/Makefile.in: Regenerate.
8009
8010 2009-06-04  Doug Kwan  <dougkwan@google.com>
8011
8012         * layout.cc (Layout::section_name_mapping): Add mapping for
8013         special ARM sections.
8014
8015 2009-06-03  Doug Kwan  <dougkwan@google.com>
8016
8017         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
8018         (utils::has_overflow): Same.
8019
8020 2009-06-03  Ian Lance Taylor  <iant@google.com>
8021
8022         * layout.cc (Layout::section_name_mapping): New array, replacing
8023         Layout::linkonce_mapping.
8024         (Layout::section_name_mapping_count): New variable, replacing
8025         Layout::linkonce_mapping_count.
8026         (Layout::linkonce_output_name): Remove.
8027         (Layout::output_section_name): Rewrite.
8028         * layout.h (class Layout): Rename Linkonce_mapping to
8029         Section_name_mapping, linkonce_mapping to section_name_mapping,
8030         linkonce_mapping_count to section_name_mapping_count.  Don't
8031         declare linkonce_output_name.
8032
8033 2009-06-03  Doug Kwan  <dougkwan@google.com>
8034
8035         * gold/arm.cc (namespace utils): New.
8036         (Target_arm::reloc_is_non_pic): Define new method.
8037         (class Arm_relocate_functions): New.
8038         (Target_arm::Relocate::relocate): Handle relocation types used by
8039         Android.
8040
8041 2009-06-03  Ian Lance Taylor  <iant@google.com>
8042
8043         * arm.cc (Target_arm::scan::global): Use || instead of |.
8044
8045 2009-06-02  Doug Kwan  <dougkwan@google.com>
8046
8047         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
8048         issued_non_pic_error_.
8049         (class Target_arm::Scan): Declare new method check_non_pic.
8050         Define new method symbol_needs_plt_entry.
8051         Declare new data member issued_non_pic_error_.
8052         (class Target_arm::Relocate): Declare new method
8053         should_apply_static_reloc.
8054         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
8055         (Target_arm::Scan::check_non_pic): Define new method.
8056         (Target_arm::Scan::local): Handle a small subset of reloc types used
8057         by Android.
8058         (Target_arm::Scan::local): Same.
8059         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
8060
8061 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
8062
8063         * incremental.cc (Incremental_inputs::report_command_line): Filter
8064         out --incremental-* options.
8065
8066 2009-05-29  Doug Kwan  <dougkwan@google.com>
8067
8068         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
8069         template class.
8070         (class Target_arm): Update comment.
8071         (Target_arm::Target_arm): Initialize new data members GOT_,
8072         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
8073         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
8074         and Target_arm::rel_dyn_section.
8075         Declare new_enum Target_arm::Got_type.
8076         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
8077         and DYNBSS_.
8078         Update commments for member do_dynsym_value.
8079         (Target_arm::got_size, Target_arm::plt_section,
8080         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
8081         new methods inside class defintion.
8082         (Target_arm::got_section): Define new method.
8083         (Target_arm::rel_dyn_section): Same.
8084         (Output_data_plt_arm): New template class.
8085         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
8086         (Output_data_plt_arm:do_adjust_output_section): Define new method.
8087         (Output_data_plt_arm::add_entry): Same.
8088         (Output_data_plt_arm::first_plt_entry): Define new
8089         static data member for PLT instruction template.
8090         (Output_data_plt_arm::plt_entry): Same.
8091         (Output_data_plt_arm::do_write): Define new method.
8092         (Target_arm::make_plt_entry): Same.
8093         (Target_arm::do_finalize_sections): Same.
8094         (Target_arm::do_dynsym_value): Same.
8095
8096 2009-05-28  Doug Kwan  <dougkwan@google.com>
8097
8098         * Makefile.am (TARGETSOURCES): Add arm.cc.
8099         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
8100         * Makefile.in: Regenerate.
8101         * arm.cc: New file.
8102         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
8103
8104 2009-05-26  Doug Kwan  <dougkwan@google.com>
8105
8106         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
8107         (General_options::check_excluded_libs): Strip off directories in
8108         archive name before matching like GNU ld does.
8109         * testsuite/Makefile.am (MOSTLYCLEANFILES,
8110         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
8111         (exclude_libs_test_LDFLAGS): Add linker option
8112         -Wl,--exclude-libs,libexclude_libs_test_3
8113         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
8114         an explicit archive without using -l.
8115         (alt/libexclude_libs_test_3.a): New make rule.
8116         * testsuite/Makefile.in: Regenerate.
8117         * testsuite/exclude_libs_test.c : Declare lib3_default().
8118         (main): Call it.
8119         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
8120         * exclude_libs_test_3.c: New file.
8121
8122 2009-05-26  Nick Clifton  <nickc@redhat.com>
8123
8124         * po/id.po: New Indonesian translation.
8125         * po/gold.pot: Updated template file.
8126
8127 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
8128
8129         * testsuite/Makefile.am: Add -ffunction-sections to compile
8130         gc_comdat_test files.  Add -Wl,--gc-sections to build
8131         gc_comdat_test.
8132         * testsuite/Makefile.in: Regenerate.
8133         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
8134
8135 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
8136
8137         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
8138         kept comdat section was garbage collected.
8139         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
8140         * testsuite/Makefile.in: Regenerate.
8141         * testsuite/gc_comdat_test.sh: New file.
8142         * testsuite/gc_comdat_test_1.cc: New file.
8143         * testsuite/gc_comdat_test_2.cc: New file.
8144
8145 2009-05-19  Doug Kwan  <dougkwan@google.com>
8146
8147         * archive.cc (Archive::Archive): Move constructor from archive.h
8148         to here.  Initialize no_export_.
8149         (Archive::get_elf_object_for_member): Set no_export flag of object.
8150         * archive.h (Archive::Archive): Move constructor body to
8151         archive.cc.
8152         (Archive::no_export): New method.
8153         (Archive::no_export_): New field.
8154         * object.h (Object::Object): Initialize no_export_ to false.
8155         (Object::no_export, Object::set_no_export): New methods.
8156         (Object::no_export_): New field.
8157         * options.cc (General_options::parse_exclude_libs): New method.
8158         (General_options::check_excluded_libs) Same.
8159         * options.h (exclude_libs): New option.
8160         (General_options::check_excluded_libs): New method declaration.
8161         (General_options::excluded_libs_): New field.
8162         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
8163         default or protected visibility if an object has no-export flag set.
8164         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
8165         (check_SCRIPTS): Add exclude_libs_test.sh.
8166         (check_DATA): Add exclude_libs_test.syms.
8167         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
8168         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
8169         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
8170         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
8171         (exclude_libs_test.syms, libexclude_libs_test_1.a,
8172         libexclude_libs_test_2.a): New rules.
8173         * testsuite/Makefile.in: Regenerate.
8174         * testsuite/exclude_libs_test.c: New file.
8175         * testsuite/exclude_libs_test.sh: Ditto.
8176         * testsuite/exclude_libs_test_1.c: Ditto.
8177         * testsuite/exclude_libs_test_2.c: Ditto.
8178
8179 2009-05-15  Ian Lance Taylor  <iant@google.com>
8180
8181         * configure.ac: Check for declarations for cases where libiberty.h
8182         checks HAVE_DECL_xxx.
8183         * configure, config.in: Rebuild.
8184
8185 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
8186
8187         * gold.h (Incremental_argument_list): Remove (invalid) forward
8188         declaration.
8189         * incremental.cc (Incremental_inputs::report_achive): New method.
8190         (Incremental_inputs::report_object): New method.
8191         (Incremental_inputs::report_script): New method.
8192         (Incremental_inputs::finalize_inputs): New method.
8193         (Incremental_inputs::finalize): Call finalize_inputs().
8194         (Incremental_inputs::sized_create_incremental_inputs_section_data):
8195         Create inputs entries.
8196         * incremental.h (Incremental_input_type): New enum.
8197         (Incremental_inputs::Incremental_input): Initialize new fields.
8198         (Incremental_inputs::report_inputs): New method.
8199         (Incremental_inputs::report_achive): New method.
8200         (Incremental_inputs::report_object): New method.
8201         (Incremental_inputs::report_script): New method.
8202         (Incremental_inputs::finalize_inputs): New method.
8203         (Incremental_inputs::Input_info): New struct.
8204         (Incremental_inputs::Input_info_map): New typedef.
8205         (Incremental_inputs::lock_): New field.
8206         (Incremental_inputs::Inputs_): New field.
8207         (Incremental_inputs::Inputs_map): New field.
8208         * main.cc (main): Call Incremental_input::report_inputs.
8209         * options.h (Input_argument_list): Typedef moved from
8210         Input_arguments.
8211         (Input_file_group::Files): Remove, use ::Input_argument_list.
8212         (Input_file_group::Input_argument_list): Remove, use
8213         ::Input_argument_list.
8214         * plugin.cc (Plugin_manager::add_input_file): Add error in
8215         incremental build.
8216         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
8217         functions.
8218         * script.cc (read_input_script): Call
8219         Incremental_input::report_script.
8220         * script.h (Script_info): New class.
8221
8222 2009-04-27  Ian Lance Taylor  <iant@google.com>
8223
8224         * x86_64.cc (do_adjust_output_section): Set entsize to
8225         plt_entry_size.
8226
8227 2009-04-23  Elliott Hughes  <enh@google.com>
8228
8229         * output.cc (Output_file::close): After short writes, continue
8230         writing from the correct offset in the buffer being written.
8231
8232 2009-04-23  Chris Demetriou  <cgd@google.com>
8233
8234         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
8235         * configure: Regenerate.
8236         * config.in: Regenerate.
8237         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
8238         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
8239
8240 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
8241
8242         * incremental.cc (Incremental_inputs_header_data): Renamed from
8243         Incremental_input_header_data.
8244         (Incremental_inputs_header_data::data_size): New field.
8245         (Incremental_inputs_header_data::put_input_file_count): Renamed
8246         from input_file_count.
8247         (Incremental_inputs_header_data::put_command_line_offset): Renamed
8248         from command_line_offset.
8249         (Incremental_inputs_header_data::put_reserved): Renamed from
8250         put_reserved.
8251         (Incremental_inputs_entry_data): Renamed from
8252         Incremental_input_entry_data.
8253         (Incremental_inputs_entry_data::data_size): New field.
8254         (Incremental_inputs::report_command_line): New method.
8255         (Incremental_inputs::finalize): New method.
8256         (Incremental_inputs::create_incremental_inputs_data): New method.
8257         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
8258         * incremental.h: New file.
8259         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
8260        (Layout::finalize): Create incremental inputs section in
8261         incremental builds.
8262        (Layout::create_incremental_info_sections): New method.
8263         * layout.h (Layout::incremental_inputs): New method.
8264        (Layout::create_incremental_info_sections): New method.
8265        (Layout::incremental_inputs_): New field.
8266         * main.cc (main): Notify Incremental_input of the command line.
8267
8268 2009-04-01  Ian Lance Taylor  <iant@google.com>
8269             Mikolaj Zalewski  <mikolajz@google.com>
8270
8271         * gold.h (reserve_unordered_map): Define, three versions, one for
8272         each version of Unordered_map.
8273         * layout.cc (Layout::Layout): Remove options parameter.  Add
8274         number_of_input_files parameter.  Don't initialize options_.
8275         Initialize number_of_input_files_ and resized_signatures_.  Move
8276         sections_are_attached_.
8277         (Layout::layout_group): Reserve space for group_signatures_.
8278         (Layout::find_or_add_kept_section): Change name parameter to be a
8279         reference.  Resize signatures_ map when it gets large enough.
8280         (Layout::layout_eh_frame): Use parameters->options() instead of
8281         this->options_.
8282         (Layout::make_output_section): Likewise.
8283         (Layout::attach_allocated_section_to_segment): Likewise.
8284         (Layout::finalize, Layout::create_executable_stack): Likewise.
8285         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
8286         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
8287         * layout.h (class Layout): Update declarations.  Remove options_
8288         field.  Add number_of_input_files_ and resized_signatures_
8289         fields.  Move sections_are_attached_ field.
8290         * main.cc (main): Pass number of input files to Layout
8291         constructor.  Don't pass options.
8292
8293 2009-03-30  Ian Lance Taylor  <iant@google.com>
8294
8295         * ffsll.c (ffsll): Correct implementation.
8296
8297 2009-03-27  Ian Lance Taylor  <iant@google.com>
8298
8299         * ffsll.c: New file.
8300         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
8301         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
8302         * ftruncate.c (ftruncate): Declare before definition.
8303         * mremap.c (mremap): Likewise.
8304         * pread.c (pread): Likewise.
8305         * configure, Makefile.in, config.in: Rebuild.
8306
8307         * mremap.c: New file.
8308         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
8309         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
8310         (mremap): Declare if HAVE_MREMAP is not defined.
8311         * configure, Makefile.in, config.in: Rebuild.
8312
8313 2009-03-27  Cary Coutant  <ccoutant@google.com>
8314
8315         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
8316         position independent.
8317         * sparc.cc (Target_sparc::check_non_pic): Likewise.
8318         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
8319
8320 2009-03-24  Cary Coutant  <ccoutant@google.com>
8321
8322         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
8323         an executable.
8324         (needs_dynamic_reloc): Likewise.
8325
8326 2009-03-24  Ian Lance Taylor  <iant@google.com>
8327
8328         * yyscript.y (file_cmd): Recognize EXTERN.
8329         (extern_name_list, extern_name_list_body): New nonterminals.
8330         * script.cc (script_add_extern): Define.
8331         * script-c.h (script_add_extern): Declare.
8332
8333 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
8334
8335         * object.cc (is_elf_object): Define.
8336         * object.h (is_elf_object): Declare.
8337         * archive.cc (Archive::get_elf_object_for_member): Call
8338         is_elf_object.
8339         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
8340
8341 2009-03-24  Elliott Hughes  <enh@google.com>
8342
8343         * output.cc (Output_file::map_anonymous): Define.
8344         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
8345         try an anonymous one.  Report the size if the mmap fails.
8346         * output.h (class Output_file): Declare map_anonymous.
8347
8348 2009-03-24  Ian Lance Taylor  <iant@google.com>
8349
8350         * target-select.cc (instantiate_target): Don't acquire the lock if
8351         the instantiated_target_ field has already been set.
8352
8353 2009-03-23  Ian Lance Taylor  <iant@google.com>
8354
8355         * gold-threads.h (class Initialize_lock): Define.
8356         * gold-threads.cc (class Initialize_lock_once): Define.
8357         (initialize_lock_control): New static variable.
8358         (initialize_lock_pointer): New static variable.
8359         (initialize_lock_once): New static function.
8360         (Initialize_lock::Initialize_lock): Define.
8361         (Initialize_lock::initialize): Define.
8362         * target-select.h: Include "gold-threads.h".
8363         (class Target_selector): Add lock_ and initialize_lock_ fields.
8364         Don't define instantiate_target, just declare it.
8365         * target-select.cc (Target_selector::Target_selector): Initialize
8366         new fields.
8367         (Target_selector::instantiate_target): Define.
8368         * descriptors.h: Include "gold-threads.h".
8369         (class Descriptors): Add initialize_lock_ field.
8370         * descriptors.cc (Descriptors::Descriptors): Initialize new
8371         field.
8372         (Descriptors::open): Use initialize_lock_ field
8373         * errors.h (class Errors): Add initialize_lock_ field.
8374         * errors.cc (Errors::Errors): Initialize new field.
8375         (Errors::initialize_lock): Use initialize_lock_ field.
8376         * powerpc.cc (class Target_selector_powerpc): Remove
8377         instantiated_target_ field.  In do_recognize call
8378         instantiate_target rather than do_instantiate_target.  In
8379         do_instantiate_target just allocate a new target.
8380         * sparc.cc (class Target_selector_sparc): Likewise.
8381
8382         * freebsd.h: New file.
8383         * i386.cc: Include "freebsd.h".
8384         (Target_i386): Derive from Target_freebsd rather than
8385         Sized_target.
8386         (Target_selector_i386): Derive from Target_selector_freebsd rather
8387         than Target_selector.
8388         * x86_64.cc: Include "freebsd.h".
8389         (Target_x86_64): Derive from Target_freebsd rather than
8390         Sized_target.
8391         (Target_selector_x86_64): Derive from Target_selector_freebsd
8392         rather than Target_selector.
8393         * target.h (class Target): Add adjust_elf_header and
8394         do_adjust_elf_header.
8395         * output.cc (Output_file_header:: do_sized_write): Call target
8396         adjust_elf_header routine.
8397         * configure.tgt: Set targ_osabi.
8398         * configure.ac: Define GOLD_DEFAULT_OSABI.
8399         * parameters.cc (Parameters::default_target): Pass
8400         GOLD_DEFAULT_OSABI to select_target.
8401         * target-select.h (class Target_selector): Make instantiate_target
8402         protected rather than private.
8403         * Makefile.am (HFILES): Add freebsd.h.
8404         * configure, Makefile.in, config.in: Rebuild.
8405
8406         * merge.cc (do_add_input_section): Correct pend value.  Change
8407         message about last entry not being null terminated from error to
8408         warning.
8409
8410 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
8411
8412         * incremental.cc: New file.
8413         * Makefile.am (CCFILES): Add incremental.cc.
8414         * Makefile.in: Rebuild.
8415
8416 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
8417
8418         * layout.cc (Layout::output_section_name): Preserve names
8419         of '.note.' sections.
8420
8421 2009-03-19  Ian Lance Taylor  <iant@google.com>
8422
8423         * descriptors.cc (Descriptors::open): Check that the options are
8424         valid before using them.
8425
8426 2009-03-18  Ian Lance Taylor  <iant@google.com>
8427
8428         * script-sections.h: Include <list>.
8429         (class Script_sections): Change Sections_elements from std::vector
8430         to std::list.  Typedef public Elements_iterator.  Add
8431         orphan_section_placement_, data_segment_align_start_, and
8432         saw_data_segment_align_ fields.  Remove data_segment_align_index_
8433         field.
8434         * script-sections.cc (class Orphan_section_placement): New class.
8435         (class Sections_element): Add virtual functions is_relro and
8436         orphan_section_init.  Remove virtual function place_orphan_here.
8437         (class Output_section_definition): Add is_relro and
8438         orphan_section_init.  Remove place_orphan_here.
8439         (class Orphan_output_section): Likewise.
8440         (Script_sections::Script_sections): Update for field changes.
8441         (Script_sections::data_segment_align): Set saw_data_segment_align_
8442         and data_segment_align_start_, not data_segment_align_index.
8443         (Script_sections::data_segment_relro_end): Check
8444         saw_data_segment_align_.  Use data_segment_align_start_ rather
8445         than data_segment_align_index_.
8446         (Script_sections::place_orphan): Rewrite to use
8447         Orphan_section_placement.
8448
8449 2009-03-17  Ian Lance Taylor  <iant@google.com>
8450
8451         * archive.cc (Archive::add_symbols): Check for a version attached
8452         to the symbol name in the archive map.
8453         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
8454         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
8455         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
8456         (ver_test_11.a): New target.
8457         * testsuite/Makefile.in: Rebuild.
8458
8459         * configure.ac: Check for chsize and posix_fallocate.  Replace
8460         ftruncate.
8461         * ftruncate.c: New file, from gnulib.
8462         * output.cc (posix_fallocate): Define dummy version if not
8463         HAVE_POSIX_FALLOCATE.
8464         (Output_file::map): Call posix_fallocate rather than lseek and
8465         write.
8466         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
8467         * configure, Makefile.in, config.in: Rebuild.
8468
8469 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
8470
8471         * layout.h (Layout::create_note): Add section_name parameter.
8472         * layout.cc (Layout::create_note): Likewise.
8473         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
8474
8475 2009-03-17  Ian Lance Taylor  <iant@google.com>
8476
8477         * descriptors.cc: Include "options.h".
8478         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
8479         (Descriptors::open): Always use O_CLOEXEC when opening a new
8480         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
8481         then set FD_CLOEXEC.
8482
8483         * sparc.cc (class Target_sparc): Add has_got_section.
8484         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
8485         make sure we have a GOT section.
8486
8487         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
8488         (Target_sparc::Scan::local): Likewise.
8489         (Target_sparc::Scan::global): Likewise.
8490         (Target_sparc::Relocate::relocate): Likewise.
8491         (Target_sparc::Relocate::relocate_tls): Likewise.
8492
8493         * symtab.cc (Symbol_table::define_default_version): New function,
8494         broken out of add_from_object.
8495         (Symbol_table::add_from_object): Call define_default_version.
8496         (Symbol_table::define_special_symbol): Add resolve_oldsym
8497         parameter.  Change all callers.  If the version for a symbol comes
8498         from a version script, resolve it with the symbol with the same
8499         name with no version.  Also add the symbol without a version if
8500         appropriate.
8501         (do_define_in_output_data): If resolving with oldsym, don't delete
8502         sym.
8503         (do_define_in_output_segment): Likewise.
8504         (do_define_as_constant): Likewise.
8505         * symtab.h (class Symbol_table): Update declarations.
8506
8507 2009-03-13  Ian Lance Taylor  <iant@google.com>
8508
8509         * readsyms.cc (Read_symbols::incompatible_warning): New function.
8510         (Read_symbols::requeue): New function.
8511         (Read_symbols::do_read_symbols): If make_elf_object fails because
8512         the target type is not configured, and the file was searched for,
8513         issue a warning and retry with the next directory.
8514         (Add_symbols::run): If the file has an incompatible format, and
8515         it was searched for, requeue the Read_symbols task.  On error,
8516         release the object.
8517         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
8518         dirindex parameter to constructor.  Change all callers.  Declare
8519         incompatible_warning and requeue.
8520         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
8521         input_argument_ and input_group_ fields.  Add them to
8522         constructor.  Change all callers.
8523         (class Read_script): Add dirindex_ field.  Add it to constructor.
8524         Change all callers.
8525         * archive.cc (Archive::setup): Remove input_objects parameter.
8526         Change all callers.
8527         (Archive::get_file_and_offset): Likewise.
8528         (Archive::read_all_symbols): Likewise.
8529         (Archive::read_symbols): Likewise.
8530         (Archive::get_elf_object_for_member): Remove input_objects
8531         parameter.  Add punconfigured parameter.  Change all callers.
8532         (Archive::add_symbols): Change return type to bool.  Check return
8533         value of include_member.
8534         (Archive::include_all_members): Likewise.
8535         (Archive::include_member): Change return type to bool.  Return
8536         false if first included object has incompatible target.  Set
8537         included_member_ field.
8538         (Add_archive_symbols::run): If add_symbols returns false, requeue
8539         Read_symbols task.
8540         * archive.h (class Archive): Add included_member_ field.
8541         Initialize it in constructor.  Add input_file and searched_for
8542         methods.  Update declarations.
8543         (class Add_archive_symbols): Add dirpath_, dirindex_, and
8544         input_argument_ fields.  Add them to constructor.  Change all
8545         callers.
8546         * script.cc: Include "target-select.h".
8547         (class Parser_closure): Add skip_on_incompatible_target_ and
8548         found_incompatible_target_ fields.  Add
8549         skip_on_incompatible_target parameter to constructor.  Change all
8550         callers.  Add methods skip_on_incompatible_target,
8551         clear_skip_on_incompatible_target, found_incompatible_target, and
8552         set_found_incompatible_target.
8553         (read_input_script): Add dirindex parameter.  Change all callers.
8554         If parser finds an incompatible target, requeue Read_symbols
8555         task.
8556         (script_set_symbol): Clear skip_on_incompatible_target in
8557         closure.
8558         (script_add_assertion, script_parse_option): Likewise.
8559         (script_start_sections, script_add_phdr): Likewise.
8560         (script_check_output_format): New function.
8561         * script.h (read_input_script): Update declaration.
8562         * script-c.h (script_check_output_format): Declare.
8563         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
8564         (ignore_cmd): Remove OUTPUT_FORMAT.
8565         * fileread.cc (Input_file::Input_file): Add explicit this.
8566         (Input_file::will_search_for): New function.
8567         (Input_file::open): Add pindex parameter.  Change all callers.
8568         * fileread.h (class Input_file): Add input_file_argument method.
8569         Declare will_search_for.  Update declarations.
8570         * object.cc (make_elf_object): Add punconfigured parameter.
8571         Change all callers.
8572         * object.h (class Object): Make input_file public.  Add
8573         searched_for method.
8574         (make_elf_object): Update declaration.
8575         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
8576         restart search.
8577         * dirsearch.h (class Dirsearch): Update declaration.
8578         * options.h (class General_options): Add --warn-search-mismatch.
8579         * parameters.cc (Parameters::is_compatible_target): New function.
8580         * parameters.h (class Parameters): Declare is_compatible_target.
8581         * workqueue.cc (Workqueue::add_blocker): New function.
8582         * workqueue.h (class Workqueue): Declare add_blocker.
8583
8584         * fileread.cc (Input_file::open): Remove options parameter.
8585         Change all callers.
8586         (Input_file::open_binary): Likewise.
8587         * script.cc (read_input_script): Likewise.
8588         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
8589         options parameter from constructor.  Change all callers.
8590         (class Read_script): Likewise.
8591         * fileread.h (class Input_file): Update declarations.
8592         * script.h (read_input_script): Update declaration.
8593
8594 2009-03-10  Nick Clifton  <nickc@redhat.com>
8595
8596         * po/es.po: New Spanish translation.
8597
8598 2009-03-06  Cary Coutant  <ccoutant@google.com>
8599
8600         * options.cc (parse_short_option): Keep dash_z from registering itself.
8601
8602 2009-03-03  Ian Lance Taylor  <iant@google.com>
8603
8604         PR 9918
8605         * target-reloc.h (relocate_section): Pass output_section to
8606         relocate.
8607         * i386.cc (Target_i386::should_apply_static_reloc): Add
8608         output_section parameter.  Change all callers.
8609         (Target_i386::Relocate::relocate): Add output_section parameter.
8610         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8611         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
8612         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
8613         * testsuite/two_file_shared.sh: New script.
8614         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
8615         (check_DATA): Add two_file_shared.dbg.
8616         (two_file_shared.dbg): New target.
8617         * testsuite/Makefile.in: Rebuild.
8618
8619 2009-03-01  Ian Lance Taylor  <iant@google.com>
8620
8621         * configure.ac: Check for byteswap.h.
8622         * configure: Rebuild.
8623         * config.in: Rebuild.
8624
8625 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
8626
8627         * layout.cc (Layout::find_or_add_kept_section): New function.
8628         (Layout::add_comdat): Removed.
8629         * layout.h (struct Kept_section): Move out of class Layout.
8630         Remove trailing underscores from field names.  Add group_sections
8631         field.  Rename group_ field to is_group.  Change all uses.
8632         (class Layout): Declare find_or_add_kept_section, not add_comdat.
8633         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
8634         comdat_groups_ field.
8635         (Sized_relobj::include_section_group): Use
8636         find_or_add_kept_section and Kept_section::group_sections.
8637         (Sized_relobj::include_linkonce_section): Likewise.
8638         * object.cc (class Sized_relobj): Don't define Comdat_group or
8639         Comdat_group_table.  Remove find_comdat_group and
8640         add_comdat_group.  Remove comdat_groups_ field.
8641         * plugin.cc (include_comdat_group): Use
8642         Layout::find_or_add_kept_section.
8643
8644 2009-02-28  Ian Lance Taylor  <iant@google.com>
8645
8646         * README: --gc-sections and map files are now supported.  Document
8647         some build requirements.
8648
8649         PR 6992
8650         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
8651         relocatable link set the value of the section symbol to zero.
8652         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
8653         relocatable link don't include the section address in the local
8654         symbol value.
8655
8656 2009-02-27  Ian Lance Taylor  <iant@google.com>
8657
8658         PR 6811
8659         * options.h (class Search_directory): Add is_system_directory.
8660         (class General_options): Declare is_in_system_directory.
8661         * options.cc (get_relative_sysroot): Make static.
8662         (get_default_sysroot): Make static.
8663         (General_optoins::is_in_system_directory): New function.
8664         * fileread.cc (Input_file::is_in_system_directory): New function.
8665         * fileread.h (class Input_file): Declare is_in_system_directory.
8666         * object.h (class Object): Add is_in_system_directory.
8667         (class Input_objects): Remove system_library_directory_ field.
8668         * object.cc (Input_objects::add_object): Don't set
8669         system_library_directory_.
8670         (input_objects::found_in_system_library_directory): Remove.
8671         * symtab.cc (Symbol_table::write_globals): Remove input_objects
8672         parameter.  Change all callers.
8673         (Symbol_table::sized_write_globals): Likewise.
8674         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
8675         Call Object::is_in_system_directory.
8676         * symtab.h (class Symbol_table): Update declarations.
8677
8678         PR 5990
8679         * descriptors.h (Open_descriptor): Add is_on_stack field.
8680         * descriptors.cc (Descriptors::open): If the descriptor is on the
8681         top of the stack, remove it.  Initialize is_on_stack field.
8682         (Descriptors::release): Only add pod to stack if it is not on the
8683         stack already.
8684         (Descriptors::close_some_descriptor): Clear stack_next and
8685         is_on_stack fields.
8686
8687         PR 7091
8688         * output.cc (Output_section::find_starting_output_address): Rename
8689         from starting_output_address; add PADDR parameter; change return
8690         type.
8691         * output.h (class Output_section): Declare
8692         find_starting_output_address instead of starting_output_address.
8693         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
8694         section symbol for which we can't find a merge section.
8695
8696         PR 9836
8697         * symtab.cc (Symbol_table::add_from_object): If the visibility is
8698         hidden or internal, force the symbol to be local.
8699         * resolve.cc (Symbol::override_visibility): Define.
8700         (Symbol::override_base): Use override_visibility.
8701         (Symbol_table::resolve): Likewise.
8702         (Symbol::override_base_with_special): Likewise.
8703         (Symbol_table::override_with_special): If the visibility is hidden
8704         or internal, force the symbol to be local.
8705         * symtab.h (class Symbol): Add set_visibility and
8706         override_visibility.
8707         * testsuite/ver_test_1.sh: New file.
8708         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
8709         (check_DATA): Add ver_test_1.syms.
8710         (ver_test_1.syms): New target.
8711         * testsuite/Makefile.in: Rebuild.
8712
8713 2009-02-25  Cary Coutant  <ccoutant@google.com>
8714
8715         * layout.cc (Layout::choose_output_section): Don't rename sections
8716         when using a linker script that has a SECTIONS clause.
8717         * Makefile.in: Regenerate.
8718
8719         * testsuite/Makefile.am (script_test_5.sh): New test case.
8720         * testsuite/Makefile.in: Regenerate.
8721         * testsuite/script_test_5.cc: New file.
8722         * testsuite/script_test_5.sh: New file.
8723         * testsuite/script_test_5.t: New file.
8724
8725 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
8726
8727         * archive.cc (Archive::include_member): Update calls to add_symbols.
8728         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
8729         the Layout argument.
8730         * dynobj.h (do_add_symbols): Add the Layout argument.
8731         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
8732         Layout argument.
8733         * object.h (Object::add_symbols): Add the Layout argument.
8734         (Object::do_add_symbols): Add the Layout argument.
8735         (Sized_relobj::do_add_symbols): Add the Layout argument.
8736         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
8737         Unify the two versions.
8738         (Add_plugin_symbols): Remove.
8739         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
8740         (Sized_pluginobj::do_add_symbols): Unify the two versions.
8741         (Add_plugin_symbols): Remove.
8742         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
8743         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
8744         (Add_symbols::run): Make it work with Pulginobj.
8745
8746 2009-02-06  Ian Lance Taylor  <iant@google.com>
8747
8748         * object.cc (Sized_relobj::do_layout): Make info message start
8749         with lower case letter.
8750
8751 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
8752
8753         * binary.cc: Fix file comment.
8754
8755         * options.h (enum Incremental_disposition): Define.
8756         (class General_options): Add new options: --incremental,
8757         --incremental_changed, --incremental_unchanged,
8758         --incremental_unknown.  Add incremental_disposition_ and
8759         implicit_incremental_ fields.
8760         (General_options::incremental_disposition): New function.
8761         (class Position_dependent_options): Add incremental_disposition
8762         option.
8763         (Position_dependent_options::copy_from_options): Set incremental
8764         dispositions.
8765         * options.cc (General_options::parse_incremental_changed): New
8766         function.
8767         (General_options::parse_incremental_unchanged): New function.
8768         (General_options::parse_incremental_unknown): New function.
8769         (General_options::General_options): Initialize new fields
8770         incremental_disposition_ and implicit_incremental_.
8771         (General_options::finalize): Check for uasge of --incremental-*
8772         without --incremental.
8773
8774 2009-02-06  Chris Demetriou  <cgd@google.com>
8775
8776         * gold.h (gold_undefined_symbol): Change to take only a Symbol
8777         pointer and to report location as the file name associated with
8778         the symbol.
8779         (gold_undefined_symbol_at_location): New function to replace the
8780         old gold_undefined_symbol functionality.
8781         * target-reloc.h (relocate_section): Update to use
8782         gold_undefined_symbol_at_location.
8783         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
8784         Call gold_undefined_symbol function rather than gold_error.
8785         * errors.h (Errors::undefined_symbol): Take location as a
8786         string, rather than calculating it from a relocation.
8787         * errors.cc (Errors::fatal): Print "fatal error:" before the
8788         formatted message.
8789         (Errors::error, Errors::error_at_location): Print "error: "
8790         before the formatted message.
8791         (Errors::undefined_symbol): Take location as a string, rather
8792         than calculating it from a relocation.
8793         (gold_undefined_symbol_at_location): New function akin to
8794         old gold_undefined_symbol, calculates location from relocation.
8795         (gold_undefined_symbol): Change to take only a Symbol pointer
8796         and to report location as the file name associated with the symbol.
8797         * testsuite/debug_msg.sh: Update for changed error messages.
8798         * testsuite/undef_symbol.sh: Likewise.
8799
8800 2009-02-04  Duncan Sands  <baldrick@free.fr>
8801
8802         PR 9812
8803         * reduced_debug_output.h
8804         (Output_reduced_debug_abbrev_section::failed): Use format for
8805         gold_warning.
8806         (Output_reduced_debug_info_section::faild): Likewise.
8807
8808 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
8809
8810         * script.cc (Lazy_demangler): New class.
8811         (Version_script_info::get_symbol_version_helper): Demangle a
8812         symbol only once.
8813
8814 2009-01-29  Cary Coutant  <ccoutant@google.com>
8815
8816         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
8817         to __tls_get_addr.
8818         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8819
8820 2009-01-28  Ian Lance Taylor  <iant@google.com>
8821
8822         * version.cc (version_string): Bump to 1.9.
8823
8824         * gold.h: Include <cstring> and <stdint.h>.
8825         * version.cc: Include <cstdio>.
8826         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
8827         warning.
8828         * reduced_debug_output.cc (insert_into_vector): Rename from
8829         Insert_into_vector; change all callers.  Use Swap_unaligned to
8830         avoid aliasing issue; remove union since it is unnecessary.
8831
8832 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
8833
8834         * Makefile.am (CCFILES): Add gc.cc.
8835         (HFILES): Add gc.h.
8836         * Makefile.in: Regenerate.
8837         * gold.cc (Gc_runner): New class.
8838         (queue_initial_tasks): Call garbage collection related tasks
8839         when corresponding options are invoked.
8840         (queue_middle_gc_tasks): New function.
8841         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
8842         processed early before laying out sections during garbage collection.
8843         * gold.h (queue_middle_gc_tasks): New function.
8844         (is_prefix_of): Move from "layout.cc".
8845         * i386.cc (Target_i386::gc_process_relocs): New function.
8846         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
8847         * main.cc (main): Create object of class "Garbage_collection".
8848         * object.cc (Relobj::copy_symbols_data): New function.
8849         (Relobj::is_section_name_included): New function.
8850         (Sized_relobj::do_layout): Allow this function to be called twice
8851         during garbage collection and defer layout of section during the
8852         first call.
8853         * object.h (Relobj::get_symbols_data): New function.
8854         (Relobj::is_section_name_included): New function.
8855         (Relobj::copy_symbols_data): New function.
8856         (Relobj::set_symbols_data): New function.
8857         (Relobj::get_relocs_data): New function.
8858         (Relobj::set_relocs_data): New function.
8859         (Relobj::is_output_section_offset_invalid): New pure virtual function.
8860         (Relobj::gc_process_relocs): New function.
8861         (Relobj::do_gc_process_relocs): New pure virtual function.
8862         (Relobj::sd_): New data member.
8863         (Sized_relobj::is_output_section_offset_invalid): New function.
8864         (Sized_relobj::do_gc_process_relocs): New function.
8865         * options.h (General_options::gc_sections): Modify to not be a no-op.
8866         (General_options::print_gc_sections): New option.
8867         * plugin.cc (Plugin_finish::run): Remove function call to
8868         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
8869         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
8870         * reloc.cc (Read_relocs::run): Add task to process relocs and
8871         determine unreferenced sections when doing garbage collection.
8872         (Gc_process_relocs): New class.
8873         (Sized_relobj::do_gc_process_relocs): New function.
8874         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
8875         sections that are garbage collected.
8876         * reloc.h (Gc_process_relocs): New class.
8877         * sparc.cc (Target_sparc::gc_process_relocs): New function.
8878         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
8879         symbols whose corresponding sections are garbage collected.
8880         (Symbol_table::Symbol_table): Add new parameter for the garbage
8881         collection object.
8882         (Symbol_table::gc_mark_undef_symbols): New function.
8883         (Symbol_table::gc_mark_symbol_for_shlib): New function.
8884         (Symbol_table::gc_mark_dyn_syms): New function.
8885         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
8886         as garbage.
8887         (Symbol_table::add_from_object): Likewise.
8888         (Symbol_table::add_from_relobj): When building shared objects, do not
8889         treat externally visible symbols as garbage.
8890         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
8891         table information for static and relocatable links.
8892         * symtab.h (Symbol_table::set_gc): New function.
8893         (Symbol_table::gc): New function.
8894         (Symbol_table::gc_mark_undef_symbols): New function.
8895         (Symbol_table::gc_mark_symbol_for_shlib): New function.
8896         (Symbol_table::gc_mark_dyn_syms): New function.
8897         (Symbol_table::gc_): New data member.
8898         * target.h (Sized_target::gc_process_relocs): New pure virtual
8899         function.
8900         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
8901         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
8902
8903 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
8904
8905         * options.h (General_options::gc_sections): Define as a no-op for now.
8906         (General_options::no_keep_memory): Ditto.
8907         (General_options::Bshareable): Define.
8908         * options.cc (General_options::finalize): Honor -Bshareable.
8909
8910 2009-01-20  Andreas Schwab  <schwab@suse.de>
8911
8912         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
8913         read the value in the contents, since we don't use it.  Use the
8914         template endianness when writing.
8915         (Relocate::relocate): Use it for R_PPC_REL16_HA.
8916
8917 2009-01-19  Andreas Schwab  <schwab@suse.de>
8918
8919         * configure.tgt (powerpc64-*): Fix targ_obj.
8920
8921 2009-01-15  Ian Lance Taylor  <iant@google.com>
8922
8923         * object.cc (Sized_relobj::write_local_symbols): Don't write out
8924         local symbols when stripping all symbols.
8925
8926 2009-01-14  Cary Coutant  <ccoutant@google.com>
8927
8928         * output.cc (Output_reloc): Add explicit instantiations.
8929
8930 2009-01-14  Cary Coutant  <ccoutant@google.com>
8931
8932         * archive.cc (Archive::get_elf_object_for_member): Remove call
8933         to File_read::claim_for_plugin.
8934         * descriptors.cc (Descriptors::open): Remove reference to
8935         is_claimed.
8936         (Descriptors::claim_for_plugin): Remove.
8937         * descriptors.h (Descriptors::claim_for_plugin): Remove.
8938         (Descriptors::is_claimed): Remove.
8939         (claim_descriptor_for_plugin): Remove.
8940         * fileread.cc (File_read::claim_for_plugin): Remove.
8941         * fileread.h (File_read::claim_for_plugin): Remove.
8942         (File_read::descriptor): Reopen descriptor if necessary.
8943         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
8944         (Plugin_manager::all_symbols_read): Add task parameter. Change
8945         all callers.
8946         (Plugin_manager::get_input_file): New function.
8947         (Plugin_manager::release_input_file): New function.
8948         (Pluginobj::Pluginobj): Add filesize parameter and initialize
8949         corresponding data member.
8950         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
8951         and pass to base constructor. Change all callers.
8952         (get_input_file, release_input_file): New functions.
8953         (make_sized_plugin_object): Add filesize parameter. Change all callers.
8954         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
8955         (Plugin_manager::all_symbols_read): Add task parameter.
8956         (Plugin_manager::get_input_file): New function.
8957         (Plugin_manager::release_input_file): New function.
8958         (Plugin_manager::task_): New data member.
8959         (Pluginobj::Pluginobj): Add filesize parameter.
8960         (Pluginobj::filename): New function.
8961         (Pluginobj::descriptor): New function.
8962         (Pluginobj::filesize): New function.
8963         (Pluginobj::filesize_): New data member.
8964         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
8965         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
8966         File_read::claim_for_plugin; use Object::unlock to unlock the file.
8967
8968         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
8969         with archive libraries.
8970         * testsuite/Makefile.in: Regenerate.
8971         * testsuite/plugin_test.c (struct sym_info): New type.
8972         (get_input_file, release_input_file): New static variables.
8973         (onload): Capture new transfer vector entries.
8974         (claim_file_hook): Stop reading at end of file according to filesize.
8975         Factor out parsing of readelf output into separate function.
8976         (all_symbols_read_hook): Exercise get_input_file and release_input_file
8977         APIs and get the source file name from the symbol table.  Convert
8978         source file name to corresponding object file name.  Print info
8979         message when adding new input files.
8980         (parse_readelf_line): New function.
8981         * testsuite/plugin_test_1.sh: Add checks for new info messages.
8982         * testsuite/plugin_test_2.sh: Likewise.
8983         * testsuite/plugin_test_3.sh: Likewise.
8984         * testsuite/plugin_test_4.sh: New test case.
8985
8986 2009-01-07  Ian Lance Taylor  <iant@google.com>
8987
8988         * version.cc (version_string): Bump to 1.8.
8989
8990 2008-12-23  Cary Coutant  <ccoutant@google.com>
8991
8992         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
8993         * plugin.cc (Plugin_manager::finish): Rename as
8994         layout_deferred_objects.  Move cleanup to separate function.
8995         (Plugin_manager::cleanup): New function.
8996         (Plugin_finish::run): Call layout_deferred_objects and cleanup
8997         separately.
8998         * plugin.h (Plugin_manager::finish): Rename as
8999         layout_deferred_objects.
9000         (Plugin_manager::cleanup): New function.
9001         (Plugin_manager::cleanup_done): New field.
9002
9003 2008-12-23  Cary Coutant  <ccoutant@google.com>
9004
9005         * plugin.cc (is_visible_from_outside): New function.
9006         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
9007         so we don't return "IR only" status for exported symbols or -r links.
9008
9009         * testsuite/Makefile.am (plugin_test_3): New test case.
9010         * testsuite/Makefile.in: Regenerate.
9011         * testsuite/plugin_test_3.sh: New file.
9012
9013 2008-12-22  Cary Coutant  <ccoutant@google.com>
9014
9015         * object.cc (Sized_relobj::layout_section): New function.
9016         (Sized_relobj::do_layout): Defer layout of input sections until after
9017         plugin has provided replacement files.
9018         (Sized_relobj::do_layout_deferred_sections): New function.
9019         * object.h (Relobj::set_section_offset): Remove virtual keyword.
9020         (Relobj::layout_deferred_sections): New function.
9021         (Relobj::do_layout_deferred_sections): New function.
9022         (Sized_relobj::do_layout_deferred_sections): New function.
9023         (Sized_relobj::layout_section): New function.
9024         (Sized_relobj::Deferred_layout): New structure.
9025         (Sized_relobj::deferred_layout_): New field.
9026         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
9027         Change all callers.  Layout deferred sections.
9028         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
9029         references.
9030         (Plugin_hook::run): Move code from do_plugin_hook inline.
9031         (Plugin_hook::do_plugin_hook): Remove.
9032         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
9033         (Plugin_manager::finish): Renamed, was cleanup.
9034         (Plugin_manager::should_defer_layout): New function.
9035         (Plugin_manager::add_deferred_layout_object): New function.
9036         (Plugin_manager::Deferred_layout_list): New type.
9037         (Plugin_manager::deferred_layout_objects_): New field.
9038         (Plugin_hook::do_plugin_hook): Remove.
9039
9040 2008-12-17  Ian Lance Taylor  <iant@google.com>
9041
9042         * options.h (class General_options): Add --no case for
9043         --export-dynamic.
9044
9045 2008-12-16  Cary Coutant  <ccoutant@google.com>
9046
9047         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
9048         vector.
9049         (Plugin_manager::claim_file): Create plugin object even if
9050         plugin did not call the add_symbols callback.
9051         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
9052         asking for more symbols than were added.
9053         * testsuite/Makefile.am (plugin_test_1): Add test case with
9054         no global symbols.
9055         (empty.syms): New target.
9056         * testsuite/Makefile.in: Regenerate.
9057         * testsuite/plugin_test.c (claim_file_hook): Add new debug
9058         message. Don't call add_symbols if no globals.
9059         (all_symbols_read_hook): Don't provide replacement for empty
9060         claimed file.
9061
9062 2008-12-12  Ian Lance Taylor  <iant@google.com>
9063
9064         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
9065         r_type == 0 for a local symbol with r_sym == 0.
9066         (scan_relocatable_relocs): Pass r_sym to
9067         local_non_section_strategy.
9068         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
9069         r_sym parameter.
9070
9071         * configure.ac: Update test for TLS descriptors: they are
9072         supported as of glibc 2.9.
9073         * configure: Rebuild.
9074
9075 2008-12-11  Ian Lance Taylor  <iant@google.com>
9076
9077         PR 7091
9078         * target-reloc.h (Default_scan_relocatable_relocs): For each
9079         function, map r_type == 0 to RELOC_DISCARD.
9080
9081 2008-12-10  Cary Coutant  <ccoutant@google.com>
9082
9083         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
9084         object to override a kept COMDAT group from a plugin object.
9085
9086 2008-12-09  Ian Lance Taylor  <iant@google.com>
9087
9088         PR 7088
9089         * yyscript.y (file_cmd): Handle INPUT.
9090
9091         * testsuite/initpri1.c: Change all declarations to be full
9092         prototypes by adding void, to avoid compiler warnings.
9093
9094 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
9095
9096         * options.cc (General_options::parse_plugin_opt): New.
9097         (General_options::add_plugin): The argument now is just the filename.
9098         (General_options::add_plugin_option): New.
9099         * options.h (plugin_opt): New.
9100         (add_plugin): Change argument name.
9101         (add_plugin_option): New.
9102         * plugin.cc (Plugin::load): Don't parse the plugin option.
9103         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
9104         (Plugin::add_option): New.
9105         (Plugin::args_): Change type.
9106         (Plugin::filename_): New.
9107         (Plugin_manager::add_plugin_option): New.
9108         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
9109         * testsuite/Makefile.in: Regenerate.
9110
9111 2008-12-05  Cary Coutant  <ccoutant@google.com>
9112
9113         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
9114         Handle --strip-lto-sections option.
9115         * options.h (strip_lto_sections): New option.
9116
9117 2008-12-01  Cary Coutant  <ccoutant@google.com>
9118
9119         * plugin.cc (ld_plugin_message): Change format parameter to const.
9120         Fix mismatch between new[] and delete.
9121
9122 2008-11-14  Cary Coutant  <ccoutant@google.com>
9123
9124         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
9125         instead of -1U.
9126
9127 2008-11-05  Craig Silverstein  <csilvers@google.com>
9128
9129         * options.cc (General_options::parse_dynamic_list): New function.
9130         * options.h (General_options): New flags dynamic_list,
9131         dynamic_list_data, dynamic_list_cpp_new, and
9132         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
9133         (General_options::in_dynamic_list): New function.
9134         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
9135         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
9136         (Lex::can_continue_name): Likewise.
9137         (yylex): Likewise.
9138         (read_script_file): New parameter script_options.
9139         (read_dynamic_list): New function.
9140         (Script_options::define_dynamic_list): New function.
9141         (dynamic_list_keyword_parsecodes): New variable.
9142         (dynamic_list_keywords): New variable.
9143         * script.h (Script_options::define_dynamic_list): New function
9144         prototype.
9145         (read_dynamic_list): New function prototype.
9146         * symtab.cc (strprefix): New macro.
9147         (Symbol::should_add_dynsym_entry): Support dynamic_list,
9148         dynamic_list_data, dynamic_list_cpp_new, and
9149         dynamic_list_cpp_typeinfo.
9150         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
9151         (dynamic_list_expr): New rule.
9152         (dynamic_list_nodes): Likewise.
9153         (dynamic_list_node): Likewise.
9154         * testsuite/Makefile.am (dynamic_list): New test.
9155         * testsuite/Makefile.in: Regenerated.
9156         * testsuite/dynamic_list.t: New file.
9157         * testsuite/dynamic_list.sh: New file.
9158
9159 2008-11-05  Craig Silverstein  <csilvers@google.com>
9160
9161         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
9162         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
9163         (t11_last): Likewise.
9164         * testsuite/ver_test_6.c (main): Likewise.
9165
9166 2008-10-07  Cary Coutant  <ccoutant@google.com>
9167
9168         * options.c (General_options::finalize): Add check for -static and
9169         -shared.
9170         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
9171         is not empty.
9172
9173 2008-10-02  Cary Coutant  <ccoutant@google.com>
9174
9175         * plugin.cc (make_sized_plugin_object): Fix conditional
9176         compilation to work when not all targets are enabled.
9177
9178 2008-09-29  Cary Coutant  <ccoutant@google.com>
9179
9180         * archive.cc (Archive::get_file_and_offset): Use filename instead
9181         of name to get library path.
9182         (Archive::include_member): Unlock external member of a thin archive.
9183
9184         * testsuite/Makefile.am (TEST_AR): New variable.
9185         (thin_archive_test_1): New test.
9186         (thin_archive_test_2): New test.
9187         * testsuite/Makefile.in: Regenerate.
9188         * testsuite/thin_archive_main.cc: New file.
9189         * testsuite/thin_archive_test_1.cc: New file.
9190         * testsuite/thin_archive_test_2.cc: New file.
9191         * testsuite/thin_archive_test_3.cc: New file.
9192         * testsuite/thin_archive_test_4.cc: New file.
9193
9194 2008-09-29  Cary Coutant  <ccoutant@google.com>
9195
9196         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
9197         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
9198         instead of -1U.
9199         (Sized_relobj::do_finalize_local_symbols): Likewise.
9200         (Sized_relobj::map_to_kept_section): Likewise.
9201         * object.h (Sized_relobj::invalid_address): New constant.
9202         (Sized_relobj::do_output_section_offset): Check for invalid_address
9203         and return -1ULL.
9204         * output.cc (Output_reloc::local_section_offset): Use constant
9205         invalid_address instead of -1U.
9206         (Output_reloc::get_address): Likewise.
9207         (Output_section::output_address): Change -1U to -1ULL.
9208         * output.h (Output_reloc::invalid_address): New constant.
9209         * reloc.cc (Sized_relobj::write_sections): Use constant
9210         invalid_address instead of -1U.
9211         (Sized_relobj::relocate_sections): Likewise.
9212         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
9213         values for merge sections.
9214         * target-reloc.h (relocate_for_relocatable): Use constant
9215         invalid_address instead of -1U.
9216
9217 2008-09-19  Cary Coutant  <ccoutant@google.com>
9218
9219         Add plugin functionality for link-time optimization (LTO).
9220         * configure.ac (plugins): Add --enable-plugins option.
9221         * configure: Regenerate.
9222         * config.in: Regenerate.
9223         * Makefile.am (LIBDL): New variable.
9224         (CCFILES): Add plugin.cc.
9225         (HFILES): Add plugin.h.
9226         (ldadd_var): Add LIBDL.
9227         * Makefile.in: Regenerate.
9228
9229         * archive.cc: Include "plugin.h".
9230         (Archive::setup): Don't preread archive symbols when using a plugin.
9231         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
9232         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
9233         files.
9234         (Archive::include_member): Add symbols from plugin objects.
9235         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
9236         * descriptors.cc (Descriptors::open): Check for file descriptors
9237         abandoned by plugins.
9238         (Descriptors::claim_for_plugin): New function.
9239         * descriptors.h (Descriptors::claim_for_plugin): New function.
9240         (Open_descriptor::is_claimed): New field.
9241         (claim_descriptor_for_plugin): New function.
9242         * fileread.cc (File_read::claim_for_plugin): New function.
9243         * fileread.h (File_read::claim_for_plugin): New function.
9244         (File_read::descriptor): New function.
9245         * gold.cc: Include "plugin.h".
9246         (queue_initial_tasks): Add task to call plugin hooks for generating
9247         new object files.
9248         * main.cc: Include "plugin.h".
9249         (main): Load plugin libraries.
9250         * object.h (Pluginobj): Declare.
9251         (Object::pluginobj): New function.
9252         (Object::do_pluginobj): New function.
9253         (Object::set_target): New function.
9254         * options.cc: Include "plugin.h".
9255         (General_options::parse_plugin): New function.
9256         (General_options::General_options): Initialize plugins_ field.
9257         (General_options::add_plugin): New function.
9258         * options.h (Plugin_manager): Declare.
9259         (General_options): Add --plugin option.
9260         (General_options::has_plugins): New function.
9261         (General_options::plugins): New function.
9262         (General_options::add_plugin): New function.
9263         (General_options::plugins_): New field.
9264         * plugin.cc: New file.
9265         * plugin.h: New file.
9266         * readsyms.cc: Include "plugin.h".
9267         (Read_symbols::do_read_symbols): Check for archive before checking
9268         for ELF file.  Call plugin hooks to claim files.
9269         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
9270         from a real object file; force override when processing replacement
9271         files.
9272         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
9273         (Symbol::init_base_object): Likewise.
9274         (Symbol::init_base_output_data): Likewise.
9275         (Symbol::init_base_output_segment): Likewise.
9276         (Symbol::init_base_constant): Likewise.
9277         (Symbol::init_base_undefined): Likewise.
9278         (Symbol::output_section): Assert that object is not a plugin.
9279         (Symbol_table::add_from_pluginobj): New function.
9280         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
9281         undefined.
9282         (Symbol_table::sized_write_globals): Likewise.
9283         (Symbol_table::add_from_pluginobj): Instantiate template.
9284         * symtab.h (Sized_pluginobj): Declare.
9285         (Symbol::in_real_elf): New function.
9286         (Symbol::set_in_real_elf): New function.
9287         (Symbol::in_real_elf_): New field.
9288         (Symbol_table::add_from_pluginobj): New function.
9289
9290         * testsuite/Makefile.am (AM_CFLAGS): New variable.
9291         (LIBDL): New variable.
9292         (LDADD): Add LIBDL.
9293         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
9294         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
9295         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
9296         (MOSTLYCLEANFILES): Likewise.
9297         * testsuite/Makefile.in: Regenerate.
9298         * testsuite/plugin_test.c: New file.
9299         * testsuite/plugin_test_1.sh: New file.
9300         * testsuite/plugin_test_2.sh: New file.
9301
9302 2008-09-16  Ian Lance Taylor  <iant@google.com>
9303
9304         * target-reloc.h (relocate_section): Check whether a symbol is
9305         defined by the ABI before reporting an undefined symbol error.
9306         * target.h (Target::is_defined_by_abi): Make parameter const.
9307         (Target::do_is_defined_by_abi): Likewise.
9308         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
9309         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
9310         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
9311         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
9312         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
9313         * testsuite/Makefile.in: Rebuild.
9314
9315         * fileread.cc (make_view): Add casts to avoid warning.
9316
9317 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
9318
9319         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
9320         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
9321
9322 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
9323
9324         * options.h (General_options::output_is_executable): New.
9325         (General_options::output_is_pie): New.
9326         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
9327         for shared libraries.
9328         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
9329
9330 2008-09-11  Chris Demetriou  <cgd@google.com>
9331
9332         * options.h (origin): New -z option.
9333         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
9334         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
9335         in DT_FLAGS_1.
9336
9337 2008-09-05  Cary Coutant  <ccoutant@google.com>
9338
9339         * fileread.cc (File_read::make_view): Add check for attempt to map
9340         beyond end of file.
9341
9342 2008-09-05  Cary Coutant  <ccoutant@google.com>
9343
9344         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
9345         explicit instantiations.
9346
9347 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
9348
9349         PR gold/6858
9350         * options.cc (General_options::finalize): Allow undefined symbols
9351         in shlibs if linking -shared.
9352
9353         PR gold/6859
9354         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
9355         symbols as not needing a dynsym entry.
9356
9357 2008-08-20  Craig Silverstein  <csilvers@google.com>
9358
9359         * fileread.cc (File_read::open): Do not lock the file unless it
9360         was successfully opened.
9361
9362 2008-08-14  Cary Coutant  <ccoutant@google.com>
9363
9364         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
9365         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
9366         * testsuite/tls_test.cc (struct int128): 128-bit struct
9367         for testing TLS relocs with non-zero addend.
9368         (v12): New TLS variable.
9369         (t12): New test.
9370         (t_last): Add check for v12.
9371         * testsuite/tls_test.h (t12): New function.
9372         * testsuite/tls_test_main.cc (thread_routine): Call new test.
9373
9374 2008-08-13  Ian Lance Taylor  <iant@google.com>
9375
9376         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
9377         set tls_segment_ or relro_segment_.
9378         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
9379         when appropriate.
9380         * output.h (Output_section::clear_is_relro): New function.
9381         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
9382         sections specially even when output_data_ is empty.
9383         (Output_segment::maximum_alignment): When first section is relro,
9384         only force alignment for PT_LOAD segments.
9385         * script.cc (script_data_segment_align): New function.
9386         (script_data_segment_relro_end): New function.
9387         * script-c.h (script_data_segment_align): Declare.
9388         (script_data_segment_relro_end): Declare.
9389         * script-sections.h (class Script_sections): Declare
9390         data_segment_align and data_segment_relro_end.  Add fields
9391         segment_align_index_ and saw_relro_end_.
9392         * script-sections.cc (class Sections_element): Add set_is_relro
9393         virtual function.  Add new bool* parameter to place_orphan_here.
9394         Add get_output_section virtual function.
9395         (class Output_section_definition): Add set_is_relro.  Add new
9396         bool* parameter to place_orphan_here.  Add get_output_section.
9397         Add is_relro_ field.
9398         (Output_section_definition::Output_section_definition): Initialize
9399         evaluated_address_, evaluated_load_address, evaluated_addralign_,
9400         and is_relro_ fields.
9401         (Output_section_definition::place_orphan_here): Add is_relro
9402         parameter.
9403         (Output_section_definition::set_section_addresses): Set relro for
9404         output section.
9405         (Output_section_definition::alternate_constraint): Likewise.
9406         (class Orphan_output_section): Add new bool* parameter to
9407         place_orphan_here.  Add get_output_section.
9408         (Orphan_output_section::place_orphan_here): Add is_relro
9409         parameter.
9410         (Script_sections::Script_sections): Initialize
9411         data_segment_align_index_ and saw_relro_end_.
9412         (Script_sections::data_segment_align): New function.
9413         (Script_sections::data_segment_relro_end): New function.
9414         (Script_sections::place_orphan): Set or clear is_relro.
9415         (Script_sections::set_section_addresses): Force alignment of first
9416         TLS section.
9417         * yyscript.y (exp): Call script_data_segment_align and
9418         script_data_segment_relro_end.
9419         * testsuite/relro_script_test.t: New file.
9420         * testsuite/relro_test.cc (using_script): Declare.
9421         (t1, t2): Test using_script.
9422         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
9423         (relro_script_test_SOURCES): Define.
9424         (relro_script_test_DEPENDENCIES): Define.
9425         (relro_script_test_LDFLAGS): Define.
9426         (relro_script_test_LDADD): Define.
9427         (relro_script_test.so): New target.
9428         * testsuite/Makefile.in: Rebuild.
9429
9430 2008-08-06  Cary Coutant <ccoutant@google.com>
9431
9432         * archive.cc (Archive::total_archives, Archive::total_members)
9433         (Archive::total_members_loaded): New variables.
9434         (Archive::setup): Add parameter.  Add option to preread
9435         archive symbols.
9436         (Archive::read_armap): Add counter.
9437         (Archive::get_file_and_offset): New function.
9438         (Archive::get_elf_object_for_member): New function.
9439         (Archive::read_all_symbols): New function.
9440         (Archive::read_symbols): New function.
9441         (Archive::add_symbols): Add counters.
9442         (Archive::include_all_members): Use armap to find members if it's
9443         already built.
9444         (Archive::include_member): Skip reading symbols if already read.
9445         Factored code into Archive::get_file_and_offset and
9446         Archive::get_elf_object_for_member.  Changed call to
9447         Mapfile::report_include_archive_member.
9448         (Archive::print_stats): New function.
9449         * archive.h: Declare Object and Read_symbols_data classes.
9450         (Archive::Archive): Add initializers for new members.
9451         (Archive::setup): Add parameter.
9452         (Archive::print_stats): New function.
9453         (Archive::total_archives, Archive::total_members)
9454         (Archive::total_members_loaded): New variables.
9455         (Archive::get_file_and_offset): New function.
9456         (Archive::get_elf_object_for_member): New function.
9457         (Archive::read_all_symbols): New function.
9458         (Archive::read_symbols): New function.
9459         (Archive::Archive_member): New class.
9460         (Archive::members_): New member.
9461         (Archive::num_members_): New member.
9462         * main.cc: Include archive.h.
9463         (main): Call Archive::print_stats.
9464         * mapfile.cc (Mapfile::report_include_archive_member): Delete
9465         archive parameter; member_name is now the fully-decorated name.
9466         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
9467         * options.h: (General_options): Add --preread-archive-symbols option.
9468         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
9469         Archive::setup.
9470
9471 2008-08-04  Ian Lance Taylor  <iant@google.com>
9472
9473         * symtab.h (Symbol::use_plt_offset): New function.
9474         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
9475         * powerpc.cc (Relocate::relocate): Likewise.
9476         * sparc.cc (Relocate::relocate): Likewise.
9477         * x86_64.cc (Relocate::relocate): Likewise.
9478         * testsuite/weak_plt.sh: New test.
9479         * testsuite/weak_plt_main.cc: New test.
9480         * testsuite/weak_plt_shared.cc: New test.
9481         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
9482         (check_PROGRAMS): Add weak_plt.
9483         (check_DATA): Add weak_plt_shared.so.
9484         (weak_plt_main_pic.o, weak_plt): New targets.
9485         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
9486         * testsuite/Makefile.in: Rebuild.
9487
9488         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
9489         gcctestdir/ld.
9490         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
9491         * testsuite/Makefile.in: Rebuild.
9492
9493 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
9494
9495         * Makefile.am (POTFILES.in): Set LC_ALL=C.
9496         * Makefile.in: Regenerate.
9497         * po/POTFILES.in: Regenerate.
9498
9499 2008-07-29  Ian Lance Taylor  <iant@google.com>
9500
9501         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
9502         symbols before other symbols.
9503         * testsuite/script_test_2.cc (test_addr): Declare.
9504         (test_addr_alias): Declare.
9505         (main): Check that test_addr and test_addr_alias have the right
9506         values.
9507         * testsuite/script_test_2.t: Define test_addr_alias and
9508         test_addr.
9509
9510 2008-07-24  Ian Lance Taylor  <iant@google.com>
9511
9512         PR 5990
9513         * descriptors.cc: New file.
9514         * descriptors.h: New file.
9515         * gold-threads.h (class Hold_optional_lock): New class.
9516         * fileread.cc: Include "descriptors.h".
9517         (File_read::~File_read): Release descriptor rather than closing
9518         it.
9519         (File_read::open) [file]: Call open_descriptor rather than open.
9520         Set is_descriptor_opened_.
9521         (File_read::open) [memory]: Assert that descriptor is not open.
9522         (File_read::reopen_descriptor): New function.
9523         (File_read::release): Release descriptor.
9524         (File_read::do_read): Make non-const.  Reopen descriptor.
9525         (File_read::read): Make non-const.
9526         (File_read::make_view): Reopen descriptor.
9527         (File_read::do_readv): Likewise.
9528         * fileread.h (class File_read): Add is_descriptor_opened_ field.
9529         Update declarations.
9530         * layout.cc: Include "descriptors.h".
9531         (Layout::create_build_id): Use open_descriptor rather than open.
9532         * output.cc: Include "descriptors.h".
9533         (Output_file::open): Use open_descriptor rather than open.
9534         * archive.cc (Archive::const_iterator): Change Archive to be
9535         non-const.
9536         (Archive::begin, Archive::end): Make non-const.
9537         (Archive::count_members): Likewise.
9538         * archive.h (class Archive): Update declarations.
9539         * object.h (Object::read): Make non-const.
9540         * Makefile.am (CCFILES): Add descriptors.cc.
9541         (HFILES): Add descriptors.h.
9542         * Makefile.in: Rebuild.
9543
9544         PR 6716
9545         * gold.h: Always include <clocale>.  Add Solaris workarounds
9546         following code in binutils/sysdep.h.
9547
9548         PR 6048
9549         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
9550         this->eh_frame_hdr_ is NULL before using it.
9551
9552         * dynobj.cc (Versions::Versions): Update comment.
9553
9554         * dynobj.cc (Versions::Versions): If there is an soname, use it as
9555         the base version name.
9556
9557         * stringpool.cc (Stringpool_template::add_with_length): Set key to
9558         array size plus one.
9559         (Stringpool_template::set_string_offsets): Subtract one from key
9560         before using it as an array index.
9561         (Stringpool_template::get_offset_with_length): Likewise.
9562         (Stringpool_template::write_to_buffer): Likewise.
9563         * stringpool.h (Stringpool_template::get_offset_from_key):
9564         Likewise.
9565
9566 2008-07-23  Ian Lance Taylor  <iant@google.com>
9567
9568         PR 6658
9569         * object.h (Merged_symbol_value::value): Do our best to handle a
9570         negative addend.
9571
9572         PR 6647
9573         * script.cc (Version_script_info::get_versions): Don't add empty
9574         version tag to return value.
9575         (Version_script_info::get_symbol_version_helper): Change return
9576         type to bool.  Add pversion parameter.  Change all callers.
9577         (script_register_vers_node): Don't require a non-NULL tag.
9578         * script.h (class Version_script_info): Update declarations.
9579         (Version_script_info::get_symbol_version): Change return type to
9580         bool.  Add version parameter.  Change all callers.
9581         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
9582         handling.  Handle an empty version from a version script.
9583         (Symbol_table::define_special_symbol): Likewise.
9584         * testsuite/ver_test_10.script: New file.
9585         * testsuite/ver_test_10.sh: New file.
9586         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
9587         (check_DATA): Add ver_test_10.syms.
9588         (ver_test_10.syms, ver_test_10.so): New target.
9589         * testsuite/Makefile.in: Rebuild.
9590
9591 2008-07-23  Simon Baldwin  <simonb@google.com>
9592
9593         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
9594         to zero for undefined symbols from dynamic libraries.
9595
9596 2008-07-23  Ian Lance Taylor  <iant@google.com>
9597
9598         * symtab.cc (Symbol_table::resolve): Remove version parameter.
9599         Change all callers.
9600         * symtab.h (class Symbol_table): Update declaration.
9601         * testsuite/ver_test_9.cc: New file.
9602         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
9603         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
9604         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
9605         (ver_test_9.so, ver_test_9.o): New targets.
9606         * testsuite/Makefile.in: Rebuild.
9607
9608 2008-07-22  Ian Lance Taylor  <iant@google.com>
9609
9610         * options.h (class General_options): Define --check-sections.
9611         * layout.cc (Layout::set_segment_offsets): Handle
9612         --check-sections.
9613
9614         * options.h (class General_options): Define -n/--nmagic and
9615         -N/--omagic.
9616         * options.cc (General_options::finalize): For -n/--nmagic or
9617         -N/--omagic, set -static.
9618         * layout.cc (Layout::attach_allocated_section_to_segment): If
9619         -N/--omagic, don't put read-only and read-write sections in
9620         different segments.
9621         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
9622         finding a read-only segment.
9623         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
9624         don't set the minimum segment alignment to the common page size,
9625         and don't set the file offset to the address modulo the page size.
9626         * script-sections.cc (Script_sections::create_segments): If
9627         -n/--omagic, don't put read-only and read-write sections in
9628         different segments.
9629
9630         * cref.cc: New file.
9631         * cref.h: New file.
9632         * options.h (class General_options): Add --print-symbol-counts.
9633         * main.cc (main): Issue defined symbol report if requested.
9634         * archive.cc (Archive::interpret_header): Make into a const member
9635         function.
9636         (Archive::add_symbols): Call Input_objects::archive_start and
9637         archive_stop.
9638         (Archive::const_iterator): Define new class.
9639         (Archive::begin, Archive::end): New functions.
9640         (Archive::include_all_members): Rewrite to use iterator.
9641         (Archive::count_members): New function.
9642         * archive.h (class Archive): Update declarations.
9643         (Archive::filename): New function.
9644         * object.cc: Include "cref.h".
9645         (Sized_relobj::Sized_relobj): Initialize defined_count_.
9646         (Sized_relobj::do_get_global_symbol_counts): New function.
9647         (Input_objects::add_object): Add object to cross-referencer.
9648         (Input_objects::archive_start): New function.
9649         (Input_objects::archive_stop): New function.
9650         (Input_objects::print_symbol_counts): New function.
9651         * object.h: Declare Cref and Archive.
9652         (Object::get_global_symbol_counts): New function.
9653         (Object::do_get_global_symbol_counts): New pure virtual function.
9654         (class Sized_relobj): Add defined_count_ field.  Update
9655         declarations.
9656         (class Input_objects): Add cref_ field.  Update constructor.
9657         Update declarations.
9658         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
9659         defined_count_.
9660         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
9661         symbol counts.
9662         (Sized_dynobj::do_get_global_symbol_counts): New function.
9663         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
9664         defined_count_.  Update declarations.  Define Symbols typedef.
9665         * symtab.cc (Symbol_table::add_from_relobj): Add defined
9666         parameter.  Change all callers.
9667         (Symbol_table::add_from_dynobj): Add sympointers and defined
9668         parameters.  Change all callers.
9669         * symtab.h (class Symbol_table): Update declarations.
9670         * Makefile.am (CCFILES): Add cref.cc.
9671         (HFILES): Add cref.h.
9672         * Makefile.in: Rebuild.
9673
9674 2008-07-22  Simon Baldwin  <simonb@google.com>
9675
9676         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
9677         to zero when writing undefined symbols.
9678
9679 2008-07-22  Ian Lance Taylor  <iant@google.com>
9680
9681         * output.cc (Output_section::add_input_section): Don't try to
9682         merge empty merge sections.
9683
9684 2008-07-21  Craig Silverstein  <csilvers@google.com>
9685
9686         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9687         Include symbol version in error message.
9688
9689 2008-07-20  Chris Demetriou  <cgd@google.com>
9690
9691         * configure.ac (gold_cv_c_random_seed): New configured variable.
9692         (RANDOM_SEED_CFLAGS): New substituted variable.
9693         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
9694         * configure: Rebuild.
9695         * Makefile.in: Likewise.
9696         * testsuite/Makefile.in: Likewise.
9697
9698 2008-07-18  Ian Lance Taylor  <iant@google.com>
9699
9700         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
9701         where we see NAME/NULL and NAME/VERSION  as separate symbols.
9702         * testsuite/ver_test_main.cc (main): Call t4.
9703         (t4, t4_2a): Define.
9704         * testsuite/ver_test_2.cc (t4_2): Define.
9705         * testsuite/ver_test_2.script: Put t4_2a in VER2.
9706         * testsuite/ver_test_4.cc (t4_2a): Define.
9707         * testsuite/ver_test_4.script: Put t4_2a in VER2.
9708         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
9709
9710 2008-07-17  Ian Lance Taylor  <iant@google.com>
9711
9712         * dynobj.cc (Versions::add_def): If we give an error about a
9713         missing version, go ahead and create the version anyhow.
9714
9715 2008-07-10  Ian Lance Taylor  <iant@google.com>
9716
9717         Handle output sections with more than 0x7fffffff bytes.
9718         * object.h (class Relobj): Change map_to_output_ to
9719         output_sections_, and just keep a section pointer.  Change all
9720         uses.  Move comdat group support to Sized_relobj.
9721         (Relobj::is_section_specially_mapped): Remove.
9722         (Relobj::output_section): Remove poff parameter.  Change all
9723         callers.
9724         (Relobj::output_section_offset): New function.
9725         (Relobj::set_section_offset): Rewrite.
9726         (Relobj::map_to_output): Remove.
9727         (Relobj::output_sections): New function.
9728         (Relobj::do_output_section_offset): New pure virtual function.
9729         (Relobj::do_set_section_offset): Likewise.
9730         (class Sized_relobj): Add section_offsets_ field.  Add comdat
9731         group support from Relobj.  Update declarations.
9732         (Sized_relobj::get_output_section_offset): New function.
9733         (Sized_relobj::do_output_section_offset): New function.
9734         (Sized_relobj::do_set_section_offset): New function.
9735         * object.cc (Relobj::output_section_address): Remove.
9736         (Sized_relobj::Sized_relobj): Initialize new fields.
9737         (Sized_relobj::include_section_group): Cast find_kept_object to
9738         Sized_relobj.
9739         (Sized_relobj::include_linkonce_section): Likewise.
9740         (Sized_relobj::do_layout): Use separate arrays for output section
9741         and output offset.
9742         (Sized_relobj::do_count_local_symbols): Change map_to_output to
9743         output_sections.
9744         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
9745         output_sections and section_offsets.
9746         (Sized_relobj::write_local_symbols): Likewise.
9747         (map_to_kept_section): Compute output address directly.
9748         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
9749         output_sections and section_offsets.
9750         (Sized_relobj::write_sections): Likewise.
9751         (Sized_relobj::relocate_sections): Likewise.
9752         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
9753         * output.h (class Output_reloc): Update declarations.  Change
9754         u2_.relobj to Sized_relobj*.
9755         (class Output_data_reloc): Change add functions to use
9756         Sized_relobj*.
9757         * output.cc (Output_reloc::Output_reloc): Change relobj to
9758         Sized_relobj*.
9759         (Output_reloc::local_section_offset): Change return type to
9760         Elf_Addr.  Use get_output_section_offset.
9761         (Output_reloc::get_address): Likewise.
9762         (Output_section::is_input_address_mapped): Don't call
9763         is_section_specially_mapped.
9764         (Output_section::output_offset): Likewise.
9765         (Output_section::output_address): Likewise.
9766         (Output_section::starting_output_address): Likewise.
9767         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
9768         parameter to Sized_relobj*.
9769         (Copy_relocs::need_copy_reloc): Likewise.
9770         (Copy_relocs::save): Likewise.
9771         * copy-relocs.h (class Copy_relocs): Update declarations.
9772         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
9773         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
9774         * target-reloc.h (relocate_for_relocatable): Change
9775         offset_in_output_section type to Elf_Addr.  Change code that uses
9776         it as well.
9777         * layout.cc (Layout::layout): Always set *off.
9778         * mapfile.cc (Mapfile::print_input_section): Use
9779         output_section_offset.
9780         * i386.cc (Target_i386::copy_reloc): Change object parameter to
9781         Sized_relobj*.
9782         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
9783         * sparc.cc (Target_sparc::copy_reloc): Likewise.
9784         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
9785
9786 2008-07-03  Ian Lance Taylor  <iant@google.com>
9787
9788         * layout.cc (Layout::include_section): Do not discard unrecognized
9789         SHT_STRTAB sections.
9790
9791 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
9792
9793         * script.cc (Lex::can_continue_name): Make '?' allowable in
9794         version-script names.
9795         * testsuite/version_script.map: Change glob pattern to use '?'
9796
9797 2008-06-30  Manish Singh  <yosh@gimp.org>
9798
9799         PR 6585
9800         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
9801         Correct typo.
9802
9803 2008-06-30  Ian Lance Taylor  <iant@google.com>
9804
9805         PR 6660
9806         PR 6682
9807         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
9808         versions]: Don't try to read the value in the contents, since we
9809         don't use it.  Use the template endianness when writing.
9810
9811 2008-06-25  Cary Coutant  <ccoutant@google.com>
9812
9813         * fileread.cc (File_read::make_view): Assert on zero-length view.
9814         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
9815         symbol table when there are no symbols to read.
9816
9817 2008-06-23  Craig Silverstein  <csilvers@google.com>
9818
9819         * version.cc (version_string): Bump to 1.7
9820
9821 2008-06-18  Craig Silverstein  <csilvers@google.com>
9822
9823         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
9824         constant 0xFFFF to type Valtype.
9825         (Powerpc_relocate_functions::rel16_ha): Likewise.
9826
9827 2008-06-17  Ian Lance Taylor  <iant@google.com>
9828
9829         * output.h (Output_section::Input_section): Initialize p2align_ to
9830         zero for Output_section_data constructors.
9831         (Output_section::Input_section::addralign): If not an input
9832         section, return the alignment of the Output_section_data.
9833         * testsuite/copy_test.cc: New file.
9834         * testsuite/copy_test_1.cc: New file.
9835         * testsuite/copy_test_2.cc: New file.
9836         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
9837         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
9838         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
9839         (copy_test_1_pic.o, copy_test_1.so): New targets.
9840         (copy_test_2_pic.o, copy_test_2.so): New targets.
9841         * testsuite/Makefile.in: Rebuild.
9842
9843         * script-sections.cc (Script_sections::place_orphan): Initialize
9844         local variable exact.
9845
9846 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
9847
9848         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
9849
9850 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
9851             David S. Miller  <davem@davemloft.net>
9852
9853         * powerpc.cc: New file.
9854         * Makefile.am (TARGETSOURCES): Add powerpc.cc
9855         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
9856         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
9857         * Makefile.in: Rebuild.
9858
9859 2008-06-09  Ian Lance Taylor  <iant@google.com>
9860
9861         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
9862         <exception>.
9863         (throwing, orig_terminate): New static variables.
9864         (terminate_handler): New static function.
9865         (t2): Set terminate handler.
9866
9867 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
9868
9869         PR 6584
9870         * binary.cc (Binary_to_elf::sized_convert): Fix .data
9871         alignment.
9872
9873 2008-05-30  Cary Coutant  <ccoutant@google.com>
9874
9875         * archive.cc (Archive::include_all_members) Correct to step
9876         over symbol table and extended name table in thin archives.
9877
9878 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
9879
9880         PR 6407
9881         * target-reloc.h (relocate_for_relocatable): Fix new_offset
9882         calculation.
9883
9884 2008-05-28  Caleb Howe  <cshowe@google.com>
9885
9886         * reduced_debug_output.cc: New file.
9887         * reduced_debug_output.h: New file.
9888         * options.h (class General_options): Add --strip-debug-non-line.
9889         * options.cc (General_options::finalize): Add strip_debug_non_line
9890         to the strip heirarchy.
9891         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
9892         fields.
9893         * layout.cc: Include "reduced_debug_output.h".
9894         (Layout::Layout): Initialize new fields.
9895         (line_only_debug_sections): New static array.
9896         (is_lines_only_debug_sections): New static inline function.
9897         (Layout::include_section): Handle --strip-debug-non-line.
9898         (Layout::make_output_section): If --strip-debug-non-line, build
9899         new output sections for .debug_abbrev and .debug_info.
9900         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
9901         gold.  Warn about possible overflow.
9902         (read_signed_LEB_128): Likewise.
9903         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
9904         (read_signed_LEB_128): Declare.
9905         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
9906         (HFILES): Add reduced_debug_output.h.
9907         * Makefile.in: Rebuild.
9908
9909 2008-05-21  Ian Lance Taylor  <iant@google.com>
9910
9911         * mapfile.cc: New file.
9912         * mapfile.h: New file.
9913         * options.h (class General_options): Add -M/--print-map and -Map.
9914         * options.cc (General_options::finalize): Make -M equivalent to
9915         -Map -.
9916         * main.cc: Include <cstdio> and "mapfile.h".
9917         (main): Open mapfile if requested.
9918         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
9919         constructor.  Change caller.
9920         (queue_initial_tasks): Add mapfile parameter.  Change caller.
9921         (queue_middle_tasks): Likewise.
9922         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
9923         declarations.
9924         * archive.cc: Include "mapfile.h".
9925         (Archive::add_symbols): Add mapfile parameter.  Change all
9926         callers.  Pass mapfile, symbol, and reason to include_member.
9927         (Archive::include_all_members): Add mapfile parameter.  Change all
9928         callers.
9929         (Archive::include_member): Add mapfile, sym, and why parameters.
9930         Change all callers.  Report inclusion to map file.
9931         * archive.h: Include "fileread.h".
9932         (class Archive): Update declarations.
9933         (Archive::file): New const method.
9934         (class Add_archive_symbols): Add mapfile_ field.  Update
9935         constructor.  Change all callers.
9936         * readsyms.h (class Read_symbols): Likewise.
9937         (class Finish_group): Likewise.
9938         (class Read_script): Likewise.
9939         * common.cc: Include "mapfile.h".
9940         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
9941         all callers.
9942         (Symbol_table::do_allocate_commons): Likewise.
9943         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
9944         symbol allocation to mapfile.
9945         * common.h (class Allocate_commons_task): Add mapfile_ field.
9946         Update constructor.  Change all callers.
9947         * symtab.h (class Symbol_table): Update declarations.
9948         * layout.cc: Include "mapfile.h".
9949         (Layout_task_runner::run): Print information to mapfile.
9950         (Layout::create_gold_note): Change Output_data_fixed_space to
9951         Output_data_zero_fill.
9952         (Layout::create_build_id): Likewise.
9953         (Layout::print_to_mapfile): New function.
9954         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
9955         constructor.  Change caller.
9956         (class Layout): Declare print_to_mapfile.
9957         * output.cc (Output_section::Input_section::print_to_mapfile): New
9958         function.
9959         (Output_section::add_input_section): If producing a map, always
9960         add to input_sections_ list.
9961         (Output_section::do_print_to_mapfile): New function.
9962         (Output_segment::print_sections_to_mapfile): New function.
9963         (Output_segment::print_section_list_to_mapfile): New function.
9964         * output.h: Include "mapfile.h".
9965         (Output_data::print_to_mapfile): New function.
9966         (Output_data::do_print_to_mapfile): New virtual function.
9967         (Output_segment_headers::do_print_to_mapfile): New function.
9968         (Output_file_header::do_print_to_mapfile): New function.
9969         (Output_data_const::do_print_to_mapfile): New function.
9970         (class Output_data_const_buffer): Add map_name_ field.  Update
9971         constructor.  Change all callers.  Add do_print_to_mapfile
9972         function.
9973         (class Output_data_fixed_space): Likewise.
9974         (class Output_data_space): Likewise.
9975         (class Output_data_zero_fill): New class.
9976         (Output_data_strtab::do_print_to_mapfile): New function.
9977         (Output_data_reloc_base::do_print_to_mapfile): New function.
9978         (Output_relocatable_relocs::do_print_to_mapfile): New function.
9979         (Output_data_group::do_print_to_mapfile): New function.
9980         (Output_data_got::do_print_to_mapfile): New function.
9981         (Output_data_dynamic::do_print_to_mapfile): New function.
9982         (Output_symtab_xindex::do_print_to_mapfile): New function.
9983         (class Output_section): Declare do_print_to_mapflie.  Declare
9984         print_to_mapfile in Input_section.
9985         (class Output_segment): Declare new functions.
9986         * object.h (Sized_relobj::symbol_count): New function.
9987         * script-sections.cc
9988         (Output_section_element_dot_assignment::set_section_addresses):
9989         Change Output_data_fixed_space to Output_data_zero_fill.
9990         (Output_data_expression::do_print_to_mapfile): New function.
9991         * script.cc (read_input_script): Add mapfile parameter.  Change
9992         all callers.
9993         * script.h (read_input_script): Update declaration.
9994         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
9995         (Eh_frame::do_print_to_mapfile): New function.
9996         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
9997         (Output_merge_string::do_print_to_mapfile): New function.
9998         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
9999         function.
10000         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
10001         function.
10002         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
10003         function.
10004         * Makefile.am (CCFILES): Add mapfile.cc.
10005         (HFILES): Add mapfile.h.
10006         * Makefile.in: Rebuild.
10007
10008 2008-05-19  Ian Lance Taylor  <iant@google.com>
10009
10010         * options.h (class General_options): Add -z relro.
10011         * layout.cc (Layout::Layout): Initialize relro_segment_.
10012         (Layout::add_output_section_data): Return the output section.
10013         (Layout::make_output_section): Rcognize relro sections and mark
10014         them appropriately.
10015         (Layout::attach_allocated_section_to_segment): Put relro sections
10016         in a PT_GNU_RELRO segment.
10017         (Layout::create_initial_dynamic_sections): Mark the .dynamic
10018         section as relro.
10019         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
10020         PT_TLS segments.
10021         (Layout::linkonce_mapping): Map d.rel.ro.local to
10022         .data.rel.ro.local.
10023         (Layout::output_section_name): Us .data.rel.ro.local for any
10024         section which begins with that.
10025         * layout.h (class Layout): Update add_output_section_data
10026         declaration.  Add relro_segment_ field.
10027         * output.cc (Output_section::Output_section): Initialize is_relro_
10028         and is_relro_local_ fields.
10029         (Output_segment::add_output_section): Group relro sections.
10030         (Output_segment::is_first_section_relro): New function.
10031         (Output_segment::maximum_alignment): If there is a relro section,
10032         align the segment to the common page size.
10033         (Output_segment::set_section_addresses): Track whether we are
10034         looking at relro sections.  If the last section is a relro
10035         section, align to the common page size.
10036         (Output_segment::set_section_list_addresses): Add in_relro
10037         parameter.  Change all callers.  Align to the page size when
10038         moving from relro to non-relro section.
10039         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
10040         segment.
10041         * output.h (class Output_section): Add is_relro_ and
10042         is_relro_local_ fields.
10043         (Output_section::is_relro): New function.
10044         (Output_section::set_is_relro): New function.
10045         (Output_section::is_relro_local): New function.
10046         (Output_section::set_is_relro_local): New function.
10047         (class Output_segment): Update declarations.
10048         * i386.cc (Target_i386::got_section): Mark .got section as relro.
10049         * sparc.cc (Target_sparc::got_section): Likewise.
10050         * x86_64.cc (Target_x86_64::got_section): Likewise.
10051         * testsuite/relro_test_main.cc: New file.
10052         * testsuite/relro_test.cc: New file.
10053         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
10054         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
10055         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
10056         (relro_test.so, relro_test_pic.o): New targets.
10057         * testsuite/Makefile.in: Rebuild.
10058
10059 2008-05-16  Ian Lance Taylor  <iant@google.com>
10060
10061         * output.cc (Output_segment::add_output_section): Remove front
10062         parameter.
10063         * output.h (class Output_segment): Remove
10064         add_initial_output_section and overloaded add_output_section.
10065         Update declaration of remaining add_output_section.
10066         * layout.cc (Layout::create_interp): Call add_output_section
10067         rather than add_initial_output_section.
10068         (Layout::finish_dynamic_section): Likewise.
10069
10070         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
10071         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
10072         know the dynamic type.
10073         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
10074         field.  Initialize it in constructor.
10075         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
10076         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
10077         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
10078         reloc.
10079
10080         * output.cc (Output_reloc::get_address): Change return type to
10081         Elf_Addr.
10082         * output.h (class Output_reloc): Update get_address declaration.
10083         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
10084         for section addresses.
10085
10086 2008-05-09  Ian Lance Taylor  <iant@google.com>
10087
10088         PR 6493
10089         * gold.cc (gold_nomem): Use return value of write.
10090
10091 2008-05-08  Ian Lance Taylor  <iant@google.com>
10092
10093         * symtab.c (Symbol::init_base_output_data): Add version
10094         parameter.  Change all callers.
10095         (Symbol::init_base_output_segment): Likewise.
10096         (Symbol::init_base_constant): Likewise.
10097         (Symbol::init_base_undefined): Likewise.
10098         (Sized_symbol::init_output_data): Likewise.
10099         (Sized_symbol::init_output_segment): Likewise.
10100         (Sized_symbol::init_constant): Likewise.
10101         (Sized_symbol::init_undefined): Likewise.
10102         (Symbol_table::do_define_in_output_data): If the new symbol has a
10103         version, mark it as the default.
10104         (Symbol_table::do_define_in_output_segment): Likewise.
10105         (Symbol_table::do_define_as_constant): Likewise.
10106         * symtab.h (class Symbol): Update declarations.
10107         (class Sized_symbol): Likewise.
10108         * resolve.cc (Symbol::override_version): New function.
10109         (Symbol::override_base): Call override_version.
10110         (Symbol::override_base_with_special): Likewise.
10111         * testsuite/ver_script_8.script: New file.
10112         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
10113         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
10114         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
10115         (ver_test_8_1.so, ver_test_8_2.so): New targets.
10116
10117 2008-05-06  Ian Lance Taylor  <iant@google.com>
10118
10119         PR 6049
10120         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
10121         functions.
10122         (class General_options): Remove existing --undefined, and add
10123         --no-undefined instead.  Add new --undefined as synonym for -u.
10124         * archive.cc (Archive::add_symbols): Check whether symbol was
10125         named with -u.
10126         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
10127         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
10128         all uses.  Add IS_UNDEFINED.  Update declarations to split
10129         different versions of init_base.  Declare init_base_undefined.
10130         (Symbol::is_defined): Handle IS_UNDEFINED.
10131         (Symbol::is_undefined): Likewise.
10132         (Symbol::is_weak_undefined): Call is_undefined.
10133         (Symbol::is_absolute): Handle IS_CONSTANT.
10134         (class Sized_symbol): Update declarations to split different
10135         versions of init.  Declare init_undefined.
10136         (class Symbol_table): Declare new functions.
10137         * symtab.cc (Symbol::init_base_object): Rename from init_base.
10138         Change all callers.
10139         (Symbol::init_base_output_data): Likewise.
10140         (Symbol::init_base_output_segment): Likewise.
10141         (Symbol::init_base_constant): Likewise.
10142         (Symbol::init_base_undefined): New function.
10143         (Sized_symbol::init_object): Rename from init.  Change all
10144         callers.
10145         (Sized_symbol::init_output_data): Likewise.
10146         (Sized_symbol::init_output_segment): Likewise.
10147         (Sized_symbol::init_constant): Likewise.
10148         (Sized_symbol::init_undefined): New function.
10149         (Symbol_table::add_undefined_symbols_from_command_line): New
10150         function.
10151         (Symbol_table::do_add_undefined_symbols_from_command_line): New
10152         function.
10153         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
10154         (Symbol::output_section): Likewise.
10155         (Symbol::set_output_section): Likewise.
10156         (Symbol_table::sized_finalize_symbol): Likewise.
10157         (Symbol_table::sized_write_globals): Likewise.
10158         * resolve.cc (Symbol_table::should_override): Likewise.
10159         (Symbol::override_base_with_special): Likewise.
10160
10161         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
10162         symbol, change it to have default visibility.
10163         * testsuite/protected_1.cc: New file.
10164         * testsuite/protected_2.cc: New file.
10165         * testsuite/protected_3.cc: New file.
10166         * testsuite/protected_main_1.cc: New file.
10167         * testsuite/protected_main_2.cc: New file.
10168         * testsuite/protected_main_3.cc: New file.
10169         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
10170         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
10171         (protected_1_LDFLAGS, protected_1_LDADD): Define.
10172         (protected_1.so): New target.
10173         (protected_1_pic.o, protected_2_pic.o): New targets.
10174         (protected_3_pic.o): New target.
10175         (check_PROGRAMS): Add protected_2.
10176         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
10177         (protected_2_LDFLAGS, protected_2_LDADD): Define.
10178         * testsuite/Makefile.in: Rebuild.
10179
10180         * options.h (DEFINE_var): Add set_user_set_##varname__.
10181         (DEFINE_bool_alias): New macro.
10182         (class General_options): Define -Bstatic using DEFINE_bool_alias
10183         rather than DEFINE_special.  Add --undefined as an alias for -z
10184         defs.
10185         * options.cc (General_options::parse_Bstatic): Remove.
10186
10187         * options.h (class General_options): Add --fatal-warnings.
10188         * main.cc (main): Implement --fatal-warnings.
10189         * errors.h (Errors::warning_count): New function.
10190
10191         * options.h (class General_options): Add -Bsymbolic-functions.
10192         * symtab.h (Symbol::is_preemptible): Check for
10193         -Bsymbolic-functions.
10194
10195 2008-05-05  Ian Lance Taylor  <iant@google.com>
10196
10197         * options.h (DEFINE_bool): For DASH_Z, create the negative option
10198         as noVARNAME rather than no-VARNAME.
10199         (class General_options): Add option -z combreloc.
10200         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
10201         get_address.
10202         (Output_reloc::sort_before) [SHT_REL]: New function.
10203         (Output_reloc::sort_before) [SHT_RELA]: New function.
10204         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
10205         Sort_relocs_comparison.
10206         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
10207         parameter.  Change all callers.
10208         (Output_data_reloc::Output_data_reloc) [both versions]: Add
10209         sort_relocs parameter.  Change all callers.
10210         * output.cc (Output_reloc::get_address): New function, broken out
10211         of write_rel.
10212         (Output_reloc::write_rel): Call it.
10213         (Output_reloc::compare): New function.
10214         (Output_data_reloc_base::do_write): Optionally sort relocs.
10215
10216         * configure.ac: If targ_extra_obj is set, link it in.
10217         * configure.tgt: Initialize all variables.
10218         (x86_64*): Set targ_extra_obj and targ_extra_size.
10219         * configure: Rebuild.
10220
10221         * object.cc (Sized_relobj::include_section_group): Adjust section
10222         indexes read from group data.  Build vector to pass to
10223         layout_group.
10224         * layout.cc (Layout::layout_group): Add flags and shndxes
10225         parameters.  Remove contents parameter.  Change caller.  Update
10226         explicit instantiations.
10227         * layout.h (class Layout): Update layout_group declaration.
10228         * output.cc (Output_data_group::Output_data_group): Add flags and
10229         input_shndxes parameters.  Remove contents parameter.  Change
10230         caller.
10231         (Output_data_group::do_write): Change input_sections_ to
10232         input_shndxes_.
10233         * output.h (class Output_data_group): Update constructor
10234         declaration.  Rename input_sections_ to input_shndxes_.
10235         * testsuite/many_sections_test.cc: Add template.
10236
10237 2008-04-30  Cary Coutant  <ccoutant@google.com>
10238
10239         * target-reloc.h (relocate_section): Fix dead-pointer bug.
10240
10241         * layout.cc (Layout::include_section): Refactored check for debug
10242         info section.
10243         (Layout::add_comdat): Add new parameters.  Change type
10244         of signature parameter.  Add object and shndx to signatures table.
10245         (Layout::find_kept_object): New function.
10246         * layout.h: Include <cstring>.
10247         (Layout::is_debug_info_section): New function.
10248         (Layout::add_comdat): Add new parameters.
10249         (Layout::find_kept_object): New function.
10250         (Layout::Kept_section): New struct.
10251         (Layout::Signatures): Change type of map range.
10252         * object.cc (Relobj::output_section_address): New function.
10253         (Sized_relobj::include_section_group): Add new parameters.  Change
10254         calls to Layout::add_comdat.  Change to build table of kept comdat
10255         groups and table mapping discarded sections to kept sections.
10256         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
10257         (Sized_relobj::do_layout): Change calls to include_section_group and
10258         include_linkonce_section.
10259         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
10260         value to zero when section is discarded.
10261         (Sized_relobj::map_to_kept_section): New function.
10262         * object.h (Relobj::output_section_address): New function.
10263         (Relobj::Comdat_group): New type.
10264         (Relobj::find_comdat_group): New function.
10265         (Relobj::Comdat_group_table): New type.
10266         (Relobj::Kept_comdat_section): New type.
10267         (Relobj::Kept_comdat_section_table): New type.
10268         (Relobj::add_comdat_group): New function.
10269         (Relobj::set_kept_comdat_section): New function.
10270         (Relobj::get_kept_comdat_section): New function.
10271         (Relobj::comdat_groups_): New field.
10272         (Relobj::kept_comdat_sections_): New field.
10273         (Symbol_value::input_value): Update comment.
10274         (Sized_relobj::map_to_kept_section) New function.
10275         (Sized_relobj::include_linkonce_section): Add new parameter.
10276         * target-reloc.h (Comdat_behavior): New type.
10277         (get_comdat_behavior): New function.
10278         (relocate_section): Add code to map a discarded section to the
10279         corresponding kept section when applying a relocation.
10280
10281 2008-04-30  Craig Silverstein  <csilvers@google.com>
10282
10283         * dwarf_reader.cc (next_generation_count): New static var.
10284         (Addr2line_cache_entry): New struct.
10285         (addr2line_cache): New static var.
10286         (Dwarf_line_info::one_addr2line): Added caching.
10287         (Dwarf_line_info::clear_addr2line_cache): New function.
10288         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
10289         cache-size parameter.
10290         (Dwarf_line_info::one_addr2line_cache): New function.
10291         * symtab.cc (Symbol_table::detect_odr_violations): Pass
10292         new cache-size argument to one_addr2line(), and clear cache.
10293
10294 2008-04-28  Cary Coutant  <ccoutant@google.com>
10295
10296         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
10297         R_386_PC8 relocations.
10298
10299 2008-04-23  Ian Lance Taylor  <iant@google.com>
10300
10301         * object.cc (Sized_relobj::include_section_group): Check for
10302         invalid section group.
10303
10304         * object.cc (make_elf_object): Correct test for 64-bit ELF file
10305         header size.
10306
10307         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
10308         than read for file header.
10309         * archive.cc (Archive::include_member): Likewise.
10310
10311 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
10312
10313         * aclocal.m4: Regenerate.
10314         * configure: Regenerate.
10315
10316 2008-04-19  Ian Lance Taylor  <iant@google.com>
10317
10318         * version.cc (version_string): Bump to 1.6.
10319
10320         * testsuite/Makefile.am (many_sections_r_test): New target.
10321         (many_sections_r_test_SOURCES): Remove.
10322         (many_sections_r_test_DEPENDENCIES): Remove.
10323         (many_sections_r_test_LDFLAGS): Remove.
10324         (many_sections_r_test_LDADD): Remove.
10325
10326         * object.cc (Sized_relobj::do_add_symbols): Always pass
10327         local_symbol_count_ to add_from_relobj.
10328
10329         * testsuite/Makefile.am (many_sections_check.h): Only check one in
10330         every thousand variables.
10331         * testsuite/Makefile.in: Rebuild.
10332
10333         * object.cc (Xindex::initialize_symtab_xindex): New function.
10334         (Xindex::read_symtab_xindex): New function.
10335         (Xindex::sym_xindex_to_shndx): New function.
10336         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
10337         available.
10338         (Sized_relobj::do_initialize_xindex): New function.
10339         (Sized_relobj::do_read_symbols): Adjust section links.
10340         (Sized_relobj::symbol_section_and_value): Add is_ordinary
10341         parameter.  Change all callers.
10342         (Sized_relobj::include_section_group): Adjust section links and
10343         symbol section indexes.
10344         (Sized_relobj::do_layout): Adjust section links.
10345         (Sized_relobj::do_count_local_symbols): Adjust section links and
10346         symbol section indexes.
10347         (Sized_relobj::do_finalize_local_symbols): Distinguish between
10348         ordinary and special symbols.
10349         (Sized_relobj::write_local_symbols): Add symtab_xindex and
10350         dynsym_xindex parameters.  Change all callers.  Adjust section
10351         links.  Use SHN_XINDEX when needed.
10352         (Sized_relobj::get_symbol_location_info): Adjust section links.
10353         Don't get fooled by special symbols.
10354         * object.h (class Xindex): Define.
10355         (class Object): Add xindex_ parameter.  Declare virtual functoin
10356         do_initialize_xindex.
10357         (Object::adjust_sym_shndx): New function.
10358         (Object::set_xindex): New protected function.
10359         (class Symbol_value): Add is_ordinary_shndx_ field.
10360         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
10361         (Symbol_value::value): Assert ordinary section.
10362         (Symbol_value::initialize_input_to_output_map): Likewise.
10363         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
10364         Change all callers.
10365         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
10366         all callers.
10367         (class Sized_relobj): Update declarations.
10368         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
10369         parameter.  Change all callers.
10370         (Sized_relobj::adjust_shndx): New function.
10371         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
10372         field.
10373         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
10374         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
10375         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
10376         (Sized_dynobj::read_dynsym_section): Adjust section links.
10377         (Sized_dynobj::read_dynamic): Likewise.
10378         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
10379         section links.
10380         (Sized_dynobj::do_initialize_xindex): New function.
10381         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
10382         do_initialize_xindex.
10383         (Sized_dynobj::adjust_shndx): New function.
10384         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
10385         dynsym_xindex_ fields.
10386         (Layout::finalize): Add a call to set_section_indexes before
10387         creating the symtab sections.
10388         (Layout::set_section_indexes): Don't do anything if the section
10389         already has a section index.
10390         (Layout::create_symtab_sections): Add shnum parameter.  Change
10391         caller.  Create .symtab_shndx section if needed.
10392         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
10393         caller.
10394         (Layout::allocated_output_section_count): New function.
10395         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
10396         needed.
10397         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
10398         fields.  Update declarations.
10399         (Layout::symtab_xindex): New function.
10400         (Layout::dynsym_xindex): New function.
10401         (class Write_symbols_task): Add layout_ field.
10402         (Write_symbols_task::Write_symbols_task): Add layout parameter.
10403         Change caller.
10404         * output.cc (Output_section_headers::Output_section_headers): Add
10405         shstrtab_section parameter.  Change all callers.
10406         (Output_section_headers::do_sized_write): Store overflow values
10407         for section count and section string table section index in
10408         section header zero.
10409         (Output_file_header::do_sized_write): Check for overflow of
10410         section count and section string table section index.
10411         (Output_symtab_xindex::do_write): New function.
10412         (Output_symtab_xindex::endian_do_write): New function.
10413         * output.h (class Output_section_headers): Add shstrtab_section_.
10414         Update declarations.
10415         (class Output_symtab_xindex): Define.
10416         (Output_section::has_out_shndx): New function.
10417         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
10418         field.
10419         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
10420         Change all callers.
10421         (Sized_symbol::init): Likewise.
10422         (Symbol::output_section): Check for ordinary symbol.
10423         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
10424         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
10425         callers.
10426         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
10427         Change all callers.  Simplify handling of symbols from sections
10428         not included in the link.
10429         (Symbol_table::add_from_dynobj): Handle ordinary symbol
10430         distinction.
10431         (Weak_alias_sorter::operator()): Assert that symbols are
10432         ordinary.
10433         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
10434         distinction.
10435         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
10436         parameters.  Change all callers.
10437         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
10438         symbol distinction.  Use SHN_XINDEX when needed.
10439         (Symbol_table::write_section_symbol): Add symtab_xindex
10440         parameter.  Change all callers.
10441         (Symbol_table::sized_write_section_symbol): Likewise.  Use
10442         SHN_XINDEX when needed.
10443         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
10444         declarations.
10445         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
10446         (Symbol::is_defined): Check is_ordinary.
10447         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
10448         (Symbol::is_absolute, Symbol::is_common): Likewise.
10449         (class Sized_symbol): Update declarations.
10450         (class Symbol_table): Update declarations.
10451         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
10452         parameters.  Change all callers.
10453         (Sized_symbol::override): Likewise.
10454         (Symbol_table::override): Likewise.
10455         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
10456         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
10457         is_ordinary, and orig_st_shndx parameters.  Change all callers.
10458         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
10459         to be in an ordinary section.
10460         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
10461         object and is_ordinary parameters.  Change all callers.
10462         (Sized_dwarf_line_info::read_relocs): Add object parameter.
10463         Change all callers.  Don't add undefined or non-ordinary symbols
10464         to reloc_map_.
10465         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
10466         Change all callers.
10467         * dwarf_reader.h (class Sized_dwarf_line_info): Update
10468         declarations.
10469         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
10470         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
10471         (Sized_relobj::relocate_sections): Likewise.
10472         * target-reloc.h (scan_relocs): Adjust section symbol index.
10473         (scan_relocatable_relocs): Likewise.
10474         * i386.cc (Scan::local): Check for ordinary symbols.
10475         * sparc.cc (Scan::local): Likewise.
10476         * x86_64.cc (Scan::local): Likewise.
10477         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
10478         to symbol_section_and_value.
10479         * testsuite/many_sections_test.cc: New file.
10480         * testsuite/Makefile.am (BUILT_SOURCES): Define.
10481         (check_PROGRAMS): Add many_sections_test.
10482         (many_sections_test_SOURCES): Define.
10483         (many_sections_test_DEPENDENCIES): Define.
10484         (many_sections_test_LDFLAGS): Define.
10485         (BUILT_SOURCES): Add many_sections_define.h.
10486         (many_sections_define.h): New target.
10487         (BUILT_SOURCES): Add many_sections_check.h.
10488         (many_sections_check.h): New target.
10489         (check_PROGRAMS): Add many_sections_r_test.
10490         (many_sections_r_test_SOURCES): Define.
10491         (many_sections_r_test_DEPENDENCIES): Define.
10492         (many_sections_r_test_LDFLAGS): Define.
10493         (many_sections_r_test_LDADD): Define.
10494         (many_sections_r_test.o): New target.
10495         * testsuite/Makefile.in: Rebuild.
10496
10497 2008-04-17  Cary Coutant  <ccoutant@google.com>
10498
10499         * errors.cc (Errors::info): New function.
10500         (gold_info): New function.
10501         * errors.h (Errors::info): New function.
10502         * gold.h (gold_info): New function.
10503         * object.cc (Input_objects::add_object): Print trace output.
10504         * options.cc (options::parse_set): New function.
10505         (General_options::parse_wrap): Deleted.
10506         (General_options::General_options): Deleted initializer.
10507         * options.h (options::String_set): New typedef.
10508         (options::parse_set): New function.
10509         (DEFINE_set): New macro.
10510         (General_options::wrap): Changed to use DEFINE_set. Changed
10511         callers of any_wrap_symbols and is_wrap_symbol.
10512         (General_options::trace, General_options::trace_symbol):
10513         New options.
10514         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
10515         (General_options::wrap_symbols_): Deleted.
10516         * symtab.cc (Symbol_table::add_from_object): Print trace output.
10517
10518 2008-04-17  David S. Miller  <davem@davemloft.net>
10519
10520         * options.cc (General_options::parse_V): New function.
10521         * options.h: Add entries for -V and -Qy.
10522
10523 2008-04-17  Ian Lance Taylor  <iant@google.com>
10524
10525         * common.cc (Symbol_table::allocate_commons): Remove options
10526         parameter.  Change caller.
10527         (Symbol_table::do_allocate_commons): Remove options parameter.
10528         Change caller.  Just call do_allocate_commons_list twice.
10529         (Symbol_table::do_allocate_commons_list): New function, broken out
10530         of do_allocate_commons.
10531         * common.h (class Allocate_commons_task): Remove options_ field.
10532         Update constructor.
10533         * symtab.cc (Symbol_table::Symbol_table): Initialize
10534         tls_commons_.
10535         (Symbol_table::add_from_object): Put TLS common symbols on
10536         tls_commons_ list.
10537         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
10538         which are IN_OUTPUT_DATA.
10539         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
10540         allocate_commons and do_allocate_commons declarations.  Declare
10541         do_allocate_commons_list.
10542         * gold.cc (queue_middle_tasks): Update creation of
10543         Allocate_commons_task to not pass options.
10544         * testsuite/Makefile.am (INCLUDES): Add -I.. .
10545         (TLS_TEST_C_FLAGS): New variable.
10546         (tls_test_c_pic.o): New target.
10547         (tls_test_shared.so): Link in tls_test_c_pic.o.
10548         (tls_test_c_pic_ie.o): New target.
10549         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
10550         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
10551         (tls_test_c.o): New target.
10552         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
10553         (tls_pic_test_LDADD): Likewise.
10554         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
10555         (tls_shared_gd_to_ie_test_LDADD): Likewise.
10556         (tls_test_c_gnu2.o): New target.
10557         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
10558         tls_test_c_gnu2.o.
10559         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
10560         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
10561         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
10562         * testsuite/tls_test.cc: Include "config.h".
10563         (t_last): Call t11_last.
10564         * testsuite/tls_test.h (t11, t11_last): Declare.
10565         * testsuite/tls_test_c.c: New file.
10566         * testsuite/tls_test_main.cc (thread_routine): Call t11.
10567         * configure.ac: Check for OpenMP support.
10568         * configure, config.in, Makefile.in: Rebuild.
10569         * testsuite/Makefile.in: Rebuild.
10570
10571 2008-04-16  Cary Coutant  <ccoutant@google.com>
10572
10573         * i386.cc (Target_i386::define_tls_base_symbol): New function.
10574         (Target_i386::tls_base_symbol_defined_): New field.
10575         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10576         (Target_i386::Scan::global): Likewise.
10577         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
10578         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
10579         (Target_x86_64::tls_base_symbol_defined_): New field.
10580         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10581         (Target_x86_64::Scan::global): Likewise.
10582
10583 2008-04-16  Cary Coutant  <ccoutant@google.com>
10584
10585         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
10586         (Symbol::needs_plt_entry): Allow weak undefined symbols.
10587         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
10588         building shared libraries.
10589         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
10590         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
10591         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
10592         * testsuite/Makefile.in: Rebuild.
10593         * testsuite/weak_undef.h: New file.
10594         * testsuite/weak_undef_file1.cc: Add extra test cases.
10595         * testsuite/weak_undef_file2.cc: Likewise.
10596         * testsuite/weak_undef_test.cc: Likewise.
10597
10598 2008-04-16  David S. Miller  <davem@davemloft.net>
10599
10600         * sparc.cc (Target_sparc::Scan): Change from struct to class.
10601         Add issued_non_pic_error_ field.  Declare check_non_pic.
10602         (Target_sparc::Scan::check_non_pic): New function.
10603         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
10604         (Target_sparc::Scan::global): Likewise.
10605
10606         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
10607         * configure: Rebuild.
10608
10609         * options.h (DEFINE_enable): New macro.
10610         (new_dtags): New enable option.
10611         (initfirst, interpose, loadfltr, nodefaultlib,
10612         nodelete, nodlopen, nodump): New -z options.
10613         * layout.cc (Layout:finish_dynamic_section): If new
10614         dtags enabled, emit DT_RUNPATH.  Also, emit a
10615         DT_FLAGS_1 containing any specified -z flags.
10616
10617 2008-04-16  Ian Lance Taylor  <iant@google.com>
10618
10619         * copy-relocs.cc: New file.
10620         * copy-relocs.h: New file.
10621         * reloc.cc: Remove Copy_relocs code.
10622         * reloc.h: Likewise.
10623         * reloc-types.h (struct Reloc_types) [both versions]: Add
10624         get_reloc_addend_noerror.
10625         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
10626         variants of add_global which take an addend which must be zero.
10627         * i386.cc: Include "copy-relocs.h".
10628         (class Target_i386): Change type of copy_relocs_ to variable,
10629         update initializer.
10630         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
10631         Change all callers.
10632         (Target_i386::do_finalize_sections): Change handling of
10633         copy_relocs_.
10634         * sparc.cc: Include "copy-relocs.h".
10635         (class Target_sparc): Change type of copy_relocs_ to variable,
10636         update initializer.
10637         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
10638         Change all callers.
10639         (Target_sparc::do_finalize_sections): Change handling of
10640         copy_relocs_.
10641         * x86_64.cc: Include "copy-relocs.h".
10642         (class Target_x86_64): Change type of copy_relocs_ to variable,
10643         update initializer.
10644         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
10645         class.  Change all callers.
10646         (Target_x86_64::do_finalize_sections): Change handling of
10647         copy_relocs_.
10648         * Makefile.am (CCFILES): Add copy-relocs.cc.
10649         (HFILES): Add copy-relocs.h.
10650
10651         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
10652
10653         * testsuite/script_test_4.sh: Permit leading zeroes.
10654
10655 2008-04-15  Ian Lance Taylor  <iant@google.com>
10656
10657         * script-sections.cc (Script_sections::create_segments): Use
10658         header_size_adjustment even when there is enough room for the
10659         headers.
10660         * testsuite/script_test_4.sh: New file.
10661         * testsuite/script_test_4.t: New file.
10662         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
10663         (check_DATA): Add script_test_4.stdout.
10664         (MOSTLYCLEANFILES): Likewise.
10665         (script_test_4): New target.
10666         (script_test_4.stdout): New target.
10667         * testsuite/Makefile.in: Rebuild.
10668
10669         * sparc.cc: Add definitions for Output_data_plt_sparc class
10670         constants.
10671
10672 2008-04-14  David S. Miller  <davem@davemloft.net>
10673
10674         * sparc.cc: New file.
10675         * Makefile.am (TARGETSOURCES): Add sparc.cc
10676         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
10677         * configure.tgt: Document targ_extra_size and
10678         targ_extra_big_endian.  Add entries for sparc-* and
10679         sparc64-*.
10680         * configure.ac: Handle targ_extra_size and
10681         targ_extra_big_endian.
10682         * Makefile.in: Rebuild.
10683         * configure: Likewise.
10684         * po/POTFILES.in: Likewise.
10685         * po/gold.pot: Likewise.
10686
10687 2008-04-14  Ian Lance Taylor  <iant@google.com>
10688
10689         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
10690         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
10691         in the name/type/flags to section mapping.  Don't call
10692         allocate_output_section.
10693         (Layout::choose_output_section): Change parameter from adjust_name
10694         to is_input_section.  Don't permit input sections after sections
10695         are attached to segments.  Don't call allocate_output_section.
10696         (Layout::layout_eh_frame): Call update_flags_for_input_section,
10697         not write_enable_output_section.
10698         (Layout::make_output_section): Don't push to
10699         unattached_section_list_ nor call attach_to_segment.  Call
10700         attach_section_to_segment if sections are attached.
10701         (Layout::attach_sections_to_segments): New function.
10702         (Layout::attach_section_to_segment): New function.
10703         (Layout::attach_allocated_section_to_segment): Rename from
10704         attach_to_segment.  Remove flags parameter.
10705         (Layout::allocate_output_section): Remove function.
10706         (Layout::write_enable_output_section): Remove function.
10707         * layout.h (class Layout): Update for above changes.  Add new
10708         field sections_are_attached_.
10709         * output.h (Output_section::update_flags_for_input_section): New
10710         function.
10711         * output.cc (Output_section::add_input_section): Call
10712         update_flags_for_input_section.
10713         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
10714
10715 2008-04-11  Cary Coutant  <ccoutant@google.com>
10716
10717         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
10718         thought unnecessary.
10719         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
10720
10721 2008-04-11  Ian Lance Taylor  <iant@google.com>
10722
10723         * output.h (class Output_section_data): Remove inline definition
10724         of set_addralign.
10725         * output.cc (Output_section_data::set_addralign): New function.
10726
10727 2008-04-11  Cary Coutant  <ccoutant@google.com>
10728
10729         Add support for TLS descriptors for i386 and x86_64.
10730         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
10731         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
10732         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
10733         GOT_TYPE_TLS_DESC.
10734         (Target_i386::got_mod_index_entry): Remove unnecessary code.
10735         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
10736         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
10737         relocations.
10738         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
10739         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
10740         Fix problem with initial-exec relocations.
10741         (Target_i386::Relocate::relocate_tls): Likewise.
10742         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
10743         relaxation.
10744         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
10745         support for section-plus-offset dynamic table entries.
10746         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
10747         (Output_data_dynamic::Dynamic_entry): Add support for
10748         section-plus-offset dynamic table entries.
10749         (Output_data_dynamic::Classification): Likewise.
10750         (Output_data_dynamic::classification_): Renamed offset_.
10751         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
10752         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
10753         (Target_x86_64::make_plt_section): New function.
10754         (Target_x86_64::reserve_tlsdesc_entries): New function.
10755         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
10756         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
10757         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
10758         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
10759         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
10760         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
10761         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
10762         add extra PLT entry for TLS descriptors.
10763         (Output_data_plt_x86_64::got_): New field.
10764         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
10765         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
10766         fields.
10767         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
10768         descriptors.
10769         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
10770         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
10771         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
10772         R_386_TLS_DESC_CALL relocations.
10773         (Target_x86_64::Scan::global): Likewise.
10774         (Target_x86_64::do_finalize_sections): Add dynamic table entries
10775         for TLS descriptors.
10776         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
10777         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
10778         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
10779         GD-to-IE relaxation.
10780         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
10781         and TLS_DESCRIPTORS.
10782         * Makefile.in: Rebuild.
10783         * configure: Rebuild.
10784         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
10785         (tls_test_shared2.so): New target.
10786         (tls_shared_gd_to_ie_test_SOURCES): New variable.
10787         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
10788         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
10789         (tls_shared_gd_to_ie_test_LDADD): New variable.
10790         (tls_shared_gnu2_gd_to_ie_test): New target.
10791         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
10792         New targets.
10793         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
10794         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
10795         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
10796         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
10797         (tls_shared_gnu2_test): New target.
10798         (tls_test_gnu2_shared.so): New target.
10799         (tls_shared_gnu2_test_SOURCES): New variable.
10800         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
10801         (tls_shared_gnu2_test_LDFLAGS): New variable.
10802         (tls_shared_gnu2_test_LDADD): New variable.
10803         * testsuite/Makefile.in: Rebuild.
10804         * testsuite/Makefile.
10805
10806 2008-04-11  Ian Lance Taylor  <iant@google.com>
10807
10808         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
10809         justsyms.t.
10810         * testsuite/Makefile.in: Rebuild.
10811
10812         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
10813         long.
10814         * testsuite/script_test_2.cc (main): Adjust test.
10815
10816 2008-04-11  David S. Miller  <davem@davemloft.net>
10817             Ian Lance Taylor  <iant@google.com>
10818
10819         * options.h (General_options): Add entries for '-Y' and
10820         '-relax'.
10821         * options.cc (General_options:finalize): If -Y was used, add those
10822         entries to the library path instead of the default "/lib" and
10823         "/usr/lib".
10824
10825 2008-04-11  David S. Miller  <davem@davemloft.net>
10826
10827         * testsuite/justsyms.t: Start at 0x100.
10828         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
10829         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
10830         long.
10831         * testsuite/script_test_2.cc: Adjust string and section length
10832         checks.
10833
10834 2008-04-09  Ian Lance Taylor  <iant@google.com>
10835
10836         PR gold/5996
10837         * script-sections.cc (Sections_element::allocate_to_segment): Add
10838         orphan parameter.
10839         (Output_section_definition::allocate_to_segment): Likewise.
10840         (Orphan_output_section::allocate_to_segment): Likewise.
10841         (Script_sections::attach_sections_using_phdrs_clause): Don't
10842         propagate non-PT_LOAD segments to orphan sections.
10843         * testsuite/Makefile.am (script_test_3.stdout): Generate using
10844         readelf rather than objdump.
10845         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
10846         .interp section and PT_INTERP segment are the same size.
10847         * testsuite/Makefile.in: Rebuild.
10848
10849         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
10850         aliases for symbols defined in the same object.
10851         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
10852         (weak_alias_test_SOURCES): New variable.
10853         (weak_alias_test_DEPENDENCIES): New variable.
10854         (weak_alias_test_LDFLAGS): New variable.
10855         (weak_alias_test_LDADD): New variable.
10856         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
10857         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
10858         (weak_alias_test_3.o): New target.
10859         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
10860         * testsuite/weak_alias_test_main.cc: New file.
10861         * testsuite/weak_alias_test_1.cc: New file.
10862         * testsuite/weak_alias_test_2.cc: New file.
10863         * testsuite/weak_alias_test_3.cc: New file.
10864
10865 2008-04-08  Ian Lance Taylor  <iant@google.com>
10866
10867         * options.h (class General_options): Add --noinhibit-exec option.
10868         * main.cc (main): Check --noinhibit-exec.
10869
10870         * options.h (class General_options): Define --wrap as a special
10871         option.  Add wrap_symbols_ field.
10872         (General_options::any_wrap_symbols): New function.
10873         (General_options::is_wrap_symbol): New function.
10874         * options.cc (General_options::parse_wrap): New function.
10875         (General_options::General_options): Initialize wrap_symbols_.
10876         * symtab.cc (Symbol_table::wrap_symbol): New function.
10877         (Symbol_table::add_from_object): Handle --wrap.
10878         * symtab.h (class Symbol_table): Declare wrap_symbol.
10879         * target.h (Target::wrap_char): New function.
10880         (Target::Target_info): Add wrap_char field.
10881         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
10882         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10883         * testsuite/testfile.cc (Target_test::test_target_info):
10884         Likewise.
10885
10886         * errors.cc (Errors::undefined_symbol): Mention symbol version if
10887         there is one.
10888
10889         * layout.h (class Layout): Add added_eh_frame_data_ field.
10890         * layout.cc (Layout::Layout): Initialize new field.
10891         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
10892         output section until we find a section we merged successfully.
10893         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
10894         that the size be non-zero.
10895
10896         * merge.cc (Object_merge_map::get_output_offset): Remove inline
10897         qualifier.
10898
10899 2008-04-08  Craig Silverstein  <csilvers@google.com>
10900
10901         * configure.ac: Export new conditional variable HAVE_ZLIB.
10902         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
10903         on HAVE_ZLIB.
10904         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
10905         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10906
10907 2008-04-07  Ian Lance Taylor  <iant@google.com>
10908
10909         * version.cc (version_string): Set to "1.5".
10910
10911         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
10912         Add issued_non_pic_error_ field.  Declare check_non_pic.
10913         (Target_x86_64::Scan::check_non_pic): New function.
10914         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
10915         (Target_x86_64::Scan::global): Likewise.
10916
10917         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
10918         addend parameter.  Change caller.  Handle merge sections.
10919         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
10920         Address to Addend.  Don't add in the result of
10921         local_section_offset, pass down the addend and use the returned
10922         value.
10923         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
10924         Update declarations of local_section_offset and symbol_value.
10925         * testsuite/two_file_test_1.cc (t18): New function.
10926         * testsuite/two_file_test_2.cc (f18): New function.
10927         * testsuite/two_file_test_main.cc (main): Call t18.
10928         * testsuite/two_file_test.h (t18, f18): Declare.
10929
10930         * configure.ac: Don't test for objdump, c++filt, or readelf.
10931         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
10932         conditionals.
10933         (TEST_READELF): New variable.
10934         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
10935         (check_PROGRAMS): Add two_file_strip_test.
10936         (two_file_strip_test): New target.
10937         (check_PROGRAMS): Add two_file_same_shared_strip_test.
10938         (two_file_same_shared_strip_test_SOURCES): New variable.
10939         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
10940         (two_file_same_shared_strip_test_LDFLAGS): New variable.
10941         (two_file_same_shared_strip_test_LDADD): New variable.
10942         (two_file_shared_strip.so): New target.
10943         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
10944         (ver_test_5.syms, ver_test_7.syms): Likewise.
10945         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
10946         (strip_test_3.stdout): Use TEST_OBJDUMP.
10947         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10948
10949 2008-04-04  Cary Coutant  <ccoutant@google.com>
10950
10951         * symtab.h (Symbol::is_weak_undefined): New function.
10952         (Symbol::is_strong_undefined): New function.
10953         (Symbol::is_absolute): New function.
10954         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
10955         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
10956         absolute symbols.
10957         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
10958         (weak_undef_test): New target.
10959         * testsuite/Makefile.in: Rebuild.
10960         * testsuite/weak_undef_file1.cc: New file.
10961         * testsuite/weak_undef_file2.cc: New file.
10962         * testsuite/weak_undef_test.cc: New file.
10963
10964 2008-04-03  Craig Silverstein  <csilvers@google.com>
10965
10966         * compressed_output.h (class Output_compressed_section): Use
10967         unsigned buffer.
10968         * compressed_output.cc (zlib_compress): Use unsigned buffers,
10969         add zlib header.
10970         (zlib_compressed_suffix): Removed.
10971         (Output_compressed_section::set_final_data_size): Use unsigned
10972         buffers.
10973         * testsuite/Makefile.am (flagstest_compress_debug_sections):
10974         Fix linker invocation.
10975         (flagstest_o_specialfile_and_compress_debug_sections):
10976         Likewise.
10977         * testsuite/Makefile.in: Regenerated.
10978
10979 2008-04-02  David S. Miller  <davem@davemloft.net>
10980
10981         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
10982         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
10983
10984 2008-04-02  Craig Silverstein  <csilvers@google.com>
10985
10986         * TODO: New file.
10987
10988 2008-04-02  Ian Lance Taylor  <iant@google.com>
10989
10990         * fileread.cc (File_read::find_view): Add byteshift and vshifted
10991         parameters.  Update for new key type to views_.  Change all
10992         callers.
10993         (File_read::read): Adjust for byteshift in returned view.
10994         (File_read::add_view): New function, broken out of
10995         find_and_make_view.
10996         (File_read::make_view): New function, broken out of
10997         find_and_make_view.
10998         (File_read::find_or_make_view): Add offset and aligned
10999         parameters.  Rewrite accordingly.  Change all callers.
11000         (File_read::get_view): Add offset and aligned parameters.  Adjust
11001         for byteshift in return value.
11002         (File_read::get_lasting_view): Likewise.
11003         * fileread.h (class File_read): Update declarations.
11004         (class File_read::View): Add byteshift_ field.  Add byteshift to
11005         constructor.  Add byteshift method.
11006         * archive.h (Archive::clear_uncached_views): New function.
11007         (Archive::get_view): Add aligned parameter.  Change all callers.
11008         * object.h (Object::get_view): Add aligned parameter.  Change all
11009         callers.
11010         (Object::get_lasting_view): Likewise.
11011
11012         * fileread.cc (File_read::release): Don't call clear_views if
11013         there are multiple objects.
11014         * fileread.h (File_read::clear_uncached_views): New function.
11015         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
11016         on the archive.
11017
11018 2008-03-31  Cary Coutant  <ccoutant@google.com>
11019
11020         Add thin archive support.
11021         * archive.cc (Archive::armagt): New const.
11022         (Archive::setup): Remove task parameter and calls to unlock.
11023         (Archive::unlock_nested_archives): New function.
11024         (Archive::read_header): Add nested_off parameter. Change
11025         all callers.
11026         (Archive::interpret_header): Likewise.
11027         (Archive::include_all_members): Change to handle thin
11028         archives.
11029         (Archive::include_member): Likewise.
11030         * archive.h (Archive::Archive): Add new parameters and
11031         initializers.
11032         (Archive::armagt): New const.
11033         (Archive::setup): Remove task parameter.
11034         (Archive::unlock_nested_archives): New function.
11035         (Archive::read_header): Add nested_off parameter.
11036         (Archive::interpret_header): Likewise.
11037         (Archive::Nested_archive_table): New typedef.
11038         (Archive::is_thin_archive_): New field.
11039         (Archive::nested_archives_): New field.
11040         (Archive::options_): New field.
11041         (Archive::dirpath_): New field.
11042         (Archive::task_): New field.
11043         * readsyms.cc (Read_symbols::do_read_symbols): Add check
11044         for thin archives.  Pass additional parameters to
11045         Archive::Archive.  Unlock the archive file after calling
11046         Archive::setup.
11047
11048 2008-03-29  Ian Lance Taylor  <iant@google.com>
11049
11050         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
11051         version symbol to be local.
11052         * testsuite/ver_test_4.sh: New file.
11053         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
11054         (check_DATA): Add ver_test_4.syms.
11055         (ver_test_4.syms): New target.
11056         * testsuite/Makefile.in: Rebuild.
11057
11058         * output.cc
11059         (Output_section::Input_section_sort_entry::has_priority): New
11060         function.
11061         (Output_section::Input_section_sort_entry::match_file_name): New
11062         function.
11063         (Output_section::Input_section_sort_entry::match_section_name):
11064         Remove.
11065         (Output_section::Input_section_sort_entry::match_section_name_prefix):
11066         Remove.
11067         (Output_section::Input_section_sort_entry::match_section_file):
11068         Remove.
11069         (Output_section::Input_section_sort_compare::operator()): Rewrite
11070         using new Input_section_sort_entry functions.  Sort crtbegin and
11071         crtend first.  Sort sections with no priority before sections with
11072         a priority.
11073         * testsuite/initpri1.c (d3): Check j != 4.
11074         (cd5): New constructor/destructor function.
11075         (main): Check j != 2.
11076
11077         * symtab.cc (Symbol_table::add_from_object): If we don't use the
11078         new symbol when resolving, don't call set_is_default.
11079         * testsuite/ver_test_7.cc: New file.
11080         * testsuite/ver_test_7.sh: New file.
11081         * testsuite/Makefile.am (ver_test_7.so): New target.
11082         (ver_test_7.o): New target.
11083         (check_SCRIPTS): Add ver_test_7.sh.
11084         (check_DATA): Add ver_test_7.syms.
11085         (ver_test_7.syms): New target.
11086
11087 2008-03-28  Ian Lance Taylor  <iant@google.com>
11088
11089         * layout.cc (Layout::layout): If we see an input section with a
11090         name that needs sorting, set the must_sort flag for the output
11091         section.
11092         (Layout::make_output_section): If the name of the output section
11093         indicates that it might require sorting, set the may_sort flag.
11094         * output.h (Output_section::may_sort_attached_input_sections): New
11095         function.
11096         (Output_section::set_may_sort_attached_input_sections): New
11097         function.
11098         (Output_section::must_sort_attached_input_sections): New
11099         function.
11100         (Output_section::set_must_sort_attached_input_sections): New
11101         function.
11102         (class Output_section): Declare Input_section_sort_entry.  Define
11103         Input_section_sort_compare.  Declare
11104         sort_attached_input_sections.  Add new fields:
11105         may_sort_attached_input_sections_,
11106         must_sort_attached_input_sections_,
11107         attached_input_sections_are_sorted_.
11108         * output.cc (Output_section::Output_section): Initialize new
11109         fields.
11110         (Output_section::add_input_section): Add an entry to
11111         input_sections_ if may_sort or must_sort are true.
11112         (Output_section::set_final_data_size): Call
11113         sort_attached_input_sections if necessary.
11114         (Output_section::Input_section_sort_entry): Define new class.
11115         (Output_section::Input_section_sort_compare::operator()): New
11116         function.
11117         (Output_section::sort_attached_input_sections): New function.
11118         * configure.ac: Check whether the compiler supports constructor
11119         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
11120         * testsuite/initpri1.c: New file.
11121         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
11122         CONSTRUCTOR_PRIORITY.
11123         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
11124         (initpri1_LDFLAGS): New variable.
11125         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11126
11127 2008-03-27  Ian Lance Taylor  <iant@google.com>
11128
11129         * common.cc (Sort_commons::operator): Correct sorting algorithm.
11130         * testsuite/common_test_1.c: New file.
11131         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
11132         (common_test_1_SOURCES): New variable.
11133         (common_test_1_DEPENDENCIES): New variable.
11134         (common_test_1_LDFLAGS): New variable.
11135
11136         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
11137         and commons_ correctly when NAME/VERSION does not override
11138         NAME/NULL.
11139         * testsuite/ver_test_6.c: New file.
11140         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
11141         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
11142         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
11143
11144 2008-03-26  Ian Lance Taylor  <iant@google.com>
11145
11146         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
11147         of an undefined symbol from a version script.
11148         * testsuite/Makefile.am (ver_test_5.so): New target.
11149         (ver_test_5.o): New target.
11150         (check_SCRIPTS): Add ver_test_5.sh.
11151         (check_DATA): Add ver_test_5.syms.
11152         (ver_test_5.syms): New target.
11153         * testsuite/ver_test_5.cc: New file.
11154         * testsuite/ver_test_5.script: New file.
11155         * testsuite/ver_test_5.sh: New file.
11156         * Makefile.in, testsuite/Makefile.in: Rebuild.
11157
11158         PR gold/5986
11159         Fix problems building gold with gcc 4.3.0.
11160         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
11161         (gold_error_at_location, gold_warning_at_location): Use it.
11162         * configure.ac: Check whether we can compile and use a template
11163         function with a printf attribute.
11164         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
11165         when jumping over bytes.
11166         * object.cc: Instantiate Object::read_section_data.
11167         * debug.h: Include <cstring>
11168         * dwarf_reader.cc: Include <algorithm>
11169         * main.cc: Include <cstring>.
11170         * options.cc: Include <cstring>.
11171         * output.cc: Include <cstring>.
11172         * script.cc: Include <cstring>.
11173         * script.h: Include <string>.
11174         * symtab.cc: Include <cstring> and <algorithm>.
11175         * target-select.cc: Include <cstring>.
11176         * version.cc: Include <string>.
11177         * testsuite/testmain.cc: Include <cstdlib>.
11178         * configure, config.in: Rebuild.
11179
11180 2008-03-25  Ian Lance Taylor  <iant@google.com>
11181
11182         * options.cc: Include "../bfd/bfdver.h".
11183         (options::help): Print bug reporting address.
11184
11185         * version.cc (print_version): Adjust output for current value of
11186         BFD_VERSION_STRING.
11187
11188         * NEWS: New file.
11189
11190         * options.cc (options::help): Print list of supported targets.
11191         * target-select.h: Include <vector>.
11192         (class Target_selector): Make machine_, size_, and is_big_endian_
11193         fields const.  Add bfd_name_ and instantiated_target_ fields.
11194         (Target_selector::Target_selector): Add bfd_name parameter.
11195         (Target_selector::recognize): Make non-virtual, call
11196         do_recognize.
11197         (Target_selector::recognize_by_name): Make non-virtual, call
11198         do_recognize_by_name.
11199         (Target_selector::supported_names): New function.
11200         (Target_selector::bfd_name): New function.
11201         (Target_selector::do_instantiate_target): New pure virtual
11202         function.
11203         (Target_selector::do_recognize): New virtual function.
11204         (Target_selector::do_recognize_by_name): New virtual function.
11205         (Target_selector::instantiate_target): New private function.
11206         (supported_target_names): Declare.
11207         * target-select.cc (Target_selector::Target_selector): Update for
11208         new parameter and fields.
11209         (select_target_by_name): Check that the name matches before
11210         calling recognize_by_name.
11211         (supported_target_names): New function.
11212         * i386.cc (class Target_selector_i386): Update Target_selector
11213         constructor call.  Remove recognize and recognize_by_name.  Add
11214         do_instantiate_target.
11215         * x86_64.cc (class Target_selector_x86_64): Likewise.
11216         * testsuite/testfile.cc (class Target_selector_test): Update for
11217         changes to Target_selector.
11218
11219         * README: Rewrite, with some notes on unsupported features.
11220
11221 2008-03-24  Cary Coutant  <ccoutant@google.com>
11222
11223         * i386.cc (Target_i386::Got_type): New enum declaration.
11224         (Target_i386::Scan::local): Updated callers of Output_data_got
11225         member functions.
11226         (Target_i386::Scan::global): Likewise.
11227         (Target_i386::Relocate::relocate): Likewise.
11228         (Target_i386::Relocate::relocate_tls): Likewise.
11229         * object.h (Got_offset_list): New class.
11230         (Sized_relobj::local_has_got_offset): Added got_type parameter.
11231         (Sized_relobj::local_got_offset): Likewise.
11232         (Sized_relobj::set_local_got_offset): Likewise.
11233         (Sized_relobj::local_has_tls_got_offset): Removed.
11234         (Sized_relobj::local_tls_got_offset): Removed.
11235         (Sized_relobj::set_local_tls_got_offset): Removed.
11236         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
11237         * output.cc (Output_data_got::add_global): Added got_type parameter.
11238         (Output_data_got::add_global_with_rel): Likewise.
11239         (Output_data_got::add_global_with_rela): Likewise.
11240         (Output_data_got::add_global_pair_with_rel): New function.
11241         (Output_data_got::add_global_pair_with_rela): New function.
11242         (Output_data_got::add_local): Added got_type parameter.
11243         (Output_data_got::add_local_with_rel): Likewise.
11244         (Output_data_got::add_local_with_rela): Likewise.
11245         (Output_data_got::add_local_pair_with_rel): New function.
11246         (Output_data_got::add_local_pair_with_rela): New function.
11247         (Output_data_got::add_global_tls): Removed.
11248         (Output_data_got::add_global_tls_with_rel): Removed.
11249         (Output_data_got::add_global_tls_with_rela): Removed.
11250         (Output_data_got::add_local_tls): Removed.
11251         (Output_data_got::add_local_tls_with_rel): Removed.
11252         (Output_data_got::add_local_tls_with_rela): Removed.
11253         * output.h (Output_data_got::add_global): Added got_type parameter.
11254         (Output_data_got::add_global_with_rel): Likewise.
11255         (Output_data_got::add_global_with_rela): Likewise.
11256         (Output_data_got::add_global_pair_with_rel): New function.
11257         (Output_data_got::add_global_pair_with_rela): New function.
11258         (Output_data_got::add_local): Added got_type parameter.
11259         (Output_data_got::add_local_with_rel): Likewise.
11260         (Output_data_got::add_local_with_rela): Likewise.
11261         (Output_data_got::add_local_pair_with_rel): New function.
11262         (Output_data_got::add_local_pair_with_rela): New function.
11263         (Output_data_got::add_global_tls): Removed.
11264         (Output_data_got::add_global_tls_with_rel): Removed.
11265         (Output_data_got::add_global_tls_with_rela): Removed.
11266         (Output_data_got::add_local_tls): Removed.
11267         (Output_data_got::add_local_tls_with_rel): Removed.
11268         (Output_data_got::add_local_tls_with_rela): Removed.
11269         * resolve.cc (Symbol::override_base_with_special): Removed
11270         reference to has_got_offset_ field.
11271         * symtab.cc (Symbol::init_fields): Replaced initialization
11272         of got_offset_ with got_offsets_.  Removed initialization
11273         of has_got_offset_
11274         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
11275         (Symbol::got_offset): Likewise.
11276         (Symbol::set_got_offset): Likewise.
11277         (Symbol::has_tls_got_offset): Removed.
11278         (Symbol::tls_got_offset): Removed.
11279         (Symbol::set_tls_got_offset): Removed.
11280         (Symbol::got_offset_): Removed.
11281         (Symbol::tls_mod_got_offset_): Removed.
11282         (Symbol::tls_pair_got_offset_): Removed.
11283         (Symbol::got_offsets_): New field.
11284         (Symbol::has_got_offset): Removed.
11285         (Symbol::has_tls_mod_got_offset): Removed.
11286         (Symbol::has_tls_pair_got_offset): Removed.
11287         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
11288         (Target_x86_64::Scan::local): Updated callers of Output_data_got
11289         member functions.
11290         (Target_x86_64::Scan::global): Likewise.
11291         (Target_x86_64::Relocate::relocate): Likewise.
11292         (Target_x86_64::Relocate::relocate_tls): Likewise.
11293
11294 2008-03-25  Ben Elliston  <bje@au.ibm.com>
11295
11296         * yyscript.y: Fix spelling error in comment.
11297
11298 2008-03-24  Ian Lance Taylor  <iant@google.com>
11299
11300         * options.h (class General_options): Define build_id option.
11301         * layout.h (class Layout): Declare write_build_id, create_note,
11302         create_build_id.  Add build_id_note_ member.
11303         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
11304         "libiberty.h", "md5.h", "sha1.h".
11305         (Layout::Layout): Initialize eh_frame_data_,
11306         eh_frame_hdr_section_, and build_id_note_.
11307         (Layout::finalize): Call create_build_id.
11308         (Layout::create_note): New function, broken out of
11309         Layout::create_gold_note.
11310         (Layout::create_gold_note): Call create_note.
11311         (Layout::create_build_id): New function.
11312         (Layout::write_build_id): New function.
11313         (Close_task_runner::run): Call write_build_id.
11314
11315         * x86_64.cc: Correct license to GPLv3.
11316
11317 2008-03-23  Ian Lance Taylor  <iant@google.com>
11318
11319         * options.cc: Include "demangle.h".
11320         (parse_optional_string): New function.
11321         (parse_long_option): Handle takes_optional_argument.
11322         (parse_short_option): Update dash_z initializer.  Handle
11323         takes_optional_argument.
11324         (General_options::General_options): Initialize do_demangle_.
11325         (General_options::finalize): Set do_demangle_.  Handle demangling
11326         style.
11327         * options.h (parse_optional_string): Declare.
11328         (struct One_option): Add optional_arg field.  Update constructor.
11329         Update call constructor calls.  Add takes_optional_argument
11330         function.
11331         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
11332         (DEFINE_optional_string): Define.
11333         (General_options::demangle): Change from DEFINE_bool to
11334         DEFINE_optional_string.
11335         (General_options::no_demangle): New function.
11336         (General_options::do_demangle): New function.
11337         (General_options::set_do_demangle): New function.
11338         (General_options::execstack_status_): Move definition to end of
11339         class definition.
11340         (General_options::static_): Likewise.
11341         (General_options::do_demangle_): New field.
11342         * object.cc (big_endian>::get_symbol_location_info): Call
11343         Options::do_demangle, not Options::demangle.
11344         * symtab.cc (demangle): Likewise.
11345
11346 2008-03-22  Ian Lance Taylor  <iant@google.com>
11347
11348         * gold.h: Include <cstddef> and <sys/types.h>
11349         * options.h: Include <cstring>.
11350
11351 2008-03-21  Ian Lance Taylor  <iant@google.com>
11352
11353         * Added source code to GNU binutils.