* script.cc (Token::integer_value): Accept trailing M/m/K/k
[external/binutils.git] / gold / ChangeLog
1 2011-06-29  Ian Lance Taylor  <iant@google.com>
2
3         PR gold/12652
4         * script.cc (Token::integer_value): Accept trailing M/m/K/k
5         modifier.
6         (Lex::gather_token): Accept trailing M/m/K/k for integers.
7
8 2011-06-29  Ian Lance Taylor  <iant@google.com>
9
10         PR gold/12675
11         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
12         SHT_X86_64_UNWIND.
13         * layout.cc (Layout::layout_eh_frame): Likewise.
14
15 2011-06-29  Ian Lance Taylor  <iant@google.com>
16
17         PR gold/12695
18         * layout.cc (Layout::symtab_section_shndx): New function.
19         * layout.h (class Layout): Declare symtab_section_shndx.
20         * output.cc (Output_section::write_header): Call it.
21
22 2011-06-29  Ian Lance Taylor  <iant@google.com>
23
24         PR gold/12818
25         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
26         symbols which are not used in a relocation.
27
28 2011-06-28  Ian Lance Taylor  <iant@google.com>
29
30         PR gold/12898
31         * layout.cc (Layout::segment_precedes): Don't crash if a linker
32         script create indistinguishable segments.
33         (Layout::set_segment_offsets): Use stable_sort when sorting
34         segments.  Pass this to Compare_segments constructor.
35         * layout.h (class Layout): Make segment_precedes non-static.
36         (class Compare_segments): Change from struct to class.  Add
37         layout_ field.  Add constructor.
38         * script-sections.cc
39         (Script_sections::attach_sections_using_phdrs_clause): Rename
40         local orphan to is_orphan.  Don't report failure to put empty
41         section in segment.  On attachment failure, report name of
42         section, and attach to first PT_LOAD segment.
43
44 2011-06-28  Ian Lance Taylor  <iant@google.com>
45
46         PR gold/12934
47         * target-select.cc (Target_selector::Target_selector): Add
48         emulation parameter.  Change all callers.
49         (select_target_by_bfd_name): Rename from select_target_by_name.
50         Change all callers.
51         (select_target_by_emulation): New function.
52         (supported_emulation_names): New function.
53         * target-select.h (class Target_selector): Add emulation_ field.
54         Update declarations.
55         (Target_selector::recognize_by_bfd_name): Rename from
56         recognize_by_name.  Change all callers.
57         (Target_selector::supported_bfd_names): Rename from
58         supported_names.  Change all callers.
59         (Target_selector::recognize_by_emulation): New function.
60         (Target_selector::supported_emulations): New function.
61         (Target_selector::emulation): New function.
62         (Target_selector::do_recognize_by_bfd_name): Rename from
63         do_recognize_by_name.  Change all callers.
64         (Target_selector::do_supported_bfd_names): Rename from
65         do_supported_names.  Change all callers.
66         (Target_selector::do_recognize_by_emulation): New function.
67         (Target_selector::do_supported_emulations): New function.
68         (select_target_by_bfd_name): Change name in declaration.
69         (select_target_by_emulation): Declare.
70         (supported_emulation_names): Declare.
71         * parameters.cc (parameters_force_valid_target): Try to find
72         target based on emulation from -m option.
73         * options.h (class General_options): Change doc string for -m.
74         * options.cc (help): Print emulations.
75         (General_options::parse_V): Likewise.
76         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
77         Add emulation parameter.  Change all callers.
78
79 2011-06-28  Ian Lance Taylor  <iant@google.com>
80
81         * target.h (class Target): Add osabi_ field.
82         (Target::osabi): New function.
83         (Target::set_osabi): New function.
84         (Target::Target): Initialize osabi_.
85         (Target::do_adjust_elf_header): Make pure virtual.
86         (Sized_target::do_adjust_elf_header): Declare.
87         * target.cc (Sized_target::do_adjust_elf_header): New function.
88         (class Sized_target): Instantiate all versions.
89         * freebsd.h (class Target_freebsd): Remove.
90         (Target_selector_freebsd::do_recognize): Call set_osabi on
91         Target.
92         (Target_selector_freebsd::do_recognize_by_name): Likewise.
93         (Target_selector_freebsd::set_osabi): Remove.
94         * i386.cc (class Target_i386): Inherit from Sized_target rather
95         than Target_freebsd.
96         * x86_64.cc (class Target_x86_64): Likewise.
97
98 2011-06-28  Ian Lance Taylor  <iant@google.com>
99
100         * target.h (Target::can_check_for_function_pointers): Rewrite.
101         Make non-virtual.
102         (Target::can_icf_inline_merge_sections): Likewise.
103         (Target::section_may_have_icf_unsafe_poineters): Likewise.
104         (Target::Target_info): Add can_icf_inline_merge_sections field.
105         (Target::do_can_check_for_function_pointers): New virtual
106         function.
107         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
108         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
109         from can_check_for_function_pointers, move in file.
110         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
111         section_may_have_icf_unsafe_poineters, move in file.
112         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
113         * i386.cc (Target_i386::do_can_check_for_function_pointers):
114         Rename from can_check_for_function_pointers, move in file.
115         (Target_i386::can_icf_inline_merge_sections): Remove.
116         (Target_i386::i386_info): Initialize
117         can_icf_inline_merge_sections.
118         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
119         Initialize can_icf_inline_merge_sections.
120         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
121         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
122         Rename from can_check_for_function_pointers, move in file.
123         (Target_x86_64::can_icf_inline_merge_sections): Remove.
124         (Target_x86_64::x86_64_info): Initialize
125         can_icf_inline_merge_sections.
126         * testsuite/testfile.cc (Target_test::test_target_info):
127         Likewise.
128         * icf.cc (get_section_contents): Correct formatting.
129
130 2011-06-27  Ian Lance Taylor  <iant@google.com>
131
132         * symtab.cc (Symbol::versioned_name): New function.
133         (Symbol_table::add_to_final_symtab): Use versioned_name when
134         appropriate.
135         (Symbol_table::sized_write_symbol): Likewise.
136         * symtab.h (class Symbol): Declare versioned_name.
137         * stringpool.h (class Stringpool_template): Add variant of add
138         which takes a std::basic_string.
139         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
140         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
141         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
142         (ver_test_12.o): New target.
143         * testsuite/Makefile.in: Rebuild.
144
145 2011-06-27  Doug Kwan  <dougkwan@google.com>
146
147         * arm.cc (Arm_relocate_functions::thm_jump8,
148         Arm_relocate_functions::thm_jump11): Use a wider signed
149         type to compute offset.
150         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
151         arm_thm_jump8.
152         * testsuite/Makefile.in: Regenerate.
153         * testsuite/arm_branch_in_range.sh: Check test results of
154         arm_thm_jump11 and arm_thm_jump8.
155         * testsuite/arm_thm_jump11.s: New test source file.
156         * testsuite/arm_thm_jump11.t: New linker script.
157         * testsuite/arm_thm_jump8.s: New test source file.
158         * testsuite/arm_thm_jump8.t: New linker script.
159
160 2011-06-24  Ian Lance Taylor  <iant@google.com>
161
162         * layout.cc: Include "object.h".
163         (ctors_sections_in_init_array): New static variable.
164         (Layout::is_ctors_in_init_array): New function.
165         (Layout::layout): Add entry to ctors_sections_in_init_array if
166         appropriate.
167         * layout.h (class Layout): Declare is_ctors_in_init_array.
168         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
169         is_ctors_reverse_view is set.
170         (Sized_relobj_file::write_sections): Add layout parameter.  Change
171         all callers.  Set is_ctors_reverse_view field of View_size.
172         (Sized_relobj_file::reverse_words): New function.
173         * object.h (Sized_relobj_file::View_size): Add
174         is_ctors_reverse_view field.
175         (class Sized_relobj_file): Update declarations.
176         * testsuite/initpri3.c: New test.
177         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
178         initpri3b.
179         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
180         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
181         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
182         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
183         * testsuite/Makefile.in: Rebuild.
184
185 2011-06-24  Cary Coutant  <ccoutant@google.com>
186
187         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
188         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
189         (debug_msg_cdebug.err): New targets.
190         * testsuite/Makefile.in: Regenerate.
191         * testsuite/debug_msg.sh: Check output of link with compressed debug.
192         Fix checks for link with shared library.
193
194 2011-06-24  Doug Kwan  <dougkwan@google.com>
195
196         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
197         skip empty text sections.
198         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
199
200 2011-06-22  Ian Lance Taylor  <iant@google.com>
201
202         PR gold/12910
203         * options.h (class General_options): Add --ctors-in-init-array.
204         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
205         friends as SHT_PROGBITS for merging sections.
206         (Layout::layout): Remove special handling of .init_array and
207         friends.  Don't sort if doing relocatable link.  Sort for .ctors
208         and .dtors if ctors_in_init_array.
209         (Layout::make_output_section): Force correct section types for
210         .init_array and friends.  Don't sort if doing relocatable link,
211         Don't sort .ctors and .dtors if ctors_in_init_array.
212         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
213         (Layout::output_section_name): Add relobj parameter.  Change all
214         callers.  Handle .ctors. and .dtors. in code rather than table.
215         Handle .ctors and .dtors if ctors_in_init_array.
216         (Layout::match_file_name): New function, moved from output.cc.
217         * layout.h (class Layout): Update declarations.
218         * output.cc: Include "layout.h".
219         (Input_section_sort_entry::get_priority): New function.
220         (Input_section_sort_entry::match_file_name): Just call
221         Layout::match_file_name.
222         (Output_section::Input_section_sort_init_fini_compare::operator()):
223         Handle .ctors and .dtors.  Sort by explicit priority rather than
224         by name.
225         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
226         * testsuite/initpri2.c: New test.
227         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
228         (check_PROGRAMS): Add initpri2.
229         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
230         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
231         * configure, testsuite/Makefile.in: Rebuild.
232
233 2011-06-19  Ian Lance Taylor  <iant@google.com>
234
235         PR gold/12880
236         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
237         .interp section to a PT_INTERP segment even if we have seen a
238         --dynamic-linker option.  Don't do it if we have seen a PHDRS
239         clause in a linker script.
240         (Layout::finalize): Don't create a .interp section if we've
241         already create a PT_INTERP segment.
242         (Layout::create_interp): Always call choose_output_section (revert
243         patch of 2011-06-17).  Don't create PT_INTERP segment.
244         * script-sections.cc
245         (Script_sections::create_note_and_tls_segments): Add a .interp
246         section to a PT_INTERP segment even if we have seen a
247         --dynamic-linker option.
248
249 2011-06-18  Ian Lance Taylor  <iant@google.com>
250
251         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
252         merely because a non-PT_LOAD segment has a dynamic reloc.
253
254 2011-06-18  Ian Lance Taylor  <iant@google.com>
255
256         * layout.cc (Layout::finish_dynamic_section): Don't create
257         DT_FLAGS entry if not needed.
258
259 2011-06-18  Ian Lance Taylor  <iant@google.com>
260
261         PR gold/12745
262         * layout.cc (Layout::layout_eh_frame): Correct handling of
263         writable .eh_frame section.
264
265 2011-06-17  Ian Lance Taylor  <iant@google.com>
266
267         PR gold/12893
268         * resolve.cc (Symbol_table::resolve): Don't give an error if a
269         symbol is redefined with the exact same object and value.
270
271 2011-06-17  Ian Lance Taylor  <iant@google.com>
272
273         PR gold/12880
274         * layout.h (class Layout): Add interp_segment_ field.
275         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
276         (Layout::attach_allocated_section_to_segment): If making shared
277         library, put .interp section in PT_INTERP segment.
278         (Layout::finalize): Also call create_interp if -dynamic-linker
279         option was used.
280         (Layout::create_interp): Assert that there is no PT_INTERP
281         segment.  If not using a SECTIONS clause, use make_output_section.
282         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
283         * script-sections.cc
284         (Script_sections::create_note_and_tls_segments): If making shared
285         library, put .interp section in PT_INTERP segment.
286
287 2011-06-17  Ian Lance Taylor  <iant@google.com>
288
289         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
290         when making a shared library.
291
292 2011-06-17  Ian Lance Taylor  <iant@google.com>
293
294         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
295         parameter.  Change all callers.  Don't issue warning about PC32
296         against locally defined symbol.
297
298 2011-06-16  Ian Lance Taylor  <iant@google.com>
299
300         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
301         occurs in same object.
302
303 2011-06-14  Alan Modra  <amodra@gmail.com>
304
305         * po/POTFILES.in: Regenerate.
306
307 2011-06-09  Ian Lance Taylor  <iant@google.com>
308
309         * script-sections.cc
310         (Orphan_output_section::set_section_addresses): For a relocatable
311         link set address to 0.
312
313 2011-06-09  Cary Coutant  <ccoutant@google.com>
314
315         PR gold/12804
316         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
317         used with --compress-debug-sections.
318         * gold/object.cc (Sized_relobj_file::do_layout): Report
319         uncompressed size of compressed input sections.
320
321 2011-06-08  Cary Coutant  <ccoutant@google.com>
322
323         PR gold/12804
324         * testsuite/two_file_test_2_v1.cc: Change initialization of
325         v2 to keep it in .data.
326
327 2011-06-07  Cary Coutant  <ccoutant@google.com>
328
329         * common.cc (Symbol_table::do_allocate_commons_list): Call
330         gold_fallback.
331         * errors.cc (Errors::fatal): Adjust call to gold_exit.
332         (Errors::fallback): New function.
333         (gold_fallback): New function.
334         * errors.h (Errors::fallback): New function.
335         * gold.cc (gold_exit): Change status parameter to enum; adjust
336         all callers.
337         (queue_initial_tasks): Call gold_fallback.
338         * gold.h: Include cstdlib.
339         (Exit_status): New enum type.
340         (gold_exit): Change status parameter to enum.
341         (gold_fallback): New function.
342         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
343         (Layout::create_symtab_sections): Likewise.
344         (Layout::create_shdrs): Likewise.
345         * main.cc (main): Adjust call to gold_exit.
346         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
347         (Output_data_got::add_got_entry_pair): Likewise.
348         (Output_section::add_input_section): Likewise.
349         (Output_section::add_output_section_data): Likewise.
350         (Output_segment::set_section_list_addresses): Likewise.
351         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
352
353 2011-06-07  Cary Coutant  <ccoutant@google.com>
354
355         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
356         for incremental links.
357         * output.cc (Output_segment::set_section_list_addresses): Remove
358         FIXME and test for TLS or BSS.
359
360 2011-06-07  Cary Coutant  <ccoutant@google.com>
361
362         * testsuite/Makefile.am: Add incremental_copy_test,
363         incremental_common_test_1.
364         * testsuite/Makefile.in: Regenerate.
365         * testsuite/common_test_1_v1.c: New source file.
366         * testsuite/common_test_1_v2.c: New source file.
367         * testsuite/copy_test_v1.cc: New source file.
368
369 2011-06-07  Cary Coutant  <ccoutant@google.com>
370
371         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
372         update, allocate common from bss section's free list.
373         * incremental-dump.cc (dump_incremental_inputs): Print flag for
374         linker-defined symbols.
375         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
376         Skip GOT and PLT entries that are no longer referenced.
377         (Output_section_incremental_inputs::write_info_blocks): Mark
378         linker-defined symbols.
379         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
380         * output.cc (Output_section::allocate): New function.
381         * output.h (Output_section::allocate): New function.
382         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
383         linker-defined symbols.
384         (Symbol::override_base_with_special): Copy is_predefined_ flag.
385         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
386         (Symbol::init_base_output_data): Likewise.
387         (Symbol::init_base_output_segment): Likewise.
388         (Symbol::init_base_constant): Likewise.
389         (Sized_symbol::init_output_data): Likewise.
390         (Sized_symbol::init_output_segment): Likewise.
391         (Sized_symbol::init_constant): Likewise.
392         (Symbol_table::do_define_in_output_data): Likewise.
393         (Symbol_table::do_define_in_output_segment): Likewise.
394         (Symbol_table::do_define_as_constant): Likewise.
395         * symtab.h (Symbol::is_predefined): New function.
396         (Symbol::init_base_output_data): Add is_predefined parameter.
397         (Symbol::init_base_output_segment): Likewise.
398         (Symbol::init_base_constant): Likewise.
399         (Symbol::is_predefined_): New data member.
400         (Sized_symbol::init_output_data): Add is_predefined parameter.
401         (Sized_symbol::init_output_segment): Likewise.
402         (Sized_symbol::init_constant): Likewise.
403         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
404
405 2011-06-07  Cary Coutant  <ccoutant@google.com>
406
407         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
408         instead of emit_copy_reloc.
409         (Copy_relocs::emit_copy_reloc): Refactor.
410         (Copy_relocs::make_copy_reloc): New function.
411         (Copy_relocs::add_copy_reloc): Remove.
412         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
413         section.
414         (Copy_relocs::make_copy_reloc): New function.
415         (Copy_relocs::add_copy_reloc): Remove.
416         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
417         unchanged input files.
418         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
419         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
420         Reserve BSS space for COPY relocations.
421         (Sized_incremental_binary::do_emit_copy_relocs): New function.
422         (Output_section_incremental_inputs::write_info_blocks): Record
423         whether a symbol is copied from a shared object.
424         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
425         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
426         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
427         (Incremental_input_entry_reader::get_output_symbol_index): Add
428         is_copy parameter.
429         (Incremental_binary::emit_copy_relocs): New function.
430         (Incremental_binary::do_emit_copy_relocs): New function.
431         (Sized_incremental_binary::Sized_incremental_binary): Initialize
432         new data member.
433         (Sized_incremental_binary::add_copy_reloc): New function.
434         (Sized_incremental_binary::do_emit_copy_relocs): New function.
435         (Sized_incremental_binary::Copy_reloc): New struct.
436         (Sized_incremental_binary::Copy_relocs): New typedef.
437         (Sized_incremental_binary::copy_relocs_): New data member.
438         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
439         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
440         * target.h (Sized_target::emit_copy_reloc): New function.
441         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
442
443 2011-06-02  Cary Coutant  <ccoutant@google.com>
444
445         PR gold/12163
446         * gold/archive.cc (Archive::Archive): Initialize new data member.
447         (Archive::include_all_members): Return if archive has already been
448         included.
449         * gold/archive.h (Archive::include_all_members_): New data member.
450
451 2011-06-02  Nick Clifton  <nickc@redhat.com>
452
453         * dynobj.h: Fix spelling mistake in comment.
454         * output.cc: Likewise.
455
456 2011-05-31  Doug Kwan  <dougkwan@google.com>
457             Asier Llano
458
459         PR gold/12826
460         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
461         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
462         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
463         redundant arm_exidx_test.so.
464         * testsuite/Makefile.in: Regenerate.
465         (check_SCRIPTS): Add pr12826.sh
466         (check_DATA): Add pr12826.stdout
467         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
468         * testsuite/pr12826.sh: New file.
469         * testsuite/pr12826_1.s: Ditto.
470         * testsuite/pr12826_1.s: Ditto.
471
472 2011-05-30  Ian Lance Taylor  <iant@google.com>
473
474         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
475         sections.
476
477 2011-05-29  Ian Lance Taylor  <iant@google.com>
478
479         PR gold/12804
480         * testsuite/Makefile.am: Use different file name for two_file_test
481         temporary file for each incremental test.
482         * testsuite/Makefile.in: Rebuild.
483
484 2011-05-29  Ian Lance Taylor  <iant@google.com>
485
486         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
487         binary input file is empty.
488
489 2011-05-27  Ian Lance Taylor  <iant@google.com>
490
491         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
492         (ver_test_9.so): Likewise.
493         * testsuite/Makefile.in: Rebuild.
494
495 2011-05-26 Cary Coutant  <ccoutant@google.com>
496
497         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
498         * incremental.cc (Incremental_inputs::report_input_section): Fix
499         comment, indentation.
500         (Incremental_inputs::report_comdat_group): New function.
501         (Output_section_incremental_inputs::set_final_data_size): Adjust size
502         of data for incremental input file entry.
503         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
504         group count, COMDAT group signatures.
505         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
506         an unchanged input file.
507         * incremental.h (Incremental_object_entry::Incremental_object_entry):
508         Initialize new data member.
509         (Incremental_object_entry::add_comdat_group): New function.
510         (Incremental_object_entry::get_comdat_group_count): New function.
511         (Incremental_object_entry::get_comdat_signature_key): New function.
512         (Incremental_object_entry::groups_): New data member.
513         (Incremental_inputs::report_comdat_group): New function.
514         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
515         data for incremental input file entry.
516         (Incremental_input_entry_reader::get_comdat_group_count): New function.
517         (Incremental_input_entry_reader::get_input_section): Adjust size of
518         data for incremental input file entry.
519         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
520         (Incremental_input_entry_reader::get_comdat_group_signature): New
521         function.
522         * object.cc (Sized_relobj::include_section_group): Report kept
523         COMDAT groups for incremental links.
524
525 2011-05-24  David Meyer  <pdox@google.com>
526
527         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
528         with name parameter.  Add found_name parameter.
529         * fileread.cc (Input_file::find_file): Adjust code accordingly.
530         * dirsearch.h (class Dirsearch): Update declaration.
531
532 2011-05-24  Ian Lance Taylor  <iant@google.com>
533
534         * archive.cc (Library_base::should_include_member): Pull in object
535         from archive if it defines the entry symbol.
536         * parameters.cc (Parameters::entry): New function.
537         * parameters.h (class Parameters): Declare entry.
538         * output.h (class Output_file_header): Remove entry_ field.
539         * output.cc (Output_file_header::Output_file_header): Remove entry
540         parameter.  Change all callers.
541         (Output_file_header::entry): Use parameters->entry.
542         * gold.cc (queue_middle_tasks): Likewise.
543         * plugin.cc (Plugin_hook::run): Likewise.
544
545 2011-05-24 Cary Coutant  <ccoutant@google.com>
546
547         * gold.cc (queue_initial_tasks): Pass incremental base filename
548         to Output_file::open_base_file; don't print error message.
549         * incremental-dump.cc (main): Adjust call to
550         Output_file::open_for_modification.
551         * incremental-dump.cc (main): Likewise.
552         * incremental.cc (Incremental_inputs::report_command_line):
553         Ignore --incremental-base option when comparing command lines.
554         Ignore parameter when given as separate argument.
555         * options.h (class General_options): Add --incremental-base.
556         * output.cc (Output_file::Output_file):
557         (Output_file::open_base_file): Add base_name and writable parameters;
558         read base file into new file; print error message here.
559         (Output_file::map_no_anonymous): Add writable parameter; adjust all
560         callers.
561         * output.h (Output_file::open_for_modification): Rename to...
562         (Output_file::open_base_file): ...this; add base_name and
563         writable parameters; adjust all callers.
564         (Output_file::map_no_anonymous): Add writable parameter; adjust all
565         callers.
566         * testsuite/Makefile.am (incremental_test_4): Test
567         --incremental-base.
568         * testsuite/Makefile.in: Regenerate.
569
570 2011-05-24 Cary Coutant  <ccoutant@google.com>
571
572         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
573         incremental_test_4.
574         * testsuite/Makefile.in: Regenerate.
575         * testsuite/two_file_test_1_v1.cc: New test source file.
576         * testsuite/two_file_test_1b_v1.cc: New test source file.
577         * testsuite/two_file_test_2_v1.cc: New test source file.
578
579 2011-05-24 Cary Coutant  <ccoutant@google.com>
580
581         * dynobj.h (Dynobj::do_dynobj): New function.
582         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
583         flag and soname for shared objects.
584         * incremental.cc (Incremental_inputs::report_object): Make
585         either Incremental_object_entry or Incremental_dynobj_entry; add
586         soname to string table.
587         (Incremental_inputs::report_input_section): Add assertion.
588         (Output_section_incremental_inputs::set_final_data_size): Adjust
589         type of input file entry for shared libraries; adjust size of
590         shared library info entry.
591         (Output_section_incremental_inputs::write_input_files): Write
592         as_needed flag for shared libraries.
593         (Output_section_incremental_inputs::write_info_blocks): Adjust type
594         of input file entry for shared libraries; write soname.
595         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
596         soname from incremental info.
597         * incremental.h (enum Incremental_input_flags): Add
598         INCREMENTAL_INPUT_AS_NEEDED.
599         (Incremental_input_entry::Incremental_input_entry): Initialize new
600         data member.
601         (Incremental_input_entry::set_as_needed): New function.
602         (Incremental_input_entry::as_needed): New function.
603         (Incremental_input_entry::do_dynobj_entry): New function.
604         (Incremental_input_entry::as_needed_): New data member.
605         (Incremental_object_entry::Incremental_object_entry): Don't check
606         for shared library.
607         (Incremental_object_entry::do_type): Likewise.
608         (class Incremental_dynobj_entry): New class.
609         (Incremental_input_entry_reader::as_needed): New function.
610         (Incremental_input_entry_reader::get_soname): New function.
611         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
612         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
613         size of shared library info entry.
614         * layout.cc (Layout::finish_dynamic_section): Don't test for 
615         incremental link when adding DT_NEEDED entries.
616         * object.h (Object::Object): Initialize new data member.
617         (Object::dynobj): New function.
618         (Object::set_as_needed): New function.
619         (Object::as_needed): New function.
620         (Object::do_dynobj): New function.
621         (Object::as_needed_): New data member.
622
623 2011-05-24 Cary Coutant  <ccoutant@google.com>
624
625         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
626         info; adjust display of GOT entries.
627         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
628         vector of input objects; remove file_status_.
629         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
630         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
631         got_plt reader; call target hooks to reserve GOT entries.
632         (Output_section_incremental_inputs::set_final_data_size): Adjust size
633         of input file info header and GOT info entry.
634         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
635         relocation info.
636         (Got_plt_view_info::got_descriptor): Remove.
637         (Got_plt_view_info::sym_index): New data member.
638         (Got_plt_view_info::input_index): New data member.
639         (Local_got_offset_visitor::visit): Write input file index.
640         (Global_got_offset_visitor::visit): Write 0 for input file index.
641         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
642         with sym_index and input_index.
643         (Output_section_incremental_inputs::write_got_plt): Adjust size of
644         incremental info GOT entry; replace got_descriptor with input_index.
645         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
646         map from input file index to object.
647         (Sized_relobj_incr::do_layout): Replace direct data member reference
648         with accessor function.
649         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
650         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
651         Adjust size of input file info header.
652         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
653         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
654         (Incremental_input_entry_reader::get_input_section): Adjust size of
655         input file info header.
656         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
657         of incremental info GOT entry.
658         (Incremental_got_plt_reader::get_got_desc): Remove.
659         (Incremental_got_plt_reader::get_got_symndx): New function.
660         (Incremental_got_plt_reader::get_got_input_index): New function.
661         (Sized_incremental_binary::Sized_incremental_binary): Remove
662         file_status_; add input_objects_.
663         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
664         (Sized_incremental_binary::set_file_is_unchanged): Remove.
665         (Sized_incremental_binary::file_is_unchanged): Remove.
666         (Sized_incremental_binary::set_input_object): New function.
667         (Sized_incremental_binary::input_object): New function.
668         (Sized_incremental_binary::file_status_): Remove.
669         (Sized_incremental_binary::input_objects_): New data member.
670         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
671         references.
672         (Sized_relobj_incr::invalid_address): Move to base class.
673         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
674         class.
675         (Sized_relobj_incr::do_output_section_offset): Likewise.
676         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
677         (Sized_relobj_incr::section_offsets_): Likewise.
678         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
679         function.
680         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
681         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
682         with accessor function.
683         (Sized_relobj_file::do_layout): Likewise.
684         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
685         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
686         (Sized_relobj_file::compute_final_local_value): Replace refs to
687         section_offsets_ with accessor function.
688         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
689         * object.h (Relobj::Relobj): Initialize new data members.
690         (Relobj::add_dyn_reloc): New function.
691         (Relobj::first_dyn_reloc): New function.
692         (Relobj::dyn_reloc_count): New function.
693         (Relobj::first_dyn_reloc_): New data member.
694         (Relobj::dyn_reloc_count_): New data member.
695         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
696         references.
697         (Sized_relobj::Address): New typedef.
698         (Sized_relobj::invalid_address): Move here from child class.
699         (Sized_relobj::Sized_relobj): Initialize new data members.
700         (Sized_relobj::sized_relobj): New function.
701         (Sized_relobj::is_output_section_offset_invalid): Move here from
702         child class.
703         (Sized_relobj::get_output_section_offset): Likewise.
704         (Sized_relobj::local_has_got_offset): Likewise.
705         (Sized_relobj::local_got_offset): Likewise.
706         (Sized_relobj::set_local_got_offset): Likewise.
707         (Sized_relobj::do_for_all_local_got_entries): Likewise.
708         (Sized_relobj::clear_got_offsets): New function.
709         (Sized_relobj::section_offsets): Move here from child class.
710         (Sized_relobj::do_output_section_offset): Likewise.
711         (Sized_relobj::do_set_section_offset): Likewise.
712         (Sized_relobj::Local_got_offsets): Likewise.
713         (Sized_relobj::local_got_offsets_): Likewise.
714         (Sized_relobj::section_offsets_): Likewise.
715         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
716         references.
717         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
718         class.
719         (Sized_relobj_file::sized_relobj): New function
720         (Sized_relobj_file::local_has_got_offset): Move to base class.
721         (Sized_relobj_file::local_got_offset): Likewise.
722         (Sized_relobj_file::set_local_got_offset): Likewise.
723         (Sized_relobj_file::get_output_section_offset): Likewise.
724         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
725         (Sized_relobj_file::do_output_section_offset): Likewise.
726         (Sized_relobj_file::do_set_section_offset): Likewise.
727         (Sized_relobj_file::Local_got_offsets): Likewise.
728         (Sized_relobj_file::local_got_offsets_): Likewise.
729         (Sized_relobj_file::section_offsets_): Likewise.
730         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
731         (all constructors).
732         (set_needs_dynsym_index): Convert relobj to derived class pointer.
733         (Output_reloc::get_symbol_index): Likewise.
734         (Output_reloc::local_section_offset): Likewise.
735         (Output_reloc::get_address): Likewise.
736         (Output_reloc::symbol_value): Likewise.
737         (Output_data_got::reserve_slot): Move to class definition.
738         (Output_data_got::reserve_local): New function.
739         (Output_data_got::reserve_slot_for_global): Remove.
740         (Output_data_got::reserve_global): New function.
741         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
742         (all constructors, two instantiations).
743         (Output_reloc::get_relobj): New function (two instantiations).
744         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
745         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
746         (Output_data_reloc::add_global): Adjust type of relobj.
747         (Output_data_reloc::add_global_relative): Likewise.
748         (Output_data_reloc::add_symbolless_global_addend): Likewise.
749         (Output_data_reloc::add_local): Likewise.
750         (Output_data_reloc::add_local_relative): Likewise.
751         (Output_data_reloc::add_symbolless_local_addend): Likewise.
752         (Output_data_reloc::add_local_section): Likewise.
753         (Output_data_reloc::add_output_section): Likewise.
754         (Output_data_reloc::add_absolute): Likewise.
755         (Output_data_reloc::add_target_specific): Likewise.
756         (Output_data_got::reserve_slot): Move definition here.
757         (Output_data_got::reserve_local): New function.
758         (Output_data_got::reserve_global): New function.
759         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
760         section_offsets_ with accessor function.
761         (Sized_relobj_file::write_sections): Likewise.
762         (Sized_relobj_file::do_relocate_sections): Likewise.
763         * target.h (Sized_target::reserve_local_got_entry): New function.
764         (Sized_target::reserve_global_got_entry): New function.
765         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
766         (Target_x86_64::reserve_global_got_entry): New function.
767         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
768
769 2011-05-23 Cary Coutant  <ccoutant@google.com>
770
771         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
772         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
773         bit when checking got_type.
774         * incremental.cc (Sized_incremental_binary::setup_readers):
775         Store symbol table and string table locations; initialize bit vector
776         of file status flags.
777         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
778         unchanged files.
779         (Sized_incremental_binary::do_process_got_plt): New function.
780         (Sized_incremental_binary::get_symtab_view): Use stored locations.
781         (Output_section_incremental_inputs::set_final_data_size): Record
782         file index for each input file.
783         (Output_section_incremental_inputs::write_got_plt): Store file index
784         instead of input entry offset for each GOT entry.
785         * incremental.h
786         (Incremental_input_entry::Incremental_input_entry): Initialize new
787         data member.
788         (Incremental_input_entry::set_offset): Store file index.
789         (Incremental_input_entry::get_file_index): New function.
790         (Incremental_input_entry::file_index_): New data member.
791         (Incremental_binary::process_got_plt): New function.
792         (Incremental_binary::do_process_got_plt): New function.
793         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
794         data members.
795         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
796         (Sized_incremental_binary::set_file_is_unchanged): New function.
797         (Sized_incremental_binary::file_is_unchanged): New function.
798         (Sized_incremental_binary::do_process_got_plt): New function.
799         (Sized_incremental_binary::file_status_): New data member.
800         (Sized_incremental_binary::main_symtab_loc_): New data member.
801         (Sized_incremental_binary::main_strtab_loc_): New data member.
802         * output.cc (Output_data_got::Got_entry::write): Add case
803         RESERVED_CODE.
804         (Output_data_got::add_global): Call add_got_entry.
805         (Output_data_got::add_global_plt): Likewise.
806         (Output_data_got::add_global_with_rel): Likewise.
807         (Output_data_got::add_global_with_rela): Likewise.
808         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
809         (Output_data_got::add_global_pair_with_rela): Likewise.
810         (Output_data_got::add_local): Call add_got_entry.
811         (Output_data_got::add_local_plt): Likewise.
812         (Output_data_got::add_local_with_rel): Likewise.
813         (Output_data_got::add_local_with_rela): Likewise.
814         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
815         (Output_data_got::add_local_pair_with_rela): Likewise.
816         (Output_data_got::reserve_slot): New function.
817         (Output_data_got::reserve_slot_for_global): New function.
818         (Output_data_got::add_got_entry): New function.
819         (Output_data_got::add_got_entry_pair): New function.
820         (Output_section::add_output_section_data): Edit FIXME.
821         * output.h
822         (Output_section_data_build::Output_section_data_build): New
823         constructor with size parameter.
824         (Output_data_space::Output_data_space): Likewise.
825         (Output_data_got::Output_data_got): Initialize new data member; new
826         constructor with size parameter.
827         (Output_data_got::add_constant): Call add_got_entry.
828         (Output_data_got::reserve_slot): New function.
829         (Output_data_got::reserve_slot_for_global): New function.
830         (class Output_data_got::Got_entry): Add RESERVED_CODE.
831         (Output_data_got::add_got_entry): New function.
832         (Output_data_got::add_got_entry_pair): New function.
833         (Output_data_got::free_list_): New data member.
834         * target.h (Sized_target::init_got_plt_for_update): New function.
835         (Sized_target::register_global_plt_entry): New function.
836         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
837         Initialize new data member; call init; add constructor with PLT count.
838         (Output_data_plt_x86_64::init): New function.
839         (Output_data_plt_x86_64::add_relocation): New function.
840         (Output_data_plt_x86_64::reserve_slot): New function.
841         (Output_data_plt_x86_64::free_list_): New data member.
842         (Target_x86_64::init_got_plt_for_update): New function.
843         (Target_x86_64::register_global_plt_entry): New function.
844         (Output_data_plt_x86_64::add_entry): Allocate from free list for
845         incremental updates.
846         (Output_data_plt_x86_64::add_relocation): New function.
847         * testsuite/object_unittest.cc (Object_test): Set default options.
848
849 2011-05-16  Ian Lance Taylor  <iant@google.com>
850
851         * options.h (class General_options): Make -i a synonym for -r.
852
853 2011-05-16  Ian Lance Taylor  <iant@google.com>
854
855         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
856
857 2011-05-10 Cary Coutant  <ccoutant@google.com>
858
859         * object.cc (Sized_relobj::do_count_local_symbols): Check for
860         strip_all (-s).
861
862 2011-05-06  Ian Lance Taylor  <iant@google.com>
863
864         * layout.cc (Layout::layout): If the output section flags change,
865         update the ordering.
866
867 2011-04-25 Cary Coutant  <ccoutant@google.com>
868
869         * incremental-dump.cc (dump_incremental_inputs): Print local
870         symbol info for each input file.
871         * incremental.cc
872         (Output_section_incremental_inputs::set_final_data_size): Add local
873         symbol info to input file entries in incremental info.
874         (Output_section_incremental_inputs::write_info_blocks): Likewise.
875         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
876         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
877         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
878         implementation.
879         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
880         (Sized_incr_relobj::do_relocate): Write the local symbols.
881         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
882         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
883         Adjust size of input file header.
884         (Incremental_inputs_reader::get_local_symbol_offset): New function.
885         (Incremental_inputs_reader::get_local_symbol_count): New function.
886         (Incremental_inputs_reader::get_input_section): Adjust size of input
887         file header.
888         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
889         (Sized_incr_relobj::This): New typedef.
890         (Sized_incr_relobj::sym_size): New const data member.
891         (Sized_incr_relobj::Local_symbol): New struct.
892         (Sized_incr_relobj::do_output_local_symbol_count): New function.
893         (Sized_incr_relobj::do_local_symbol_offset): New function.
894         (Sized_incr_relobj::local_symbol_count_): New data member.
895         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
896         (Sized_incr_relobj::local_symbol_index_): New data member.
897         (Sized_incr_relobj::local_symbol_offset_): New data member.
898         (Sized_incr_relobj::local_dynsym_offset_): New data member.
899         (Sized_incr_relobj::local_symbols_): New data member.
900         * object.h (Relobj::output_local_symbol_count): New function.
901         (Relobj::local_symbol_offset): New function.
902         (Relobj::do_output_local_symbol_count): New function.
903         (Relobj::do_local_symbol_offset): New function.
904         (Sized_relobj::do_output_local_symbol_count): New function.
905         (Sized_relobj::do_local_symbol_offset): New function.
906
907 2011-04-22  Vladimir Simonov  <sv@sw.ru>
908
909         * descriptors.cc (set_close_on_exec): New function.
910         (Descriptors::open): Use set_close_on_exec.
911         * output.cc (S_ISLNK): Define if not defined.
912
913 2011-04-22 Cary Coutant  <ccoutant@google.com>
914
915         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
916         global symbol map.
917         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
918         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
919         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
920         relocations.
921         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
922         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
923         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
924         * incremental.h
925         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
926         function.
927         (Incremental_binary::apply_incremental_relocs): New function.
928         (Incremental_binary::do_apply_incremental_relocs): New function.
929         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
930         data member.
931         (Sized_incremental_binary::add_global_symbol): New function.
932         (Sized_incremental_binary::global_symbol): New function.
933         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
934         (Sized_incremental_binary::symbol_map_): New data member.
935         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
936         * target.h (Sized_target::apply_relocation): New function.
937         * target-reloc.h (apply_relocation): New function.
938         * x86_64.cc (Target_x86_64::apply_relocation): New function.
939
940 2011-04-22  Doug Kwan  <dougkwan@google.com>
941
942         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
943         flag of a SHT_ARM_EXIDX section.
944         * testsuite/Makefile.am (arm_exidx_test): New test rules.
945         * testsuite/Makefile.in: Regenerate.
946         * testsuite/arm_exidx_test.s: New file.
947         * testsuite/arm_exidx_test.sh: Same.
948
949 2011-04-20 Cary Coutant  <ccoutant@google.com>
950
951         PR gold/12689
952         * archive.h (Incremental_archive_entry::Archive_member):
953         Initialize arg_serial_ (second constructor).
954
955 2011-04-17  Ian Lance Taylor  <iant@google.com>
956
957         * object.cc (Relocate_info::location): Simplify location string.
958         * errors.cc (Errors::error_at_location): Don't print program
959         name.
960         (Errors::warning_at_location): Likewise.
961         (Errors::undefined_symbol): Likewise.
962         * testsuite/debug_msg.sh: Update accordingly.
963
964 2011-04-14 Cary Coutant  <ccoutant@google.com>
965
966         * gold/layout.cc (Layout::symtab_section_offset): New function.
967         * gold/layout.h (Layout::symtab_section_offset): New function.
968         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
969
970 2011-04-12  Ian Lance Taylor  <iant@google.com>
971
972         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
973         with MREMAP_MAYMOVE.
974         * output.h (class Output_file): Add map_is_allocated_ field.
975         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
976         not available, provide stubs.  If mremap is not available, #define
977         it to gold_mremap.
978         (MREMAP_MAYMOVE): Define if not defined.
979         (Output_file::Output_file): Initialize map_is_allocated_.
980         (Output_file::resize): Check map_is_allocated_.
981         (Output_file::map_anonymous): If mmap fails, use malloc.
982         (Output_file::unmap): Don't do anything for an anonymous map.
983         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
984         is not available, provide stubs.
985         (File_read::View::~View): Use free rather than delete[].
986         (File_read::make_view): Use malloc rather than new[].  If mmap
987         fails, use malloc.
988         (File_read::find_or_make_view): Use malloc rather than new[].
989         * gold.h: Remove HAVE_REMAP code.
990         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
991         exists.  Rename mremap to gold_mremap.  If mmap is not available
992         don't do anything.
993         * configure, config.in: Rebuild.
994
995 2011-04-11  Ian Lance Taylor  <iant@google.com>
996
997         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
998         initialize local variable v.
999
1000 2011-04-11  Cary Coutant  <ccoutant@google.com>
1001
1002         * archive.cc (Archive::include_member): Adjust call to
1003         report_object.
1004         (Add_archive_symbols::run): Track argument serial numbers.
1005         (Lib_group::include_member): Likewise.
1006         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
1007         * archive.h (Incremental_archive_entry::Archive_member):
1008         Initialize arg_serial_.
1009         (Archive_member::arg_serial_): New data member.
1010         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
1011         (Sized_dynobj::do_add_symbols): Track symbols when doing an
1012         incremental link.
1013         (Sized_dynobj::do_for_all_local_got_entries): New function.
1014         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
1015         function.
1016         * fileread.cc (get_mtime): New function.
1017         * fileread.h (get_mtime): New function.
1018         * gold.cc (queue_initial_tasks): Check for incremental update.
1019         (process_incremental_input): New function.
1020         (queue_middle_tasks): Don't force valid target for incremental
1021         update.
1022         * incremental-dump.cc (find_input_containing_global): Adjust
1023         size of symbol info entry.
1024         (dump_incremental_inputs): Dump argument serial number and
1025         in_system_directory flag; bias shndx by 1; print symbol names
1026         when dumping per-file symbol lists; use new symbol info readers.
1027         * incremental.cc
1028         (Output_section_incremental_inputs:update_data_size): New function.
1029         (Sized_incremental_binary::setup_readers): Setup input readers
1030         for each input file; build maps for files added from libraries
1031         and scripts.
1032         (Sized_incremental_binary::check_input_args): New function.
1033         (Sized_incremental_binary::do_check_inputs): Build map of argument
1034         serial numbers to input arguments.
1035         (Sized_incremental_binary::do_file_has_changed): Rename
1036         do_file_is_unchanged to this; compare file modification times.
1037         (Sized_incremental_binary::do_init_layout): New function.
1038         (Sized_incremental_binary::do_reserve_layout): New function.
1039         (Sized_incremental_binary::do_get_input_reader): Remove.
1040         (Sized_incremental_binary::get_symtab_view): New function.
1041         (Incremental_checker::can_incrementally_link_output_file): Remove.
1042         (Incremental_inputs::report_command_line): Exclude --debug options.
1043         (Incremental_inputs::report_archive_begin): Add parameter; track
1044         argument serial numbers; don't put input file entry for archive
1045         before archive members.
1046         (Incremental_inputs::report_archive_end): Put input file entry
1047         for archive after archive members.
1048         (Incremental_inputs::report_object): Add parameter; track argument
1049         serial numbers and in_system_directory flag.
1050         (Incremental_inputs::report_script): Add parameter; track argument
1051         serial numbers.
1052         (Output_section_incremental_inputs::set_final_data_size): Adjust
1053         size of symbol info entry; check for forwarding symbols.
1054         (Output_section_incremental_inputs::write_input_files): Write
1055         in_system_directory flag and argument serial number.
1056         (Output_section_incremental_inputs::write_info_blocks): Map section
1057         indices between incremental info and original input file; store
1058         input section index for each symbol.
1059         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
1060         change operator() to visit().
1061         (class Global_got_offset_visitor): Likewise.
1062         (class Global_symbol_visitor_got_plt):
1063         (Output_section_incremental_inputs::write_got_plt): Use new visitor
1064         classes.
1065         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
1066         (Sized_incr_relobj::do_read_symbols): New function.
1067         (Sized_incr_relobj::do_layout): New function.
1068         (Sized_incr_relobj::do_layout_deferred_sections): New function.
1069         (Sized_incr_relobj::do_add_symbols): New function.
1070         (Sized_incr_relobj::do_should_include_member): New function.
1071         (Sized_incr_relobj::do_for_all_global_symbols): New function.
1072         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
1073         (Sized_incr_relobj::do_section_size): New function.
1074         (Sized_incr_relobj::do_section_name): New function.
1075         (Sized_incr_relobj::do_section_contents): New function.
1076         (Sized_incr_relobj::do_section_flags): New function.
1077         (Sized_incr_relobj::do_section_entsize): New function.
1078         (Sized_incr_relobj::do_section_address): New function.
1079         (Sized_incr_relobj::do_section_type): New function.
1080         (Sized_incr_relobj::do_section_link): New function.
1081         (Sized_incr_relobj::do_section_info): New function.
1082         (Sized_incr_relobj::do_section_addralign): New function.
1083         (Sized_incr_relobj::do_initialize_xindex): New function.
1084         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
1085         (Sized_incr_relobj::do_read_relocs): New function.
1086         (Sized_incr_relobj::do_gc_process_relocs): New function.
1087         (Sized_incr_relobj::do_scan_relocs): New function.
1088         (Sized_incr_relobj::do_count_local_symbols): New function.
1089         (Sized_incr_relobj::do_finalize_local_symbols): New function.
1090         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
1091         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
1092         (Sized_incr_relobj::do_relocate): New function.
1093         (Sized_incr_relobj::do_set_section_offset): New function.
1094         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
1095         (Sized_incr_dynobj::do_read_symbols): New function.
1096         (Sized_incr_dynobj::do_layout): New function.
1097         (Sized_incr_dynobj::do_add_symbols): New function.
1098         (Sized_incr_dynobj::do_should_include_member): New function.
1099         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
1100         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
1101         (Sized_incr_dynobj::do_section_size): New function.
1102         (Sized_incr_dynobj::do_section_name): New function.
1103         (Sized_incr_dynobj::do_section_contents): New function.
1104         (Sized_incr_dynobj::do_section_flags): New function.
1105         (Sized_incr_dynobj::do_section_entsize): New function.
1106         (Sized_incr_dynobj::do_section_address): New function.
1107         (Sized_incr_dynobj::do_section_type): New function.
1108         (Sized_incr_dynobj::do_section_link): New function.
1109         (Sized_incr_dynobj::do_section_info): New function.
1110         (Sized_incr_dynobj::do_section_addralign): New function.
1111         (Sized_incr_dynobj::do_initialize_xindex): New function.
1112         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
1113         (make_sized_incremental_object): New function.
1114         (Incremental_library::copy_unused_symbols): New function.
1115         (Incremental_library::do_for_all_unused_symbols): New function.
1116         * incremental.h (enum Incremental_input_flags): New type.
1117         (class Incremental_checker): Remove.
1118         (Incremental_input_entry::Incremental_input_entry): Add argument
1119         serial number.
1120         (Incremental_input_entry::arg_serial): New function.
1121         (Incremental_input_entry::set_is_in_system_directory): New function.
1122         (Incremental_input_entry::is_in_system_directory): New function.
1123         (Incremental_input_entry::arg_serial_): New data member.
1124         (Incremental_input_entry::is_in_system_directory_): New data member.
1125         (class Script_info): Move here from script.h.
1126         (Script_info::Script_info): Add filename parameter.
1127         (Script_info::filename): New function.
1128         (Script_info::filename_): New data member.
1129         (Incremental_script_entry::Incremental_script_entry): Add argument
1130         serial number.
1131         (Incremental_object_entry::Incremental_object_entry): Likewise.
1132         (Incremental_object_entry::add_input_section): Build list of input
1133         sections with map to original shndx.
1134         (Incremental_object_entry::get_input_section_index): New function.
1135         (Incremental_object_entry::shndx_): New data member.
1136         (Incremental_object_entry::name_key_): Rename; adjust all refs.
1137         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
1138         (Incremental_archive_entry::Incremental_archive_entry): Add argument
1139         serial number.
1140         (Incremental_inputs::report_archive_begin): Likewise.
1141         (Incremental_inputs::report_object): Likewise.
1142         (Incremental_inputs::report_script): Likewise.
1143         (class Incremental_global_symbol_reader): New class.
1144         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
1145         and store flags and input file type.
1146         (Incremental_input_entry_reader::arg_serial): New function.
1147         (Incremental_input_entry_reader::type): Extract type from flags.
1148         (Incremental_input_entry_reader::is_in_system_directory): New function.
1149         (Incremental_input_entry_reader::get_input_section_count): Call
1150         accessor function for type.
1151         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
1152         function for type; adjust size of global symbol entry.
1153         (Incremental_input_entry_reader::get_global_symbol_count): Call
1154         accessor function for type.
1155         (Incremental_input_entry_reader::get_object_count): Likewise.
1156         (Incremental_input_entry_reader::get_object_offset): Likewise.
1157         (Incremental_input_entry_reader::get_member_count): Likewise.
1158         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
1159         (Incremental_input_entry_reader::get_member_offset): Likewise.
1160         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
1161         (Incremental_input_entry_reader::Global_symbol_info): Remove.
1162         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
1163         (Incremental_input_entry_reader::get_global_symbol_reader): New
1164         function.
1165         (Incremental_input_entry_reader::get_output_symbol_index): New
1166         function.
1167         (Incremental_input_entry_reader::type_): Remove.
1168         (Incremental_input_entry_reader::flags_): New data member.
1169         (Incremental_inputs_reader::input_file_offset): New function.
1170         (Incremental_inputs_reader::input_file_index): New function.
1171         (Incremental_inputs_reader::input_file): Call input_file_offset.
1172         (Incremental_inputs_reader::input_file_at_offset): New function.
1173         (Incremental_relocs_reader::get_r_type): Reformat.
1174         (Incremental_relocs_reader::get_r_shndx): Reformat.
1175         (Incremental_relocs_reader::get_r_offset): Reformat.
1176         (Incremental_relocs_reader::data): New function.
1177         (Incremental_binary::Incremental_binary): Initialize new data members.
1178         (Incremental_binary::check_inputs): Add cmdline parameter.
1179         (Incremental_binary::file_is_unchanged): Remove.
1180         (Input_reader::arg_serial): New function.
1181         (Input_reader::get_unused_symbol_count): New function.
1182         (Input_reader::get_unused_symbol): New function.
1183         (Input_reader::do_arg_serial): New function.
1184         (Input_reader::do_get_unused_symbol_count): New function.
1185         (Input_reader::do_get_unused_symbol): New function.
1186         (Incremental_binary::input_file_count): New function.
1187         (Incremental_binary::get_input_reader): Change signature to use
1188         index instead of filename.
1189         (Incremental_binary::file_has_changed): New function.
1190         (Incremental_binary::get_input_argument): New function.
1191         (Incremental_binary::get_library): New function.
1192         (Incremental_binary::get_script_info): New function.
1193         (Incremental_binary::init_layout): New function.
1194         (Incremental_binary::reserve_layout): New function.
1195         (Incremental_binary::output_file): New function.
1196         (Incremental_binary::do_check_inputs): New function.
1197         (Incremental_binary::do_file_is_unchanged): Remove.
1198         (Incremental_binary::do_file_has_changed): New function.
1199         (Incremental_binary::do_init_layout): New function.
1200         (Incremental_binary::do_reserve_layout): New function.
1201         (Incremental_binary::do_input_file_count): New function.
1202         (Incremental_binary::do_get_input_reader): Change signature.
1203         (Incremental_binary::input_args_map_): New data member.
1204         (Incremental_binary::library_map_): New data member.
1205         (Incremental_binary::script_map_): New data member.
1206         (Sized_incremental_binary::Sized_incremental_binary): Initialize
1207         new data members.
1208         (Sized_incremental_binary::output_section): New function.
1209         (Sized_incremental_binary::inputs_reader): Add const.
1210         (Sized_incremental_binary::symtab_reader): Add const.
1211         (Sized_incremental_binary::relocs_reader): Add const.
1212         (Sized_incremental_binary::got_plt_reader): Add const.
1213         (Sized_incremental_binary::get_symtab_view): New function.
1214         (Sized_incremental_binary::Inputs_reader): New typedef.
1215         (Sized_incremental_binary::Input_entry_reader): New typedef.
1216         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
1217         (Sized_incremental_binary::do_file_is_unchanged): Remove.
1218         (Sized_incremental_binary::do_file_has_changed): New function.
1219         (Sized_incremental_binary::do_init_layout): New function.
1220         (Sized_incremental_binary::do_reserve_layout): New function.
1221         (Sized_input_reader::Inputs_reader): Remove.
1222         (Sized_input_reader::Input_entry_reader): Remove.
1223         (Sized_input_reader::do_arg_serial): New function.
1224         (Sized_input_reader::do_get_unused_symbol_count): New function.
1225         (Sized_input_reader::do_get_unused_symbol): New function.
1226         (Sized_incremental_binary::do_input_file_count): New function.
1227         (Sized_incremental_binary::do_get_input_reader): Change signature;
1228         use index instead of filename.
1229         (Sized_incremental_binary::section_map_): New data member.
1230         (Sized_incremental_binary::input_entry_readers_): New data member.
1231         (class Sized_incr_relobj): New class.
1232         (class Sized_incr_dynobj): New class.
1233         (make_sized_incremental_object): New function.
1234         (class Incremental_library): New class.
1235         * layout.cc (Free_list::num_lists): New static data member.
1236         (Free_list::num_nodes): New static data member.
1237         (Free_list::num_removes): New static data member.
1238         (Free_list::num_remove_visits): New static data member.
1239         (Free_list::num_allocates): New static data member.
1240         (Free_list::num_allocate_visits): New static data member.
1241         (Free_list::init): New function.
1242         (Free_list::remove): New function.
1243         (Free_list::allocate): New function.
1244         (Free_list::dump): New function.
1245         (Free_list::print_stats): New function.
1246         (Layout_task_runner::run): Resize output file for incremental updates.
1247         (Layout::Layout): Initialize new data members.
1248         (Layout::set_incremental_base): New function.
1249         (Layout::init_fixed_output_section): New function.
1250         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
1251         incremental updates.
1252         (Layout::create_gold_note): Do not create gold note section for
1253         incremental updates.
1254         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
1255         for incremental updates.
1256         (Layout::set_section_offsets): For incremental updates, allocate space
1257         from free list.
1258         (Layout::create_symtab_sections): Layout with offsets relative to
1259         start of section; for incremental updates, allocate space from free
1260         list.
1261         (Layout::create_shdrs): For incremental updates, allocate space from
1262         free list.
1263         (Layout::finish_dynamic_section): For incremental updates, do not
1264         check --as-needed (fixed in subsequent patch).
1265         * layout.h (class Free_list): New class.
1266         (Layout::set_incremental_base): New function.
1267         (Layout::incremental_base): New function.
1268         (Layout::init_fixed_output_section): New function.
1269         (Layout::allocate): New function.
1270         (Layout::incremental_base_): New data member.
1271         (Layout::free_list_): New data member.
1272         * main.cc (main): Print Free_list statistics.
1273         * object.cc (Relobj::finalize_incremental_relocs): Add
1274         clear_counts parameter; clear counts only when clear_counts is set.
1275         (Sized_relobj::Sized_relobj): Initialize new base class.
1276         (Sized_relobj::do_layout): Don't report special sections.
1277         (Sized_relobj::do_for_all_local_got_entries): New function.
1278         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
1279         symtab_off to all symbol table offsets.
1280         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
1281         * object.h (class Got_offset_list): Move to top of file.
1282         (Object::Object): Allow case where input_file == NULL.
1283         (Object::~Object): Likewise.
1284         (Object::input_file): Assert that input_file != NULL.
1285         (Object::lock): Allow case where input_file == NULL.
1286         (Object::unlock): Likewise.
1287         (Object::is_locked): Likewise.
1288         (Object::token): Likewise.
1289         (Object::release): Likewise.
1290         (Object::is_incremental): New function.
1291         (Object::get_mtime): New function.
1292         (Object::for_all_local_got_entries): New function.
1293         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
1294         (Object::set_is_in_system_directory): New function.
1295         (Object::is_in_system_directory): New function.
1296         (Object::do_is_incremental): New function.
1297         (Object::do_get_mtime): New function.
1298         (Object::do_for_all_local_got_entries): New function.
1299         (Object::is_in_system_directory_): New data member.
1300         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
1301         (class Sized_relobj_base): New class.
1302         (class Sized_relobj): Derive from Sized_relobj_base.
1303         (class Sized_relobj::Symbols): Redeclare from base class.
1304         (class Sized_relobj::local_got_offset_list): Remove.
1305         (class Sized_relobj::Output_sections): Redeclare from base class.
1306         (class Sized_relobj::do_for_all_local_got_entries): New function.
1307         (class Sized_relobj::write_local_symbols): Add offset parameter.
1308         (class Sized_relobj::local_symbol_offset_): Update comment.
1309         (class Sized_relobj::local_dynsym_offset_): Update comment.
1310         * options.cc (Input_arguments::add_file): Remove const.
1311         * options.h (Input_file_argument::Input_file_argument):
1312         Initialize arg_serial_ (all constructors).
1313         (Input_file_argument::set_arg_serial): New function.
1314         (Input_file_argument::arg_serial): New function.
1315         (Input_file_argument::arg_serial_): New data member.
1316         (Input_arguments::Input_arguments): Initialize file_count_.
1317         (Input_arguments::add_file): Remove const.
1318         (Input_arguments::number_of_input_files): New function.
1319         (Input_arguments::file_count_): New data member.
1320         (Command_line::number_of_input_files): Call
1321         Input_arguments::number_of_input_files.
1322         * output.cc (Output_segment_headers::Output_segment_headers):
1323         Set current size.
1324         (Output_section::Input_section::current_data_size): New function.
1325         (Output_section::Output_section): Initialize new data members.
1326         (Output_section::add_input_section): Don't do merge sections for
1327         an incremental link; allocate space from free list for an
1328         incremental update.
1329         (Output_section::add_output_section_data): Allocate space from
1330         free list for an incremental update.
1331         (Output_section::update_data_size): New function.
1332         (Output_section::set_fixed_layout): New function.
1333         (Output_section::reserve): New function.
1334         (Output_segment::set_section_addresses): Remove const.
1335         (Output_segment::set_section_list_addresses): Remove const; allocate
1336         space from free list for an incremental update.
1337         (Output_segment::set_offset): Adjust size of RELRO segment for an
1338         incremental update.
1339         * output.h (Output_data::current_data_size): Move here from
1340         child classes.
1341         (Output_data::pre_finalize_data_size): New function.
1342         (Output_data::update_data_size): New function.
1343         (Output_section_headers::update_data_size): new function.
1344         (Output_section_data_build::current_data_size): Move to Output_data.
1345         (Output_data_strtab::update_data_size): New function.
1346         (Output_section::current_data_size): Move to Output_data.
1347         (Output_section::set_fixed_layout): New function.
1348         (Output_section::has_fixed_layout): New function.
1349         (Output_section::reserve): New function.
1350         (Output_section::update_data_size): New function.
1351         (Output_section::has_fixed_layout_): New data member.
1352         (Output_section::free_list_): New data member.
1353         (Output_segment::set_section_addresses): Remove const.
1354         (Output_segment::set_section_list_addresses): Remove const.
1355         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
1356         New function.
1357         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
1358         New function.
1359         * readsyms.cc (Read_symbols::do_read_symbols): Add library
1360         parameter when calling Add_symbols constructor; store argument
1361         serial number for members of a lib group.
1362         (Add_symbols::locks): Allow case where token == NULL.
1363         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
1364         (Read_member::~Read_member): New function.
1365         (Read_member::is_runnable): New function.
1366         (Read_member::locks): New function.
1367         (Read_member::run): New function.
1368         (Check_script::~Check_script): New function.
1369         (Check_script::is_runnable): New function.
1370         (Check_script::locks): New function.
1371         (Check_script::run): New function.
1372         (Check_library::~Check_library): New function.
1373         (Check_library::is_runnable): New function.
1374         (Check_library::locks): New function.
1375         (Check_library::run): New function.
1376         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
1377         (Add_symbols::library_): New data member.
1378         (class Read_member): New class.
1379         (class Check_script): New class.
1380         (class Check_library): New class.
1381         * reloc.cc (Read_relocs::is_runnable): Allow case where
1382         token == NULL.
1383         (Read_relocs::locks): Likewise.
1384         (Scan_relocs::locks): Likewise.
1385         (Relocate_task::locks): Likewise.
1386         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
1387         to clear counters.
1388         (Sized_relobj::incremental_relocs_scan): Fix comment.
1389         (Sized_relobj::do_relocate): Pass output file offset to
1390         write_local_symbols.
1391         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
1392         from class declaration.
1393         * script.cc (read_input_script): Allocate Script_info; pass
1394         argument serial number to report_script.
1395         * script.h (class Script_info): Move to incremental.h.
1396         * symtab.cc (Symbol_table::add_from_incrobj): New function.
1397         * symtab.h (Symbol_table::add_from_incrobj): New function.
1398         (Symbol_table::set_file_offset): New function.
1399
1400 2011-04-05  Cary Coutant  <ccoutant@google.com>
1401
1402         * incremental-dump.cc (dump_incremental_inputs): Change signature
1403         to take a Sized_incremental_binary; change caller.  Use readers
1404         in Sized_incremental_binary.
1405         * incremental.cc
1406         (Sized_incremental_binary::find_incremental_inputs_sections):
1407         Rename do_find_incremental_inputs_sections to this.
1408         (Sized_incremental_binary::setup_readers): New function.
1409         (Sized_incremental_binary::do_check_inputs): Check
1410         has_incremental_info_ flag; move setup code to setup_readers;
1411         use input readers.
1412         (Sized_incremental_binary::do_file_is_unchanged): New function.
1413         (Sized_incremental_binary::do_get_input_reader): New function.
1414         * incremental.h (class Incremental_binary): Move to end of file.
1415         (Incremental_binary::file_is_unchanged): New function.
1416         (Incremental_binary::do_file_is_unchanged): New function.
1417         (Incremental_binary::Input_reader): New class.
1418         (Incremental_binary::get_input_reader): New function.
1419         (class Sized_incremental_binary): Move to end of file.
1420         (Sized_incremental_binary::Sized_incremental_binary): Setup the
1421         input section reader classes.
1422         (Sized_incremental_binary::has_incremental_info): New function.
1423         (Sized_incremental_binary::inputs_reader): New function.
1424         (Sized_incremental_binary::symtab_reader): New function.
1425         (Sized_incremental_binary::relocs_reader): New function.
1426         (Sized_incremental_binary::got_plt_reader): New function.
1427         (Sized_incremental_binary::do_file_is_unchanged): New function.
1428         (Sized_incremental_binary::Sized_input_reader): New class.
1429         (Sized_incremental_binary::get_input_reader): New function.
1430         (Sized_incremental_binary::find_incremental_inputs_sections):
1431         Rename do_find_incremental_inputs_sections to this.
1432         (Sized_incremental_binary::setup_readers): New function.
1433         (Sized_incremental_binary::has_incremental_info_): New data member.
1434         (Sized_incremental_binary::inputs_reader_): New data member.
1435         (Sized_incremental_binary::symtab_reader_): New data member.
1436         (Sized_incremental_binary::relocs_reader_): New data member.
1437         (Sized_incremental_binary::got_plt_reader_): New data member.
1438         (Sized_incremental_binary::current_input_file_): New data member.
1439
1440 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
1441
1442         PR gold/12640
1443         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
1444         violation.
1445
1446 2011-03-30  Cary Coutant  <ccoutant@google.com>
1447
1448         * archive.cc (Archive::include_member): Adjust call to report_object.
1449         (Add_archive_symbols::run): Add script_info to call to
1450         report_archive_begin.
1451         (Lib_group::include_member): Adjust call to report_object.
1452         (Add_lib_group_symbols::run): Adjust call to report_object.
1453         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
1454         blocks.  Add object count for script input files.
1455         * incremental.cc (Incremental_inputs::report_archive_begin): Add
1456         script_info parameter; change all callers.
1457         (Incremental_inputs::report_object): Add script_info parameter;
1458         change all callers.
1459         (Incremental_inputs::report_script): Store backpointer to
1460         incremental info entry.
1461         (Output_section_incremental_inputs::set_final_data_size): Record
1462         additional information for scripts.
1463         (Output_section_incremental_inputs::write_info_blocks): Likewise.
1464         * incremental.h (Incremental_script_entry::add_object): New function.
1465         (Incremental_script_entry::get_object_count): New function.
1466         (Incremental_script_entry::get_object): New function.
1467         (Incremental_script_entry::objects_): New data member; adjust
1468         constructor.
1469         (Incremental_inputs::report_archive_begin): Add script_info parameter.
1470         (Incremental_inputs::report_object): Add script_info parameter.
1471         (Incremental_inputs_reader::get_object_count): New function.
1472         (Incremental_inputs_reader::get_object_offset): New function.
1473         * options.cc (Input_arguments::add_file): Return reference to
1474         new input argument.
1475         * options.h (Input_argument::set_script_info): New function.
1476         (Input_argument::script_info): New function.
1477         (Input_argument::script_info_): New data member; adjust all
1478         constructors.
1479         (Input_file_group::add_file): Return reference to new input argument.
1480         (Input_file_lib::add_file): Likewise.
1481         (Input_arguments::add_file): Likewise.
1482         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
1483         * script.cc (Parser_closure::Parser_closure): Add script_info
1484         parameter; adjust all callers.
1485         (Parser_closure::script_info): New function.
1486         (Parser_closure::script_info_): New data member.
1487         (read_input_script): Report scripts earlier to incremental info.
1488         (script_add_file): Set script_info in Input_argument.
1489         (script_add_library): Likewise.
1490         * script.h (Script_options::Script_info): Rewrite class.
1491
1492 2011-03-29  Cary Coutant  <ccoutant@google.com>
1493
1494         * archive.cc (Library_base::should_include_member): Move
1495         method here from class Archive.
1496         (Archive::Archive): Initialize base class.
1497         (Archive::should_include_member): Move to base class.
1498         (Archive::do_for_all_unused_symbols): New function.
1499         (Add_archive_symbols::run): Remove redundant access to
1500         incremental_inputs.
1501         (Lib_group::Lib_group): Initialize base class.
1502         (Lib_group::do_filename): New function.
1503         (Lib_group::include_member): Pass pointer to Lib_group to
1504         report_object.
1505         (Lib_group::do_for_all_unused_symbols): New function.
1506         (Add_lib_group_symbols::run): Report archive information for
1507         incremental links.
1508         * archive.h (class Library_base): New base class.
1509         (class Archive): Derive from Library_base.
1510         (Archive::filename): Move to base class.
1511         (Archive::set_incremental_info): Likewise.
1512         (Archive::incremental_info): Likewise.
1513         (Archive::Should_include): Likewise.
1514         (Archive::should_include_member): Likewise.
1515         (Archive::Armap_entry): Remove.
1516         (Archive::Unused_symbol_iterator): Remove.
1517         (Archive::unused_symbols_begin): Remove.
1518         (Archive::unused_symbols_end): Remove.
1519         (Archive::do_filename): New function.
1520         (Archive::do_get_mtime): New function.
1521         (Archive::do_for_all_unused_symbols): New function.
1522         (Archive::task_): Move to base class.
1523         (Archive::incremental_info_): Likewise.
1524         (class Lib_group): Derive from Library_base.
1525         (Lib_group::do_filename): New function.
1526         (Lib_group::do_get_mtime): New function.
1527         (Lib_group::do_for_all_unused_symbols): New function.
1528         (Lib_group::task_): Move to base class.
1529         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
1530         function.
1531         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
1532         function.
1533         * incremental.cc (Incremental_inputs::report_archive_begin):
1534         Use Library_base; call library's get_mtime; add incremental inputs
1535         entry before members.
1536         (class Unused_symbol_visitor): New class.
1537         (Incremental_inputs::report_archive_end): Use Library_base; use
1538         visitor class to record unused symbols; don't add incremental inputs
1539         entry after members.
1540         (Incremental_inputs::report_object): Use Library_base.
1541         * incremental.h
1542         (Incremental_archive_entry::Incremental_archive_entry): Remove
1543         unused Archive parameter.
1544         (Incremental_inputs::report_archive_begin): Use Library_base.
1545         (Incremental_inputs::report_archive_end): Likewise.
1546         (Incremental_inputs::report_object): Likewise.
1547         * object.cc (Sized_relobj::do_for_all_global_symbols): New
1548         function.
1549         * object.h (Object::for_all_global_symbols): New function.
1550         (Object::do_for_all_global_symbols): New function.
1551         (Sized_relobj::do_for_all_global_symbols): New function.
1552         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
1553         function.
1554         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
1555         function.
1556
1557 2011-03-27  Ian Lance Taylor  <iant@google.com>
1558
1559         * archive.cc (Archive::interpret_header): Return -1 if something
1560         goes wrong.  Change callers accordingly.
1561
1562 2011-03-25  Cary Coutant  <ccoutant@google.com>
1563
1564         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
1565         * testsuite/Makefile.in: Regenerate.
1566
1567 2010-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
1568
1569         * plugin.cc (get_view): New.
1570         (Plugin::load): Pass get_view to the plugin.
1571         (Plugin_manager::get_view): New.
1572
1573 2011-03-21  Ian Lance Taylor  <iant@google.com>
1574
1575         * testsuite/final_layout.sh: Rewrite to not use dc.
1576         * testsuite/relro_test.sh: Fail if dc is not present.
1577
1578 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
1579
1580         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
1581         Change == to -eq.
1582         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
1583         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
1584         Change == to -eq.
1585         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
1586         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
1587
1588 2011-03-14  Ian Lance Taylor  <iant@google.com>
1589
1590         * script-sections.cc (Sort_output_sections::script_compare):
1591         Rename from is_before, change return type.
1592         (Sort_output_sections::operator()): Adjust accordingly.
1593
1594 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
1595
1596         PR gold/12572
1597         * testsuite/odr_violation2.cc: Add comment to make all error line
1598         numbers double digits.
1599         * testsuite/debug_msg.sh: Adjust expected errors.
1600
1601 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
1602
1603         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
1604         but mark earlier ones as non-canonical
1605         (offset_to_iterator): Update search target and example
1606         (do_addr2line): Return extra lines in a vector*
1607         (format_file_lineno): Extract from do_addr2line
1608         (one_addr2line): Add vector* out-param
1609         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
1610         when a lineno entry appeared last for its instruction
1611         (Dwarf_line_info): Add vector* out-param
1612         * object.cc (Relocate_info): Pass NULL for the vector* out-param
1613         * symtab.cc (Odr_violation_compare): Include the lineno in the
1614         comparison again.
1615         (linenos_from_loc): New. Combine the canonical line for an
1616         address with its other lines.
1617         (True_if_intersect): New. Helper functor to make
1618         std::set_intersection a query.
1619         (detect_odr_violations): Compare sets of lines instead of just
1620         one line for each function. This became less deterministic, but
1621         has fewer false positives.
1622         * symtab.h: Declarations.
1623         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
1624         mix an optimized and non-optimized object in the same binary
1625         (odr_violation2.so): Same.
1626         * testsuite/Makefile.in: Regenerate from Makefile.am.
1627         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
1628         * testsuite/debug_msg.sh: Update line numbers and add
1629         assertions.
1630         * testsuite/odr_violation1.cc: Use OdrDerived, in a
1631         non-optimized context.
1632         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
1633         isn't inlined, and use OdrDerived in an optimized context.
1634         * testsuite/odr_header1.h: Defines OdrDerived, where
1635         optimization will change the
1636         first-instruction-in-the-destructor's file and line number.
1637         * testsuite/odr_header2.h: Defines OdrBase.
1638
1639 2011-03-09  Ian Lance Taylor  <iant@google.com>
1640
1641         * fileread.cc (File_read::clear_views): Don't delete the whole
1642         file view.
1643
1644 2011-03-08  Ian Lance Taylor  <iant@google.com>
1645
1646         PR gold/12525
1647         * fileread.cc: #include <climits>.
1648         (GOLD_IOV_MAX): Define.
1649         (File_read::read_multiple): Limit number of entries by iov_max.
1650         * fileread.h (class File_read): Always set max_readv_entries to
1651         128.
1652
1653 2011-03-07  Ian Lance Taylor  <iant@google.com>
1654
1655         PR gold/12525
1656         * options.h (class General_options): Add -dy and -dn.
1657
1658 2011-03-02  Cary Coutant  <ccoutant@google.com>
1659
1660         * testsuite/script_test_9.t: Add TLS segment.
1661
1662 2011-03-02  Simon Baldwin  <simonb@google.com>
1663
1664         * configure.ac: Add check for gnu_indirect_function support in
1665         the toolchain building binutils.
1666         * configure: Rebuild.
1667
1668 2010-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
1669
1670         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
1671         plugin only symbols.
1672         (Symbol_table::sized_finalize_symbol) Mark symbol only present
1673         in plugin files as not needed in the symbol table.
1674
1675 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
1676
1677         * output.cc (Output_section::add_input_section): Delay fill
1678         generation for section ordering.
1679
1680 2011-02-09  Ian Lance Taylor  <iant@google.com>
1681
1682         PR gold/12316
1683         * object.h (class Sized_relobj): Remove clear_local_symbols.
1684         * reloc.cc (Sized_relobj::do_relocate): Don't call
1685         clear_local_symbols.
1686
1687 2010-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
1688
1689         * plugin.cc (is_visible_from_outside): Return true for symbols
1690         in the -u option.
1691
1692 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
1693
1694         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
1695         filename.
1696
1697 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
1698
1699         * icf.h (is_section_foldable_candidate): Change type of parameter
1700         to std::string.
1701         * icf.cc (Icf::find_identical_sections): Change type of local variable
1702         section_name to be std::string.
1703         (is_function_ctor_or_dtor): Change type of parameter to std::string.
1704
1705 2011-01-25  Ian Lance Taylor  <iant@google.com>
1706
1707         * script.cc (script_add_extern): Rewrite to use
1708         add_symbol_reference.
1709
1710 2011-01-25  Doug Kwan  <dougkwan@google.com>
1711
1712         * icf.cc (get_section_contents): Always lock section's object.
1713
1714 2011-01-24  Ian Lance Taylor  <iant@google.com>
1715
1716         * options.h (class General_options): Accept
1717         --no-detect-odr-violations.
1718
1719 2011-01-24  Ian Lance Taylor  <iant@google.com>
1720
1721         * version.cc (version_string): Bump to 1.11.
1722
1723 2011-01-24  Ian Lance Taylor  <iant@google.com>
1724
1725         * plugin.cc (class Plugin_rescan): Define new class.
1726         (Plugin_manager::claim_file): Set any_claimed_.
1727         (Plugin_manager::save_archive): New function.
1728         (Plugin_manager::save_input_group): New function.
1729         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
1730         necessary.
1731         (Plugin_manager::new_undefined_symbol): New function.
1732         (Plugin_manager::rescan): New function.
1733         (Plugin_manager::rescannable_defines): New function.
1734         (Plugin_manager::add_input_file): Set any_added_.
1735         * plugin.h (class Plugin_manager): define new fields rescannable_,
1736         undefined_symbols_, any_claimed_, and any_added_.  Declare
1737         Plugin_rescan as friend.  Declare new functions.
1738         (Plugin_manager::Rescannable): Define type.
1739         (Plugin_manager::Rescannable_list): Define type.
1740         (Plugin_manager::Undefined_symbol_list): Define type.
1741         (Plugin_manager::Plugin_manager): Initialize new fields.
1742         * archive.cc (Archive::defines_symbol): New function.
1743         (Add_archive_symbols::run): Pass archive to plugins if any.
1744         * archive.h (class Archive): Declare defines_symbol.
1745         * readsyms.cc (Input_group::~Input_group): New function.
1746         (Finish_group::run): Pass input_group to plugins if any.
1747         * readsyms.h (class Input_group): Declare destructor.
1748         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
1749         any.
1750
1751 2011-01-10  Ian Lance Taylor  <iant@google.com>
1752
1753         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
1754         section as relro.
1755         (Layout::set_segment_offsets): Reset increase_relro before calling
1756         set_section_addresses a second time.
1757
1758 2011-01-04  Cary Coutant  <ccoutant@google.com>
1759
1760         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
1761         sections before NOBITS sections.
1762
1763 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
1764
1765         * version.cc (print_version): Update copyright to 2011.
1766
1767 2010-12-23  Cary Coutant  <ccoutant@google.com>
1768
1769         * output.h (Output_data_reloc::add_output_section): Pass OD instead
1770         of OS to this->add.  Add OD parameter to second form of the function.
1771
1772 2010-12-20  Ian Lance Taylor  <iant@google.com>
1773
1774         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
1775         second of two consecutive entries with same offset.
1776
1777 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
1778
1779         * testsuite/Makefile.am (ifuncmain2static_LDADD)
1780         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
1781         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
1782         to avoid unneeded links against $(LDADD).
1783         * testsuite/Makefile.in: Regenerate.
1784
1785 2010-12-15  Ian Lance Taylor  <iant@google.com>
1786
1787         PR gold/12324
1788         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
1789         for R_X86_64_32 and R_X86_64_PC32.
1790         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
1791         ver_matching_def_pic.o.
1792         (ver_matching_def_pic.o): New target.
1793
1794 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
1795
1796         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
1797         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
1798         Move definition before File_read::View member definitions.
1799         (File_read::View::~View): Initialize and hold lock before
1800         updating current_mapped_bytes.
1801
1802 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
1803
1804         * dwarf_reader.cc: Remove outdated comment.
1805         * gold-threads.cc: Fix typo in error message.
1806         * archive.cc: Fix typos in comments.
1807         * archive.h: Likewise.
1808         * arm-reloc-property.cc: Likewise.
1809         * arm-reloc-property.h: Likewise.
1810         * arm-reloc.def: Likewise.
1811         * arm.cc: Likewise.
1812         * attributes.h: Likewise.
1813         * cref.cc: Likewise.
1814         * ehframe.cc: Likewise.
1815         * fileread.h: Likewise.
1816         * gold.h: Likewise.
1817         * i386.cc: Likewise.
1818         * icf.cc: Likewise.
1819         * incremental.h: Likewise.
1820         * int_encoding.cc: Likewise.
1821         * layout.h: Likewise.
1822         * main.cc: Likewise.
1823         * merge.h: Likewise.
1824         * object.cc: Likewise.
1825         * object.h: Likewise.
1826         * options.cc: Likewise.
1827         * readsyms.cc: Likewise.
1828         * reduced_debug_output.cc: Likewise.
1829         * reloc.cc: Likewise.
1830         * script-sections.cc: Likewise.
1831         * sparc.cc: Likewise.
1832         * symtab.h: Likewise.
1833         * target-reloc.h: Likewise.
1834         * target.cc: Likewise.
1835         * target.h: Likewise.
1836         * timer.cc: Likewise.
1837         * timer.h: Likewise.
1838         * x86_64.cc: Likewise.
1839
1840 2010-12-09  Cary Coutant  <ccoutant@google.com>
1841
1842         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
1843         stack.
1844         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
1845         parameter; change all callers.
1846         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
1847         * options.h (warn_execstack): New option.
1848
1849 2010-12-07  Doug Kwan  <dougkwan@google.com>
1850
1851         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
1852         like function call relocations.
1853
1854 2010-12-07  Ian Lance Taylor  <iant@google.com>
1855
1856         * archive.cc (Archive::get_elf_object_for_member): Permit
1857         punconfigured to be NULL.
1858         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
1859         (Archive::include_member): Pass NULL to get_elf_object_for_member
1860         if we searched for the archive and this is the first included
1861         object.
1862
1863 2010-12-01  Ian Lance Taylor  <iant@google.com>
1864
1865         * dwarf_reader.h (class Sized_dwarf_line_info): Add
1866         track_relocs_type_ field.
1867         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1868         Set track_relocs_type_.
1869         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
1870         contents when using RELA relocs.
1871         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
1872         reloc_map_.
1873         * reloc.cc (Track_relocs::next_addend): New function.
1874         * reloc.h (class Track_relocs): Declare next_addend.
1875
1876 2010-12-01  Ian Lance Taylor  <iant@google.com>
1877
1878         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
1879         virtual destructor.
1880
1881 2010-12-01  Ian Lance Taylor  <iant@google.com>
1882
1883         * README: Update compilers known to work and fail.
1884
1885 2010-11-23  Matthias Klose  <doko@ubuntu.com>
1886
1887         * configure.in: For --enable-gold, handle value `default' instead of
1888         `both*'.  Always install ld as ld.bfd, install as ld if gold is
1889         not the default.
1890         * configure: Regenerate.
1891
1892 2010-11-18  Doug Kwan  <dougkwan@google.com>
1893
1894         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
1895         and right_alignment to be zero.  Store result alignment only if it is
1896         greater than existing alignment.
1897
1898 2010-11-16  Cary Coutant  <ccoutant@google.com>
1899
1900         PR gold/12220
1901         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1902         Check for ".zdebug_line".
1903
1904 2010-11-16  Doug Kwan  <dougkwan@google.com>
1905             Cary Coutant  <ccoutant@google.com>
1906
1907         * output.h (Output_segment::set_section_addresses): Pass increase_relro
1908         by reference; adjust all callers.
1909         * output.cc (Output_segment::set_section_addresses): Adjust references
1910         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
1911         list is empty.
1912         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
1913         end at page boundary.
1914
1915 2010-11-16  Cary Coutant  <ccoutant@google.com>
1916
1917         PR gold/12220
1918         * layout.cc (Layout::choose_output_section): Transform names of
1919         compressed sections even when using a script with a SECTIONS clause.
1920         (Layout::output_section_name): Remove code to transform
1921         compressed debug section names.
1922         * output.cc (Output_section::add_input_section): Use uncompressed
1923         section size when tracking input sections.
1924
1925 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
1926
1927         * symtab.h (Symbol::NON_PIC_REF): Remove.
1928         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
1929         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
1930         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
1931         (Symbol::use_plt_offset): Take a flags argument and pass it
1932         directly to needs_dynamic_reloc.  Restrict check for undefined
1933         weak symbols to function calls.
1934         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
1935         (Target_arm::Scan::global): Use it.
1936         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
1937         (Target_arm::Relocate::relocate): Likewise.
1938         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
1939         parameter with an r_type parameter.  Use get_reference_flags
1940         to get the flags.
1941         (Target_arm::Relocate::relocate): Update accordingly.
1942         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
1943         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
1944         (Target_i386::Scan::global): Likewise.
1945         (Target_i386::Relocate::relocate): Likewise.
1946         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
1947         parameter with an r_type parameter.  Use get_reference_flags
1948         to get the flags.
1949         (Target_i386::Relocate::relocate): Update accordingly.
1950         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
1951         (Target_powerpc::Scan::global): Use it.
1952         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
1953         (Target_powerpc::Relocate::relocate): Likewise.
1954         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
1955         (Target_sparc::Scan::global): Use it.
1956         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
1957         (Target_sparc::Relocate::relocate): Likewise.
1958         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
1959         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
1960         (Target_x86_64::Scan::global): Likewise.
1961         (Target_x86_64::Relocate::relocate): Likewise.
1962
1963 2010-11-08  Doug Kwan  <dougkwan@google.com>
1964             Cary Coutant  <ccoutant@google.com>
1965
1966         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
1967         (Arm_exidx_merge_section::section_contents_): New data member.
1968         (Arm_input_section::Arm_input_section): Initialize original_contents_.
1969         (Arm_input_section::~Arm_input_section): De-allocate memory.
1970         (Arm_input_section::original_contents_): New data member.       
1971         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
1972         in parameters instead of calling Object::section_contents without
1973         locking.
1974         (Arm_output_section::group_section): New parameter TASK.  Pass it
1975         to callees that need locking objects.
1976         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
1977         to lock EXIDX input sections.  Fix a formatting issue.  Call
1978         Arm_exidx_merged_section::build_contents to create merged section
1979         contents.
1980         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
1981         to lock object of stub table owner.
1982         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
1983         TEXT_SIZE to initialize data member TEXT_SIZE_.
1984         (Arm_exidx_input_section::addralign): Fix typo in comment.
1985         (Arm_exidx_input_section::text_size): New method.
1986         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
1987         that require locking objects.  Lock objects before scanning for stubs
1988         and updating local symbols.
1989         (Arm_input_section<big_endian>::init): Copy contents of original
1990         input section.
1991         (Arm_input_section<big_endian>::do_write): Use saved contents of
1992         original input section instead of calling Object::section_contents
1993         without locking.
1994         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
1995         size without calling Object::section_size().
1996         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
1997         for size.  Allocate a buffer for merged EXIDX entries.
1998         (Arm_exidx_merged_section::build_contents): New method.
1999         (Arm_exidx_merged_section::do_write): Move merge section contents
2000         building code to Arm_exidx_merged_section::build_contetns.  Write
2001         out contetns in buffer instead of building it on the fly.
2002         (Arm_relobj::make_exidx_input_section): Also pass text section size
2003         to Arm_exidx_input_section constructor.
2004         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
2005         (Arm_dynobj::do_read_symbols): Fix memory leak.
2006         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
2007         * target.h: (class Task): Add forward declaration.
2008         (Target::relax): Add new parameter TASK and pass it to
2009         Target::do_relax().
2010         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
2011
2012 2010-11-05  Cary Coutant  <ccoutant@google.com>
2013
2014         PR gold/10708
2015         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
2016         object when reading from the file.
2017         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
2018         second layout pass.
2019         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
2020         when reading section contents.
2021         (get_section_contents): Likewise.
2022         (icf::find_identical_sections): Likewise.
2023         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
2024         object when reading from the file.
2025         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
2026         the object when doing deferred section layout.
2027
2028 2010-11-03  Nick Clifton  <nickc@redhat.com>
2029
2030         PR gold/12001
2031         * script.h (class Symbol_assignment: name): New member.  Returns
2032         the name of the symbol.
2033         * scrfipt.cc (Script_options::is_pending_assignment): New member.
2034         Returns true if the given symbol name is on the list of
2035         assignments wating to be processed.
2036         * archive.cc (should_incldue_member): If the symbol is undefined,
2037         check to see if it is on the list of symbols pending assignment.
2038
2039 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
2040
2041         * script-sections.cc (Script_sections::find_memory_region): Check
2042         for a NULL output section pointer.
2043
2044 2010-10-29  Doug Kwan  <dougkwan@google.com>
2045
2046         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
2047         Output_section::add_relaxed_input_section.
2048         * output.cc (Output_section::add_relaxed_input_section): Add new
2049         arguments LAYOUT and NAME.  Set section order index.
2050         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
2051         Copy section order index.
2052         * output.h (Output_section::add_relaxed_input_section): Add new
2053         arguments LAYOUT and NAME.
2054
2055 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2056
2057         * testsuite/Makefile.am: Move gcctestdir/ld rule to
2058         NATIVE_OR_CROSS_LINKER.
2059         * testsuite/Makefile.in: Regenerate.
2060
2061 2010-10-20  Doug Kwan  <dougkwan@google.com>
2062
2063         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
2064         without SHF_LINK_ORDER flags.
2065         * layout.cc (Layout::choose_output_section): Do not filter
2066         SHF_LINK_ORDER flag in a relocatable link.
2067
2068 2010-10-17  Cary Coutant  <ccoutant@google.com>
2069
2070         * output.h (Output_segment::set_section_addresses): Change function
2071         signature.  Update all callers.
2072         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
2073         sections.
2074         (Output_segment::set_section_addresses): Align after last TLS
2075         section.  Add padding before last relro section instead of after.
2076
2077 2010-10-17  Doug Kwan  <dougkwan@google.com>
2078
2079         * gold/arm.cc (Target_arm::got_section): Use correct order and set
2080         GOT output section to be writable.
2081
2082 2010-10-14  Cary Coutant  <ccoutant@google.com>
2083
2084         * debug.h (DEBUG_INCREMENTAL): New flag.
2085         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
2086         * gold.cc (queue_initial_tasks): Check parameters for incremental link
2087         mode.
2088         * incremental.cc (report_command_line): Ignore all forms of
2089         --incremental.
2090         * layout.cc (Layout::Layout): Check parameters for incremental link
2091         mode.
2092         * options.cc (General_options::parse_incremental): New function.
2093         (General_options::parse_no_incremental): New function.
2094         (General_options::parse_incremental_full): New function.
2095         (General_options::parse_incremental_update): New function.
2096         (General_options::incremental_mode_): New data member.
2097         (General_options::finalize): Check incremental_mode_.
2098         * options.h (General_options): Update help text for --incremental.
2099         Add --no-incremental, --incremental-full, --incremental-update.
2100         (General_options::Incremental_mode): New enum type.
2101         (General_options::incremental_mode): New function.
2102         (General_options::incremental_mode_): New data member.
2103         * parameters.cc (Parameters::incremental_mode_): New data member.
2104         (Parameters::set_options): Set incremental_mode_.
2105         (Parameters::set_incremental_full): New function.
2106         (Parameters::incremental): New function.
2107         (Parameters::incremental_update): New function.
2108         (set_parameters_incremental_full): New function.
2109         * parameters.h (Parameters::set_incremental_full): New function.
2110         (Parameters::incremental): New function.
2111         (Parameters::incremental_update): New function.
2112         (Parameters::incremental_mode_): New data member.
2113         (set_parameters_incremental_full): New function.
2114         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
2115         incremental link mode.
2116         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
2117         (Sized_relobj::do_relocate_sections): Likewise.
2118         * testsuite/Makefile.am (incremental_test): Use --incremental-full
2119         option.
2120         * testsuite/Makefile.in: Regenerate.
2121         * testsuite/incremental_test.sh: Filter all forms of --incremental.
2122
2123 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2124
2125         * script-sections.h (class Script_sections): Make
2126         Sections_elements typedef public.
2127         * script-sections.cc (class Sort_output_sections): Add elements_
2128         field.  Add constructor which sets it; change all callers.
2129         (Sort_output_sections::is_before): New function.
2130         (Sort_output_sections::operator()): Call is_before.
2131         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
2132         conditional.
2133         * testsuite/script_test_10.sh: New test. Test script section
2134         order.
2135         * testsuite/script_test_10.t: Likewise.
2136         * testsuite/script_test_10.s: Likewise.
2137         * testsuite/Makefile.am: Wrap the cross linker tests and the
2138         common tests into NATIVE_OR_CROSS_LINKER.
2139         (check_SCRIPTS): Add script_test_10.sh.
2140         (check_DATA): Add script_test_10.stdout.
2141         (script_test_10.o, script_test_10): New targets.
2142         (script_test_10.stdout): New target.
2143         * configure, testsuite/Makefile.in: Regenerate.
2144
2145 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2146
2147         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
2148         error for the deprecated relocations.
2149         (Target_arm::Scan::global): Likewise.
2150         (Target_arm::Relocate::relocate): Likewise.
2151
2152 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
2153
2154         * fileread.cc (Input_file::find_file): Initialize *found_name
2155         and *namep when using the fallback search for case 4.
2156
2157 2010-10-11  Cary Coutant  <ccoutant@google.com>
2158
2159         * options.h (class General_options): Redefine -z lazy as an alias for
2160         the negation of -z now.
2161
2162 2010-10-11  Ian Lance Taylor  <iant@google.com>
2163
2164         * resolve.cc (symbol_to_bits): Report the value of the unsupported
2165         binding.
2166
2167 2010-10-06  Nick Clifton  <nickc@redhat.com>
2168
2169         * script-sections.cc(class Memory_region): Remove
2170         current_lma_offset_ field.  Rename current_vma_offset_ to
2171         current_offset_.  Add last_section_ field.
2172         (Memory_region::get_current_vma_address): Rename to
2173         get_current_address.
2174         (Memory_region::get_current_lma_address): Delete.
2175         (Memory_region::increment_vma_offset): Rename to
2176         increment_offset.
2177         (Memory_region::increment_lma_offset): Delete.
2178         (Memory_region::attributes_compatible): New method.  Returns
2179         true if the provided section is compatible with the region.
2180         (Memory_region::get_last_section): New method.  Returns the last
2181         section to use the region.
2182         (Memory_region::set_last_section): New method.  Stores the last
2183         section to use the region.
2184         (Script_sections::block_in_region): New method.  Returns true if
2185         a block of memory is contained within a region.
2186         (Script_sections::find_memory_region): New method.  Locates a
2187         memory region to be used to set a VMA or LMA address.
2188         (Output_section_definition::set_section_addresses): Add code to
2189         check for addresses set by memory regions.
2190         (Output_segment::set_section_addresses): Remove memory region
2191         walking code.
2192         (Script_sections::create_segment): Add a warning if a header
2193         segment is created outside of any region.
2194         * script-sections.h (class Script_sections): Add prototypes for
2195         find_memory_region and block_in_region methods.
2196         * testsuite/memory_test.s: Use .long instead of .word.
2197         * testsuite/memory_test.t: Add some more output sections.
2198         * testsuite/memory_test.sh: Update expected output.
2199
2200 2010-10-02  Doug Kwan  <dougkwan@google.com>
2201
2202         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
2203         defintion to symtab.h
2204         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
2205         declaration to defintion.
2206
2207 2010-10-01  Nick Clifton  <nickc@redhat.com>
2208
2209         * expression.cc (eval): Replace dummy argument with NULL.
2210         (eval_maybe_dot): Check for a NULL result section pointer.
2211         (Symbol_expression::value): Likewise.
2212         (Dot_expression::value): Likewise.
2213         (BINARY_EXPRESSION): Likewise.
2214         (Max_expression::value): Likewise.
2215         (Min_expression::value): Likewise.
2216         (Absolute_expression::value): Likewise.
2217         (Addr_expression::value_from_output_section): Likewise.
2218         (Loaddddr_expression::value_from_output_section): Likewise.
2219         (Segment_start_expression::value): Likewise.
2220         * script-sections.cc
2221         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
2222         argument with NULL.
2223         (Sections_elememt_dot_assignment::set_section_addresses):
2224         Likewise.
2225         (Output_data_expression::do_write_to_buffer): Likewise.
2226         (Output_section_definition::finalize_symbols): Likewise.
2227         (Output_section_definition::set_section_addresses): Likewise.
2228
2229 2010-09-30  Doug Kwan  <dougkwan@google.com>
2230
2231         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
2232
2233 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
2234
2235         * target.h (Target::can_icf_inline_merge_sections): New virtual
2236         function.
2237         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
2238         virtual function.
2239         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
2240         virtual function.
2241         * icf.cc (get_section_contents): Inline merge sections only when
2242         target allows it.
2243
2244 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2245
2246         * configure: Regenerate.
2247
2248 2010-09-17  Ian Lance Taylor  <iant@google.com>
2249
2250         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
2251         * testsuite/Makefile.am (memory_test.o): New target.
2252         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
2253         memory_test.t.
2254         * testsuite/Makefile.in: Rebuild.
2255
2256 2010-09-17  Doug Kwan  <dougkwan@google.com>
2257
2258         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
2259         defintion if relocation uses GOT entries of the symbol.
2260         * testsuite/icf_safe_test.sh: Fix test.
2261         * testsuite/icf_safe_so_test.sh: Fix test.
2262
2263 2010-09-16  Cary Coutant  <ccoutant@google.com>
2264
2265         * script_sections.cc (class Memory_region): Remove "NULL" from
2266         vector initializations.
2267
2268 2010-09-15  Cary Coutant  <ccoutant@google.com>
2269
2270         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
2271         Resolve forwarding symbols.
2272
2273 2010-09-15  Doug Kwan  <dougkwan@google.com>
2274
2275         * gold/testsuite/script_test_3.t: Add ARM special sections.
2276         * gold/testsuite/script_test_4.t: Same.
2277         * gold/testsuite/script_test_5.t: Same.
2278         * gold/testsuite/script_test_6.t: Same.
2279         * gold/testsuite/script_test_7.t: Same.
2280         * gold/testsuite/script_test_7.t: Same.
2281         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
2282
2283 2010-09-14  Cary Coutant  <ccoutant@google.com>
2284
2285         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
2286         (Target_x86_64::Relocate::relocate_tls): Replace check for
2287         saw_tls_block_reloc_ with test for executable section.
2288
2289 2010-09-12  Cary Coutant  <ccoutant@google.com>
2290
2291         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
2292         position-independent executables to shared libraries need dynamic
2293         relocations.
2294         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
2295         position-independent executables.
2296         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
2297         * testsuite/Makefile.in: Regenerate.
2298
2299 2010-09-10  Nick Clifton  <nickc@redhat.com>
2300
2301         PR gold/11997
2302         * testsuite/memory_test.t: Discard any sections that are not
2303         needed.
2304
2305 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
2306
2307         PR gold/11996
2308         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
2309         "This::" to work around a bug in gcc 4.2.
2310
2311         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
2312
2313 2010-09-09  Rafael Espindola  <espindola@google.com>
2314
2315         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
2316         sections with different PF_X flags in the same segment.
2317         (Layout::find_first_load_seg): Search all segments to find the first
2318         one.
2319         * options.h (rosegment): New.
2320
2321 2010-09-08  Rafael Espindola  <espindola@google.com>
2322
2323         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
2324
2325 2010-09-08  Doug Kwan  <dougkwan@google.com>
2326
2327         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
2328         (Arm_relobj::do_relocate_sections): Add new parameter for output
2329         file to match the parent.
2330         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
2331         of local symbols instead of input values.  Update code to track
2332         changes in gold::relocate_section.
2333         * object.cc (Sized_relobj::compute_final_local_value): New methods.
2334         (Sized_relobj::compute_final_local_value_internal): New methods.
2335         (Sized_relobj::do_finalize_local_symbols): Move code from loop
2336         body into private version of Sized_relobj::compute_final_local_value.
2337         Call the inline method.
2338         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
2339         merged symbol value if there is one.
2340         (Symbol_value::has_output_value): New method defintiion.
2341         (Sized_relobj::Compute_final_local_value_status): New enum type.
2342         (Sized_relobj::compute_final_local_value): New methods.
2343         (Sized_relobj::compute_final_local_value_internal): New methods.
2344         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
2345         and arm_cortex_a8.sh.
2346         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
2347         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
2348         New tests.
2349         * Makefile.in: Regenerate.
2350         * testsuite/arm_bl_out_of_range.s: Update test.
2351         * testsuite/thumb_bl_out_of_range.s: Ditto.
2352         * testsuite/thumb_blx_out_of_range.s: Ditto.
2353         * testsuite/arm_branch_out_of_range.sh: New file.
2354         * testsuite/arm_cortex_a8.sh: Ditto.
2355         * testsuite/arm_cortex_a8_b.s: Ditto.
2356         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
2357         * testsuite/arm_cortex_a8_b_local.s: Ditto.
2358         * testsuite/arm_cortex_a8_bl.s: Ditto.
2359         * testsuite/arm_cortex_a8_blx.s: Ditto.
2360         * testsuite/arm_cortex_a8_local.s: Ditto.
2361         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
2362         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
2363
2364 2010-09-08  Rafael Espindola  <espindola@google.com>
2365
2366         * Makefile.am (memory_test.stdout): Run readelf with -W.
2367         * Makefile.in: Regenerate.
2368         * testsuite/memory_test.sh: Make the regexps accept both 32 and
2369         64 bit output.
2370
2371 2010-09-08  Rafael Espindola  <espindola@google.com>
2372
2373         * script-sections.cc (Script_sections::add_memory_region): Convert
2374         field precision to int.
2375         * script.cc (script_set_section_region, script_set_section_region):
2376         Convert field precision to int.
2377
2378 2010-09-08  Rafael Espindola  <espindola@google.com>
2379
2380         * arm.cc (do_finalize_sections): Create the __exidx_start and
2381         __exdix_end symbols even when the section is missing.
2382
2383 2010-09-08  Nick Clifton  <nickc@redhat.com>
2384
2385         * README: Remove claim that MEMORY is not supported.
2386         * expression.cc (script_exp_function_origin)
2387         (script_exp_function_length): Move from here to ...
2388         * script.cc: ... here.
2389         (script_set_section_region, script_add_memory)
2390         (script_parse_memory_attr, script_include_directive): New
2391         functions.
2392         * script-sections.cc
2393         (class Memory_region): New class.
2394         (class Output_section_definition): Add set_memory_region,
2395         set_section_vma, set_section_lma and get_section_name methods.
2396         (class Script_Sections): Add add_memory_region,
2397         find_memory_region, find_memory_region_origin,
2398         find_memory_region_length and set_memory_region methods.
2399         Have set_section_addresses method walk the list of set memory
2400         regions.
2401         Extend the print methos to display memory regions.
2402         * script-sections.h: Add prototypes for new methods.
2403         Add enum for MEMORY region attributes.
2404         * yyscript.y: Add support for parsing MEMORY regions.
2405         * script-c.h: Add prototypes for new functions.
2406         * testsuite/Makefile.am: Add test of MEMORY region functionality.
2407         * testsuite/Makefile.in: Regenerate.
2408         * testsuite/memory_test.sh: New script.
2409         * testsuite/memory_test.s: New assembler source file.
2410         * testsuite/memory_test.t: New linker script.
2411
2412 2010-08-27  Doug Kwan  <dougkwan@google.com>
2413
2414         * gold/resolve.cc (Symbol_table::should_override): Let a weak
2415         reference override an existing dynamic weak reference.
2416         * testsuite/Makefile.am: Add new test dyn_weak_ref.
2417         * testsuite/Makefile.in: Regenerate.
2418         * testsuite/dyn_weak_ref.sh: New file.
2419         * testsuite/dyn_weak_ref_1.c: Ditto.
2420         * testsuite/dyn_weak_ref_2.c: Ditto.
2421
2422 2010-08-27  Ian Lance Taylor  <iant@google.com>
2423
2424         * incremental.h (class Incremental_input_entry): Add virtual
2425         destructor.
2426
2427 2010-08-27  Ian Lance Taylor  <iant@google.com>
2428
2429         * testsuite/start_lib_test_3.c: Mark t3 as used.
2430
2431 2010-08-27  Nick Clifton  <nickc@redhat.com>
2432
2433         * options.cc (version_script): Fix small typo in previous
2434         whitespace tidyup.
2435
2436 2010-08-25  Nick Clifton  <nickc@redhat.com>
2437
2438         * archive.cc: Formatting fixes: Remove whitespace between
2439         typename and following asterisk.  Remove whitespace between
2440         function name and opening parenthesis.
2441         * archive.h: Likewise.
2442         * arm.cc: Likewise.
2443         * attributes.cc: Likewise.
2444         * attributes.h: Likewise.
2445         * common.cc: Likewise.
2446         * copy-relocs.cc: Likewise.
2447         * dirsearch.h: Likewise.
2448         * dynobj.cc: Likewise.
2449         * ehframe.cc: Likewise.
2450         * ehframe.h: Likewise.
2451         * expression.cc: Likewise.
2452         * fileread.cc: Likewise.
2453         * fileread.h: Likewise.
2454         * gc.h: Likewise.
2455         * gold-threads.cc: Likewise.
2456         * gold.cc: Likewise.
2457         * i386.cc: Likewise.
2458         * icf.h: Likewise.
2459         * incremental-dump.cc: Likewise.
2460         * incremental.cc: Likewise.
2461         * layout.cc: Likewise.
2462         * layout.h: Likewise.
2463         * main.cc: Likewise.
2464         * merge.cc: Likewise.
2465         * merge.h: Likewise.
2466         * object.cc: Likewise.
2467         * object.h: Likewise.
2468         * options.cc: Likewise.
2469         * options.h: Likewise.
2470         * output.cc: Likewise.
2471         * output.h: Likewise.
2472         * plugin.cc: Likewise.
2473         * plugin.h: Likewise.
2474         * powerpc.cc: Likewise.
2475         * reloc.cc: Likewise.
2476         * script-c.h: Likewise.
2477         * script-sections.cc: Likewise.
2478         * script.cc: Likewise.
2479         * stringpool.cc: Likewise.
2480         * symtab.cc: Likewise.
2481         * symtab.h: Likewise.
2482         * target.cc: Likewise.
2483         * timer.cc: Likewise.
2484         * timer.h: Likewise.
2485         * version.cc: Likewise.
2486         * x86_64.cc: Likewise.
2487
2488 2010-08-24  Nick Clifton  <nickc@redhat.com>
2489
2490         PR 11899
2491         * layout.cc (segment_precedes): Sort segments by their physical
2492         addresses, if they have been set.
2493
2494 2010-08-23  Cary Coutant  <ccoutant@google.com>
2495
2496         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
2497         symbols data.
2498         (Lib_group::include_member): Unlock object after deleting its
2499         symbols data.
2500         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
2501         the bug fixed here.
2502
2503 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
2504             Cary Coutant  <ccoutant@google.com>
2505
2506         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
2507         constructor, and set_blocker.
2508         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
2509         readsyms_blocker_.
2510         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
2511         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
2512         * testsuite/Makefile.am (start_lib_test): New test case.
2513         * testsuite/Makefile.in: Regenerate.
2514         * testsuite/start_lib_test_main.c: New file.
2515         * testsuite/start_lib_test_1.c: New file.
2516         * testsuite/start_lib_test_2.c: New file.
2517         * testsuite/start_lib_test_3.c: New file.
2518
2519 2010-08-19  Ian Lance Taylor  <iant@google.com>
2520
2521         * Makefile.in: Rebuild with automake 1.11.1.
2522         * aclocal.m4: Likewise.
2523         * testsuite/Makefile.in: Likewise.
2524
2525 2010-08-19  Ian Lance Taylor  <iant@google.com>
2526
2527         PR 10893
2528         * i386.cc (class Output_data_plt_i386): Update declarations.
2529         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
2530         local_ifuncs_ fields.
2531         (Target_i386::do_plt_section_for_global): New function.
2532         (Target_i386::do_plt_section_for_local): New function.
2533         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
2534         parameter; change all callers.  Initialize global_ifuncs_ and
2535         local_ifuncs_.  If doing a static link define __rel_iplt_start and
2536         __rel_iplt_end.
2537         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
2538         (Output_data_plt_i386::add_local_ifunc_entry): New function.
2539         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
2540         symbols.
2541         (Target_i386::make_plt_section): New function, broken out of
2542         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
2543         (Target_i386::make_plt_entry): Call make_plt_section.
2544         (Target_i386::make_local_ifunc_plt_entry): New function.
2545         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
2546         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
2547         R_386_IRELATIVE to switch.
2548         (Target_i386::Scan::global): Likewise.
2549         (Target_i386::Relocate::relocate): Likewise.
2550         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
2551         switch.
2552         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
2553         (Target_x86_64::do_plt_section_for_global): New function.
2554         (Target_x86_64::do_plt_section_for_local): New function.
2555         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
2556         parameter; change all callers.  If doing a static link define
2557         __rela_iplt_start and __rela_iplt_end.
2558         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
2559         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
2560         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
2561         to point to .plt.
2562         (Target_x86_64::make_local_ifunc_plt_entry): New function.
2563         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
2564         switch.
2565         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
2566         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
2567         R_X86_64_IRELATIVE to switch.
2568         (Target_x86_64::Scan::global): Likewise.
2569         (Target_x86_64::Relocate::relocate): Likewise.
2570         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
2571         switch.
2572         * target.h (class Target): Add plt_section_for_global and
2573         plt_section_for_local functions.  Add do_plt_section_for_global
2574         and do_plt_section_for_local virtual functions.
2575         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
2576         clarifying comments.
2577         (Symbol::use_plt_offset): Handle IFUNC symbol.
2578         * object.cc (Sized_relobj::Sized_relobj): Initialize
2579         local_plt_offsets_.
2580         (Sized_relobj::local_has_plt_offset): New function.
2581         (Sized_relobj::local_plt_offset): New function.
2582         (Sized_relobj::set_local_plt_offset): New function.
2583         (Sized_relobj::do_count): Handle IFUNC symbol.
2584         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
2585         a bit away from input_shndx_ field.  Add set_is_func_symbol and
2586         is_ifunc_symbol functions.
2587         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
2588         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
2589         local_plt_offsets_ field.
2590         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
2591         * output.h (class Output_section_data): Add non-const
2592         output_section function.
2593         (class Output_data_got): Update declarations.
2594         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
2595         Add use_plt_offset parameter to global and local constructors.
2596         Change all callers.  Change local_sym_index_ field to 31 bits.
2597         Change GSYM_CODE and CONSTANT_CODE accordingly.
2598         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
2599         doing a static link don't set sh_link field.
2600         (Output_data_got::Got_entry::write): Use PLT offset if
2601         appropriate.
2602         (Output_data_got::add_global_plt): New function.
2603         (Output_data_got::add_local_plt): New function.
2604         * target-reloc.h (relocate_section): Handle IFUNC symbol.
2605         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
2606         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
2607         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
2608         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
2609         IFUNC conditional.
2610         * testsuite/ifunc-sel.h: New file.
2611         * testsuite/ifuncmain1.c: New file.
2612         * testsuite/ifuncmain1vis.c: New file.
2613         * testsuite/ifuncmod1.c: New file.
2614         * testsuite/ifuncdep2.c: New file.
2615         * testsuite/ifuncmain2.c: New file.
2616         * testsuite/ifuncmain3.c: New file.
2617         * testsuite/ifuncmod3.c: New file.
2618         * testsuite/ifuncmain4.c: New file.
2619         * testsuite/ifuncmain5.c: New file.
2620         * testsuite/ifuncmod5.c: New file.
2621         * testsuite/ifuncmain6pie.c: New file.
2622         * testsuite/ifuncmod6.c: New file.
2623         * testsuite/ifuncmain7.c: New file.
2624         * configure, testsuite/Makefile.in: Rebuild.
2625
2626 2010-08-18  Ian Lance Taylor  <iant@google.com>
2627
2628         * incremental.cc
2629         (Output_section_incremental_inputs::write_input_files): Add cast
2630         to avoid signed/unsigned comparison warning.
2631         (Output_section_incremental_inputs::write_info_blocks): Likewise.
2632
2633 2010-08-12  Cary Coutant  <ccoutant@google.com>
2634
2635         * common.cc (Sort_commons::operator()): Remove unnecessary code.
2636
2637 2010-08-13  Ian Lance Taylor  <iant@google.com>
2638
2639         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
2640
2641 2010-08-12  Cary Coutant  <ccoutant@google.com>
2642             Doug Kwan  <dougkwan@google.com>
2643
2644         * resolve.cc (Symbol_table::should_override): When a weak dynamic
2645         defintion overrides non-weak undef, remember that the original undef
2646         is not weak.
2647         * symtab.cc (Symbol_table::sized_write_global): For undef without
2648         an original weak binding, set binding to global in output.
2649         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
2650         * testsuite/Makefile.in: Regenerate.
2651         * testsuite/strong_ref_weak_def.sh: New file.
2652         * testsuite/strong_ref_weak_def_1.c: Ditto.
2653         * testsuite/strong_ref_weak_def_2.c: Ditto.
2654
2655 2010-08-12  Cary Coutant  <ccoutant@google.com>
2656
2657         * testsuite/incremental_test.sh: Rewrite.
2658         * testsuite/incremental_test_1.c: Rewrite.
2659         * testsuite/incremental_test_2.c: Rewrite.
2660
2661 2010-08-12  Cary Coutant  <ccoutant@google.com>
2662
2663         * arm.cc (Target_arm::got_size): Add const.
2664         (Target_arm::got_entry_count): New function.
2665         (Target_arm::plt_entry_count): New function.
2666         (Target_arm::first_plt_entry_offset): New function.
2667         (Target_arm::plt_entry_size): New function.
2668         (Output_data_plt_arm::entry_count): New function.
2669         (Output_data_plt_arm::first_plt_entry_offset): New function.
2670         (Output_data_plt_arm::get_plt_entry_size): New function.
2671         * i386.cc (Target_i386::got_size): Add const.
2672         (Target_i386::got_entry_count): New function.
2673         (Target_i386::plt_entry_count): New function.
2674         (Target_i386::first_plt_entry_offset): New function.
2675         (Target_i386::plt_entry_size): New function.
2676         (Output_data_plt_i386::entry_count): New function.
2677         (Output_data_plt_i386::first_plt_entry_offset): New function.
2678         (Output_data_plt_i386::get_plt_entry_size): New function.
2679         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
2680         find_incremental_inputs_sections.  Dump incremental_got_plt section.
2681         * incremental.cc: Include target.h.
2682         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
2683         parameter.  Adjust all callers.  Find incremental_got_plt section.
2684         (Incremental_inputs::create_data_sections): Create incremental_got_plt
2685         section.
2686         (Output_section_incremental_inputs::set_final_data_size): Calculate
2687         size of incremental_got_plt section.
2688         (Output_section_incremental_inputs::do_write): Write the
2689         incremental_got_plt section.
2690         (Got_plt_view_info): New struct.
2691         (Local_got_offset_visitor): New class.
2692         (Global_got_offset_visitor): New class.
2693         (Global_symbol_visitor_got_plt): New class.
2694         (Output_section_incremental_inputs::write_got_plt): New function.
2695         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
2696         Add parameter.  Adjust all callers.
2697         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2698         (Incremental_inputs::got_plt_section): New function.
2699         (Incremental_inputs::got_plt_section_): New data member.
2700         (Incremental_got_plt_reader): New class.
2701         * layout.cc (Layout::create_incremental_info_sections): Add the
2702         incremental_got_plt section.
2703         * object.h (Got_offset_list::get_list): New function.
2704         (Got offset_list::for_all_got_offsets): New function.
2705         (Sized_relobj::local_got_offset_list): New function.
2706         * powerpc.cc (Target_powerpc::got_size): Add const.
2707         (Target_powerpc::got_entry_count): New function.
2708         (Target_powerpc::plt_entry_count): New function.
2709         (Target_powerpc::first_plt_entry_offset): New function.
2710         (Target_powerpc::plt_entry_size): New function.
2711         (Output_data_plt_powerpc::entry_count): New function.
2712         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
2713         (Output_data_plt_powerpc::get_plt_entry_size): New function.
2714         * sparc.cc (Target_sparc::got_size): Add const.
2715         (Target_sparc::got_entry_count): New function.
2716         (Target_sparc::plt_entry_count): New function.
2717         (Target_sparc::first_plt_entry_offset): New function.
2718         (Target_sparc::plt_entry_size): New function.
2719         (Output_data_plt_sparc::entry_count): New function.
2720         (Output_data_plt_sparc::first_plt_entry_offset): New function.
2721         (Output_data_plt_sparc::get_plt_entry_size): New function.
2722         * symtab.h (Symbol::got_offset_list): New function.
2723         (Symbol_table::for_all_symbols): New function.
2724         * target.h (Sized_target::got_entry_count): New function.
2725         (Sized_target::plt_entry_count): New function.
2726         (Sized_target::plt_entry_size): New function.
2727         * x86_64.cc (Target_x86_64::got_size): Add const.
2728         (Target_x86_64::got_entry_count): New function.
2729         (Target_x86_64::plt_entry_count): New function.
2730         (Target_x86_64::first_plt_entry_offset): New function.
2731         (Target_x86_64::plt_entry_size): New function.
2732         (Output_data_plt_x86_64::entry_count): New function.
2733         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
2734         (Output_data_plt_x86_64::get_plt_entry_size): New function.
2735
2736 2010-08-12  Cary Coutant  <ccoutant@google.com>
2737
2738         * archive.cc: Include incremental.h.
2739         (Archive::Archive): Initialize incremental_info_.
2740         (Archive::include_member): Record archive members in incremental info.
2741         (Add_archive_symbols::run): Record begin and end of an archive in
2742         incremental info.
2743         (Lib_group::include_member): Record objects in incremental info.
2744         * archive.h (Incremental_archive_entry): Forward declaration.
2745         (Archive::set_incremental_info): New member function.
2746         (Archive::incremental_info): New member function.
2747         (Archive::Unused_symbol_iterator): New class.
2748         (Archive::unused_symbols_begin): New member function.
2749         (Archive::unused_symbols_end): New member function.
2750         (Archive::incremental_info_): New data member.
2751         * incremental-dump.cc (find_input_containing_global): New function.
2752         (dump_incremental_inputs): Dump new incremental info sections.
2753         * incremental.cc: Include symtab.h.
2754         (Output_section_incremental_inputs): New class.
2755         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
2756         new incremental info sections.
2757         (Sized_incremental_binary::do_check_inputs): Likewise.
2758         (Incremental_inputs::report_archive): Remove.
2759         (Incremental_inputs::report_archive_begin): New function.
2760         (Incremental_inputs::report_archive_end): New function.
2761         (Incremental_inputs::report_object): New function.
2762         (Incremental_inputs::finalize_inputs): Remove.
2763         (Incremental_inputs::report_input_section): New function.
2764         (Incremental_inputs::report_script): Rewrite.
2765         (Incremental_inputs::finalize): Do nothing but finalize string table.
2766         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2767         (Incremental_inputs::sized_create_inputs_section_data): Remove.
2768         (Incremental_inputs::create_data_sections): New function.
2769         (Incremental_inputs::relocs_entsize): New function.
2770         (Output_section_incremental_inputs::set_final_data_size): New function.
2771         (Output_section_incremental_inputs::do_write): New function.
2772         (Output_section_incremental_inputs::write_header): New function.
2773         (Output_section_incremental_inputs::write_input_files): New function.
2774         (Output_section_incremental_inputs::write_info_blocks): New function.
2775         (Output_section_incremental_inputs::write_symtab): New function.
2776         * incremental.h (Incremental_script_entry): Forward declaration.
2777         (Incremental_object_entry): Forward declaration.
2778         (Incremental_archive_entry): Forward declaration.
2779         (Incremental_inputs): Forward declaration.
2780         (Incremental_inputs_header_data): Remove.
2781         (Incremental_inputs_header): Remove.
2782         (Incremental_inputs_header_write): Remove.
2783         (Incremental_inputs_entry_data): Remove.
2784         (Incremental_inputs_entry): Remove.
2785         (Incremental_inputs_entry_write): Remove.
2786         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
2787         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
2788         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2789         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
2790         Likewise.
2791         (Incremental_input_entry): New class.
2792         (Incremental_script_entry): New class.
2793         (Incremental_object_entry): New class.
2794         (Incremental_archive_entry): New class.
2795         (Incremental_inputs::Incremental_inputs): Initialize new data members.
2796         (Incremental_inputs::report_inputs): Remove.
2797         (Incremental_inputs::report_archive): Remove.
2798         (Incremental_inputs::report_archive_begin): New function.
2799         (Incremental_inputs::report_archive_end): New function.
2800         (Incremental_inputs::report_object): Change prototype.
2801         (Incremental_inputs::report_input_section): New function.
2802         (Incremental_inputs::report_script): Change prototype.
2803         (Incremental_inputs::get_reloc_count): New function.
2804         (Incremental_inputs::set_reloc_count): New function.
2805         (Incremental_inputs::create_data_sections): New function.
2806         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2807         (Incremental_inputs::inputs_section): New function.
2808         (Incremental_inputs::symtab_section): New function.
2809         (Incremental_inputs::relocs_section): New function.
2810         (Incremental_inputs::get_stringpool): Add const.
2811         (Incremental_inputs::command_line): Add const.
2812         (Incremental_inputs::inputs): Remove.
2813         (Incremental_inputs::command_line_key): New function.
2814         (Incremental_inputs::input_file_count): New function.
2815         (Incremental_inputs::input_files): New function.
2816         (Incremental_inputs::relocs_entsize): New function.
2817         (Incremental_inputs::sized_create_inputs_section_data): Remove.
2818         (Incremental_inputs::finalize_inputs): Remove.
2819         (Incremental_inputs::Input_info): Remove.
2820         (Incremental_inputs::lock_): Remove.
2821         (Incremental_inputs::inputs_): Change type.
2822         (Incremental_inputs::inputs_map_): Remove.
2823         (Incremental_inputs::current_object_entry_): New data member.
2824         (Incremental_inputs::inputs_section_): New data member.
2825         (Incremental_inputs::symtab_section_): New data member.
2826         (Incremental_inputs::relocs_section_): New data member.
2827         (Incremental_inputs::reloc_count_): New data member.
2828         (Incremental_inputs_reader): New class.
2829         (Incremental_symtab_reader): New class.
2830         (Incremental_relocs_reader): New class.
2831         * layout.cc (Layout::finalize): Move finalization of incremental info
2832         and creation of incremental info sections to follow finalization of
2833         symbol table.  Set offsets for postprocessing sections.
2834         (Layout::create_incremental_info_sections): Call
2835         Incremental_inputs::create_data_sections.  Add incremental symtab
2836         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
2837         sections to layout after input sections.
2838         * layout.h (struct Timespec): Forward declaration.
2839         (Layout::incremental_inputs): Add const.
2840         (Layout::create_incremental_info_sections): Add parameter.
2841         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
2842         * object.cc: Include incremental.h.
2843         (Relobj::finalize_incremental_relocs): New function.
2844         (Sized_relobj::do_layout): Record input sections in incremental info.
2845         * object.h (Object::output_section): New function.
2846         (Object::output_section_offset): Moved from Relobj.
2847         (Object::get_incremental_reloc_base): New function.
2848         (Object::get_incremental_reloc_count): New function.
2849         (Object::do_output_section): New function.
2850         (Object::do_output_section_offset): Moved from Relobj.
2851         (Object::do_get_incremental_reloc_base): New function.
2852         (Object::do_get_incremental_reloc_count): New function.
2853         (Object::Object): Initialize new data members.
2854         (Relobj::output_section): Renamed do_output_section and moved to
2855         protected.
2856         (Relobj::output_section_offset): Moved to Object.
2857         (Relobj::do_get_incremental_reloc_base): New function.
2858         (Relobj::do_get_incremental_reloc_count): New function.
2859         (Relobj::allocate_incremental_reloc_counts): New function.
2860         (Relobj::count_incremental_reloc): New function.
2861         (Relobj::finalize_incremental_relocs): New function.
2862         (Relobj::next_incremental_reloc_index): New function.
2863         (Relobj::reloc_counts_): New data member.
2864         (Relobj::reloc_bases_): New data member.
2865         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
2866         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
2867         (Sized_relobj::incremental_relocs_scan): New function.
2868         (Sized_relobj::incremental_relocs_scan_reltype): New function.
2869         (Sized_relobj::incremental_relocs_write): New function.
2870         (Sized_relobj::incremental_relocs_write_reltype): New function.
2871         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
2872         incremental link.
2873         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
2874         archives and object files elsewhere.
2875         (Add_symbols::run): Report object files here.
2876         (Finish_group::run): Report end of archive at end of group.
2877         * reloc.cc: Include layout.h, incremental.h.
2878         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
2879         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
2880         (Sized_relobj::incremental_relocs_scan): New function.
2881         (Sized_relobj::incremental_relocs_scan_reltype): New function.
2882         (Sized_relobj::do_relocate_sections): Write incremental relocations.
2883         (Sized_relobj::incremental_relocs_write): New function.
2884         (Sized_relobj::incremental_relocs_write_reltype): New function.
2885         * script.cc (read_input_script): Rewrite test for incremental link.
2886         Change call to Incremental_inputs::report_script.
2887         * symtab.h (Symbol_table::first_global_index): New function.
2888         (Symbol_table::output_count): New function.
2889
2890 2010-08-12  Doug Kwan  <dougkwan@google.com>
2891
2892         * arm.cc (Target_arm::merge_object_attributes): Check command line
2893         options --no-wchar-size-warning and --no-enum-size-warning.
2894         * options.h (General_options): Add ld-compatible options
2895         --no-enum-size-warning and --no-wchar-size-warning.
2896
2897 2010-08-04  Ian Lance Taylor  <iant@google.com>
2898
2899         * x86_64.cc (Target_x86_64::Scan::local): Use
2900         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
2901         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
2902         (Target_x86_64::Scan::global): Likewise.
2903         (Target_x86_64::Relocate::relocate): Likewise.
2904         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
2905         Likewise.
2906
2907 2010-08-03  Cary Coutant  <ccoutant@google.com>
2908
2909         * merge.cc (Output_merge_string::do_add_input_section): Count strings
2910         to reserve space in merged_strings vector. Keep total input size
2911         for stats.
2912         (Output_merge_string::do_print_merge_stats): Print total input size.
2913         * merge.h (Output_merge_string): Add input_size_ field.
2914         * stringpool.cc (Stringpool_template::string_length): Move
2915         implementations out of Stringpool_template class and place in
2916         stringpool.h.
2917         * stringpool.h (string_length): Move out of Stringpool_template.
2918
2919 2010-08-03  Ian Lance Taylor  <iant@google.com>
2920
2921         PR 11712
2922         * layout.cc (relaxation_loop_body): If address of load segment is
2923         set, adjust address to include headers if possible.
2924
2925 2010-08-03  Ian Lance Taylor  <iant@google.com>
2926
2927         * version.cc (version_string): Bump to 1.10.
2928
2929 2010-08-03  Ian Lance Taylor  <iant@google.com>
2930
2931         PR 11805
2932         * layout.h (enum Output_section_order): Define.
2933         (class Layout): Update declarations.
2934         * layout.cc (Layout::get_output_section): Add order parameter.
2935         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
2936         is_first_non_relro parameters.  Change all callers.
2937         (Layout::choose_output_section): Likewise.
2938         (Layout::add_output_section_data): Likewise.
2939         (Layout::make_output_section): Likewise.  Set order.
2940         (Layout::default_section_order): New function.
2941         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
2942         * output.cc (Output_section::Output_section): Initialize order_.
2943         Don't initialize deleted fields.
2944         (Output_segment::Output_segment): Don't initialize deleted
2945         fields.
2946         (Output_segment::add_output_section_to_load): New function
2947         replacing add_output_section.  Change all callers to call this or
2948         add_output_section_to_nonload.
2949         (Output_segment::add_output_section_to_nonload): New function.
2950         (Output_segment::remove_output_section): Rewrite.
2951         (Output_segment::add_initial_output_data): Likewise.
2952         (Output_segment::has_any_data_sections): Likewise.
2953         (Output_segment::is_first_section_relro): Likewise.
2954         (Output_segment::maximum_alignment): Likewise.
2955         (Output_segment::has_dynamic_reloc): New function replacing
2956         dynamic_reloc_count.  Change all callers.
2957         (Output_segment::has_dynamic_reloc_list): New function replacing
2958         dynamic_reloc_count_list.  Change all callers.
2959         (Output_segment::set_section_addresses): Rewrite.
2960         (Output_segment::set_offset): Rewrite.
2961         (Output_segment::find_first_and_last_list): Remove.
2962         (Output_segment::set_tls_offsets): Rewrite.
2963         (Output_segment::first_section_load_address): Likewise.
2964         (Output_segment::output_section_count): Likewise.
2965         (Output_segment::section_with_lowest_load_address): Likewise.
2966         (Output_segment::write_section_headers): Likewise.
2967         (Output_segment::print_sections_to_map): Likewise.
2968         * output.h (class Output_data): Remove dynamic_reloc_count_
2969         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
2970         (Output_data::add_dynamic_reloc): Rewrite.
2971         (Output_data::has_dynamic_reloc): New function.
2972         (Output_data::dynamic_reloc_count): Remove.
2973         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
2974         is_last_relro_, is_first_non_relro_, is_interp_,
2975         is_dynamic_linker_section_ fields.  Add order and set_order
2976         functions.  Remove is_relro_local, set_is_relro_local,
2977         is_last_relro, set_is_last_relro, is_first_non_relro,
2978         set_is_first_non_relro functions, is_interp, set_is_interp,
2979         is_dynamic_linker_section, and set_is_dynamic_linker_section
2980         functions.
2981         (class Output_segment): Change Output_data_list from std::list to
2982         std:;vector.  Add output_lists_ field.  Remove output_data_ and
2983         output_bss_ fields.  Update declarations.
2984
2985 2010-08-02  Ian Lance Taylor  <iant@google.com>
2986
2987         * arm.cc (Target_arm::gc_process_relocs): Use typename.
2988         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
2989         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
2990
2991 2010-08-02  Ian Lance Taylor  <iant@google.com>
2992
2993         PR 11855
2994         * script.cc (Script_options::Script_options): Initialize
2995         symbol_definitions_ and symbol_references_.
2996         (Script_options::add_symbol_assignment): Update
2997         symbol_definitions_ and symbol_references_.
2998         (Script_options::add_symbol_reference): New function.
2999         (script_symbol): New function.
3000         * script.h (class Script_options): Add symbol_definitions_ and
3001         symbol_references_ fields.
3002         (Script_options::referenced_const_iterator): New type.
3003         (Script_options::referenced_begin): New function.
3004         (Script_options::referenced_end): New function.
3005         (Script_options::is_referenced): New function.
3006         (Script_options::any_unreferenced): New function.
3007         * script-c.h (script_symbol): Declare.
3008         * yyscript.y (exp): Call script_symbol.
3009         * symtab.cc: Include "script.h".
3010         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
3011         Change all callers.  Check symbols referenced by scripts.
3012         (Symbol_table::add_undefined_symbols_from_command_line): Add
3013         layout parameter.  Change all callers.
3014         (Symbol_table::do_add_undefined_symbols_from_command_line):
3015         Likewise.  Break out loop body.  Check symbols referenced by
3016         scripts.
3017         (Symbol_table::add_undefined_symbol_from_command_line): New
3018         function broken out of
3019         do_add_undefined_symbols_from_command_line.
3020         * symtab.h (class Symbol_table): Update declarations.
3021         * archive.cc: Include "layout.h".
3022         (Archive::should_include_member): Add layout parameter.  Change
3023         all callers.  Check for symbol mentioned in expression.
3024         * archive.h (class Archive): Update declaration.
3025         * object.cc (Sized_relobj::do_should_include_member): Add layout
3026         parameter.
3027         * object.h (Object::should_include_member): Add layout parameter.
3028         Change all callers.
3029         (Object::do_should_include_member): Add layout parameter.
3030         (class Sized_relobj): Update declaration.
3031         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
3032         parameter.
3033         * dynobj.h (class Sized_dynobj): Update declaration.
3034         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
3035         layout parameter.
3036         * plugin.h (class Sized_pluginobj): Update declaration.
3037
3038 2010-08-02  Ian Lance Taylor  <iant@google.com>
3039
3040         PR 11866
3041         * output.cc (Output_segment::set_offset): Search for the first and
3042         last sections rather than assuming that the list is in order.
3043         (Output_segment::find_first_and_last_list): New function.
3044         * output.h (class Output_segment): Update declarations.
3045         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
3046         (relro_strip_test_SOURCES): New variable.
3047         (relro_strip_test_DEPENDENCIES): New variable.
3048         (relro_strip_test_LDFLAGS): New variable.
3049         (relro_strip_test_LDADD): New variable.
3050         (relro_strip_test.so): New target.
3051
3052 2010-08-02  Ian Lance Taylor  <iant@google.com>
3053
3054         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
3055         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
3056         (Target_i386::got_tlsdesc_section): New function.
3057         (Target_i386::got_section): Create space for GOT entries for
3058         TLSDESC relocations.
3059         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
3060         R_386_TLS_GOTDESC.
3061         (Target_i386::Scan::global): Likewise.
3062         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
3063         using TLSDESC GOT.
3064         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
3065         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
3066         (Target_x86_64::got_tlsdesc_section): New function.
3067         (Target_x86_64::got_section): Create space for GOT entries for
3068         TLSDESC relocations.
3069         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
3070         R_386_TLS_GOTDESC.
3071         (Target_x86_64::Scan::global): Likewise.
3072         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
3073         using TLSDESC GOT.
3074
3075 2010-08-02  Ian Lance Taylor  <iant@google.com>
3076
3077         * testsuite/final_layout.sh: Use dc to convert from hex to
3078         decimal.
3079
3080 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
3081
3082         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
3083         paramter to the call to gold::gc_process_relocs.
3084         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
3085         paramter to the call to gold::gc_process_relocs.
3086         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
3087         parameter to the call to gold::gc_process_relocs.
3088         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
3089         template parameter to the call to gold::gc_process_relocs.
3090         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
3091         paramter to the call to gold::gc_process_relocs.
3092         * gc.h (get_embedded_addend_size): New function.
3093         (gc_process_relocs): Save the size of the reloc for use by ICF.
3094         * icf.cc (get_section_contents): Get the addend from the text section
3095         for SHT_REL relocation sections.
3096         * icf.h (Icf::Reloc_addend_size_info): New typedef.
3097         (Icf::Reloc_info): Add new member reloc_addend_size_info.
3098         * int_encoding.h (read_from_pointer): New overloaded function.
3099         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
3100         * testsuite/icf_sht_rel_addend_test.sh: New file.
3101         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
3102         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
3103
3104 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3105
3106         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
3107         * Makefile.in: Regenerate.
3108         * testsuite/Makefile.in: Regenerate.
3109
3110 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
3111
3112         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
3113         * gold/testsuite/debug_msg.cc: Likewise.
3114         * gold/testsuite/odr_violation1.cc
3115         * gold/testsuite/odr_violation2.cc
3116
3117 2010-07-21  Cary Coutant  <ccoutant@google.com>
3118
3119         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
3120         string, and length fields.
3121         (Output_merge_string::Merged_strings_list): New type.
3122         (Output_merge_string::Merged_strings_lists): New typedef.
3123         (Output_merge_string): Replace merged_strings_ with
3124         merged_strings_lists_.
3125         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
3126         Merged_strings_list per input object and section.  Don't store pointer
3127         to the string.  Don't store length with each merged string entry.
3128         (Output_merge_string::finalize_merged_data): Loop over list of merged
3129         strings lists.  Recompute length of each merged string.
3130
3131 2010-07-15  Cary Coutant  <ccoutant@google.com>
3132
3133         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
3134         here.
3135
3136 2010-07-14  Ian Lance Taylor  <iant@google.com>
3137
3138         * descriptors.cc (Descriptors::open): Report correct name in error
3139         message.
3140
3141 2010-07-13  Doug Kwan  <dougkwan@google.com>
3142
3143         * arm.cc (Arm_input_section::Arm_input_section): For a
3144         SHT_ARM_EXIDX section, always keeps the input sections.
3145         (Arm_input_section::set_exidx_section_link): New method.
3146         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
3147         has_errors_ to false.
3148         (Arm_exidx_input_section::has_errors,
3149         Arm_exidx_input_section::set_has_errors): New methods.
3150         (Arm_exidx_input_section::has_errors_): New data member.
3151         (Arm_relobj::get_exidx_shndx_list): New method.
3152         (Arm_output_section::append_text_sections_to_list): Do not skip
3153         section without SHF_EXECINSTR.
3154         (Arm_output_section::fix_exidx_coverage): Skip input sections with
3155         errors.
3156         (Arm_relobj::make_exidx_input_section): Add new parameter for text
3157         section header.  Make error messages more verbose.  Check for
3158         a non-executable section linked to an EXIDX section.
3159         (Arm_relobj::do_read_symbols): Remove error checking, which has been
3160         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
3161         check that there is no deferred EXIDX section if we exit early.
3162         Instead of not making an EXIDX section in case of an error, make one
3163         and set the has_errors flag of it.
3164         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
3165         in a relocatable link.
3166         (Target_arm::do_relax): Look for the EXIDX output section instead of
3167         assuming that it is called .ARM.exidx.
3168         (Target_arm::fix_exidx_coverage): Add a new parameter for input
3169         section list.  Do not check for SHF_EXECINSTR section flags but
3170         skip any input section with errors.
3171         * output.cc (Output_section::Output_section): Initialize
3172         always_keeps_input_sections_ to false.
3173         (Output_section::add_input_section): Check for
3174         always_keeps_input_sections_.
3175         *  output.h (Output_section::always_keeps_input_sections,
3176         Output_section::set_always_keeps_input_sections): New methods.
3177         (Output_section::always_keeps_input_sections): New data member.
3178
3179 2010-07-13  Rafael Espindola  <espindola@google.com>
3180
3181         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
3182         * fileread.h (Input_file): Add try_extra_search_path and find_file.
3183
3184 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
3185             Ian Lance Taylor  <iant@google.com>
3186
3187         * output.h (Output_section_lookup_maps::add_merge_section):
3188         Correct check of whether value was inserted.
3189         (Output_section_lookup_maps::add_merge_input_section): Likewise.
3190         (Output_section_lookup_maps::add_relaxed_input_section):
3191         Likewise.
3192         * arm.cc (Target_arm::got_section): Remove used local os.
3193         * i386.cc (Target_i386::got_section): Likewise.
3194         * x86_64.cc (Target_x86_64::got_section): Likewise.
3195         * sparc.cc (Target_sparc::got_section): Likewise.
3196         (Target_sparc::relocate): Remove unused local have_got_offset.
3197         * powerpc.cc (Target_powerpc::relocate): Likewise.
3198
3199 2010-07-13  Ian Lance Taylor  <iant@google.com>
3200
3201         * compressed_output.cc (zlib_decompress): Fix signature in
3202         !HAVE_ZLIB_H case.
3203
3204         * archive.cc (Archive::include_member): Unlock an external member
3205         of a thin archive.  Don't bother to delete an object we know is
3206         NULL.
3207
3208 2010-07-12  Cary Coutant  <ccoutant@google.com>
3209
3210         * compressed_output.cc (zlib_decompress): New function.
3211         (get_uncompressed_size): New function.
3212         (decompress_input_section): New function.
3213         * compressed_output.h (get_uncompressed_size): New function.
3214         (decompress_input_section): New function.
3215         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
3216         Handle compressed debug sections.
3217         * layout.cc (is_compressed_debug_section): New function.
3218         (Layout::output_section_name): Map compressed section names to
3219         canonical names.
3220         * layout.h (is_compressed_debug_section): New function.
3221         (is_debug_info_section): Recognize compressed debug sections.
3222         * merge.cc: Include compressed_output.h.
3223         (Output_merge_data::do_add_input_section): Handle compressed
3224         debug sections.
3225         (Output_merge_string::do_add_input_section): Handle compressed
3226         debug sections.
3227         * object.cc: Include compressed_output.h.
3228         (Sized_relobj::Sized_relobj): Initialize new data members.
3229         (build_compressed_section_map): New function.
3230         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
3231         * object.h (Object::section_is_compressed): New method.
3232         (Object::do_section_is_compressed): New method.
3233         (Sized_relobj::Compressed_section_map): New type.
3234         (Sized_relobj::do_section_is_compressed): New method.
3235         (Sized_relobj::compressed_sections_): New data member.
3236         * output.cc (Output_section::add_input_section): Handle compressed
3237         debug sections.
3238         * reloc.cc: Include compressed_output.h.
3239         (Sized_relobj::write_sections): Handle compressed debug sections.
3240
3241 2010-07-08  Cary Coutant  <ccoutant@google.com>
3242
3243         * resolve.cc (Symbol_table::resolve): Remember whether undef was
3244         weak when resolving to a dynamic def.
3245         (Symbol_table::should_override): Add adjust_dyndef flag; set it
3246         for weak undef/dynamic def cases. Adjust callers.
3247         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
3248         undef_binding_weak_.
3249         (Symbol_table::sized_write_globals): Adjust symbol binding.
3250         (Symbol_table::sized_write_symbol): Add binding parameter.
3251         * symtab.h (Symbol::set_undef_binding): New method.
3252         (Symbol::is_undef_binding_weak): New method.
3253         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
3254         (Symbol_table::should_override): Add new parameter.
3255         (Symbol_table::sized_write_symbol): Add new parameter.
3256
3257         * testsuite/weak_undef_file1.cc: Add new test case.
3258         * testsuite/weak_undef_file2.cc: Fix header comment.
3259         * testsuite/weak_undef_test.cc: Add new test case.
3260
3261 2010-06-29  Doug Kwan  <dougkwan@google.com>
3262
3263         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
3264         Initialize USE_SYMBOL_.
3265         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
3266         definition.
3267         (Arm_reloc_property::uses_symbol_): New data member declaration.
3268         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
3269         uses symbol value and symbol is undefined but not weakly undefined.
3270
3271 2010-06-28  Rafael Espindola  <espindola@google.com>
3272
3273         * plugin.cc (Plugin::load): Use dlerror.
3274
3275 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
3276
3277         * symtab.cc (detect_odr_violations): When reporting an ODR
3278         violation, report an object where the symbol is defined.
3279
3280 2010-06-25  Doug Kwan  <dougkwan@google.com>
3281
3282         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
3283         (Target_arm::section_may_have_icf_unsafe_pointers): New method
3284         definition.
3285         (Target_arm::Scan::local_reloc_may_be_function_pointer,
3286         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
3287         target hook to detect function points.
3288         (Target_arm::Scan::possible_function_pointer_reloc): New method.
3289         * icf.h (Icf::check_section_for_function_pointers): Change type of
3290         parameter SECTION_NAME to const reference to std::string.  Use
3291         target hook to determine if section may have unsafe pointers.
3292         * target.h (Target::section_may_have_icf_unsafe_pointers): New
3293         method definition.
3294
3295 2010-06-21  Rafael Espindola  <espindola@google.com>
3296
3297         * fileread.cc (Input_file::find_fie): New
3298         (Input_file::open): Use Input_file::find_fie.
3299         * fileread.h (Input_file::find_fie): New
3300         * plugin.cc (set_extra_library_path): New.
3301         (Plugin::load): Add set_extra_library_path to the transfer vector.
3302         (Plugin_manager::set_extra_library_path): New.
3303         (Plugin_manager::add_input_file): Use the extra search path if set.
3304         (set_extra_library_path(): New.
3305         * plugin.h (Plugin_manager): Add set_extra_library_path and
3306         extra_search_path_.
3307
3308 2010-06-19  Cary Coutant  <ccoutant@google.com>
3309
3310         * layout.cc (gdb_sections): Add .debug_types.
3311         (lines_only_debug_sections): Likewise.
3312
3313 2010-06-18  Rafael Espindola  <espindola@google.com>
3314
3315         * plugin.cc (add_input_file,add_input_library)
3316         (Plugin_manager::add_input_file): Make filename arguments const.
3317         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
3318         const.
3319
3320 2010-06-16  Doug Kwan  <dougkwan@google.com>
3321
3322         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
3323         .ARM.attributes section if we have not merged any input
3324         attributes sections.
3325
3326 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3327
3328         * arm.cc: Allow combining objects with no EABI version
3329         information.
3330
3331 2010-06-15  Rafael Espindola  <espindola@google.com>
3332
3333         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
3334
3335 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3336
3337         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
3338         (struct iovec): Correct !HAVE_READV definition.
3339
3340 2010-06-10  Cary Coutant  <ccoutant@google.com>
3341
3342         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
3343         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
3344         reloc sections.
3345         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
3346
3347         PR 11683
3348         * symtab.h (Symbol::is_placeholder): New member function.
3349         * target-reloc.h (relocate_section): Check for placeholder symbols.
3350
3351         * testsuite/Makefile.am (plugin_test_8): New test.
3352         (plugin_test_9): New test.
3353         * testsuite/Makefile.in: Regenerate.
3354
3355 2010-06-09  Nick Clifton  <nickc@redhat.com>
3356
3357         * yyscript.y (input_list_element): Allow strings prefixed with
3358         the '-' character.  Treat these as libraries.
3359         * script.cc (script_add_library): New function.  Adds a library
3360         specified by "-l<name>" found in an input script.
3361         * script-c.h: Add prototype for script_add_library.
3362
3363 2010-06-07  Doug Kwan  <dougkwan@google.com>
3364
3365         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
3366         Restrict stub-group size to be within long conditional branch
3367         range when working around cortex-A8 erratum.
3368
3369 2010-06-07  Damien Diederen  <dd@crosstwine.com>
3370
3371         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
3372         #ifdef typo.
3373
3374 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
3375
3376         PR gold/11658
3377         * output.cc
3378         (Output_section::Input_section_sort_entry::compare_section_ordering):
3379         Change to return non-zero correctly.
3380         (Output_section::Input_section_sort_section_order_index_compare
3381         ::operator()): Change to fix ambiguity in comparisons.
3382
3383 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
3384
3385         * gold.h (is_wildcard_string): New function.
3386         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
3387         (Layout::layout_eh_frame): Ditto.
3388         (Layout::find_section_order_index): New method.
3389         (Layout::read_layout_from_file): New method.
3390         * layout.h (Layout::find_section_order_index): New method.
3391         (Layout::read_layout_from_file): New method.
3392         (Layout::input_section_position_): New private member.
3393         (Layout::input_section_glob_): New private member.
3394         * main.cc (main): Call read_layout_from_file here.
3395         * options.h (--section-ordering-file): New option.
3396         * output.cc (Output_section::input_section_order_specified_): New
3397         member.
3398         (Output_section::Output_section): Initialize new member.
3399         (Output_section::add_input_section): Add new parameter.
3400         Keep input sections when --section-ordering-file is used.
3401         (Output_section::set_final_data_size): Sort input sections when
3402         section ordering file is specified.
3403         (Output_section::Input_section_sort_entry): Add new parameter.
3404         Check sorting type.
3405         (Output_section::Input_section_sort_entry::compare_section_ordering):
3406         New method.
3407         (Output_section::Input_section_sort_compare::operator()): Change to
3408         consider section_order_index.
3409         (Output_section::Input_section_sort_init_fini_compare::operator()):
3410         Change to consider section_order_index.
3411         (Output_section::Input_section_sort_section_order_index_compare
3412         ::operator()): New method.
3413         (Output_section::sort_attached_input_sections): Change to sort
3414         according to section order when specified.
3415         (Output_section::add_input_section<32, true>): Add new parameter.
3416         (Output_section::add_input_section<64, true>): Add new parameter.
3417         (Output_section::add_input_section<32, false>): Add new parameter.
3418         (Output_section::add_input_section<64, false>): Add new parameter.
3419         * output.h (Output_section::add_input_section): Add new parameter.
3420         (Output_section::input_section_order_specified): New
3421         method.
3422         (Output_section::set_input_section_order_specified): New method.
3423         (Input_section::Input_section): Initialize section_order_index_.
3424         (Input_section::section_order_index): New method.
3425         (Input_section::set_section_order_index): New method.
3426         (Input_section::section_order_index_): New member.
3427         (Input_section::Input_section_sort_section_order_index_compare): New
3428         struct.
3429         (Output_section::input_section_order_specified_): New member.
3430         * script-sections.cc (is_wildcard_string): Delete and move modified
3431         method to gold.h.
3432         (Output_section_element_input::Output_section_element_input): Modify
3433         call to is_wildcard_string.
3434         (Output_section_element_input::Input_section_pattern
3435         ::Input_section_pattern): Ditto.
3436         (Output_section_element_input::Output_section_element_input): Ditto.
3437         * testsuite/Makefile.am (final_layout): New test case.
3438         * testsuite/Makefile.in: Regenerate.
3439         * testsuite/final_layout.cc: New file.
3440         * testsuite/final_layout.sh: New file.
3441
3442 2010-06-01  Rafael Espindola  <espindola@google.com>
3443
3444         * plugin.cc (Plugin::load): Pass the output name to the plugin.
3445
3446 2010-06-01  Rafael Espindola  <espindola@google.com>
3447
3448         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
3449         visibility of symbols.
3450
3451 2010-05-27  Doug Kwan  <dougkwan@google.com>
3452
3453         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
3454         from start of output section instead of address for a local symbol
3455         in a merged or relaxed section when doing a relocatable link.
3456
3457 2010-05-26  Rafael Espindola  <espindola@google.com>
3458
3459        PR 11604
3460         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
3461         adding sections the garbage collector removed.
3462         * gold/testsuite/Makefile.am: Add test.
3463         * gold/testsuite/Makefile.in: Regenerate.
3464         * gold/testsuite/plugin_test_7.sh: New.
3465         * gold/testsuite/plugin_test_7_1.c: New.
3466         * gold/testsuite/plugin_test_7_2.c: New.
3467
3468 2010-05-26  Rafael Espindola  <espindola@google.com>
3469
3470         * script-sections.cc (Output_section_definition::set_section_addresses):
3471         Check for --section-start.
3472
3473 2010-05-26  Doug Kwan  <dougkwan@google.com>
3474
3475         * arm.cc (Arm_scan_relocatable_relocs): New class.
3476         (Target_arm::relocate_special_relocatable): New method.
3477         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
3478         (Arm_relocate_functions::thumb_branch_common): Same.
3479         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
3480         instead of Default_scan_relocatable_relocs.
3481         * target-reloc.h (relocate_for_relocatable): Let target handle
3482         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
3483         * target.h (Sized_target::relocate_special_relocatable): New method.
3484
3485 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3486
3487         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
3488
3489 2010-05-23  Doug Kwan  <dougkwan@google.com>
3490
3491         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
3492         instead of a cast.
3493         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
3494         with a direct branch, not a conditional branch, to a stub.
3495         * merge.cc (Output_merge_base::record_input_section): New method
3496         defintion.
3497         (Output_merge_data::do_add_input_section): Record input section if
3498         keeps-input-sections flag is set.
3499         (Output_merge_string::do_add_input_section): Ditto.
3500         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
3501         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
3502         INPUT_SECTIONS_.
3503         (Output_merge_base::keeps_input_sections,
3504         Output_merge_base::set_keeps_input_sections,
3505         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
3506         method definitions.
3507         (Output_merge_base::Input_sections): New type declaration.
3508         (Output_merge_base::input_sections_begin,
3509         Output_merge_base::input_sections_end,
3510         Output_merge_base::do_set_keeps_input_sections): New method definitions.
3511         (Output_merge_base::bool keeps_input_sections_,
3512         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
3513         Output_merge_base::input_sections_): New data members.
3514         (Output_merge_data::do_set_keeps_input_sections): New method
3515         defintion.
3516         (Output_merge_string::do_set_keeps_input_sections): Ditto.
3517         * output.cc (Output_section::Input_section::relobj): Move method
3518         defintion from class declaration to here and handle merge sections.
3519         (Output_section::Input_section::shndx): Ditto.
3520         (Output_section::Output_section): Remove initializations of removed
3521         data members and initialize new data member LOOKUP_MAPS_.
3522         (Output_section::add_input_section): Set keeps-input-sections flag
3523         for a newly created merge output section as appropriate.  Adjust code
3524         to use Output_section_lookup_maps class.
3525         (Output_section::add_relaxed_input_section): Adjst code for lookup
3526         maps code refactoring.
3527         (Output_section::add_merge_input_section): Add a new parameter
3528         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
3529         class.  If adding input section to a newly created merge output
3530         section fails, remove the new merge section.
3531         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
3532         Adjust code for use of the Output_section_lookup_maps class.
3533         (Output_section::find_merge_section): Ditto.
3534         (Output_section::build_lookup_maps): New method defintion.
3535         (Output_section::find_relaxed_input_section): Adjust code to use
3536         Output_section_lookup_maps class.
3537         (Output_section::get_input_sections): Export merge sections.  Adjust
3538         code to use Output_section_lookup_maps class.
3539         (Output_section:::add_script_input_section): Adjust code to use
3540         Output_section_lookup_maps class.  Update lookup maps for merge
3541         sections also.
3542         (Output_section::discard_states): Use Output_section_lookup_maps.
3543         (Output_section::restore_states): Same.
3544         * output.h (Merge_section_properties): Move class defintion out of
3545         Output_section.
3546         (Output_section_lookup_maps): New class.
3547         (Output_section::Input_section::is_merge_section): New method
3548         defintion.
3549         (Output_section::Input_section::relobj): Move defintion out of class
3550         defintion.  Declare method only.
3551         (Output_section::Input_section::shndx): Ditto.
3552         (Output_section::Input_section::output_merge_base): New method defintion.
3553         (Output_section::Input_section::u2_.pomb): New union field.
3554         (Output_section::Merge_section_by_properties_map,
3555         Output_section::Output_section_data_by_input_section_map,
3556         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
3557         Remove types.
3558         (Output_section::add_merge_input_section): Add new parameter
3559         KEEPS_INPUT_SECTIONS.
3560         (Output_section::build_lookup_maps): New method declaration.
3561         (Output_section::merge_section_map_,
3562         Output_section::merge_section_by_properties_map_,
3563         Output_section::relaxed_input_section_map_,
3564         Output_section::is_relaxed_input_section_map_valid_): Remove data
3565         members.
3566         (Output_section::lookup_maps_): New data member.
3567
3568 2010-05-21  Doug Kwan  <dougkwan@google.com>
3569
3570         PR gold/11619
3571         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
3572         avoid a compilation error.
3573
3574 2010-05-19  Rafael Espindola  <espindola@google.com>
3575
3576         * script-sections.cc (Output_section_definition::allocate_to_segment):
3577         Update the phdrs_list even when the output section is NULL.
3578         * testsuite/Makefile.am: Add test.
3579         * testsuite/Makefile.in: Regenerate.
3580         * testsuite/script_test_9.cc: New.
3581         * testsuite/script_test_9.sh: New.
3582         * testsuite/script_test_9.t: New.
3583
3584 2010-05-19  Doug Kwan  <dougkwan@google.com>
3585
3586         * arm.cc (Arm_input_section::original_size): New method.
3587         (Arm_input_section::do_addralign): Add a cast.
3588         (Arm_input_section::do_output_offset): Remove static cast.
3589         (Arm_input_section::original_addralign,
3590          Arm_input_section::original_size_): Change type to uint32_t.
3591         (Arm_input_section::init): Add safe casts for section alignment
3592         and size.
3593         (Arm_input_section::set_final_data_size): Do not set address and
3594         offset of stub table.
3595         (Arm_output_section::fix_exidx_coverage): Change use of of
3596         Output_section::Simple_input_section to that of
3597         Output_section::Input_section.
3598         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
3599         except for the first pass.
3600         * output.cc (Output_section::get_input_sections): Change type of
3601         input_sections to std::list<Input_section>.
3602         (Output_section::add_script_input_section): Rename from
3603         Output_section::add_simple_input_section.  Change type of SIS
3604         parameter from Simple_input_section to Input_section.
3605         * output.h (Output_section::Simple_input_section): Remove class.
3606         (Output_section::Input_section): Change class visibility to public.
3607         (Output_section::Input_section::addralign): Use stored alignments
3608         for special input sections if set.
3609         (Output_section::Input_section::set_addralign): New method.
3610         (Output_section::get_input_sections): Change parameter type from
3611         list of Simple_input_section to list of Input_section.
3612         (Output_section::add_script_input_section): Rename from
3613         Output_section::add_simple_input_section. Change first parameter's
3614         type from Simple_input_section to Input_section and remove the
3615         second and third parameters.
3616         * script-sections.cc (Input_section::Input_section_list): Change
3617         type to list of Output_section::Input_section/
3618         (Input_section_info::Input_section_info): Change parameter type of
3619         INPUT_SECTION to Output_section::Input_section.
3620         (Input_section_info::input_section): Change return type.
3621         (Input_section_info::input_section_): Change type to
3622         Output_section::Input_section.
3623         (Output_section_element_input::set_section_addresses): Adjust code
3624         to use Output_section::Input_section instead of
3625         Output_section::Simple_input_section.  Adjust code for renaming
3626         of Output_section::add_simple_input_section.
3627         (Orphan_output_section::set_section_addresses): Ditto.
3628
3629 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3630
3631         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
3632         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
3633
3634 2010-05-18  Rafael Espindola  <espindola@google.com>
3635
3636         * options.cc (General_options::finalize): Handle -nostdlib.
3637         * options.h (nostdlib): New option.
3638         * script.cc (script_add_search_dir): Handle -nostdlib.
3639
3640 2010-05-12  Doug Kwan  <dougkwan@google.com>
3641
3642         * arm.cc (Target_arm::do_finalize_sections): Create an empty
3643         attributes section only if there no attributes section after merging.
3644         (Target_arm::merge_object_attributes): Move value of
3645         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
3646         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
3647         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
3648         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
3649         and arm_attr_merge_7.stdout.
3650         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
3651         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
3652         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
3653         arm_attr_merge_7b.o): New rules.
3654         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
3655         arm_attr_merge_7
3656         * testsuite/Makefile.in: Regenerate.
3657         * testsuite/arm_attr_merge.sh: New file.
3658         * testsuite/arm_attr_merge_[67][ab].s: Same.
3659
3660 2010-05-05  Nick Clifton  <nickc@redhat.com>
3661
3662         * po/es.po: Updated Spanish translation.
3663
3664 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
3665
3666         * Makefile.am (install-exec-local): Properly install gold as
3667         default cross linker.
3668         * Makefile.in: Regenerated.
3669
3670 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
3671             Nick Clifton  <nickc@redhat.com>
3672
3673         * configure.ac (install_as_default): Define and set to false
3674         unless --enable-gold or --enable-gold=both/gold has been
3675         specified.
3676         * configure: Regenerate.
3677
3678         * Makefile.am (install-exec-local): Install the executable as
3679         'ld.gold'.  If install_as_default is true then also install it as
3680         'ld'.
3681         * Makefile.in: Regenerated.
3682
3683 2010-04-24  Ian Lance Taylor  <iant@google.com>
3684
3685         * layout.cc (Layout::layout_reloc): In relocatable link don't
3686         combine reloc sections for grouped sections.
3687
3688 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
3689
3690         * gc.h (gc_process_relocs): Pass information on relocs pointing to
3691         sections that are not ordinary to icf.
3692         * icf.cc (get_section_contents): Handle relocation pointing to section
3693         with no object or shndx information.
3694         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
3695         * testsuite/Makefile.in: Regenerate.
3696         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
3697         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
3698
3699 2010-04-22  Ian Lance Taylor  <iant@google.com>
3700
3701         * expression.cc (Expression::Expression_eval_info): Add
3702         result_alignment_pointer field.
3703         (Expression::eval_with_dot): Add result_alignment_pointer
3704         parameter.  Change all callers.
3705         (Expression::eval_maybe_dot): Likewise.
3706         (class Binary_expression): Add alignment_pointer parameter to
3707         left_value and right_value.  Change all callers.
3708         (BINARY_EXPRESSION): Set result alignment.
3709         (class Trinary_expression): Add alignment_pointer parameter to
3710         arg2_value and arg3_value.  Change all callers.
3711         (Trinary_cond::value): Set result alignment.
3712         (Max_expression::value, Min_expression::value): Likewise.
3713         (Align_expression::value): Likewise.
3714         * script-sections.cc (class Sections_element): Add dot_alignment
3715         parameter to set_section_addresses virtual function.  Update
3716         instantiations.
3717         (class Output_section_element): Likewise.
3718         (Script_sections::create_segments): Add dot_alignment parameter.
3719         Change all callers.
3720         (Script_sections::create_segments_from_phdrs_clause): Likewise.
3721         (Script_sections::set_phdrs_clause_addresses): Likewise.
3722         * script-sections.h: Update declarations.
3723         * script.h: Update declarations.
3724         * output.h (Output_segment::set_minimum_p_align): Don't decrease
3725         min_p_align.
3726         * testsuite/script_test_3.t: Set large alignment.
3727         * testsuite/script_test_3.sh: Make sure that at least one LOAD
3728         segment has expected alignment.
3729
3730 2010-04-22  Nick Clifton  <nickc@redhat.com>
3731
3732         * po/gold.pot: Updated by the Translation project.
3733         * po/vi.po: Updated Vietnamese translation.
3734
3735 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
3736
3737         * testsuite/Makefile.am (check_PROGRAMS): Add
3738         icf_virtual_function_folding_test.
3739         * testsuite/Makefile.in: Regenerated.
3740
3741 2010-04-15  Andrew Haley  <aph@redhat.com>
3742
3743         * options.h (merge_exidx_entries): New option.
3744         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
3745         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
3746         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
3747         (Target_arm::merge_exidx_entries): New function.
3748         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
3749         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
3750         to Arm_exidx_fixup constructor.
3751         Add new arg, merge_exidx_entries.
3752         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
3753         Arm_output_section::fix_exidx_coverage.
3754
3755 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
3756
3757         * icf.cc (get_section_contents): Check for preemptible functions.
3758         Ignore addend when appropriate.
3759         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
3760         section folded.
3761         (add_from_relobj): Check for section folded.
3762         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
3763         * symtab.h (should_add_dynsym_entry): Add new parameter.
3764         * target-reloc.h (scan_relocs): Check for section folded.
3765         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
3766         Check reloc types for function pointers in shared objects.
3767         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
3768         case.
3769         (icf_preemptible_functions_test): New test case.
3770         (icf_string_merge_test): New test case.
3771         * testsuite.Makefile.in: Regenerate.
3772         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
3773         bar_glob.  Refactor code.
3774         * testsuite/icf_preemptible_functions_test.cc: New file.
3775         * testsuite/icf_preemptible_functions_test.sh: New file.
3776         * testsuite/icf_string_merge_test.cc: New file.
3777         * testsuite/icf_string_merge_test.sh: New file.
3778         * testsuite/icf_virtual_function_folding_test.cc: New file.
3779         * testsuite/icf_virtual_function_folding_test.sh: New file.
3780
3781 2010-04-14  Doug Kwan  <dougkwan@google.com>
3782
3783         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
3784         for local symbol recounting if we remove a section due to ICF.
3785         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
3786         there are no regular objects in input.
3787
3788 2010-04-13  Doug Kwan  <dougkwan@google.com>
3789
3790         * arm.cc (Arm_input_section::set_final_data_size): Compute
3791         accurate final data size instead of using current data size.
3792
3793 2010-04-09  Doug Kwan  <dougkwan@google.com>
3794
3795         * layout.cc (Layout::choose_output_section): Handle script section
3796         types.
3797         (Layout::make_output_section_for_script): Add section type parameter.
3798         Handle script section types.
3799         * layout.h (Layout::make_output_section_for_script): Add section
3800         type parameter.
3801         * output.cc (Output_section::Output_section): Initialize data member
3802         is_noload_.
3803         (Output_section::do_reset_address_and_file_offset): Do not set address
3804         to 0 if section is a NOLOAD section.
3805         * output.h (Output_section::is_noload): New method.
3806         (Output_section::set_is_noload): Ditto.
3807         (Output_section::is_noload_): New data member.
3808         * script-c.h (Script_section_type): New enum type.
3809         (struct Parser_output_section_header): Add new file section_type.
3810         * script-sections.cc (Sections_element::output_section_name): Add
3811         parameter for returning script section type.
3812         (Output_section_definition::output_section_name): Ditto.
3813         (Output_section_definition::section_type)P; New method.
3814         (Output_section_definiton::script_section_type_name): Ditto.
3815         (Output_section_definition::script_section_type_): New data member.
3816         (Output_section_definition::Output_section_definition): Initialize
3817         data member Output_section_definition::script_section_type_.
3818         (Output_section_definition::create_sections): Pass script section type
3819         to Layout::make_output_section_for_script.
3820         (Output_section_definition::output_section_name): Return script
3821         section type to caller.
3822         (Output_section_definition::set_section_address): Do not advance
3823         dot value and load address if section type is NOLOAD.  Set address
3824         of NOLOAD sections regardless of section flags.
3825         (Output_section_definition::print): Print section type if it is
3826         not SCRIPT_SECTION_TYPE_NONE.
3827         (Output_section_definition::section_type): New method.
3828         (Output_section_definition::script_section_type_name): Ditto.
3829         (Script_sections::output_section_name): Add new parameter
3830         PSECTION_TYPE for returning script section type.  Pass it to
3831         section elements.  Handle discard sections.
3832         (Sort_output_sections::operator()): Handle NOLOAD sections.
3833         * script-sections.h (Script_sections::Section_type): New enum type.
3834         (Script_sections::output_section_name): Add a new parameter for
3835         returning script section type.
3836         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
3837         INFO and NOLOAD.
3838         * yyscript.y (union): Add new field SECTION_TYPE.
3839         (COPY, DSECT, INFO, NOLOAD): New tokens.
3840         (opt_address_and_section_type): Change type to output_section_header.
3841         (section_type): New non-terminal
3842         (section_header): Handle section type.
3843         (opt_address_and_section_type): Return section type value.
3844
3845 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
3846
3847         * testsuite/plugin_common_test_1.c (foo): Add prototype.
3848         * testsuite/plugin_common_test_2.c (foo): Likewise.
3849
3850 2010-04-08  Doug Kwan  <dougkwan@google.com>
3851
3852         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
3853         Output_merge_data.
3854         * output.cc (Output_section::add_merge_input_section): Simplify
3855         code and return status of Output_merge_base::add_input_section.
3856         Update merge section map only if Output_merge_base::add_input_section
3857         returns true.
3858
3859 2010-04-07  Doug Kwan  <dougkwan@google.com>
3860
3861         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
3862         if section is marked as containing instructions but has no mapping
3863         symbols.
3864         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
3865         correct section index.
3866         (Arm_relobj::find_linked_text_section): Ditto.
3867
3868 2010-04-07  Cary Coutant  <ccoutant@google.com>
3869
3870         * archive.cc (include_member): Destroy Read_symbols_data object before
3871         releasing file.
3872         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
3873         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
3874         (Read_symbols_data::~Read_symbols_data) New destructor.
3875         (Section_relocs::Section_relocs) New constructor.
3876         (Section_relocs::~Section_relocs) New destructor.
3877         (Read_relocs_data::Read_relocs_data) New constructor.
3878         (Read_relocs_data::~Read_relocs_data) New destructor.
3879         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
3880         pointers to NULL after deleting.
3881
3882 2010-04-07  Doug Kwan  <dougkwan@google.com>
3883
3884         * arm.cc: Replace "endianity" with "endianness" in comments.
3885         (Arm_exidx_cantunwind): Ditto.
3886         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
3887         (Arm_relobj::merge_flags_and_attributes): New method.
3888         (Arm_relobj::merge_flags_and_attributes_): New data member.
3889         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
3890         (Arm_relobj::scan_sections_for_stubs): Ditto.
3891         (Arm_relobj::do_read_symbols): Check to see if we really want to
3892         merge processor-specific flags and attributes.  Exit early if
3893         an object is empty except for section names and the undefined symbol.
3894         (Target_arm::do_finalize_sections): Move check for ELF format to
3895         Arm_relobj::do_read_symbols.  Merge processor specific flags and
3896         attributes from a regular object only when we have determined that
3897         it is aapropriate.  Do not create an .ARM.attributes section in
3898         output if there is no regular input object.
3899         (Target_arm::merge_processor_specific_flags): Check
3900         --warn-mismatch before printing any error.
3901         (Target_arm::merge_object_attributes): Ditto.
3902         * gold.cc (queue_middle_tasks): Handle the case in which there is
3903         no regular object in input.
3904         * options.cc (General_options::parse_EB): New method.
3905         (General_options::parse_EL): Same.
3906         (General_options::General_options): Initialize endianness_.
3907         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
3908         New options.
3909         (General_options::Endianness): New enum.
3910         (General_options::endianness): New method.
3911         (General_options::endianness_): New data member.
3912         * parameters.cc (Parameters::set_options): Check target endianness.
3913         (Parameters::set_target_once): Ditto.
3914         (Parameters::check_target_endianness): New method.
3915         (parameters_force_valid_target): If either -EL or -EB is specified,
3916         use it to define endianness of default target.
3917         * parameters.h (Parameters::check_target_endianness): New method
3918         declaration.
3919         * target.h (class Target): Change "endianity" to "endianness"
3920         in comments.
3921
3922 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3923
3924         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
3925         * configure: Regenerate.
3926         * Makefile.in: Regenerate.
3927         * testsuite/Makefile.in: Regenerate.
3928
3929 2010-04-06  Cary Coutant  <ccoutant@google.com>
3930
3931         gcc PR lto/42757
3932         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
3933         prevailing definitions of common symbols.
3934         * testsuite/plugin_test_6.sh: New test case.
3935         * testsuite/plugin_common_test_1.c: New test case.
3936         * testsuite/plugin_common_test_2.c: New test case.
3937         * testsuite/Makefile.am (plugin_test_6): New test case.
3938         * testsuite/Makefile.in: Regenerate.
3939
3940 2010-04-06  Nick Clifton  <nickc@redhat.com>
3941
3942         * po/vi.po: New Vietnamese translation.
3943
3944 2010-03-30  Doug Kwan  <dougkwan@google.com>
3945
3946         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
3947
3948 2010-03-25  Doug Kwan  <dougkwan@google.com>
3949
3950         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
3951         to avoid a conversion warning on a 32-bit host.
3952
3953 2010-03-24  Ian Lance Taylor  <iant@google.com>
3954
3955         * testsuite/script_test_3.t: Add a TLS segment.
3956         * testsuite/Makefile.am (check_PROGRAMS): Add
3957         tls_phdrs_script_test.
3958         (tls_phdrs_script_test_SOURCES): Define.
3959         (tls_phdrs_script_test_DEPENDENCIES): Define.
3960         (tls_phdrs_script_test_LDFLAGS): Define.
3961         (tls_phdrs_script_test_LDADD): Define.
3962         * testsuite/Makefile.in: Rebuild.
3963
3964 2010-03-23  Cary Coutant  <ccoutant@google.com>
3965
3966         * fileread.cc (find_or_make_view): Fix comment.
3967
3968 2010-03-23  Ian Lance Taylor  <iant@google.com>
3969
3970         * script-sections.cc (class Orphan_section_placement): Define
3971         PLACE_TLS and PLACE_TLS_BSS.
3972         (Orphan_section_placement::Orphan_section_placement): Initialize
3973         new places.
3974         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
3975         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
3976         (tls_script_test_SOURCES): Define.
3977         (tls_script_test_DEPENDENCIES): Define.
3978         (tls_script_test_LDFLAGS): Define.
3979         (tls_script_test_LDADD): Define.
3980         * testsuite/Makefile.in: Rebuild.
3981
3982 2010-03-22  Doug Kwan  <dougkwan@google.com>
3983
3984         * arm.cc (Arm_relocate_functions::abs8,
3985         Arm_relocate_functions::abs16): Use correct check for overflow
3986         specified in the ARM ELF specs.
3987         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
3988         target of a BLX instruction specially.
3989         (Reloc_stub::stub_type_for_reloc): Ditto.
3990         (Relocate::relocate): Use symbolic names instead of numeric relocation
3991         codes to report error.
3992         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
3993         workaround.
3994         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
3995         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
3996         thumb2_blx_out_of_range.stdout
3997         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
3998         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
3999         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
4000         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
4001         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
4002         thumb2_blx_in_range, thumb2_blx_in_range.o,
4003         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
4004         thumb2_blx_out_of_range.o): New rules.
4005         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
4006         thumb2_blx_in_range and thumb2_blx_out_of_range.
4007         * testsuite/Makefile.in: Regenerate.
4008         * arm_branch_in_range.sh: Add tests for THUMB BLX.
4009         * testsuite/thumb_blx_in_range.s: New file.
4010         * testsuite/thumb_blx_out_of_range.s: New file.
4011
4012 2010-03-22  Rafael Espindola  <espindola@google.com>
4013
4014         * archive.cc (Should_include): Move to archive.h.
4015         (should_include_member): Make it a member of Archive.
4016         (Lib_group): New.
4017         (Add_lib_group_symbols): New.
4018         * archive.h: Include options.h.
4019         (Archive_member): Moved from Archive.
4020         (Should_include): Moved from archive.cc.
4021         (Lib_group): New.
4022         (Add_lib_group_symbols): New.
4023         * dynobj.cc (do_should_include_member): New.
4024         * dynobj.h (do_should_include_member): New.
4025         * gold.cc (queue_initial_tasks): Update call to queue.
4026         * main.cc (main): Print lib group stats.
4027         * object.cc (do_should_include_member): New.
4028         * object.h: Include archive.h.
4029         (Object::should_include_member): New.
4030         (Object::do_should_include_member): New.
4031         (Sized_relobj::do_should_include_member): New.
4032         * options.cc (General_options::parse_start_lib): New.
4033         (General_options::parse_end_lib): New.
4034         (Input_arguments::add_file): Handle lib groups.
4035         (Input_arguments::start_group): Check we are not in a lib.
4036         (Input_arguments::start_lib): New.
4037         (Input_arguments::end_lib): New.
4038         * options.h (General_options): Add start_lib and end_lib.
4039         (Input_argument::lib_): New.
4040         (Input_argument::lib): New.
4041         (Input_argument::is_lib): New.
4042         (Input_file_lib): New.
4043         (Input_arguments::in_lib_): New.
4044         (Input_arguments::in_lib): New.
4045         (Input_arguments::start_lib): New.
4046         (Input_arguments::end_lib_): New.
4047         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
4048         in unused members as preempted.
4049         (Sized_pluginobj::do_should_include_member): New.
4050         * plugin.h (Sized_pluginobj::do_should_include_member): New.
4051         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
4052         return the blocker.
4053         (Read_symbols::do_whole_lib_group): New.
4054         (Read_symbols::do_lib_group): New.
4055         (Read_symbols::do_read_symbols): Handle lib groups.
4056         (Read_symbols::get_name): Handle lib groups.
4057         * readsyms.h (Read_symbols): Add an archive member pointer.
4058         (Read_symbols::do_whole_lib_group): New.
4059         (Read_symbols::do_lib_group): New.
4060         (Read_symbols::member_): New.
4061         * script.cc (read_input_script): Update call to queue_soon.
4062
4063 2010-03-19  Doug Kwan  <dougkwan@google.com>
4064
4065         * arm.cc (Stub_table::Stub_table): Initialize new data members
4066         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
4067         (Stub_table::add_reloc_stub): Assign stub offset and update
4068         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
4069         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
4070         New data members.
4071         (Stub_table::update_data_size_and_addralign): Use
4072         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
4073         instead of going over all reloc stubs.
4074         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
4075         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
4076         Stringpool_template::offset_ to size of Stringpool_char.
4077         (Stringpool_template::new_key_offset): Remove code to initialize
4078         Stringpool_template::offset_.
4079         * stringpool.h (Stringpool_template::set_no_zero_null): Set
4080         Stringpool_template::offset_ to zero.
4081
4082 2010-03-15  Doug Kwan  <dougkwan@google.com>
4083
4084         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
4085         offset_.
4086         (Stringpool_template::new_key_offset): New method.
4087         (Stringpool_template::add_string): Assign offsets when adding new
4088         strings.
4089         (Stringpool_template::set_string_offsets): Do not set string offsets
4090         when not optimizing.
4091         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
4092         member size_.
4093         (Chunked_vector::clear): Clear size_.
4094         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
4095         (Chunked_vector::size): Return size_.
4096         (Chunked_vector::push_back): Use size_ to find insert position.
4097         (Chunked_vector::size_): New data member.
4098         (Stringpool_template::set_no_zero_null): Assert string set is empty.
4099         (Stringpool_template::new_key_offset): New method declaration.
4100         (Stringpool_template::offset_): New data member.
4101
4102 2010-03-15   Rafael Espindola  <espindola@google.com>
4103
4104         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
4105         Add_symbols' constructor.
4106         * readsyms.h (Add_symbols): Remove the input_group member.
4107
4108 2010-03-10  Ian Lance Taylor  <iant@google.com>
4109
4110         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
4111         target to ask whether a reference to a symbol requires a stack
4112         split.
4113         * target.h (Target::is_call_to_non_split): New function.
4114         (Target::do_is_call_to_non_split): Declare virtual function.
4115         * target.cc: Include "symtab.h".
4116         (Target::do_is_call_to_non_split): New function.
4117         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
4118
4119 2010-03-10  Cary Coutant  <ccoutant@google.com>
4120
4121         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
4122         (File_read::open[1]): Remove initial mapping of whole_file_view_.
4123         (File_read::open[2]): Add whole_file_view_ to list of views.
4124         (File_read::make_view): Remove test of whole_file_view_.
4125         (File_read::find_or_make_view): Create whole_file_view_ if
4126         necessary.
4127         (File_read::clear_views): Replace bool parameter with enum;
4128         adjust all callers.  Don't delete views with permanent data;
4129         do delete cached views and views from archives if
4130         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
4131         if clearing the corresponding view.
4132         * fileread.h (File_read::Clear_views_mode): New enum.
4133         (File_read::View::is_permanent_view): New method.
4134         (File_read::clear_views): Replace bool parameter
4135         with enum; adjust all callers.
4136         * options.h (General_options): Change keep_files_mapped option;
4137         add map_whole_files.
4138         * readsyms.cc (Add_symbols::run): Delete sd_ object before
4139         releasing the file.
4140         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
4141         the file.
4142
4143 2010-03-10  David S. Miller  <davem@davemloft.net>
4144
4145         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
4146
4147 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
4148
4149         * icf.cc (get_section_contents): Add '@' marker after processing the
4150         merge reloc.
4151
4152 2010-03-08  Doug Kwan  <dougkwan@google.com>
4153
4154         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
4155         due to a conversion warning.
4156         (Arm_relobj::update_output_local_symbol_count): Check for local
4157         symbol with unset output index.
4158
4159 2010-03-05  Ian Lance Taylor  <iant@google.com>
4160
4161         * options.h (class General_options): Add --spare-dynamic-tags.
4162         * output.cc (Output_data_dynamic::set_final_data_size): Implement
4163         --spare-dynamic-tags.
4164
4165 2010-03-05  Ian Lance Taylor  <iant@google.com>
4166
4167         * incremental.cc: Include "libiberty.h".
4168
4169 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
4170
4171         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
4172         function, is_info_ member.
4173         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
4174         (Versions::Versions): Update caller.
4175         (Versions::define_base_version): Likewise.
4176         (Versions::add_def): Likewise.
4177
4178 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
4179
4180         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
4181         (Scan::possible_function_pointer_reloc): New function.
4182         (Scan::local_reloc_may_be_function_pointer): Change to call
4183         possible_function_pointer_reloc.
4184         (Scan::global_reloc_may_be_function_pointer): Ditto.
4185         * icf.h (Icf::check_section_for_function_pointers): Change to reject
4186         relocations in ".data.rel.ro._ZTV" section.
4187         * testsuite/icf_safe_so_test.sh: Change to pass i386.
4188         * testsuite/icf_safe_so_test.cc: Ditto.
4189         * testsuite/icf_safe_test.cc: Ditto.
4190         * testsuite/icf_safe_test.sh: Ditto.
4191
4192 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4193             Ian Lance Taylor  <iant@google.com>
4194
4195         * target-reloc.h (relocate_section): Check the symbol table index
4196         for -1U before setting the local symbol index.
4197         (scan_relocatable_relocs): If copying the relocation, record that
4198         the local symbol is required.
4199         * object.h (Symbol_value::is_output_symtab_index_set): New
4200         function.
4201         (Symbol_value::may_be_discarded_from_output_symtab): New
4202         function.
4203         (Symbol_value::has_output_symtab_entry): New function.
4204         (Symbol_value::needs_output_symtab_entry): Remove.
4205         (Symbol_value::output_symtab_index): Make sure the symbol index is
4206         set.
4207         (Symbol_value::set_output_symtab_index): Make sure the symbol
4208         index is not set.  Make sure the new index is valid.
4209         (Symbol_value::set_must_have_output_symtab_entry): New function.
4210         (Symbol_value::has_output_dynsym_entry): New function.
4211         (Symbol_value::set_output_dynsym_index): Make sure the new index
4212         is valid.
4213         (Sized_relobj::set_must_have_output_symtab_entry): New function.
4214         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
4215         local symbol if permitted.
4216         (Sized_relobj::do_finalize_local_symbols): Call
4217         is_output_symtab_index_set rather than needs_output_symtab_entry.
4218         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
4219         rather than needs_output_symtab_entry.  Call
4220         has_output_dynsym_entry rather than needs_output_dynsym_entry.
4221         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
4222         is_output_symtab_index_set rather than needs_output_symtab_entry.
4223         * testsuite/discard_locals_relocatable_test.c: New file.
4224         * testsuite/discard_locals_test.sh: Test -r.
4225         * testsuite/Makefile.am (check_DATA): Add
4226         discard_locals_relocatable_test1.syms,
4227         discard_local_relocatable_test2.syms.
4228         (MOSTLYCLEANFILES): Likewise.  Also add
4229         discard_locals_relocatable_test1.lout and
4230         discard_locals_relocatable_test2.out.
4231         (discard_locals_relocatable_test1.syms): New target.
4232         (discard_locals_relocatable_test.o): New target.
4233         (discard_locals_relocatable_test1.out): New target.
4234         (discard_locals_relocatable_test2.syms): New target.
4235         (discard_locals_relocatable_test2.out): New target.
4236         (various): Add missing ../ld-new dependencies.
4237         * testsuite/Makefile.in: Rebuild.
4238
4239 2010-03-03  Nick Clifton  <nickc@redhat.com>
4240
4241         * po/fi.po: New Finnish translation.
4242
4243 2010-03-01  Doug Kwan  <dougkwan@google.com>
4244
4245         * layout.cc (Layout::Layout): Force section types of .init_array*,
4246         .preinit_array* and .fini_array* sections.
4247         * output.cc (Output_section::Input_section_sort_entry::has_priority):
4248         Fix check of return value of std::string::find.().
4249         (Output_section::Input_section_sort_compare::operator()): Remove
4250         comment about .init_array.
4251         (Output_section::Input_section_sort_init_fini_compare::operator()):
4252         New method.
4253         (Output_section::sort_attached_input_sections): Handle .init_array
4254         and .fini_array specially.
4255         * output.h (Output_section::Inut_section_sort_compare): Update
4256         comment.
4257         (Output_section::Input_section_sort_init_fini_compare): New struct.
4258
4259 2010-02-26  Doug Kwan  <dougkwan@google.com>
4260
4261         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
4262         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
4263         * testsuite/debug_msg.sh: Avoid matching source line number for
4264         use of global variable undef_int.
4265
4266 2010-02-26  Doug Kwan  <dougkwan@google.com>
4267
4268         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
4269         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
4270         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
4271         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
4272         * options.cc (General_options::General_options): Initialize member
4273         fix_v4bx_.
4274         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
4275         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
4276         and rm_no_fix_v4bx.stdout
4277         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
4278         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
4279         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
4280         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
4281         and arm_no_fix_v4bx.
4282         * Makefile.in: Regenerate.
4283         * testsuite/arm_fix_v4bx.s: New file.
4284         * testsuite/arm_fix_v4bx.sh: Ditto.
4285
4286 2010-02-24  Doug Kwan  <dougkwan@google.com>
4287
4288         * arm.cc (Target_arm::got_section): Make the .got section the first
4289         non RELRO section in the data segment.
4290         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
4291         suffixes of section names.
4292
4293 2010-02-24  Doug Kwan  <dougkwan@google.com>
4294
4295         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
4296         flags and attributes merging if an input file is a binary file.
4297         * fileread.cc (Input_file::open): Record format of original file.
4298         * fileread.h (Input_file::Format): New enum type.
4299         (Input_file::Input_file): Initialize data member format_.
4300         (Input_file::format): New method definition.
4301         (Input_file::format_):: New data member.
4302
4303 2010-02-24  Doug Kwan  <dougkwan@google.com>
4304
4305         * arm.cc (Arm_output_data_got): New class.
4306         (ARM_TCB_SIZE): New constant
4307         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
4308         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
4309         If user uses a script with a SECTIONS clause, issue only a warning
4310         for a misplaced EXIDX input section.  Otherwise, issue an error.
4311         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
4312         garbage collection.
4313         (Target_arm::got_mode_index_entry): Handle static linking.
4314         (Target_arm::Scan::local): Ditto.
4315         (Target_arm::Scan::global): Ditto.
4316         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
4317         all incorrectly implemented relocations.
4318         (Target_arm::fix_exidx_coverage): Pass layout to
4319         Arm_output_section::fix_exidx_coverage.
4320         * layout.cc (Layout::section_name_mapping): Remove trailing dots
4321         from ".ARM.exidx." and ".ARM.extab.".
4322
4323 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4324
4325         * arm.cc (Target_arm::do_finalize_sections): Create attribute
4326         section if it does not already exist.
4327         * attributes.cc (Attributes_section_data::Attributes_section_data):
4328         Don't crash if size is zero.
4329
4330 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4331             Ian Lance Taylor  <iant@google.com>
4332
4333         * gold.cc (queue_middle_tasks): If no input files were opened,
4334         exit.
4335         * workqueue.h (Task_function::Task_function): Assert that there is
4336         a blocker.
4337
4338 2010-02-22  Doug Kwan  <dougkwan@google.com>
4339
4340         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
4341         * icf.cc (get_section_contents): Cast snprintf arguments to long long
4342         types to avoid warnings due to different uint64_t implementations
4343         on different hosts.
4344
4345 2010-02-21  Doug Kwan  <dougkwan@google.com>
4346
4347         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
4348         handling of the maximum backward branch offset.
4349         (Arm_relocate_functions::thumb_branch_common): Ditto.
4350         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
4351         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
4352         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
4353         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
4354         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
4355         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
4356         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
4357         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
4358         thumb_bl_out_of_range thumb_bl_out_of_range.o,
4359         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
4360         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
4361         thumb2_bl_out_of_range.o): New rules.
4362         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
4363         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
4364         thumb2_bl_out_of_range
4365         * testsuite/Makefile.in: Regenerate.
4366         * testsuite/arm_bl_in_range.s: New file.
4367         * testsuite/arm_bl_out_of_range.s: Ditto.
4368         * testsuite/arm_branch_in_range.sh: Ditto.
4369         * testsuite/arm_branch_range.t: Ditto.
4370         * testsuite/thumb2_branch_range.t: Ditto.
4371         * testsuite/thumb_bl_in_range.s: Ditto.
4372         * testsuite/thumb_bl_out_of_range.s: Ditto.
4373         * testsuite/thumb_branch_range.t: Ditto.
4374
4375 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
4376
4377         * gc.h (gc_process_relocs): Change vectors to point to the new list.
4378         Add reloc offset information.
4379         * icf.cc (get_section_contents): Change iterators to point to the new
4380         vectors. Add reloc offset information to the contents.
4381         * icf.h (Icf::Sections_reachable_info): New typedef.
4382         (Icf::Sections_reachable_list): New typedef.
4383         (Icf::Offset_info): New typedef.
4384         (Icf::Reloc_info): New struct typedef.
4385         (Icf::Reloc_info_list): New typedef.
4386         (Icf::symbol_reloc_list): Delete method.
4387         (Icf::addend_reloc_list): Delete method.
4388         (Icf::section_reloc_list): Delete method.
4389         (Icf::reloc_info_list): New method.
4390         (Icf::reloc_info_list_): New member.
4391
4392 2010-02-19  Doug Kwan  <dougkwan@google.com>
4393
4394         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
4395         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
4396         * arm.cc (Arm_relocation_functions): New forward declaration.
4397         (Target_arm::Target_arm): Initialize new data members
4398         got_mod_index_offset_ and tls_base_symbol_defined_.
4399         (Target_arm::Relocate::relocate_tls): New method.
4400         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
4401          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
4402         New methods.
4403         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
4404         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
4405         (Target_arm::got_mod_index_offset_,
4406         Target_arm::tls_base_symbol_defined_): New data members.
4407         (Target_arm::Scan::local, Target::Scan::global,
4408         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
4409         relocations.
4410
4411 2010-02-18  Doug Kwan  <dougkwan@google.com>
4412
4413         * arm.cc (Arm_relobj::find_linked_text_section): New method.
4414         (Arm_relobj::make_exidx_input_section): Pass section index of linked
4415         text section as a parameter becuase some broken tools may not set
4416         the link in section header.
4417         (Target_arm::has_got_section): New method.
4418         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
4419         without any mapping symbol as data only.  Remove warning.
4420         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
4421         link in its section header, try to discover the link by inspecting the
4422         REL31 relocation at the beginning of the section.
4423         (Target_arm::Scan::check_non_pic): Report name of offending relocation
4424         in error message.
4425         (Target_arm::Scan::global): Treat any reference to the symbol
4426         _GLOBAL_OFFSET_TABLE_ as a GOT access.
4427
4428 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
4429
4430         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
4431         (Scan::global_reloc_may_be_function_pointer): New function.
4432         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
4433         (Scan::global_reloc_may_be_function_pointer): New function.
4434         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
4435         (Scan::global_reloc_may_be_function_pointer): New function.
4436         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
4437         (Scan::global_reloc_may_be_function_pointer): New function.
4438         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
4439         (Scan::global_reloc_may_be_function_pointer): New function.
4440         (Scan::possible_function_pointer_reloc): New function.
4441         (Target_x86_64::can_check_for_function_pointers): New function.
4442         * gc.h (gc_process_relocs): Scan relocation types to determine if
4443         function pointers were taken for targets that support it.
4444         * icf.cc (Icf::find_identical_sections): Include functions for
4445         folding in safe ICF whose pointer is not taken.
4446         * icf.h (Secn_fptr_taken_set): New typedef.
4447         (fptr_section_id_): New member.
4448         (section_has_function_pointers): New function.
4449         (set_section_has_function_pointers): New function.
4450         (check_section_for_function_pointers): New function.
4451         * options.h: Fix comment for safe ICF option.
4452         * target.h (can_check_for_function_pointers): New function.
4453         * testsuite/Makefile.am: Add icf_safe_so_test test case.
4454         Modify icf_safe_test for X86-64.
4455         * testsuite/Makefile.in: Regenerate.
4456         * testsuite/icf_safe_so_test.cc: New file.
4457         * testsuite/icf_safe_so_test.sh: New file.
4458         * testsuite/icf_safe_test.cc (kept_func_3): New function.
4459         (main): Change to take pointer to function kept_func_3.
4460         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
4461         folding is done correctly for X86-64.
4462
4463 2010-02-12  David S. Miller  <davem@davemloft.net>
4464
4465         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
4466         is_symbolless parameter.
4467         (Output_reloc<SHT_REL>::is_symbolless): New.
4468         (Output_reloc<SHT_REL>::is_symbolless_): New.
4469         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
4470         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
4471         (Output_reloc<SHT_RELA>::is_symbolless): New.
4472         (Output_data_reloc::add_global): Handle is_symbolless.
4473         (Output_data_reloc::add_global_relative): Likewise.
4474         (Output_data_reloc::add_local): Likewise.
4475         (Output_data_reloc::add_local_relative): Likewise.
4476         (Output_data_reloc::add_symbolless_global_addend): New.
4477         (Output_data_reloc::add_symbolless_local_addend): New.
4478         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
4479         is_symbolless.
4480         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
4481         instead of ->is_relative_
4482         (Output_reloc::write): Likewise.
4483         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
4484         (Output_reloc::write_rel): Simplify.
4485
4486         * sparc.cc (Target_sparc::Scan::local): Use
4487         ->add_symbolless_local_addend as needed.
4488         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
4489         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
4490         based upon relocation offset.
4491
4492 2010-02-11  Doug Kwan  <dougkwan@google.com>
4493
4494         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
4495         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
4496         beginning of function.
4497         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
4498         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
4499         parameter is_32bit in calls to should_apply_static_reloc.
4500         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
4501         (check_DATA): Add arm_abs_global.stdout.
4502         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
4503         arm_abs_global.stdout): New rules.
4504         (MOSTLLYCLEANFILES): Add arm_abs_global
4505         * Makefile.in: Regenerate.
4506         * testsuite/arm_abs_global.s: New file.
4507         * testsuite/arm_abs_global.sh: Ditto.
4508         * testsuite/arm_abs_lib.s: Ditto.
4509
4510 2010-02-11  Ian Lance Taylor  <iant@google.com>
4511
4512         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
4513         Read_relocs task.
4514         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
4515         Allocate_commons_task first.
4516         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
4517         task, rather than symtab_lock_.
4518         (Gc_process_relocs::~Gc_process_relocs): New function.
4519         (Gc_process_relocs::is_runnable): Check this_blocker_.
4520         (Gc_process_relocs::locks): Use next_blocker_ rather than
4521         blocker_.
4522         (Scan_relocs::~Scan_relocs): New function.
4523         (Scan_relocs::is_runnable): Check this_blocker_ rather than
4524         symtab_lock_.
4525         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
4526         next_blocker_.
4527         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
4528         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
4529         constructor accordingly.
4530         (class Gc_process_relocs): Likewise.
4531         (class Scan_relocs): Likewise.
4532         * common.h (class Allocate_commons_task): Remove symtab_lock_
4533         field, and corresponding constructor parameter.
4534         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
4535         symtab_lock_.
4536         (Allocate_commons_task::locks): Likewise.
4537
4538 2010-02-11  Ian Lance Taylor  <iant@google.com>
4539
4540         * gold-threads.h (class Once): Define.
4541         (class Initialize_lock): Rewrite as child of Once.
4542         * gold-threads.cc (class Once_initialize): Define.
4543         (once_pointer_control): New static variable.
4544         (once_pointer, once_arg): New static variables.
4545         (c_run_once): New static function.
4546         (Once::Once, Once::run_once, Once::internal_run): New functions.
4547         (class Initialize_lock_once): Remove.
4548         (initialize_lock_control): Remove.
4549         (initialize_lock_pointer): Remove.
4550         (initialize_lock_once): Remove.
4551         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
4552         (Initialize_lock::initialize): Rewrite.
4553         (Initialize_lock::do_run_once): New function.
4554         * archive.cc (Archive::interpret_header): Only clear name if it is
4555         not already empty.
4556         * fileread.cc: Include "gold-threads.h"
4557         (file_counts_lock): New static variable.
4558         (file_counts_initialize_lock): Likewise.
4559         (File_read::release): Only increment counts when using --stats.
4560         Use a lock around the increment.
4561         * parameters.cc (class Set_parameters_target_once): Define.
4562         (set_parameters_target_once): New static variable.
4563         (Parameters::Parameters): Move here from parameters.h.
4564         (Parameters::set_target): Rewrite.
4565         (Parameters::set_target_once): New function.
4566         (Parameters::clear_target): Move here and rewrite.
4567         * parameters.h (class Parameters): Update declarations.  Add
4568         set_parameters_target_once_ field.
4569         (Parameters::Parameters): Move to parameters.cc.
4570         (Parameters::clear_target): Likewise.
4571         * readsyms.cc (Read_symbols::do_group): Create a Start_group
4572         task.
4573         (Start_group::~Start_group): New function.
4574         (Start_group::is_runnable): New function.
4575         (Start_group::locks, Start_group::run): New functions.
4576         (Finish_group::run): Change saw_undefined to size_t.
4577         * readsyms.h (class Start_group): Define.
4578         (class Finish_group): Change saw_undefined_ field to size_t.
4579         (Finish_group::Finish_group): Remove saw_undefined and
4580         this_blocker parameters.  Change all callers.
4581         (Finish_group::set_saw_undefined): New function.
4582         (Finish_group::set_blocker): New function.
4583         * symtab.h (class Symbol_table): Change saw_undefined to return
4584         size_t.  Change saw_undefined_ field to size_t.
4585         * target-select.cc (Set_target_once::do_run_once): New function.
4586         (Target_selector::Target_selector): Initialize set_target_once_
4587         field.  Don't initialize lock_ and initialize_lock_ fields.
4588         (Target_selector::instantiate_target): Rewrite.
4589         (Target_selector::set_target): New function.
4590         * target-select.h (class Set_target_once): Define.
4591         (class Target_selector): Update declarations.  Make
4592         Set_target_once a friend.  Remove lock_ and initialize_lock_
4593         fields.  Add set_target_once_ field.
4594
4595 2010-02-10  Ian Lance Taylor  <iant@google.com>
4596
4597         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
4598         queueing any tasks.
4599         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
4600         (queue_middle_tasks): Add all blockers before queueing any tasks.
4601         (queue_final_tasks): Likewise.
4602         * token.h (Task_token::add_blockers): New function.
4603         * object.h (Input_objects::number_of_relobjs): New function.
4604
4605 2010-02-10  Ian Lance Taylor  <iant@google.com>
4606
4607         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
4608         shared, not if not position independent.
4609         * x86_64.cc (Relocate::relocate_tls): Likewise.
4610         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
4611         (tls_pie_pic_test): New target.
4612         * testsuite/Makefile.in: Rebuild.
4613
4614         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
4615         (tls_test_main_pie.o, tls_test_pie.o): New targets.
4616         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
4617         * testsuite/Makefile.in: Rebuild.
4618
4619 2010-02-09  David S. Miller  <davem@davemloft.net>
4620
4621         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
4622         R_SPARC_RELATIVE using ->add_local_relative().
4623         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
4624
4625         * output.h (Output_data_dynamic::add_section_size): New method
4626         that takes two Output_data objects.
4627         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
4628         entry param.  Handle it in initializers.
4629         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
4630         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
4631         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
4632         arg.
4633         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
4634         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
4635         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
4636         for dynrel_includes_plt.
4637         * i386.cc (Target_i386::do_finalize_sections): Likewise.
4638         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4639         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
4640         before .rela.plt
4641         (Target_sparc::do_finalize_sections): Update to pass true for
4642         dynrel_includes_plt.
4643         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
4644         output before .rela.plt
4645         (Target_powerpc::do_finalize_sections): Update to pass true for
4646         dynrel_includes_plt when 32-bit.
4647
4648 2010-02-08  Doug Kwan  <dougkwan@google.com>
4649
4650         * arm.cc (Arm_relobj::simple_input_section_output_address): New
4651         method.
4652         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
4653         Arm_relobj::scan_section_for_cortex_a8_stubs,
4654         Arm_relobj::do_relocation_section): Instead of calling
4655         Output_section::output_address, use faster
4656         Arm_relobj::simple_input_section_output_address.
4657
4658 2010-02-08  David S. Miller  <davem@davemloft.net>
4659
4660         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
4661         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
4662         relocation helper function.
4663
4664         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
4665         just like R_SPARC_GOT{10,13,22}.
4666         (Target_sparc::Scan::local): Likewise.
4667         (Target_sparc::Relocate:relocate): Likewise.
4668
4669 2010-02-06  Ian Lance Taylor  <iant@google.com>
4670
4671         * configure.ac: Rewrite targetobjs duplicate removal code to use
4672         only shell constructs.
4673         * configure: Rebuild.
4674
4675 2010-02-05  Doug Kwan  <dougkwan@google.com>
4676
4677         PR 11247
4678         * arm.cc (Arm_relobj::section_is_scannable): New method.
4679         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
4680         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
4681
4682 2010-02-04  Doug Kwan  <dougkwan@google.com>
4683
4684         PR 11247
4685         * arm-reloc-property.cc (cstdio): Include.
4686         * configure.ac (targetobjs): Remove duplicates.
4687         * configure: Regenerate.
4688         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
4689         big and little endian version for a given address size.
4690
4691 2010-02-03  Doug Kwan  <dougkwan@google.com>
4692
4693         * arm-reloc-property.cc
4694         (Arm_reloc_property_table::reloc_name_in_error_message): New method
4695         definition.
4696         * arm-reloc-property.h
4697         (Arm_reloc_property_table::get_implemented_static_reloc_property):
4698         New method definition.
4699         (Arm_reloc_property_table::reloc_name_in_error_message): New method
4700         declaration.
4701         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
4702         overflow to N.
4703         (GOT_PREL): Change implemented to Y.
4704         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
4705         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
4706         (Arm_relocate_functions::movw_abs_nc): Remove method.
4707         (Arm_relocate_functions::movt_abs): Ditto.
4708         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
4709         (Arm_relocate_functions::thm_movt_abs): Ditto.
4710         (Arm_relocate_functions::movw_rel_nc): Ditto.
4711         (Arm_relocate_functions::movw_rel): Ditto.
4712         (Arm_relocate_functions::movt_rel): Ditto.
4713         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
4714         (Arm_relocate_functions:thm_movw_rel): Ditto.
4715         (Arm_relocate_functions:thm_movt_rel): Ditto.
4716         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
4717         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
4718         New method definitions.
4719         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
4720         (Arm_relocation_functions::arm_grp_ldr): Ditto.
4721         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
4722         (Arm_relocation_functions::arm_grp_ldc): Ditto.
4723         (Target_arm::Relocate::relocate): Check for non-static or
4724         unimplemented relocation code and exit early.  Change calls to
4725         Target_arm::reloc_uses_thumb_bit and
4726         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
4727         instead.  Refactor code to handle similar relocations to increase
4728         code sharing.  Remove check for unsupported relocation code in switch
4729         statement.
4730         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
4731         relocation property table to find out size.  Change error message to
4732         print out the name of a relocation code instead of the numeric value.
4733         (Target_arm::scan_reloc_for_stub): Use relocation property table
4734         instead of calling Target_arm::reloc_uses_thumb_bit().
4735
4736 2010-02-02  Doug Kwan  <dougkwan@google.com>
4737
4738         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
4739         types of relaxed input section.
4740
4741 2010-02-02  Doug Kwan  <dougkwan@google.com>
4742
4743         * Makefile.am (HFILES): Add arm-reloc-property.h.
4744         (DEFFILES): New.
4745         (TARGETSOURCES): Add arm-reloc-property.cc
4746         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
4747         (libgold_a_SOURCES): $(DEFFILES)
4748         * Makefile.in: Regenerate.
4749         * arm-reloc-property.cc: New file.
4750         * arm-reloc-property.h: New file.
4751         * arm-reloc.def: New file.
4752         * arm.cc: Update comments.
4753         (arm-reloc-property.h): New included header.
4754         (arm_reloc_property_table): New global variable.
4755         (Target_arm::do_select_as_default_target): New method definition.
4756         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
4757         arm-reloc-property to targ_extra_obj.
4758         * parameters.cc (set_parameters_target): Call
4759         Target::select_as_default_target().
4760         * target.h (Target::select_as_default_target): New method definition.
4761         (Target::do_select_as_default_target): Same.
4762
4763 2010-02-01  Doug Kwan  <dougkwan@google.com>
4764
4765         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
4766         first_output_text_section_.
4767         (Arm_exidx_fixup::first_output_text_section): New method definition.
4768         (Arm_exidx_fixup::first_output_text_section_): New data member.
4769         (Arm_exidx_fixup::process_exidx_section): Record the first text
4770         output section seen.
4771         (Arm_output_section::fix_exidx_coverage): Set correct linked section
4772         and entsize in output section header.
4773
4774 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4775
4776         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
4777         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
4778         (Arm_relocate_functions::thm_alu11): New Method.
4779         (Arm_relocate_functions::thm_pc8): New Method.
4780         (Arm_relocate_functions::thm_pc12): New Method.
4781         (Target_arm::Scan::local): Handle the relocations.
4782         (Target_arm::Scan::global): Likewise.
4783         (Target_arm::Relocate::relocate): Likewise.
4784         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
4785
4786 2010-01-29  Doug Kwan  <dougkwan@google.com>
4787
4788         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
4789         of relocation types as ld.
4790
4791 2010-01-29  Doug Kwan  <dougkwan@google.com>
4792
4793         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
4794         to public.
4795         (Arm_relocate_functions::thumb_branch_common): Ditto.
4796         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
4797         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
4798         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
4799         Arm_relocate_functions::jump24): Remove.
4800         (Target_arm::Relocate::relocate): Adjust code to call
4801         Arm_relocation_functions::arm_branch_common and
4802         Arm_relocation_functions::thumb_branch_common instead of their removed
4803         wrappers.  Merge switch-cases together to reduce source code size.
4804
4805 2010-01-29  Doug Kwan  <dougkwan@google.com>
4806
4807         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
4808         output_local_symbol_count_needs_update_.
4809         (Arm_relobj::output_local_symbol_count_needs_update,
4810          Arm_relobj::set_output_local_symbol_count_needs_update,
4811          Arm_relobj::update_output_local_symbol_count): New methods.
4812         (Arm_relobj::output_local_symbol_count_needs_update_): New data
4813         member.
4814         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
4815         of pointed function as in a R_ARM_PREL31 relocation.
4816         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
4817         for output local symbol count updating.
4818         (Target_arm::do_relax): Update output local symbol counts in objects
4819         if necessary.
4820         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
4821
4822 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4823
4824         * arm.cc: Added support for the ARM relocations:
4825         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
4826         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
4827         (Arm_relocate_functions::movw_rel_nc): Renamed (was
4828         movw_prel_nc).
4829         (Arm_relocate_functions::movw_rel): New method.
4830         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
4831         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
4832         thm_movw_prel_nc).
4833         (Arm_relocate_functions::thm_movw_rel): New method.
4834         (Arm_relocate_functions::thm_movt_rel): Renamed (was
4835         thm_movt_prel).
4836         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
4837         relocations.
4838         (Target_arm::Scan::global): Likewise.
4839         (Target_arm::Relocate::relocate): Likewise.
4840         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4841         Likewise.
4842
4843 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4844
4845         * arm.cc: Added support for ARM group relocations.
4846         (Target_arm::reloc_needs_sym_origin): New method.
4847         (Arm_relocate_functions::calc_grp_kn): New method.
4848         (Arm_relocate_functions::calc_grp_residual): New method.
4849         (Arm_relocate_functions::calc_grp_gn): New method.
4850         (Arm_relocate_functions::arm_grp_alu): New Method.
4851         (Arm_relocate_functions::arm_grp_ldr): New Method.
4852         (Arm_relocate_functions::arm_grp_ldrs): New Method.
4853         (Arm_relocate_functions::arm_grp_ldc): New Method.
4854         (Target_arm::Scan::local): Handle the ARM group relocations.
4855         (Target_arm::Scan::global): Likewise.
4856         (Target_arm::Relocate::relocate): Likewise.
4857         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4858         Likewise.
4859
4860 2010-01-26  Doug Kwan  <dougkwan@google.com>
4861
4862         * arm.cc (set): Include.
4863         (class Arm_exidx_fixup): Change type of last_input_section_ to const
4864         pointer type.
4865         (Arm_output_section::Text_section_list): New type.
4866         (Arm_output_section::append_text_sections_to_list): New method.
4867         (Arm_output_section::fix_exidx_coverage): Ditto.
4868         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
4869         (Arm_relobj::convert_input_section_to_relaxed_section): Use
4870         Relobj::set_section_offset() instead of
4871         Sized_relobj::invalidate_section_offset().
4872         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
4873         parameter for section headers. Ignore relocation sections for
4874         unallocated sections and EXIDX sections.
4875         (Target_arm::fix_exidx_coverage): New method.
4876         (Target_arm::output_section_address_less_than): New type.
4877         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
4878         linked text section instead of the EXIDX section.
4879         (Arm_output_section::create_stub_group): Add an assertion to check
4880         that this is not an EXIDX output section.
4881         (Arm_output_section::append_text_sections_to_list): New method.
4882         (Arm_output_section::fix_exidx_coverage): Ditto.
4883         (Arm_relobj::scan_sections_for_stubs): Adjust call to
4884         Arm_relobj::section_needs_reloc_stub_scanning.
4885         (Target_arm::do_relax): Fix EXIDX output section coverage in the
4886         first pass.
4887         (Target_arm::fix_exidx_coverage): New method.
4888         * object.h (Relobj::set_output_section): New method.
4889         (Sized_relobj::invalidate_section_offset): Remove method.
4890         (Sized_relobj::do_invalidate_section_offset): Remove method.
4891         (Sized_relobj::do_set_section_offset): Handle offset value -1.
4892
4893 2010-01-25  Doug Kwan  <dougkwan@google.com>
4894
4895         * arm.cc (Arm_exidx_merged_section::do_output_offset):
4896         Fix warning due to signed and unsigned comparison on a 32-bit host.
4897
4898 2010-01-22  Doug Kwan  <dougkwan@google.com>
4899
4900         * arm.cc (Target_arm::do_relax): Record an output section for section
4901         offset adjustment it contains any stub table that has changed.
4902         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
4903         offsets in an output section if necessary.
4904         * output.cc (Output_section::Output_section): Initialize
4905         section_offsets_need_adjustments_.
4906         (Output_section::add_input_section_for_script): Renamed to
4907         Output_section::add_simple_input_section.
4908         (Output_section::save_states): Add a comment.
4909         (Output_section::discard_states): New method defintion.
4910         (Output_section::adjust_section_offsets): Same.
4911         * output.h (Output_section::add_input_section_for_script): Renamed to
4912         Output_section::add_simple_input_section.
4913         (Output_section::discard_states): New method declaration.
4914         (Output_section::adjust_section_offsets): Same.
4915         (Output_section::section_offsets_need_adjustment,
4916         Output_section::set_section_offsets_need_adjustment): New method
4917         definitions.
4918         (Output_section::section_offsets_need_adjustment_): New data member.
4919         * script-sections.cc
4920         (Output_section_element_input::set_section_address): Adjust code for
4921         renaming of Output_section::add_input_section_for_script.
4922         (Orphan_output_section::set_section_address): Same.
4923
4924 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4925
4926         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
4927         Fix_v4bx enum values .
4928         * gold/options.h (General_options): New option definitions.
4929         (General_options::fix_v4bx): New method.
4930         (General_options::Fix_v4bx): New enum.
4931         * gold/options.cc (General_options::parse_fix_v4bx): New method.
4932         (General_options::parse_fix_v4bx_interworking): New method.
4933
4934 2010-01-22  Doug Kwan  <dougkwan@google.com>
4935
4936         * arm.cc (Arm_exidx_fixup): New class.
4937
4938 2010-01-21  Doug Kwan  <dougkwan@google.com>
4939
4940         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
4941         classes.
4942         (Arm_exidx_section_offset_map): New type.
4943
4944 2010-01-21  Doug Kwan  <dougkwan@google.com>
4945
4946         * arm.cc (Arm_exidx_input_section): New class.
4947         (Arm_relobj::exidx_input_section_by_link,
4948         Arm_relobj::exidx_input_section_by_shndx,
4949         Arm_relobj::make_exidx_input_section): New methods.
4950         (read_arm_attributes_section): Remove.
4951         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
4952         information about them.
4953         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
4954         to here.
4955
4956 2010-01-20  Doug Kwan  <dougkwan@google.com>
4957
4958         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
4959         Input_section_specifier to Section_id.
4960         (Target_arm::new_arm_input_section: Adjust code for change of key
4961         type.
4962         (Target_arm::find_arm_input_section): Ditto.
4963         * gc.h (object.h): Include for Section_id nand Section_id_hash.
4964         (Section_id): Remove.
4965         (Garbage_collection::Section_id_hash): Remove.
4966         * icf.h (object.h): Include for Section_id nand Section_id_hash.
4967         (Section_id): Remove.
4968         (Icf::Section_id_hash): Remove.
4969         * object.h (Section_id, Const_section_id, Section_id_hash,
4970         Const_section_id_hash): New type definitions.
4971         * output.cc (Output_section::add_relaxed_input_section): Change to
4972         use Const_section_id instead of Input_section_specifier as key type.
4973         (Output_section::add_merge_input_section): Ditto.
4974         (Output_section::build_relaxation_map): Change to use Section_id
4975         instead of Input_section_specifier as key type.
4976         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4977         Ditto.
4978         (Output_section::convert_input_sections_to_relaxed_sections): Change
4979         to use Const_section_id instead of Input_section_specifier as key type.
4980         (Output_section::find_merge_section): Ditto.
4981         (Output_section::find_relaxed_input_section): Ditto.
4982         * output.h (Input_section_specifier): Remove class.
4983         (Output_section::Output_section_data_by_input_section_map): Change
4984         key type to Const_section_id.
4985         (Output_section::Output_relaxed_input_section_by_input_section_map):
4986         Ditto.
4987         (Output_section::Relaxation_map): Change key type to Section_id.
4988
4989 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4990
4991         * gold/arm.cc: Added support for R_ARM_V4BX relocation
4992         (class Arm_v4bx_stub): New class.
4993         (DEF_STUBS): Updated definition to support v4_veneer_bx.
4994         (Stub_factory::make_arm_v4bx_stub): New method.
4995         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
4996         (Stub_table::empty): Handle v4bx stubs.
4997         (Stub_table::add_arm_v4bx_stub): New method.
4998         (Stub_table::find_arm_v4bx_stub): New method.
4999         (Arm_relocate_functions::v4bx): New method.
5000         (Target_arm::fix_v4bx): New method.
5001         (Target_arm::Target_arm): Handle R_ARM_V4BX.
5002         (Stub_table::relocate_stubs): Likewise.
5003         (Stub_table::do_write): Likewise.
5004         (Stub_table::update_data_size_and_addralign): Likewise.
5005         (Stub_table::finalize_stubs):  Likewise.
5006         (Target_arm::Scan::local): Likewise.
5007         (Target_arm::Scan::global): Likewise.
5008         (Target_arm::do_finalize_sections): Likewise.
5009         (Target_arm::Relocate::relocate): Likewise.
5010         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5011         Likewise.
5012         (Target_arm::scan_reloc_for_stub): Likewise.
5013         (Target_arm::scan_reloc_section_for_stubs): Likewise.
5014
5015 2010-01-19  Ian Lance Taylor  <iant@google.com>
5016
5017         * output.cc (Output_section_headers::do_sized_write): Write large
5018         segment count to sh_info field.
5019         (Output_file_header::do_sized_write): For large segment count,
5020         write PN_XNUM to e_phnum field.
5021
5022 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5023
5024         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
5025         (Arm_relocate_functions::thm_jump8): New function.
5026         (Arm_relocate_functions::thm_jump11): New function.
5027         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
5028         R_ARM_THM_JUMP11.
5029         (Target_arm::Scan::global): Likewise.
5030         (Target_arm::Relocate::relocate): Likewise.
5031         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5032         Likewise.
5033
5034 2010-01-14  Doug Kwan  <dougkwan@google.com>
5035
5036         * arm.cc (map, utility): Include headers.
5037         (Target_arm::apply_cortex_a8_workaround): New method.
5038         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
5039         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
5040         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
5041         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
5042         the --[no-]fix-cortex-a8 command line options.
5043         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
5044         (Target_arm::relocate_stub): Use addend in instruction template.
5045         * options.h (DEFINE_bool): Set the user-set flag.
5046         (General_options): Add --[no-]-fix-cortex options.
5047         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
5048         : Update fast look-up map after conversion.
5049
5050 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
5051
5052         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
5053         in the first pass of do_layout.
5054
5055 2010-01-13  Doug Kwan  <dougkwan@google.com>
5056
5057         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
5058         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
5059         apparent compiler problem of not folding static constant integral
5060         data members of elfcpp::Elf_sizes<32>.
5061
5062 2010-01-13  Doug Kwan  <dougkwan@google.com>
5063
5064         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
5065         Arm_relobj::section_needs_cortex_a8_stub_scanning,
5066         Arm_relobj::scan_section_for_cortex_a8_erratum,
5067         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
5068         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
5069         sections to scan for relocation stubs into a new method
5070         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
5071         relocation and Cortex-A8 stub scanning.
5072         (Target_arm::do_relax): Force stubs to be after stubbed sections
5073         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
5074         the beginning of a new relaxation pass.  Update a comment.
5075         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
5076
5077 2010-01-12  Ian Lance Taylor  <iant@google.com>
5078
5079         * target-reloc.h (visibility_error): New inline function.
5080         (relocate_section): Call visibility_error.
5081         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
5082         (MOSTLYCLEANFILES): Likewise.
5083         (protected_4_pic.o, protected_3.err): New targets.
5084         * testsuite/protected_4.cc: New file.
5085
5086 2010-01-12  Doug Kwan  <dougkwan@google.com>
5087
5088         * arm.cc (Cortex_a8_reloc): New class.
5089         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
5090         and cortex_a8_relocs_info_.
5091         (Target_arm::fix_cortex_a8): New method definition.
5092         (Target_arm::Cortex_a8_relocs_info): New type.
5093         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
5094         New data member declarations.
5095         (Target_arm::scan_reloc_for_stub): Record information about
5096         relocations for THUMB branches that might be exempted from the
5097         Cortex-A8 workaround.
5098         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
5099         at the beginning of a relaxation pass.
5100
5101 2010-01-12  Doug Kwan  <dougkwan@google.com>
5102
5103         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
5104         (Arm_relobj::Mapping_symbol_position,
5105          Arm_reloj::Mapping_symbol_position_less,
5106          Arm_relobj::Mapping_symbols_info): New types.
5107         (Target_arm::is_mapping_symbol_name): New method definition.
5108         (Arm_relobj::do_count_local_symbols): Save information about mapping
5109         symbols.
5110
5111 2010-01-11  Doug Kwan  <dougkwan@google.com>
5112
5113         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
5114         Arm_relocate_functions::thumb32_branch_upper,
5115         Arm_relocate_functions::thumb32_branch_lower,
5116         Arm_relocate_functions::thumb32_cond_branch_offset,
5117         Arm_relocate_functions::thumb32_cond_branch_upper,
5118         Arm_relocate_functions::thumb32_cond_branch_lower,
5119         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
5120         branch offset encoding.
5121         (Arm_relocate_functions::thumb_branch_common): Use new branch
5122         offset encoding methods to avoid code duplication.
5123         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
5124         (Stub_addend_reader::operator()): Use new branch encoding method
5125         to avoid code duplication.
5126
5127 2010-01-11  Doug Kwan  <dougkwan@google.com>
5128
5129         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
5130         (Target_arm::do_finalize_sections): Define special EXIDX section
5131         symbols only if referenced.
5132         * gc.h (Garbage_collection::add_reference): New method.
5133         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
5134         code duplication.
5135
5136 2010-01-11  Ian Lance Taylor  <iant@google.com>
5137
5138         * script.cc (Version_script_info::build_expression_list_lookup):
5139         Change complaing about duplicate wildcard match from error to
5140         warning.
5141
5142         * script.cc (class Lazy_demangler): Recreate--revert part of patch
5143         of 2009-12-30.
5144         (Version_script_info::Version_script_info): Initialize globs_,
5145         default_version_, default_is_global_, and exact_.  Don't
5146         initialize globals_ or locals_.
5147         (Version_script_info::build_lookup_tables): Build local symbols
5148         first.
5149         (Version_script_info::unquote): New function.
5150         (Version_script_info::add_exact_match): New function.
5151         (Version_script_info::build_expression_list_lookup): Remove lookup
5152         parameter.  Add is_global parameter.  Change all callers.  Handle
5153         wildcard pattern specially.  Unquote pattern.  Call
5154         add_exact_match.
5155         (Version_script_info::get_name_to_match): New function.
5156         (Version_script_info::get_symbol_version): New function.
5157         (Version_script_info::get_symbol_version_helper): Remove.
5158         (Version_script_info::check_unmatched_names): Call unquote.
5159         * script.h (class Version_script_info): Change get_symbol_version
5160         to be non-inline and add is_global parameter; change all callers.
5161         Rewrite symbol_is_local.  Update declarations.  Define struct
5162         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
5163         Remove globals_ and locals_ members.  Add exact_, globs_,
5164         default_version_, is_global_.
5165         (Version_script_info::Glob): Remove pattern, add expression and
5166         is_global.  Update constructor.  Change all callers.
5167         * dynobj.cc (Versions::finalize): Mark the version symbol as the
5168         default version.
5169         (Versions::symbol_section_contents): If a symbol is undefined, or
5170         defined in a dynamic object, set the version index to
5171         VER_NDX_LOCAL.
5172         * symtab.cc (Symbol_table::add_from_relobj): Don't call
5173         symbol_is_local.
5174         (Symbol_table::add_from_pluginobj): Likewise.
5175         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
5176
5177 2010-01-11  Doug Kwan  <dougkwan@google.com>
5178
5179         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
5180         (incremental_dump_LDADD): Add linking option for libintl.
5181         * Makefile.in: Regenerate.
5182
5183 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
5184
5185         PR gold/11144
5186         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
5187         instead of -Ds.
5188         * testsuite/Makefile.in: Regenerated.
5189
5190 2010-01-10  Doug Kwan  <dougkwan@google.com>
5191
5192         * options.h (DEFINE_var): Use parentheses around argument varname__
5193         in macro body to avoid any unintended subsequent substitutions.
5194
5195 2010-01-10  Ian Lance Taylor  <iant@google.com>
5196
5197         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
5198         candidates before doing symbol resolution.
5199
5200         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
5201         ODR candidates if only one is weak.
5202
5203 2010-01-08  Ian Lance Taylor  <iant@google.com>
5204
5205         * script.cc (Version_script_info::build_expression_list_lookup):
5206         Don't warn about ambiguous version, just record the ambiguity.
5207         (Version_script_info::get_symbol_version_helper): Give error if
5208         version is ambiguous.
5209
5210 2010-01-08  Doug Kwan  <dougkwan@google.com>
5211
5212         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
5213           prev_data_size_ and prev_addralign_.  Remove initializer for
5214           deleted data member has_been_changed_.
5215           (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
5216           to determine if the table is empty.
5217           (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
5218           Remove.
5219           (Stub_table::add_reloc_stub): Define method in class definition
5220           instead of just declaring it there.
5221           (Stub_table::add_cortex_a8_stub): New method definition.
5222           (Stub_table::update_data_size_and_addralign): Ditto.
5223           (Stub_table::finalize_stubs): Ditto.
5224           (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
5225           (Stub_table::do_addralign_): Return address alignment in the
5226           (Stub_table::do_reset_address_and_file_offset): Define method in
5227           class definition instead of declaring it there.  Set current data
5228           size to be the data size of the previous pass.
5229           (Stub_table::set_final_data_size): Use current data size as the
5230           final data size.
5231           (Stub_table::relocate_stub): Change parameter type of stub from
5232           Reloc_stub pointer to Stub pointer.
5233           (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
5234           (Stub_table::Cortex_a8_stub_list): New typedef.
5235           (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
5236            Stub_table::prev_addralign_): New data member.
5237           (Arm_relobj::Arm_relobj): Initialize data member
5238           section_has_cortex_a8_workaround_.
5239           (Arm_relobj::section_has_cortex_a8_workaround,
5240            Arm_relobj::mark_section_for_cortex_a8_workaround): New method
5241            definitions.
5242           (Arm_relobj::section_has_cortex_a8_workaround_): New data member
5243           declarations.
5244           (Target_arm::relocate_stub): Change parameter type of stub from
5245           Reloc_stub pointer to Stub pointer.
5246           (Insn_template::size, Insn_template::alignment): Handle
5247           THUMB16_SPECIAL_TYPE.
5248           (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
5249            Stub_table::update_data_size_and_addralign,
5250            Stub_table::apply_cortex_a8_workaround_to_address_range): New method
5251           definitions.
5252           (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
5253           (Stub_table::do_write): Ditto.
5254           (Target_arm::do_relax): Adjust code for changes in Stub_table.
5255
5256 2010-01-08  Ian Lance Taylor  <iant@google.com>
5257
5258         PR 11108
5259         * symtab.h (class Symbol): Remove fields is_target_special_ and
5260         has_plt_offset_.  Add field is_defined_in_discarded_section_.
5261         (Symbol::is_defined_in_discarded_section): New function.
5262         (Symbol::set_is_defined_in_discarded_section): New function.
5263         (Symbol::has_plt_offset): Rewrite.
5264         (Symbol::set_plt_offset): Verify that new offset is not -1U.
5265         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
5266         Don't initialize is_target_special_ or has_plt_offset_.
5267         Initialize is_defined_in_discarded_section_.
5268         (Symbol_table::add_from_relobj): If appropriate, set
5269         is_defined_in_discarded_section.
5270         * resolve.cc (Symbol::override_base_with_special): Don't test
5271         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
5272         * target-reloc.h (relocate_section): Do special handling for
5273         symbols defined in discarded sections for global symbols as well
5274         as local symbols.
5275
5276 2010-01-08  Ian Lance Taylor  <iant@google.com>
5277
5278         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
5279         the SHT_SYMTAB case.
5280
5281 2010-01-08  Ian Lance Taylor  <iant@google.com>
5282
5283         * object.cc (Sized_relobj::do_layout): Don't get confused if
5284         layout_eh_frame returns NULL.
5285
5286 2010-01-08  Ian Lance Taylor  <iant@google.com>
5287
5288         PR 11084
5289         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
5290         dynamic symbol table, use the normal symbol table.
5291         (Sized_dynobj::do_read_symbols): Remove assertion about type of
5292         symbol table.
5293
5294 2010-01-08  Ian Lance Taylor  <iant@google.com>
5295
5296         PR 11072
5297         * layout.cc (Layout::include_section): Remove .gnu_debuglink
5298         sections.
5299
5300 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
5301
5302         * version.cc (print_version): Change to "Copyright 2010".
5303
5304 2010-01-08  Ian Lance Taylor  <iant@google.com>
5305
5306         PR 10287
5307         PR 11063
5308         * i386.cc (class Target_i386): Change return type of plt_section
5309         to be non-const.
5310         (class Output_data_plt_i386): Add tls_desc_rel_ field.
5311         (Output_data_plt_i386::Output_data_plt_i386): Initialize
5312         tls_desc_rel_ field.
5313         (Output_data_plt_i386::rel_tls_desc): New function.
5314         (Target_i386::rel_tls_desc_section): New function.
5315         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
5316         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
5317         R_386_TLS_DESC reloc in rel_tls_desc_section.
5318         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
5319         Define struct Tlsdesc_info.
5320         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
5321         (Target_x86_64::do_reloc_symbol_index): New function.
5322         (Target_x86_64::add_tlsdesc_info): New function.
5323         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
5324         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
5325         tlsdesc_rel_ field.
5326         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
5327         all callers.
5328         (Output_data_plt_x86_64::rela_tlsdesc): New function.
5329         (Target_x86_64::rela_tlsdesc_section): New function.
5330         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
5331         handling.
5332         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
5333         (Target_x86_64::do_reloc_addend): New function.
5334         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
5335         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
5336         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
5337         (Output_reloc::type): New function.
5338         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
5339         (Output_reloc::is_target_specific): New function.
5340         (Output_reloc::target_arg): New function.
5341         (class Output_reloc) [SHT_RELA]: Add four new constructors for
5342         absolute relocs and target specific relocs.
5343         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
5344         add_target_specific.
5345         (class Output_data_reloc) [SHT_RELA]: Likewise.
5346         * output.cc (Output_reloc::Output_reloc): Add four new versions
5347         for absolute relocs and target specific relocs.
5348         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
5349         (Output_reloc::get_symbol_index): Likewise.
5350         (Output_reloc::local_section_offset): Check that local_sym_index_
5351         is not TARGET_CODE or 0.
5352         (Output_reloc::symbol_value): Likewise.
5353         (Output_reloc::write) [SHT_RELA]: Call target for target specific
5354         reloc.
5355         * target.h (class Target): Add reloc_symbol_index and reloc_addend
5356         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
5357         functions.
5358         * layout.cc (add_target_dynamic_tags): Use output section for
5359         DT_PLTRELSZ and DT_JMPREL.
5360
5361 2010-01-07  Ian Lance Taylor  <iant@google.com>
5362
5363         PR 11061
5364         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
5365         function.
5366         (class Output_data_reloc_generic): Define.
5367         (class Output_data_reloc_base): Change base class to
5368         Output_data_reloc_generic.  Change add() method to call
5369         bump_relative_reloc_count for a relative reloc.  Remove
5370         sort_relocs_ field.
5371         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
5372         to sort_relocs().
5373         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
5374         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
5375         appropriate.
5376         * layout.h (class Layout): Update declaration.
5377
5378 2010-01-07  Ian Lance Taylor  <iant@google.com>
5379
5380         * output.h (class Output_data): Add const version of
5381         output_section and do_output_section.
5382         (class Output_section_data): Add const version of
5383         do_output_section.
5384         (class Output_section): Likewise.
5385         * layout.cc (Layout::add_target_dynamic_tags): New function.
5386         * layout.h (class Layout): Update declarations.
5387         * arm.cc (Target_arm::do_finalize_sections): Use
5388         add_target_dynamic_tags.
5389         * i386.cc (Target_i386::do_finalize_sections): Likewise.
5390         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
5391         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
5392         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5393
5394 2010-01-07  Ian Lance Taylor  <iant@google.com>
5395
5396         PR 11042
5397         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
5398         object as needed.
5399
5400 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
5401             Ian Lance Taylor  <iant@google.com>
5402
5403         PR 11019
5404         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
5405         Xindex::read_symtab_xindex.
5406
5407 2010-01-07  Doug Kwan  <dougkwan@google.com>
5408
5409         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
5410         (Insn_template::thumb16_bcond_insn): New method declaration.
5411         (Insn_template): Fix spelling.
5412         (Stub::thumb16_special): New method declaration.
5413         (Stub::do_write): Define virtual method which was previously pure
5414         virtual.
5415         (Stub::do_thumb16_special): New method declaration.
5416         (Stub::do_fixed_endian_write): New template member.
5417         (Reloc_stub::do_write): Remove.
5418         (Reloc_stub::do_fixed_endian_write): Remove.
5419         (Cortex_a8_stub): New class definition.
5420         (Stub_factory::make_cortex_a8_stub): New method definition.
5421         (Stub_factory::Stub_factory): Add missing static storage class
5422         qualifier for elf32_arm_stub_a8_veneer_blx.
5423
5424 2010-01-07  Ian Lance Taylor  <iant@google.com>
5425
5426         PR 10980
5427         * options.h (class General_options): Add --warn-unresolved-symbols
5428         and --error-unresolved-symbols.
5429         * errors.cc (Errors::undefined_symbol): Implement
5430         --warn-unresolved-symbols.
5431
5432         * options.h (class General_options): Add -z text and -z textoff.
5433         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
5434
5435 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
5436
5437         * gc.h (Garbage_collection::Cident_section_map): New typedef.
5438         (Garbage_collection::cident_sections): New function.
5439         (Garbage_collection::add_cident_section): New function.
5440         (Garbage_collection::cident_sections_): New member.
5441         (gc_process_relocs): Add references to sections whose names are C
5442         identifiers.
5443         * gold.h (cident_section_start_prefix): New constant.
5444         (cident_section_stop_prefix): New constant.
5445         (is_cident): New function.
5446         * layout.cc (Layout::define_section_symbols): Replace string constants
5447         with the newly defined constants.
5448         * object.cc (Sized_relobj::do_layout): Track sections whose names are
5449         C identifiers.
5450         * testsuite/Makefile.am: Add gc_orphan_section_test.
5451         * testsuite/Makefile.in: Regenerate.
5452         * testsuite/gc_orphan_section_test.cc: New file.
5453         * testsuite/gc_orphan_section_test.sh: New file.
5454
5455 2010-01-06  Ian Lance Taylor  <iant@google.com>
5456
5457         PR 10980
5458         * options.h (class General_options): Add --warn-shared-textrel.
5459         * layout.cc (Layout::finish_dynamic_section): Implement
5460         --warn-shared-textrel.
5461
5462         PR 10980
5463         * options.h (class General_options): Add --warn-multiple-gp.
5464
5465 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5466
5467         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
5468         $(THREADSLIB) and $(LIBDL).
5469         * Makefile.in: Rebuild.
5470
5471 2010-01-06  Ian Lance Taylor  <iant@google.com>
5472
5473         PR 10980
5474         * options.cc (General_options::parse_section_start): New function.
5475         (General_options::section_start): New function.
5476         (General_options::General_options): Initialize all members.
5477         * options.h: Include <map>
5478         (class General_options): Add --section-start.  Add section_starts_
5479         member.
5480         * layout.cc (Layout::attach_allocated_section_to_segment): If
5481         --section-start was used, set the address of the segment.  Remove
5482         local sort_sections.
5483         (Layout::relaxation_loop_body): If the address of the load segment
5484         has been set by --section-start, don't use it.
5485         * output.h (Output_segment::update_flags_for_output_section): New
5486         function.
5487         * output.cc (Output_segment::add_output_section): Call
5488         update_flags_for_output_section.
5489
5490 2010-01-05  Ian Lance Taylor  <iant@google.com>
5491
5492         PR 10980
5493         * options.h (class General_options): Add --undefined-version.
5494         * script.cc (struct Version_expression): Add was_matched_by_symbol
5495         field.
5496         (Version_script_info::matched_symbol): New function.
5497         (Version_script_info::get_symbol_version_helper): Call
5498         matched_symbol.
5499         (Version_script_info::check_unmatched_names): New function.
5500         * script.h (class Version_script_info): Update declarations.
5501         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
5502
5503         * options.h (class General_options): Use DEFINE_bool_alias for
5504         allow_multiple_definition.
5505         * resolve.cc (Symbol_table::should_override): Don't test
5506         allow_multiple_definition.
5507
5508         PR 10980
5509         * options.h (class General_options): Add --cref.
5510         * main.cc (main): Print cref table if --cref.  Don't close mapfile
5511         until after printing cref table.
5512         * cref.cc: Include "symtab.h".
5513         (class Cref_inputs): Define Cref_table_compare and Cref_table.
5514         (Cref_table_compare::operator()): New function.
5515         (Cref_inputs::gather_cref): New function.
5516         (filecol): New static const.
5517         (Cref_inputs::print_cref): New function.
5518         (Cref::print_cref): New function.
5519         * cref.h: Include <cstdio>.
5520         (class Cref): Update declarations.
5521         * mapfile.h (Mapfile::file): New function.
5522         * object.h (class Object): Define Symbols.  Declare virtual
5523         do_get_global_symbols.
5524         (Object::get_global_symbols): New function.
5525         * object.cc (Input_objects::add_object): Pass object to cref_ if
5526         --cref.
5527         (Input_objects::archive_start): Likewise.
5528         (Input_objects::archive_stop): Likewise.
5529         (Input_objects::print_cref): New function.
5530         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
5531         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
5532         --cref.
5533         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
5534         function.
5535         * plugin.h (class Sized_pluginobj): Update declarations.
5536
5537 2010-01-05  Ian Lance Taylor  <iant@google.com>
5538
5539         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
5540         to is_default_version.  Rename insdef to insdefault.
5541         (Symbol_table::add_from_relobj): Rename def to is_default_version
5542         and local to is_forced_local.
5543         (Symbol_table::add_from_pluginobj): Likewise.
5544         (Symbol_table::add_from_dynobj): Likewise.
5545         (Symbol_table::define_special_symbol): Rename insdef to
5546         insdefault.
5547
5548 2010-01-04  Ian Lance Taylor  <iant@google.com>
5549
5550         PR 10980
5551         * options.h (class General_options): Add
5552         --allow-multiple-definition and -z muldefs.
5553         * resolve.cc (Symbol_table::should_override): Don't warn about a
5554         multiple symbol definition if --allow-multiple-definition or -z
5555         muldefs.
5556
5557         PR 10980
5558         * options.h (class General_options): Add --add-needed and
5559         --copy-dt-needed-entries.  Tweak --as-needed help entry.
5560         * object.cc (Input_objects::check_dynamic_dependencies): Give an
5561         error if --copy-dt-needed-entries aka --add-needed is used and
5562         would cause a change in behaviour.
5563
5564         PR 10980
5565         * options.h (class General_options): Add -G as a short version of
5566         --shared.  Add no-op options -assert, -g, and -i.
5567
5568 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
5569
5570         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
5571         check for .text or .gnu.linkonce.t sections.
5572         * icf.cc (Icf::find_identical_sections): Ditto.
5573         Change the detection for mangled function name within the section
5574         name.
5575         * icf.h (is_section_foldable_candidate): New function.
5576
5577 2009-12-30  Ian Lance Taylor  <iant@google.com>
5578
5579         PR 10980
5580         * options.h (class General_options): Permit two dashes with
5581         --retain-symbols-file.
5582
5583 2009-12-30  Ian Lance Taylor  <iant@google.com>
5584
5585         PR 10979
5586         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
5587         don't put the file header and segment headers in the text
5588         segment.
5589
5590         PR 10979
5591         * common.cc (Sort_commons::operator()): Stabilize sort when both
5592         entries are NULL.
5593         (Symbol_table::do_allocate_commons_list): When allocating common
5594         symbols, skip a symbol which is no longer common.
5595         * symtab.h (Symbol::is_common): Test whether the symbol comes from
5596         an object before checking its type.
5597         * testsuite/common_test_2.c: New file.
5598         * testsuite/common_test_3.c: New file.
5599         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
5600         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
5601         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
5602         (common_test_2_pic.o, common_test_2.so): New targets.
5603         (common_test_3_pic.o, common_test_3.so): New targets.
5604         * testsuite/Makefile.in: Rebuild.
5605
5606         PR 10979
5607         * script.cc (read_input_script): If we see a new SECTIONS clause,
5608         and we have added an input section, give an error.
5609         * layout.h (class Layout): Add have_added_input_section function.
5610         Add have_added_input_section_ field.
5611         * layout.cc (Layout::Layout): Initialize
5612         have_added_input_section_.
5613         (Layout::layout): Set have_added_input_section_.
5614         (Layout::layout_eh_frame): Likewise.
5615
5616 2009-12-30  Ian Lance Taylor  <iant@google.com>
5617
5618         PR 10931
5619         * options.h (class General_options): Add --sort-common option.
5620         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
5621         * common.cc (Sort_common): Add sort_order parameter to
5622         constructor.  Add sort_order_ field.
5623         (Sort_commons::operator): Check sort_order_.
5624         (Symbol_table::allocate_commons): Determine the sort order.
5625         (Symbol_table::do_allocate_commons): Add sort_order parameter.
5626         Change all callers.
5627         (Symbol_table::do_allocate_commons_list): Likewise.
5628
5629 2009-12-30  Ian Lance Taylor  <iant@google.com>
5630
5631         PR 10916
5632         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
5633         symbols from this object, don't change the visibility of an
5634         undefined symbol.
5635         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
5636
5637 2009-12-30  Ian Lance Taylor  <iant@google.com>
5638
5639         PR 10861
5640         * script.h (class Version_script_info): Define Language enum.
5641         Update declarations.  Define Glob, Exact, and Lookup types.  Add
5642         new fields globals_, locals_, and is_finalized_.
5643         * script.cc: Various formatting fixes.
5644         (class Parser_closure): Change language_stack_ from a vector of
5645         std::string to one of Version_script_info::Language.  Adjust all
5646         uses accordingly.
5647         (class Lazy_demangler): Remove.
5648         (struct Version_expression): Change language from std::string to
5649         Version_script_info::Language.
5650         (Version_script_info::Version_script_info): New function.
5651         (Version_script_info::~Version_script_info): Don't call clear.
5652         (Version_script_info::finalize): New function.
5653         (Version_script_info::build_lookup_tables): New function.
5654         (Version_script_info::build_expression_list_lookup): New
5655         function.
5656         (Version_script_info::get_symbol_version_helper): Rewrite to use
5657         lookup tables.
5658         (Version_script_info::print_expression_list): Adjust to use
5659         Version_script_info::Language.
5660         (script_push_lex_into_version_mode): Check that the version script
5661         has not been finalized.
5662         (version_script_push_lang): Change language string to
5663         Version_script_info::Language.
5664         * options.cc (Command_line::version_script): New function.
5665         * options.h (class General_options): Add finalize_dynamic_list
5666         function.  Change version_script from declaration to definition.
5667         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
5668         * testsuite/version_script.map: Remove duplicate def of foo.
5669         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
5670         version_script.map.
5671         * testsuite/Makefile.in: Rebuild.
5672
5673 2009-12-30  Ian Lance Taylor  <iant@google.com>
5674
5675         PR 10843
5676         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
5677         if the input symbol index is 0, make the output symbol index 0.
5678
5679 2009-12-30  Ian Lance Taylor  <iant@google.com>
5680
5681         PR 10670
5682         * options.h (class General_options): Add -x/--discard-all.
5683         * object.cc (Sized_relobj::do_count_local_symbols): Handle
5684         --discard-all.  If the local symbol needs a dynamic entry, check
5685         that before handling --discard-locals.
5686
5687 2009-12-30  Ian Lance Taylor  <iant@google.com>
5688
5689         PR 10450
5690         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
5691         flags to PF_R.
5692         (Output_segment::add_output_section): Don't change the flags if
5693         the type is PT_TLS.
5694
5695         PR 10450
5696         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
5697         GNU hash table if they need a dynamic value.  Otherwise, don't add
5698         them if they are defined in a dynamic object or are forced local.
5699
5700 2009-12-29  Ian Lance Taylor  <iant@google.com>
5701
5702         PR 10450
5703         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
5704         .gnu.hash table for a 32-bit target.
5705
5706         PR 10450
5707         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
5708         regular and a dynamic object only needs a dynamic symbol table
5709         entry if it is externally visible.
5710
5711         PR 10450
5712         * i386.cc (class Target_i386): Initialize global_offset_table_ in
5713         constructor.  Add global_offset_table_ field.
5714         (Target_i386::got_section): Set global_offset_table_.
5715         (Target_i386::do_finalize_sections): Set global_offset_table_
5716         size.
5717         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
5718         in constructor.  Add global_offset_table_ field.
5719         (Target_x86_64::got_section): Set global_offset_table_.
5720         (Target_x86_64::do_finalize_sections): Set global_offset_table_
5721         size.
5722
5723         * layout.cc (Layout::Layout): Initialize increase_relro_.
5724         (Layout::get_output_section): Add is_relro, is_last_relro, and
5725         is_first_non_relro parameters.  Change all callers.
5726         (Layout::choose_output_section): Likewise.
5727         (Layout::add_output_section_data): Likewise.
5728         (Layout::make_output_section): Likewise.
5729         (Layout::set_segment_offsets): Clear increase_relro when using a
5730         linker script.
5731         * layout.h (class Layout): Add increase_relro method.  Add
5732         increase_relro_ field.  Update declarations.
5733         * output.cc (Output_section::Output_section): Initialize
5734         is_last_relro_ and is_first_non_relro_.
5735         (Output_segment::add_output_section): Group relro sections is
5736         do_sort is true.  Handle is_last_relro and is_first_non_relro.
5737         (Output_segment::maximum_alignment): Remove relro handling.
5738         (Output_segment::set_section_addresses): Add increase_relro
5739         parameter.  Change all callers.  Add initial alignment to align
5740         relro sections on separate page.  Remove old relro handling.
5741         (Output_segment::set_section_list_addresses): Remove in_relro
5742         parameter.  Change all callers.
5743         (Output_segment::set_offset): Add increase parameter.  Change all
5744         callers.  Remove old relro handling.
5745         * output.h (class Output_section): Add new methods: is_last_relro,
5746         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
5747         Add is_last_relro_ and is_first_non_relro_ fields.
5748         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
5749         Create separate .got.plt section.  Call increase_relro.
5750         * x86_64.cc (Target_x86_64::got_section): Likewise.
5751         * testsuite/relro_script_test.t: Add .got.plt.
5752
5753         PR 10450
5754         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
5755         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
5756         (Layout::finalize): Call set_dynamic_symbol_size.
5757         (Layout::set_dynamic_symbol_size): New function.
5758         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
5759         set_dynamic_symbol_size.
5760
5761         PR 10450
5762         * output.h (class Output_section): Add is_entsize_zero_ field.
5763         * output.cc (Output_section::Output_section): Initialize
5764         is_entsize_zero_.
5765         (Output_section::set_entsize): If two different entsizes are
5766         requested, force it to zero.
5767         (Output_section::add_input_section): Set flags for .debug_str
5768         before updating section flags.  Set entsize.
5769         (Output_section::update_flags_for_input_section): Set SHF_MERGE
5770         and SHF_STRING if all input sections have those flags.
5771
5772 2009-12-29   Rafael Espindola  <espindola@google.com>
5773
5774         * main.cc (main): Fix the sys time reporting.
5775         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
5776         reporting.
5777
5778 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
5779
5780         * options.cc (General_options::parse_version): Allow -v to exit
5781         without an error if there is nothing to link.
5782
5783 2009-12-29  Ian Lance Taylor  <iant@google.com>
5784
5785         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
5786         using a version of gcc before 4.1.
5787         * configure: Rebuild.
5788
5789 2009-12-28  Chris Demetriou  <cgd@google.com>
5790
5791         * attributes.cc (Output_attributes_section_data::do_write): Use
5792         std::vector::front rather than std::vector::data.
5793
5794 2009-12-28  Ian Lance Taylor  <iant@google.com>
5795
5796         * symtab.h (class Symbol_table): Add enum Defined.
5797         * resolve.cc (Symbol_table::should_override): Add defined
5798         parameter.  Change all callers.  Test whether object is NULL
5799         before calling a method on it.
5800         (Symbol_table::report_resolve_problem): Add defined parameter.
5801         Change all callers.
5802         (Symbol_table::should_override_with_special): Likewise.
5803         * symtab.cc (Symbol_table::define_in_output_data): Add defined
5804         parameter.  Change all callers.
5805         (Symbol_table::do_define_in_output_data): Likewise.
5806         (Symbol_table::define_in_output_segment): Likewise.
5807         (Symbol_table::do_define_in_output_segment): Likewise.
5808         (Symbol_table::define_as_constant): Likewise.
5809         (Symbol_table::do_define_as_constant): Likewise.
5810         * script.h (class Symbol_assignment): Add is_defsym parameter to
5811         constructor; change all callers.
5812         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
5813         parameter.  Change all callers.  Add is_defsym_ field.
5814         (class Parser_closure): Add parsing_defsym parameter to
5815         constructor; change all callers.  Add parsing_defsym accessor
5816         function.  Add parsing_defsym_ field.
5817
5818 2009-12-28  Ian Lance Taylor  <iant@google.com>
5819
5820         * gold.cc (queue_middle_tasks): Fix formatting.
5821         * object.cc (Relobj::is_section_name_included): Likewise.
5822
5823 2009-12-23  Ian Lance Taylor  <iant@google.com>
5824
5825         * i386.cc (Target_i386::do_calls_non_split): Recognize
5826         -fsplit-stack prologue for a function with a static chain.
5827         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
5828         -fsplit-stack prologue when using %r11.
5829
5830 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
5831
5832         * options.cc (General_options::parse_version): Make -v continue and do
5833         the link like GNU ld does.
5834
5835 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
5836
5837         * Makefile.am (CCFILES): Add timer.cc.
5838         (HFILES): Add timer.h.
5839         * configure.ac: Check for sysconf and times.
5840         * main.cc: include timer.h.
5841         (main): Use Timer instead of get_run_time.
5842         * timer.cc: New.
5843         * timer.h: New.
5844         * workqueue.cc: include timer.h.
5845         (Workqueue::find_and_run_task):
5846         Report user, sys and wall time.
5847         * Makefile.in: Regenerate.
5848         * config.in: Regenerate.
5849         * configure: Regenerate.
5850
5851 2009-12-16  Doug Kwan  <dougkwan@google.com>
5852
5853         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
5854         sections.
5855         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
5856         relaxed input sections.
5857         * output.cc (Output_section::find_relaxed_input_section): Change
5858         return type to Output_relaxed_input_section pointer.  Adjust code
5859         for new type of relaxed_input_section_map_.
5860         * output.h (Output_section::find_relaxed_input_section): Change
5861         return type to Output_relaxed_input_section pointer.
5862         (Output_section::Output_relaxed_input_section_by_input_section_map):
5863         New type.
5864         (Output_section::relaxed_input_section_map_): Change type to
5865         Output_section::Output_relaxed_input_section_by_input_section_map.
5866         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
5867         input section.
5868
5869 2009-12-15  Ian Lance Taylor  <iant@google.com>
5870
5871         * layout.cc (Layout::create_shstrtab): Only write out after input
5872         sections if we are compressing debug sections.
5873
5874 2009-12-15  Ian Lance Taylor  <iant@google.com>
5875
5876         * archive.cc (Archive::add_symbols): Only look up a symbol without
5877         a version if there is, in fact, a version.
5878
5879 2009-12-14  Ian Lance Taylor  <iant@google.com>
5880
5881         Revert -Wshadow changes, all changes from:
5882         2009-12-11  Doug Kwan  <dougkwan@google.com>
5883         2009-12-11  Nick Clifton  <nickc@redhat.com>
5884         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
5885
5886 2009-12-11  Doug Kwan  <dougkwan@google.com>
5887
5888         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
5889         due to -Wshadow.
5890         * attributes.cc (Object_attribute::size): Ditto.
5891         (Attributes_section_data::size): Ditto.
5892         (Attributes_section_data::Attributes_section_data): Ditto.
5893         (Output_attributes_section_data::do_write): Ditto.
5894         * attributes.h (Object_attribute::set_type): Ditto.
5895         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
5896
5897 2009-12-11  Nick Clifton  <nickc@redhat.com>
5898
5899         * archive.cc: Fix shadowed variable warnings.
5900         * arm.cc: Likewise.
5901         * compressed_output.cc: Likewise.
5902         * compressed_output.h: Likewise.
5903         * configure: Likewise.
5904         * dwarf_reader.cc: Likewise.
5905         * dynobj.cc: Likewise.
5906         * dynobj.h: Likewise.
5907         * ehframe.cc: Likewise.
5908         * ehframe.h: Likewise.
5909         * errors.cc: Likewise.
5910         * expression.cc: Likewise.
5911         * fileread.cc: Likewise.
5912         * fileread.h: Likewise.
5913         * freebsd.h: Likewise.
5914         * i386.cc: Likewise.
5915         * icf.cc: Likewise.
5916         * incremental.h: Likewise.
5917         * layout.cc: Likewise.
5918         * layout.h: Likewise.
5919         * mapfile.cc: Likewise.
5920         * merge.cc: Likewise.
5921         * merge.h: Likewise.
5922         * object.cc: Likewise.
5923         * object.h: Likewise.
5924         * options.h: Likewise.
5925         * output.cc: Likewise.
5926         * output.h: Likewise.
5927         * parameters.cc: Likewise.
5928         * plugin.cc: Likewise.
5929         * powerpc.cc: Likewise.
5930         * reduced_debug_output.cc: Likewise.
5931         * reduced_debug_output.h: Likewise.
5932         * reloc.cc: Likewise.
5933         * reloc.h: Likewise.
5934         * resolve.cc: Likewise.
5935         * script-sections.cc: Likewise.
5936         * script.cc: Likewise.
5937         * script.h: Likewise.
5938         * sparc.cc: Likewise.
5939         * symtab.cc: Likewise.
5940         * symtab.h: Likewise.
5941         * target-select.cc: Likewise.
5942         * target-select.h: Likewise.
5943         * token.h: Likewise.
5944         * workqueue.cc: Likewise.
5945         * workqueue.h: Likewise.
5946         * x86_64.cc: Likewise.
5947
5948 2009-12-10  Doug Kwan  <dougkwan@google.com>
5949
5950         * arm.cc (attributes.h): New include.
5951         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
5952         (Arm_relobj::~Arm_relobj): Delete object pointed by
5953         attributes_section_data_.
5954         (Arm_relobj::attributes_section_data): New method definition.
5955         (Arm_relobj::attributes_section_data_): New data member declaration.
5956         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
5957         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
5958         attributes_section_data_.
5959         (Arm_dynobj::attributes_section_data): New method definition.
5960         (Arm_dynobj::attributes_section_data_): New data member declaration.
5961         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
5962         initialization value of may_use_blx_ to false.
5963         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
5964         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
5965         object attributes to compute results instead of hard-coding.
5966         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
5967         Target_arm::get_secondary_compatible_arch,
5968         Target_arm::set_secondary_compatible_arch
5969         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5970         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
5971         New method declarations.
5972         (Target_arm::get_aeabi_object_attribute): New method definition.
5973         (Target_arm::attributes_section_data_): New data member declaration.
5974         (read_arm_attributes_section): New template definition.
5975         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
5976         (Arm_dynobj::do_read_symbols): Ditto.
5977         (Target_arm::do_finalize_sections): Merge attributes sections from
5978         input.  Check for BLX use after attributes section merging.
5979         Fix __exidx_start and __exidx_end visibility.  Create an
5980         .ARM.attributes section if necessary.
5981         (Target_arm::get_secondary_compatible_arch,
5982         Target_arm::set_secondary_compatible_arch,
5983         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5984         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
5985         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
5986         New method definitions.
5987
5988 2009-12-09  Ian Lance Taylor  <iant@google.com>
5989
5990         * plugin.cc (Plugin::load): Don't cast from void* to a function
5991         pointer.
5992
5993 2009-12-09  Ian Lance Taylor  <iant@google.com>
5994
5995         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
5996         information fields.
5997
5998 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
5999
6000         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
6001         Replace two_file_shared_1.so with two_file_shared_2.so.
6002         * testsuite/Makefile.in: Regenerated.
6003
6004 2009-12-08  Doug Kwan  <dougkwan@google.com>
6005
6006         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
6007         (HFILES): Add attributes.h and int_encoding.h.
6008         * Makefile.in: Regenerate.
6009         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
6010         function definitions to int_encoding.cc
6011         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
6012         prototypes to int_encoding.h
6013         * reduced_debug_output.cc (int_encoding.h): New include.
6014         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
6015         function definitions to int_encoding.cc
6016         (insert_into_vector, read_from_pointer): Move template definitions to
6017         int_encoding.h
6018         * attributes.cc: New file.
6019         * attributes.h: New file.
6020         * int_encoding.cc: New file.
6021         * int_encoding.h: New file.
6022
6023 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
6024
6025         PR gold/11055
6026         * incremental-dump.cc (dump_incremental_inputs): New.
6027         (main): Use dump_incremental_inputs.
6028
6029 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
6030
6031         PR gold/10893
6032         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
6033         checking elfcpp::STT_FUNC.
6034         (Target_i386::Relocate::relocate): Likewise.
6035         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
6036
6037         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
6038         symbols from shared libraries into normal FUNC symbols.
6039
6040         * symtab.h (Symbol): Add is_func and use it.
6041
6042 2009-12-05  Doug Kwan  <dougkwan@google.com>
6043
6044         * arm.cc (Target_arm::arm_info): Initialize new fields
6045         attributes_section and attributes_vendor.
6046         * i386.cc (Target_i386::i386_info): Same.
6047         * object.cc (Sized_relobj::do_layout): Skip attribute section.
6048         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
6049         fields attributes_section and attributes_vendor.
6050         * sparc.cc (Target_sparc::sparc_info): Same.
6051         * target.h (Target::attributes_section, Target::attributes_vendor,
6052         Target::is_attributes_section, Target::attribute_arg_type,
6053         Target::attributes_order): New method definitions.
6054         (Target::Target_info::attributes_section,
6055         Target::Target_info::attributes_vendor): New fields.
6056         (Target::do_attribute_arg_type, Target::do_attributes_order): New
6057         virtual method definitions.
6058         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
6059         attributes_section and attributes_vendor.
6060         * testsuite/testfile.cc (Target_test::test_target_info): Same.
6061
6062 2009-12-05  Doug Kwan  <dougkwan@google.com>
6063
6064         * arm.cc: Update comments about interworking and stub generation.
6065         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
6066         considered as non-PIC.
6067         (Arm_relocate_functions::base_abs): Fix formatting.
6068         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
6069         of function to use GOT entry address instead of offset.
6070         (Target_arm::Scan::global): Issue an error if a symbol would need a
6071         PLT does not get one because it is untyped.  Remove code to create
6072         dynamic symbols for relative branches.
6073         (Target_arm::Relocate::relocate: Use 0 instead of false since function
6074         takes unsigned integer instead of boolean.
6075
6076 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
6077
6078         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
6079         (two_file_test_LDADD): Likewise.
6080         (common_test_1_LDADD): Likewise.
6081         (exception_test_LDADD) Likewise.
6082         (weak_test_LDADD): Likewise.
6083         (many_sections_test_LDADD): Likewise.
6084         (initpri1_LDADD): Likewise.
6085         (script_test_1_LDADD): Likewise.
6086         (script_test_2_LDADD): Likewise.
6087         (justsyms_LDADD): Likewise.
6088         (binary_test_LDADD): Likewise.
6089         (large_LDADD): Likewise.
6090         * testsuite/Makefile.in: Regenerated.
6091
6092 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
6093
6094         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
6095         (Symbol_table::override_with_special): Likewise.
6096         (Symbol_table::add_from_object): Likewise.
6097
6098 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
6099
6100         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
6101         Don't set the data_offset twice.
6102
6103 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
6104
6105         * testsuite/Makefile.in: Regenerate.
6106
6107 2009-12-03  Doug Kwan  <dougkwan@google.com>
6108
6109         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
6110         (Target_arm::do_finalize_sections): Add parameter for symbol table
6111         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
6112         * i386.cc (Target_i386::do_finalize_sections): Add an additional
6113         parameter for symbol table pointer.
6114         * layout.cc (Layout::finalize): Call Target::finalize_sections with
6115         an additional parameter for a pointer to symbol table.
6116         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
6117         parameter for a symbol table pointer.
6118         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
6119         * target.h (Target::finalize_sections, Target::do_finalize_sections):
6120         Ditto.
6121         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
6122         parameter for a symbol table pointer.
6123
6124 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
6125
6126         * incremental.cc (Incremental_inputs_header)
6127         (Incremental_inputs_header_write, Incremental_inputs_entry)
6128         (Incremental_inputs_entry_write): Move ...
6129         * incremental.h (Incremental_inputs_header)
6130         (Incremental_inputs_header_write, Incremental_inputs_entry)
6131         (Incremental_inputs_entry_write): here.
6132
6133 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
6134
6135         * incremental.cc (make_sized_incremental_binary): Set the target.
6136         Error if it is incompatible.
6137         * output.h (Output_file): Add filename method.
6138
6139 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
6140
6141         * incremental.cc (Incremental_inputs_entry): Remove unused argument
6142         from the get_* methods.
6143
6144 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
6145
6146         * incremental-dump.cc (main): Check that the offeset of a script is 0.
6147         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
6148         Write 0 for the data_offset of scripts.
6149
6150 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
6151
6152         * testsuite/Makefile.am: Add the incremental_test.sh test.
6153         * testsuite/incremental_test.sh: New.
6154         * testsuite/incremental_test_1.c: New.
6155         * testsuite/incremental_test_2.c: New.
6156
6157 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
6158
6159        * incremental-dump.cc (main): Fix typos.
6160
6161 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
6162
6163         PR gold/11025
6164         * incremental-dump.cc (main): Use llu to print 64 bit values.
6165
6166 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
6167             H.J. Lu  <hongjiu.lu@intel.com>
6168
6169         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
6170         $(LIBDL).
6171         (incremental_dump_LDADD): Likewise.
6172         * Makefile.in: Regenerated.
6173
6174 2009-11-25  Doug Kwan  <dougkwan@google.com>
6175
6176         Revert:
6177
6178         2009-11-25  Doug Kwan  <dougkwan@google.com>
6179
6180                 * arm.cc (Target_arm::Target_arm): Move method definition
6181                 outside of class definition.  Add code to handle
6182                 --target1-rel, --target1-abs and --target2= options.
6183                 (Target_arm::get_reloc_reloc_type): Change method to be
6184                 non-static and const.
6185                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
6186                 New data member declaration.
6187                 (Target_arm::Scan::local, Target_arm::Scan::global,
6188                 Target_arm::Relocate::relocate,
6189                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6190                 Adjust call to Target_arm::get_real_reloc_type.
6191                 (Target_arm::get_real_reloc_type): Use command line options
6192                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
6193                 * options.h (--target1-rel, --target1-abs, --target2): New
6194                 ARM-only options.
6195
6196 2009-11-25  Doug Kwan  <dougkwan@google.com>
6197
6198         * arm.cc (Target_arm::Target_arm): Move method definition outside of
6199         class definition.  Add code to handle --target1-rel, --target1-abs
6200         and --target2= options.
6201         (Target_arm::get_reloc_reloc_type): Change method to be non-static
6202         and const.
6203         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
6204         member declaration.
6205         (Target_arm::Scan::local, Target_arm::Scan::global,
6206         Target_arm::Relocate::relocate,
6207         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
6208         call to Target_arm::get_real_reloc_type.
6209         (Target_arm::get_real_reloc_type): Use command line options to
6210         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
6211         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
6212         options.
6213
6214 2009-11-25  Doug Kwan  <dougkwan@google.com>
6215
6216         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
6217         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
6218         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
6219         formatting.
6220         (Arm_relocate_functions::thm_call): Replace body with a call to
6221         Arm_relocate_functions::thumb_branch_common.
6222         (Arm_relocate_functions::thm_jump24,
6223         Arm_relocate_functions::thm_xpc22): New method definitions.
6224         (Arm_relocate_functions::thumb_branch_common): New method definition.
6225         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
6226         operator.
6227         (Target_arm::Relocate::relocate): Adjust call to thm_call.
6228         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
6229
6230 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
6231
6232         * Makefile.am: Build incremental-dump
6233         * Makefile.in: Regenerate.
6234         * incremental-dump.cc: New.
6235         * incremental.cc (Incremental_inputs_header_data,
6236         Incremental_inputs_entry_data): Move to incremental.h
6237         * incremental.h: (Incremental_inputs_header_data,
6238         Incremental_inputs_entry_data): Move from incremental.cc
6239
6240 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
6241
6242         * incremental.cc (Incremental_inputs_header,
6243         Incremental_inputs_header_write, Incremental_inputs_entry,
6244         Incremental_inputs_entry_write): Add a typedef with the data type.
6245
6246 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
6247
6248         * incremental.cc (Incremental_inputs_header,
6249         Incremental_inputs_header_write, Incremental_inputs_entry,
6250         Incremental_inputs_entry_write): Update comment about which
6251         type has the filed descriptions.
6252
6253 2009-11-15  Doug Kwan  <dougkwan@google.com>
6254
6255         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
6256         (Arm_relocate_functions::arm_branch_common): Change method defintion
6257         in class definition to a method declaration and update list of formal
6258         parameters.
6259         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
6260         Arm_relocation_functions::jump24): Adjust call to
6261         Arm_relocate_functions::arm_branch_common.  Update list of formal
6262         parameters.
6263         (Arm_relocate_functions::xpc25): New method definition.
6264         (Arm_relocate_functions::arm_branch_common): Move method defintion
6265         out from class definition.  Use stubs for mode-switching and extending
6266         branch ranges.
6267         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
6268         specially.  Change code to enable use of stubs in ARM branches.
6269
6270 2009-11-10  Doug Kwan  <dougkwan@google.com>
6271
6272         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
6273         in method declaration.
6274         (Target_arm::relocate_stub): New method declaration.
6275         (Target_arm::default_target): Change to return a pointer instead of
6276         a const reference.
6277         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
6278         Target_arm::default_target.
6279         (Arm_Relobj::do_relocate_sections): Remove options paramater in
6280         method definition.
6281         (Target_arm::relocate_section): Adjust view.
6282         (Target_arm::relocate_stub): New method definition.
6283
6284 2009-11-10  Doug Kwan  <dougkwan@google.com>
6285
6286         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
6287         a format warning.
6288         * incremental.cc (open_incremental_binary): Initialized local
6289         variables to avoid warnings.
6290         * object.cc (make_elf_object): Ditto.
6291         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
6292         a format warning.
6293
6294 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
6295
6296         PR gold/10930
6297         * testsuite/plugin_test.c: Include "config.h".
6298
6299 2009-11-09  Doug Kwan  <dougkwan@google.com>
6300
6301         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
6302         (arm_symbol_value): Remove.
6303         (Arm_relocate_functions::arm_branch_common,
6304         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
6305         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
6306         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
6307         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
6308         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
6309         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
6310         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
6311         Arm_relocate_functions::thm_mobw_abs_nc,
6312         Arm_relocate_functions::thm_mov_abs,
6313         Arm_relocate_functions::movw_prel_nc,
6314         Arm_relocate_functions::thm_movt_abs,
6315         Arm_relocate_functions::movt_prel,
6316         Arm_relocate_functions::thm_movw_prel_nc,
6317         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
6318         (Target_arm::Relocate::relocate): Only decompose address into two
6319         parts if relocation type uses the thumb-bit and pass the actual
6320         bit instead of a flag indicating that the thumb-bit is used.  Adjust
6321         calls to methods in Arm_relocate_functions for this change.
6322
6323 2009-11-08  Ian Lance Taylor  <iant@google.com>
6324
6325         PR 10925
6326         * reloc.cc: Instantiate
6327         Sized_relobj::initialize_input_to_output_maps and
6328         Sized_relobj:free_input_to_output_maps.
6329
6330 2009-11-06  Ian Lance Taylor  <iant@google.com>
6331
6332         PR 10876
6333         * defstd.cc (in_segment): Set only_if_ref true for "end".
6334
6335 2009-11-06  Doug Kwan  <dougkwan@google.com>
6336
6337         * arm.cc (class Reloc_stub): Correct a comment.
6338         (Target_arm::Target_arm): Initialize arm_input_section_map_.
6339         (Target_arm::scan_section_for_stubs): New method declaration.
6340         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
6341         Change methods from private to protected.
6342         (Target_arm::do_may_relax): New method definition.
6343         (Target_arm::do_relax, Target_arm::group_sections,
6344         Target_arm::scan_reloc_for_stub,
6345         Target_arm::scan_reloc_section_for_stubs): New method declarations.
6346         (Target_arm::arm_input_section_map_): New data member declaration.
6347         (Target_arm::scan_reloc_for_stub,
6348         Target_arm::scan_reloc_section_for_stubs,
6349         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
6350         Target_arm::do_relax): New method definitions.
6351
6352 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
6353
6354         * configure.ac: Check for (struct stat)::st_mtim
6355         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
6356         * config.in: Regenerate.
6357         * configure: Regenerate.
6358
6359 2009-11-05  Ian Lance Taylor  <iant@google.com>
6360
6361         PR 10910
6362         * output.cc (Output_segment::add_output_section): Add missing
6363         return statement.
6364
6365 2009-11-04  Ian Lance Taylor  <iant@google.com>
6366
6367         PR 10880
6368         * object.h (class Object): Add is_needed and set_is_needed
6369         methods.  Add is_needed_ field.  Make bool fields into bitfields.
6370         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
6371         defined in a dynamic object and referenced by a regular object,
6372         set is_needed for the dynamic object.
6373         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
6374         if the file is marked with as_needed and it is not needed.
6375
6376 2009-11-04  Ian Lance Taylor  <iant@google.com>
6377
6378         PR 10887
6379         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
6380         tags if data is discarded by linker script.
6381         * i386.cc (Target_i386::do_finalize_sections): Likewise.
6382         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6383         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6384         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6385
6386 2009-11-04  Ian Lance Taylor  <iant@google.com>
6387
6388         * layout.cc (Layout::get_output_section): Add is_interp and
6389         is_dynamic_linker_section parameters.  Change all callers.
6390         (Layout::choose_output_section): Likewise.
6391         (Layout::make_output_section): Likewise.
6392         (Layout::add_output_section_data): Add is_dynamic_linker_section
6393         parameter.  Change all callers.
6394         * layout.h (class Layout): Update declarations.
6395         * output.h (class Output_section): Add is_interp, set_is_interp,
6396         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
6397         Add is_interp_, is_dynamic_linker_section_ fields.  Change
6398         generate_code_fills_at_write_ to a bitfield.
6399         * output.cc (Output_section::Output_sections): Initialize new
6400         fields.
6401         (Output_segment::add_output_section): Add do_sort parameter.
6402         Change all callers.
6403
6404 2009-11-03  Ian Lance Taylor  <iant@google.com>
6405
6406         PR 10860
6407         * options.h (class General_options): Add --warn-common.
6408         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
6409         merging two common symbols.
6410         (Symbol_table::should_override): Handle --warn-common when merging
6411         a common symbol with a defined symbol.  Use report_resolve_problem
6412         for multiple definitions.
6413         (Symbol_table::report_resolve_problem): New function.
6414         * symtab.h (class Symbol_table): Declare report_resolve_problem.
6415
6416 2009-11-03  Doug Kwan  <dougkwan@google.com>
6417
6418         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
6419         stub_factory_.
6420         (Target_arm::stub_factory): New method definition.
6421         (Target_arm::new_arm_input_section,
6422         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
6423         Target_arm::reloc_uses_thumb_bit): New method declarations.
6424         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
6425         New type definitions.
6426         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
6427         member declarations.
6428         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
6429         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
6430         New method definitions.
6431
6432 2009-11-03  Ian Lance Taylor  <iant@google.com>
6433
6434         * options.h (class General_options): Add --warn_constructors.
6435
6436 2009-11-03  Ian Lance Taylor  <iant@google.com>
6437
6438         PR 10893
6439         * defstd.cc (in_section): Add entries for __rel_iplt_start,
6440         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
6441
6442 2009-11-03  Ian Lance Taylor  <iant@google.com>
6443
6444         PR 10895
6445         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
6446         --msgid-bugs-address.
6447         (install-pdf): New target.
6448         (install-data_yes): Look up one directory to find mkinstalldirs.
6449
6450 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
6451
6452         * po/Make-in (.po.gmo): Don't generate .gmo files in source
6453         tree.
6454
6455 2009-10-30  Doug Kwan  <dougkwan@google.com>
6456
6457         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
6458
6459 2009-10-30  Doug Kwan  <dougkwan@google.com>
6460
6461         * arm.cc (Stub_addend_reader): New struct template definition
6462         and partial specializations.
6463         (Stub_addend_reader::operator()): New method definition for a
6464         partially specialized template.
6465
6466 2009-10-30  Doug Kwan  <dougkwan@google.com>
6467
6468         * arm.cc (Arm_relobj::processor_specific_flags): New method
6469         definition.
6470         (Arm_relobj::do_read_symbols): New method declaration.
6471         (Arm_relobj::processor_specific_flags_): New data member declaration.
6472         (Arm_dynobj): New class definition.
6473         (Target_arm::do_finalize_sections): Add input_objects parameter.
6474         (Target_arm::do_adjust_elf_header): New method declaration.
6475         (Target_arm::are_eabi_versions_compatible,
6476         (Target_arm::merge_processor_specific_flags): New method declaration.
6477         (Target_arm::do_make_elf_object): New overloaded method definitions
6478         and declaration.
6479         (Arm_relobj::do_read_symbols): New method definition.
6480         (Arm_dynobj::do_read_symbols): Ditto.
6481         (Target_arm::do_finalize_sections): Add input_objects parameters.
6482         Merge processor-specific flags from all input objects.
6483         (Target_arm::are_eabi_versions_compatible,
6484         Target_arm::merge_processor_specific_flags,
6485         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
6486         New method definitions.
6487         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
6488         Input_objects pointer type parameter.
6489         * layout.cc (Layout::finalize): Pass input objects to target's.
6490         finalize_sections function.
6491         * output.cc (Output_file_header::do_sized_write): Set ELF file
6492         header's processor-specific flags.
6493         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
6494         Input_objects pointer type parameter.
6495         * sparc.cc (Target_sparc::do_finalize_sections): Same.
6496         * target.h (Input_objects): New forward class declaration.
6497         (Target::processor_specific_flags,
6498         Target::are_processor_specific_flags_sect): New method definitions.
6499         (Target::finalize_sections): Add input_objects parameter.
6500         (Target::Target): Initialize processor_specific_flags_ and
6501         are_processor_specific_flags_set_.
6502         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
6503         parameter.
6504         (Target::set_processor_specific_flags): New method definition.
6505         (Target::processor_specific_flags_,
6506         Target::are_processor_specific_flags_set_): New data member
6507         declarations.
6508         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
6509         Input_objects pointer type parameter.
6510
6511 2009-10-30  Doug Kwan  <dougkwan@google.com>
6512
6513         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
6514
6515 2009-10-28  Ian Lance Taylor  <iant@google.com>
6516
6517         * object.h (class Relobj): Drop options parameter from
6518         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
6519         do_scan_relocs, do_relocate.  Change all callers.
6520         (class Sized_relobj): Drop options parameters from
6521         do_gc_process_relocs, do_scan_relocs, do_relocate,
6522         do_relocate_sections, relocate_sections, emit_relocs_scan,
6523         emit_relocs_scan_reltype.  Change all callers.
6524         (struct Relocate_info): Remove options field and all references to
6525         it.
6526         * reloc.h (class Read_relocs): Remove options constructor
6527         parameter and options_ field.  Change all callers.
6528         (class Gc_process_relocs, class Scan_relocs): Likewise.
6529         (class Relocate_task): Likewise.
6530         * target-reloc.h (scan_relocs): Remove options parameter.  Change
6531         all callers.
6532         (scan_relocatable_relocs): Likewise.
6533         * target.h (class Sized_target): Remove options parameter from
6534         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
6535         all callers.
6536         * gc.h (gc_process_relocs): Remove options parameter.  Change all
6537         callers.
6538         * arm.cc: Update functions to remove options parameters.
6539         * i386.cc: Likewise.
6540         * powerpc.cc: Likewise.
6541         * sparc.cc: Likewise.
6542         * x86_64.cc: Likewise.
6543         * testsuite/testfile.cc: Likewise.
6544
6545 2009-10-28  Doug Kwan  <dougkwan@google.com>
6546
6547         * arm.cc (Arm_relobj): New class definition.
6548         (Arm_relobj::scan_sections_for_stubs,
6549         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
6550         New method definitions.
6551
6552 2009-10-28  Cary Coutant  <ccoutant@google.com>
6553
6554         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
6555         (Plugin::cleanup_done_): New member.
6556         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
6557         (Plugin_manager::cleanup_done_): Remove.
6558         (Plugin_manager::add_input_file): Edit error message.
6559         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
6560         (Plugin_manager::cleanup): Remove use of cleanup_done_.
6561
6562 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
6563
6564         * fileread.cc: (File_read::View::~View): Use the new
6565         data_ownership_ filed.
6566         (File_read::~File_read): Dispose the new whole_file_view_.
6567         (File_read::open): Mmap the whole file if needed.
6568         (File_read::open): Use whole_file_view_ instead of contents_.
6569         (File_read::find_view): Use whole_file_view_ if applicable.
6570         (File_read::do_read): Use whole_file_view_ instead of contents_.
6571         (File_read::make_view): Use whole_file_view_ instead of contents_,
6572         update File_read::View::View call.
6573         (File_read::find_or_make_view): Update File_read::View::View
6574         call.
6575         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
6576         remove contents_
6577         (File_read::View::Data_ownership): New enum.
6578         (File_read::View::View): Replace bool mapped_ with Data_ownership
6579         argument.
6580         (File_read::View::mapped_): Remove (replaced by data_ownership_).
6581         (File_read::View::data_ownership_): New field.
6582         (File_read::contents_): Remove (replaced by whole_file_view_).
6583         (File_read::whole_file_view_): New field.
6584         * options.h (class General_options): Add --keep-files-mapped.
6585
6586 2009-10-27  Cary Coutant  <ccoutant@google.com>
6587
6588         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
6589         * testsuite/Makefile.am (plugin_test_5): New test case.
6590         * testsuite/Makefile.in: Regenerate.
6591
6592 2009-10-25  Doug Kwan  <dougkwan@google.com>
6593
6594         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
6595         from private to protected to allow access by child class.
6596         (Sized_relobj::do_relocate_sections): New method declaration.
6597         (Sized_relobj::relocate_sections): Virtualize.
6598         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
6599         Sized_relobj::relocate_sections.  Instantiate template explicitly
6600         for different target sizes and endianity.
6601
6602 2009-10-24  Doug Kwan  <dougkwan@google.com>
6603
6604         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
6605         (Arm_input_section::as_arm_input_section): New method.
6606         (Arm_output_section): New class definition.
6607         (Arm_output_section::create_stub_group,
6608         Arm_output_section::group_sections): New method definitions.
6609
6610 2009-10-22  Doug Kwan  <dougkwan@google.com>
6611
6612         * arm.cc (Arm_input_section): New class definition.
6613         (Arm_input_section::init, Arm_input_section:do_write,
6614         Arm_input_section::set_final_data_size,
6615         Arm_input_section::do_reset_address_and_file_offset): New method
6616         definitions.
6617
6618 2009-10-21  Doug Kwan  <dougkwan@google.com>
6619
6620         * arm.cc (Stub_table, Arm_input_section): New forward class
6621         declarations.
6622         (Stub_table): New class defintion.
6623         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
6624         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
6625         New method definition.
6626
6627 2009-10-21  Doug Kwan  <dougkwan@google.com>
6628
6629         * arm.cc: Update copyright comments.
6630         (Target_arm): New forward class template declaration.
6631         (Arm_address): New type.
6632         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
6633         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
6634         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
6635         constants.
6636         (Insn_template): Same.
6637         (DEF_STUBS): New macro.
6638         (Stub_type): New enum type.
6639         (Stub_template): New class definition.
6640         (Stub): Same.
6641         (Reloc_stub): Same.
6642         (Stub_factory): Same.
6643         (Target_arm::Target_arm): Initialize may_use_blx_ and
6644         should_force_pic_veneer_.
6645         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
6646         Target_arm::should_force_pic_veneer,
6647         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
6648         Target_arm::using_thumb_only, Target_arm:;default_target): New
6649         method defintions.
6650         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
6651         New data member declarations.
6652         (Insn_template::size, Insn_template::alignment): New method defintions.
6653         (Stub_template::Stub_template): New method definition.
6654         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
6655         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
6656         (Stub_factory::Stub_factory): New method definition.
6657         * gold.h (string_hash): New template.
6658         * output.h (Input_section_specifier::hash_value): Use
6659         gold::string_hash.
6660         (Input_section_specifier::string_hash): Remove.
6661         * stringpool.cc (Stringpool_template::string_hash): Use
6662         gold::string_hash.
6663
6664 2009-10-20  Doug Kwan  <dougkwan@google.com>
6665
6666         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
6667         symbols of relaxed input sections.
6668         * output.h (Output_section::find_relaxed_input_section): Make
6669         method public.
6670
6671 2009-10-16  Doug Kwan  <dougkwan@google.com>
6672
6673         * dynobj.cc (Versions::Versions): Initialize version_script_.
6674         Only insert base version symbol definition for a shared object
6675         if version script defines any version versions.
6676         (Versions::define_base_version): New method definition.
6677         (Versions::add_def): Check that base version is not needed.
6678         (Versions::add_need): Define base version lazily.
6679         * dynobj.h (Versions::define_base_version): New method declaration.
6680         (Versions::needs_base_version_): New data member declaration.
6681         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
6682         (check_DATA): Add no_version_test.stdout.
6683         (libno_version_test.so, no_version_test.o no_version_test.stdout):
6684         New make rules.
6685         * testsuite/Makefile.in: Regenerate.
6686         * testsuite/no_version_test.c: New file.
6687         * testsuite/no_version_test.sh: Ditto.
6688
6689 2009-10-16  Doug Kwan  <dougkwan@google.com>
6690
6691         * expression.cc (class Segment_start_expression): New class definition.
6692         (Segment_start_expression::value): New method definition.
6693         (script_exp_function_segment_start): Return a new
6694         Segment_start_expression.
6695         * gold/script-c.h (script_saw_segment_start_expression): New function
6696         prototype.
6697         * script-sections.cc (Script_sections::Script_sections): Initialize
6698         SAW_SEGMENT_START_EXPRESSION_ to false.
6699         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
6700         and -Tbbs options to specify section addresses if given in
6701         command line and no SEGMENT_START expression is seen in a script.
6702         * script-sections.h (Script_sections::saw_segment_start_expression,
6703         Script_sections::set_saw_segment_start_expression): New method
6704         definition.
6705         (Script_sections::saw_segment_start_expression_): New data member
6706         declaration.
6707         * script.cc (script_saw_segment_start_expression): New function.
6708         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
6709         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
6710         script_test_7.sh and script_test_8.sh.
6711         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
6712         script_test_8.stdout.
6713         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
6714         (script_test_6, script_test_6.stdout, script_test_7,
6715         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
6716         * Makefile.in: Regenerate.
6717         * testsuite/script_test_6.sh: New file.
6718         * testsuite/script_test_6.t: Same.
6719         * testsuite/script_test_7.sh: Same.
6720         * testsuite/script_test_7.t: Same.
6721         * testsuite/script_test_8.sh: Same.
6722
6723 2009-10-16  Doug Kwan  <dougkwan@google.com>
6724
6725         * output.cc (Output_segment::set_section_list_address): Cast
6726         expressions to unsigned long long type to avoid format warnings.
6727
6728 2009-10-15  Ian Lance Taylor  <iant@google.com>
6729
6730         * script.cc (Script_options::add_symbol_assignment): Always add a
6731         dot assignment to script_sections_.
6732         * script-sections.cc (Script_sections::add_dot_assignment):
6733         Initialize if necessary.
6734
6735         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
6736         program headers with no load segment if there is a linker script.
6737
6738         * layout.cc (Layout::set_segment_offsets): Align the file offset
6739         to the segment aligment for -N or -n with no load segment.
6740         * output.cc (Output_segment::add_output_section): Don't crash if
6741         the first section is a TLS section.
6742         (Output_segment::set_section_list_addresses): Print an error
6743         message if the address moves backward in a linker script.
6744         * script-sections.cc
6745         (Output_section_element_input::set_section_addresses): Don't
6746         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
6747         (Orphan_output_section::set_section_addresses): Likewise.
6748
6749 2009-10-15  Doug Kwan  <dougkwan@google.com>
6750
6751         * layout.cc (Layout::finish_dynamic_section): Generate tags
6752         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
6753         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
6754         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
6755
6756 2009-10-14  Ian Lance Taylor  <iant@google.com>
6757
6758         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
6759         fields.
6760         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
6761         data_shdr fields of relinfo.
6762         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
6763         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
6764         R_386_TLS_LDO_32, adjust based on section flags.
6765         (Target_i386::Relocate::fix_up_ldo): Remove.
6766
6767 2009-10-13  Ian Lance Taylor  <iant@google.com>
6768
6769         Add support for -pie.
6770         * options.h (class General_options): Add -pie and
6771         --pic-executable.
6772         (General_options::output_is_position_independent): Test -pie.
6773         (General_options::output_is_executable): Return true if not shared
6774         and not relocatable.
6775         (General_options::output_is_pie): Remove.
6776         * options.cc (General_options::finalize): Reject incompatible uses
6777         of -pie.
6778         * gold.cc (queue_middle_tasks): A -pie link is not static.
6779         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
6780         * symtab.cc (Symbol::final_value_is_known): Return false if
6781         output_is_position_independent.
6782         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
6783         output_is_position_independent.
6784         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
6785         output_is_position_independent.
6786         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
6787         output_is_position_independent.
6788         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
6789         two_file_pie_test.
6790         (basic_pie_test.o, basic_pie_test): New targets.
6791         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
6792         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
6793         (two_file_pie_test): New target.
6794         * testsuite/Makefile.in: Rebuild.
6795         * README: Remove note saying that -pie is not supported.
6796
6797 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
6798
6799         * options.h (class General_options): Add -init and -fini.
6800         * layout.cc (Layout::finish_dynamic_section): Emit
6801         given init and fini functions.
6802
6803 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
6804
6805         * gc.h (gc_process_relocs): Check if icf is enabled using new
6806         function.
6807         * gold.cc (queue_initial_tasks): Likewise.
6808         (queue_middle_tasks): Likewise.
6809         * object.cc (do_layout): Likewise.
6810         * symtab.cc (is_section_folded): Likewise.
6811         * main.cc (main): Likewise.
6812         * reloc.cc (Read_relocs::run): Likewise.
6813         (Sized_relobj::do_scan_relocs): Likewise.
6814         * icf.cc (is_function_ctor_or_dtor): New function.
6815         (Icf::find_identical_sections): Check if function is ctor or dtor when
6816         safe icf is chosen.
6817         * options.h (General_options::icf): Change option to be an enum.
6818         (Icf_status): New enum.
6819         (icf_enabled): New method.
6820         (icf_safe_folding): New method.
6821         (set_icf_status): New method.
6822         (icf_status_): New variable.
6823         * (options.cc) (General_options::finalize): Set icf_status_.
6824         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
6825         icf_test and icf_keep_unique_test to use the --icf enum flag.
6826         * testsuite/icf_safe_test.sh: New file.
6827         * testsuite/icf_safe_test.cc: New file.
6828
6829 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
6830
6831         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
6832         includes to gc.h and icf.h.
6833         * arm.cc: Include gc.h.
6834         * gold.cc: Likewise.
6835         * i386.cc: Likewise.
6836         * powerpc.cc: Likewise.
6837         * sparc.cc: Likewise.
6838         * x86_64.cc: Likewise.
6839         * gc.h: Include icf.h.
6840
6841 2009-10-11  Ian Lance Taylor  <iant@google.com>
6842
6843         * plugin.cc: Include "gold.h" before other header files.
6844
6845 2009-10-10  Chris Demetriou  <cgd@google.com>
6846
6847         * options.h (Input_file_argument::Input_file_type): New enum.
6848         (Input_file_argument::is_lib_): Replace with...
6849         (Input_file_argument::type_): New member.
6850         (Input_file_argument::Input_file_argument): Take Input_file_type
6851         'type' rather than boolean 'is_lib' as second argument.
6852         (Input_file_argument::is_lib): Use type_.
6853         (Input_file_argument::is_searched_file): New function.
6854         (Input_file_argument::may_need_search): Handle is_searched_file.
6855         * options.cc (General_options::parse_library): Support -l:filename.
6856         (General_options::parse_just_symbols): Update for Input_file_argument
6857         changes.
6858         (Command_line::process): Likewise.
6859         * archive.cc (Archive::get_file_and_offset): Likewise.
6860         * plugin.cc (Plugin_manager::release_input_file): Likewise.
6861         * script.cc (read_script_file, script_add_file): Likewise.
6862         * fileread.cc (Input_file::Input_file): Likewise.
6863         (Input_file::will_search_for): Handle is_searched_file.
6864         (Input_file::open): Likewise.
6865         * readsyms.cc (Read_symbols::get_name): Likewise.
6866         * testsuite/Makefile.am (searched_file_test): New test.
6867         * testsuite/Makefile.in: Regenerate.
6868         * testsuite/searched_file_test.cc: New file.
6869         * testsuite/searched_file_test_lib.cc: New file.
6870
6871 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6872             Ian Lance Taylor  <iant@google.com>
6873
6874         * descriptor.cc: Include <cstdio> and "binary-io.h".
6875         (Descriptors::open): Open the files in binary mode always.
6876         * script.cc (Lex::get_token): Treat \r as whitespace.
6877
6878 2009-10-09  Ian Lance Taylor  <iant@google.com>
6879
6880         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
6881
6882 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6883             Ian Lance Taylor  <iant@google.com>
6884
6885         * configure.ac: Check for readv function also.
6886         * fileread.cc (readv): Define if not HAVE_READV.
6887         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
6888         does not exist.
6889         * config.in: Regenerate.
6890         * configure: Regenerate.
6891
6892 2009-10-09  Doug Kwan  <dougkwan@google.com>
6893
6894         * layout.cc (Layout::make_output_section): Call target hook to make
6895         ordinary output section.
6896         (Layout::finalize): Adjust parameter list of call the
6897         Target::may_relax().
6898         * layout.h (class Layout::section_list): New method.
6899         * merge.h (Output_merge_base::entsize): Change visibility to public.
6900         (Output_merge_base::is_string, Output_merge_base::do_is_string):
6901         New methods.
6902         (Output_merge_string::do_is_string): New method.
6903         * object.cc (Sized_relobj::do_setup): renamed from
6904         Sized_relobj::set_up.
6905         * object.h (Sized_relobj::adjust_shndx,
6906         Sized_relobj::initializ_input_to_output_maps,
6907         Sized_relobj::free_input_to_output_maps): Change visibilities to
6908         protected.
6909         (Sized_relobj::setup): Virtualize.
6910         (Sized_relobj::do_setup): New method declaration.
6911         (Sized_relobj::invalidate_section_offset,
6912         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
6913         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
6914         * options.cc (parse_int): New function.
6915         * options.h (parse_int): New declaration.
6916         (DEFINE_int): New macro.
6917         (stub_group_size): New option.
6918         * output.cc (Output_section::Output_section): Initialize memebers
6919         merge_section_map_, merge_section_by_properties_map_,
6920         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
6921         (Output_section::add_input_section): Handled deferred code-fill
6922         generation and remove an old comment.
6923         (Output_section::add_relaxed_input_section): New method definition.
6924         (Output_section::add_merge_input_section): Use merge section by
6925         properties map to speed to search.  Update merge section maps
6926         as appropriate.
6927         (Output_section::build_relaxation_map): New method definition.
6928         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6929         Same.
6930         (Output_section::relax_input_section): Renamed to
6931         Output_section::convert_input_sections_to_relaxed_sections and change
6932         interface to take a vector of pointers to relaxed sections.
6933         (Output_section::find_merge_section,
6934         Output_section::find_relaxed_input_section): New method definitions.
6935         (Output_section::is_input_address_mapped,
6936         Output_section::output_offset, Output_section::output_address):
6937         Use output section data maps to speed up searching.
6938         (Output_section::find_starting_output_address): Add comments.
6939         (Output_section::do_write,
6940         Output_section::write_to_postprocessing_buffer): Do code-fill
6941         generation as appropriate.
6942         (Output_section::get_input_sections): Invalidate relaxed input section
6943         map.
6944         (Output_section::restore_states): Adjust type of checkpoint .
6945         Invalidate relaxed input section map.
6946         * output.h (Output_merge_base): New class declaration.
6947         (Input_section_specifier): New class defintion.
6948         (class Output_relaxed_input_section) Change base class to
6949         Output_section_data_build.
6950         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
6951         base class initializer.
6952         (Output_section::add_relaxed_input_section): New method declaration.
6953         (Output_section::Input_section): Change visibility to protected.
6954         (Output_section::Input_section::relobj,
6955         Output_section::Input_section::shndx): Handle relaxed input sections.
6956         Output_section::input_sections) Change visibility to protected.  Also
6957         define overload to return a non-const pointer.
6958         (Output_section::Merge_section_properties): New class defintion.
6959         (Output_section::Merge_section_by_properties_map,
6960         Output_section::Output_section_data_by_input_section_map,
6961         Output_section::Relaxation_map): New types.
6962         (Output_section::relax_input_section): Rename method to
6963         Output_section::convert_input_sections_to_relaxed_sections and change
6964         interface to take a vector of relaxed section pointers.
6965         (Output_section::find_merge_section,
6966         Output_section::find_relaxed_input_section,
6967         Output_section::build_relaxation_map,
6968         Output_section::convert_input_sections_in_list_to_relaxed_sections):
6969         New method declarations.
6970         (Output_section::merge_section_map_
6971         Output_section::merge_section_by_properties_map_,
6972         Output_section::relaxed_input_section_map_,
6973         Output_section::is_relaxed_input_section_map_valid_,
6974         Output_section::generate_code_fills_at_write_): New data members.
6975         * script-sections.cc
6976         (Output_section_element_input::set_section_addresses): Call
6977         current_data_size and addralign methods of relaxed input sections.
6978         (Orphan_output_section::set_section_addresses): Call current_data_size
6979         and addralign methods of relaxed input sections.
6980         * symtab.cc (Symbol_table::compute_final_value): Extract template
6981         from the body of Symbol_table::sized_finalize_symbol.
6982         (Symbol_table::sized_finalized_symbol): Call
6983         Symbol_table::compute_final_value.
6984         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
6985         (Symbol_table::compute_final_value): New templated method declaration.
6986         * target.cc (Target::do_make_output_section): New method defintion.
6987         * target.h (Target::make_output_section): New method declaration.
6988         (Target::relax): Add more parameters for input objects, symbol table
6989         and layout.  Adjust call to do_relax.
6990         (Target::do_make_output_section): New method declaration.
6991         (Target::do_relax): Add parameters for input objects, symbol table
6992         and layout.
6993
6994 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6995
6996         * pread.c: Include stdio.h.
6997
6998 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6999
7000         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
7001         defined.
7002
7003 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
7004
7005         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7006         Change read_shndx type to unsigned int.
7007         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
7008         int.
7009         (Sized_dwarf_line_info::read_line_mappings): Likewise.
7010         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
7011         Change read_shndx type to unsigned int.
7012         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
7013         int.
7014         (Sized_dwarf_line_info::read_line_mappings): Likewise.
7015         * layout.cc (Layout::create_symtab_sections): Cast the result of
7016         local_symcount * symsize to off_t in the gold_assert.
7017
7018 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7019
7020         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
7021         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
7022         R_ARM_BASE_ABS.
7023         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
7024         (Arm_relocate_functions::thm_abs5): New function.
7025         (Arm_relocate_functions::abs12): New function.
7026         (Arm_relocate_functions::abs16): New function.
7027         (Arm_relocate_functions::base_abs): New function.
7028         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
7029         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
7030         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
7031         R_ARM_BASE_ABS.
7032         (Scan::global): Likewise.
7033         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
7034         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
7035         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
7036         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
7037         R_ARM_BASE_ABS.
7038
7039 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7040
7041         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
7042         (Arm_relocate_functions::movt_prel): New function.
7043         (Arm_relocate_functions::thm_movw_prel_nc): New function.
7044         (Arm_relocate_functions::thm_movt_prel): New function.
7045         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
7046         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
7047         (Scan::global, Relocate::relocate): Likewise.
7048         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7049
7050 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
7051
7052         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
7053         Incremental_checker.
7054         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
7055         unsigned int.
7056         (class Incremental_inputs_header): New class.
7057         (Incremental_inputs_header_writer): Edit comment.
7058         (Incremental_inputs_entry): New class.
7059         (Incremental_inputs_entry_writer): Edit comment.
7060         (Sized_incremental_binary::do_find_incremental_inputs_section):
7061         Add *strtab_shndx parameter, fill it.
7062         (Sized_incremental_binary::do_check_inputs): New method.
7063         (Incremental_checker::can_incrementally_link_output_file): Use
7064         Sized_incremental_binary::check_inputs.
7065         (Incremental_inputs::report_command_line): Save command line in
7066         command_line_.
7067         * incremental.h:
7068         (Incremental_binary::find_incremental_inputs_section): New
7069         method.
7070         (Incremental_binary::do_find_incremental_inputs_section): Add
7071         strtab_shndx parameter.
7072         (Incremental_binary::do_check_inputs): New pure virtual method.
7073         (Sized_incremental_binary::do_check_inputs): Declare.
7074         (Incremental_checker::Incremental_checker): Add incremental_inputs
7075         parameter, use it to initialize incremental_inputs_.
7076         (Incremental_checker::incremental_inputs_): New field.
7077         (Incremental_checker::command_line): New method.
7078         (Incremental_checker::inputs): New method.
7079         (Incremental_checker::command_line_): New field.
7080
7081 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
7082
7083         * incremental.cc: Include <cstdarg> and "target-select.h".
7084         (vexplain_no_incremental): New function.
7085         (explain_no_incremental): New function.
7086         (Incremental_binary::error): New method.
7087         (Sized_incremental_binary::do_find_incremental_inputs_section): New
7088         method.
7089         (make_sized_incremental_binary): New function.
7090         (open_incremental_binary): New function.
7091         (can_incrementally_link_file): Add checks if output is ELF and has
7092         inputs section.
7093         * incremental.h: Include "elfcpp_file.h" and "output.h".
7094         (Incremental_binary): New class.
7095         (Sized_incremental_binary): New class.
7096         (open_incremental_binary): Declare.
7097         * object.cc (is_elf_object): Use
7098         elfcpp::Elf_recognizer::is_elf_file.
7099         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
7100         * output.h (Output_file::filesize): New method.
7101
7102 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7103
7104         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
7105         New function.
7106         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
7107         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
7108         function.
7109         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
7110         function.
7111         (Arm_relocate_functions::movw_abs_nc): New function.
7112         (Arm_relocate_functions::movt_abs): New function.
7113         (Arm_relocate_functions::thm_movw_abs_nc): New function.
7114         (Arm_relocate_functions::thm_movt_abs): New function.
7115         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
7116         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
7117         (Scan::global): Likewise.
7118         (Relocate::relocate): Likewise.
7119         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7120
7121 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7122
7123         * arm.cc (Arm_relocate_functions::got_prel) New function.
7124         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
7125         (Relocate::relocate): Likewise.
7126         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7127
7128 2009-10-06  Ian Lance Taylor  <iant@google.com>
7129
7130         * options.h (class General_options): Define
7131         split_stack_adjust_size parameter.
7132         * object.h (class Object): Add uses_split_stack_ and
7133         has_no_split_stack_ fields.  Add uses_split_stack and
7134         has_no_split_stack accessor functions.  Declare
7135         handle_split_stack_section.
7136         (class Reloc_symbol_changes): Define.
7137         (class Sized_relobj): Define Function_offsets.  Declare
7138         split_stack_adjust, split_stack_adjust_reltype, and
7139         find_functions.
7140         * object.cc (Object::handle_split_stack_section): New function.
7141         (Sized_relobj::do_layout): Call handle_split_stack_section.
7142         * dynobj.cc (Sized_dynobj::do_layout): Call
7143         handle_split_stack_section.
7144         * reloc.cc (Sized_relobj::relocate_sections): Call
7145         split_stack_adjust for executable sections in split_stack
7146         objects.  Pass reloc_map to relocate_section.
7147         (Sized_relobj::split_stack_adjust): New function.
7148         (Sized_relobj::split_stack_adjust_reltype): New function.
7149         (Sized_relobj::find_functions): New function.
7150         * target-reloc.h: Include "object.h".
7151         (relocate_section): Add reloc_symbol_changes parameter.  Change
7152         all callers.
7153         * target.h (class Target): Add calls_non_split method.  Declare
7154         do_calls_non_split virtual method.  Declare match_view and
7155         set_view_to_nop.
7156         * target.cc: Include "elfcpp.h".
7157         (Target::do_calls_non_split): New function.
7158         (Target::match_view): New function.
7159         (Target::set_view_to_nop): New function.
7160         * gold.cc (queue_middle_tasks): Give an error if mixing
7161         split-stack and non-split-stack objects with -r.
7162         * i386.cc (Target_i386::relocate_section): Add
7163         reloc_symbol_changes parameter.
7164         (Target_i386::do_calls_non_split): New function.
7165         * x86_64.cc (Target_x86_64::relocate_section): Add
7166         reloc_symbol_changes parameter.
7167         (Target_x86_64::do_calls_non_split): New function.
7168         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
7169         parameter.
7170         * powerpc.cc (Target_powerpc::relocate_section): Add
7171         reloc_symbol_changes parameter.
7172         * sparc.cc (Target_sparc::relocate_section): Add
7173         reloc_symbol_changes parameter.
7174         * configure.ac: Call AM_CONDITIONAL for the default target.
7175         * configure: Rebuild.
7176         * testsuite/Makefile.am (TEST_AS): New variable.
7177         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
7178         (check_DATA): Add split_i386 and split_x86_64 files.
7179         (SPLIT_DEFSYMS): Define.
7180         (split_i386_[1234n].o): New targets.
7181         (split_i386_[124]): New targets.
7182         (split_i386_[1234r].stdout): New targets.
7183         (split_x86_64_[1234n].o): New targets.
7184         (split_x86_64_[124]): New targets.
7185         (split_x86_64_[1234r].stdout): New targets.
7186         (MOSTLYCLEANFILES): Add new executables.
7187         * testsuite/split_i386.sh: New file.
7188         * testsuite/split_x86_64.sh: New file.
7189         * testsuite/split_i386_1.s: New file.
7190         * testsuite/split_i386_2.s: New file.
7191         * testsuite/split_i386_3.s: New file.
7192         * testsuite/split_i386_4.s: New file.
7193         * testsuite/split_i386_n.s: New file.
7194         * testsuite/split_x86_64_1.s: New file.
7195         * testsuite/split_x86_64_2.s: New file.
7196         * testsuite/split_x86_64_3.s: New file.
7197         * testsuite/split_x86_64_4.s: New file.
7198         * testsuite/split_x86_64_n.s: New file.
7199         * testsuite/testfile.cc (Target_test): Update relocation_section
7200         function.
7201         * testsuite/Makefile.in: Rebuild.
7202
7203 2009-10-06  Ian Lance Taylor  <iant@google.com>
7204
7205         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
7206         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
7207         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
7208         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
7209         the address on ldo_addrs_.
7210         (Target_i386::Relocate::fix_up_ldo): New function.
7211
7212 2009-10-06   Rafael Espindola  <espindola@google.com>
7213
7214         * plugin.cc (add_input_library): New.
7215         (Plugin::load): Add add_input_library to tv.
7216         (Plugin_manager::add_input_file): Add the is_lib argument.
7217         (add_input_file): Update call to Plugin_manager::add_input_file.
7218         (add_input_library): New.
7219         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
7220
7221 2009-09-30  Doug Kwan  <dougkwan@google.com>
7222
7223         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
7224         symbol and call Symbol::may_need_copy_reloc to determine if
7225         a copy reloc is needed.
7226         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
7227         nocopyreloc is given in command line.
7228         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
7229         given in command line.
7230         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
7231         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
7232         of the removed Target_i386::may_need_copy_reloc.
7233         * options.h (copyreloc): New option with default value false.
7234         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
7235         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
7236         instead of the removed Target_powerpc::may_need_copy_reloc.
7237         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
7238         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
7239         instead of the removed Target_sparc::may_need_copy_reloc.
7240         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
7241         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
7242         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
7243         instead of the removed Target_x86_64::may_need_copy_reloc.
7244
7245 2009-09-30  Ian Lance Taylor  <iant@google.com>
7246
7247         * object.h (class Object): Remove target_ field, and target,
7248         sized_target, and set_target methods.
7249         (Object::sized_target): Remove.
7250         (class Sized_relobj): Update declarations.  Remove sized_target.
7251         * object.cc (Sized_relobj::setup): Remove target parameter.
7252         Change all callers.
7253         (Input_objects::add_object): Don't do anything with the target.
7254         (make_elf_sized_object): Add punconfigured parameter.  Change all
7255         callers.  Set or test parameter target.
7256         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
7257         Change all callers.
7258         * parameters.cc (Parameters::set_target): Change parameter type to
7259         be non-const.
7260         (Parameters::default_target): Remove.
7261         (set_parameters_target): Change parameter type to be non-const.
7262         (parameters_force_valid_target): New function.
7263         (parameters_clear_target): New function.
7264         * parameters.h (class Parameters): Update declarations.  Remove
7265         default_target method.  Add sized_target and clear_target
7266         methods.  Change target_ to be non-const.
7267         (set_parameters_target): Update declaration.
7268         (parameters_force_valid_target): Declare.
7269         (parameters_clear_target): Declare.
7270         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
7271         as NULL if we aren't searching.
7272         (Add_symbols::run): Don't check for compatible target.
7273         * fileread.cc (Input_file::open_binary): Call
7274         parameters_force_valid_target.
7275         * gold.cc (queue_middle_tasks): Likewise.
7276         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
7277         set_target on object.
7278         * dynobj.h (class Sized_dynobj): Update declarations.
7279         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
7280         make_elf_object returns NULL.
7281         (Archive::include_member): Don't check whether object target is
7282         compatible.
7283         * output.cc (Output_section::add_input_section): Get target from
7284         parameters.
7285         (Output_section::relax_input_section): Likewise.
7286         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
7287         parameters.
7288         (Sized_relobj::do_scan_relocs): Likewise.
7289         (Sized_relobj::relocate_sections): Likewise.
7290         * resolve.cc (Symbol_table::resolve): Likewise.
7291         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
7292         parameter.  Change all callers.
7293         (Symbol_table::add_from_object): Get target from parameters.
7294         (Symbol_table::add_from_relobj): Don't check object target.
7295         (Symbol_table::add_from_dynobj): Likewise.
7296         (Symbol_table::define_special_symbol): Get target from
7297         parameters.
7298         * symtab.h (class Symbol_table): Update declaration.
7299         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
7300         parameter.  Change all callers.  Clear parameter target.
7301         (Binary_test): Test target here.
7302         * testsuite/object_unittest.cc (gold_testsuite): Remove
7303         target_test_pointer parameter.  Change all callers.
7304         (Object_test): Test target here.
7305
7306 2009-09-26  Ian Lance Taylor  <iant@google.com>
7307
7308         * testsuite/initpri1.c: Don't try to use constructor priorities if
7309         compiling with gcc before 4.3.
7310
7311 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
7312
7313         * testsuite/retain_symbols_file_test.sh (check_present): Change
7314         output file name to retain_symbols_file_test.stdout.
7315         (check_absent): Likewise.
7316
7317 2009-09-18  Craig Silverstein  <csilvers@google.com>
7318
7319         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
7320         * options.cc: Include <cerrno> and <fstream>.
7321         (General_options::finalize): Parse -retain-symbols-file tag.
7322         * options.h: New flag.
7323         (General_options): New method should_retain_symbol, new
7324         variable symbols_to_retain.
7325         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
7326         should_retain_symbol map.
7327         * testsuite/Makefile.am (retain_symbols_file_test): New test.
7328         * testsuite/Makefile.in: Regenerate.
7329         * testsuite/retain_symbols_file_test.sh: New file.
7330
7331 2009-09-18  Nick Clifton  <nickc@redhat.com>
7332
7333         * po/es.po: Updated Spanish translation.
7334
7335 2009-09-17  Doug Kwan  <dougkwan@google.com>
7336
7337         * debug.h (DEBUG_RELAXATION): New constant.
7338         (DEBUG_ALL): Add DEBUG_RELAXATION.
7339         (debug_string_to_enum): Add relaxation debug option.
7340         * layout.cc
7341         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
7342         Layout::Relaxation_debug_check::read_sections,
7343         Layout::Relaxation_debug_check::read_sections): New method definitions.
7344         (Layout::Layout): Initialize data members
7345         record_output_section_data_from_scrips_,
7346         script_output_section_data_list_ and relaxation_debug_check_.
7347         (Layout::save_segments, Layout::restore_segments,
7348         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7349         Layout::relaxation_loop_body): New method definitions.
7350         (Layout::finalize): Support relaxation.  Move section layout code to
7351         Layout::relaxation_loop_body.
7352         (Layout::set_asection_address_from_script): Move code for orphan
7353         section placement out.
7354         (Layout::place_orphan_sections_in_script): New method definition.
7355         * layout.h (Output_segment_headers, Output_file_header):
7356         New forward class declarations.
7357         (Layout::~Layout): Define.
7358         (Layout::new_output_section_data_from_script): New method definition.
7359         (Layout::place_orphan_sections_in_script): New method declaration.
7360         (Layout::Segment_states): New type declaration.
7361         (Layout::save_segments, Layout::restore_segments,
7362         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7363         Layout::relaxation_loop_body): New method declarations.
7364         (Layout::Output_section_data_list): New type declaration.
7365         (Layout::Relaxation_debug_check): New class definition.
7366         (Layout::record_output_section_data_from_script_,
7367         Layout::script_output_section_data_list_, Layout::segment_states_,
7368         Layout::relaxation_debug_check_): New data members.
7369         * output.cc: (Output_section_headers::do_size): New method definition.
7370         (Output_section_headers::Output_section_headers): Move size
7371         computation to Output_section_headers::do_size.
7372         (Output_segment_headers::do_size): New method definition.
7373         (Output_file_header::Output_file_header): Move size computation to
7374         Output_file_header::do_size and call it.
7375         (Output_file_header::do_size): New method definition.
7376         (Output_data_group::Output_data_group): Adjust call to
7377         Output_section_data.
7378         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
7379         (Output_symtab_xindex::do_write): Add array bound check.
7380         (Output_section::Input_section::print_to_mapfile): Handle
7381         RELAXED_INPUT_SECTION_CODE.
7382         (Output_section::Output_section): Initialize data member checkpoint_.
7383         (Output_section::~Output_section): Delete checkpoint object pointed
7384         by checkpoint_.
7385         (Output_section::add_input_section): Always add an Input_section if
7386         relaxing.
7387         (Output_section::add_merge_input_section): Add assert.
7388         (Output_section::relax_input_section): New method definition.
7389         (Output_section::set_final_data_size): Set load address to zero for
7390         an unallocated section.
7391         (Output_section::do_address_and_file_offset_have_reset_values):
7392         New method definition.
7393         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
7394         Handle relaxed input section.
7395         (Output_section::sort_attached_input_sections): Checkpoint input
7396         section list lazily.
7397         (Output_section::get_input_sections): Change type of input_sections to
7398         list of Simple_input_section pointers.  Checkpoint input section list
7399         lazily.  Also handle relaxed input sections.
7400         (Output_section::add_input_section_for_script): Take a reference to
7401         a Simple_input_section object instead of Relobj pointer and section
7402         index as parameter.  Handle relaxed input sections.
7403         (Output_section::save_states, Output_section::restore_states): New
7404         method definitions.
7405         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
7406         (Output_data::is_data_size_fixed): New method definition.
7407         (Output_data::reset_addresss_and_file_offset): Do not reset data size
7408         if it is fixed.
7409         (Output_data::address_and_file_offset_have_reset_values): New method
7410         definition.
7411         (Output_data::do_address_and_file_offset_have_reset_values): New method
7412         definition.
7413         (Output_data::set_data_size): Check that data size is not fixed.
7414         (Output_data::fix_data_size): New method definition.
7415         (Output_data::is_data_size_fixed_): New data member.
7416         (Output_section_headers::set_final_data_size): New method definition.
7417         (Output_section_headers::do_size): New method declaration.
7418         (Output_segment_headers::set_final_data_size): New method definition.
7419         (Output_segment_headers::do_size): New method declaration.
7420         (Output_file_header::set_final_data_size)::New method definition.
7421         (Output_file_header::do_size)::New method declaration.
7422         (Output_section_data::Output_section_data): Add new parameter
7423         is_data_size_fixed and use it to fix data size.
7424         (Output_data_const::Output_data_const): Adjust call to base class
7425         constructor and fix data size.
7426         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
7427         base class constructor and fix data size.
7428         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
7429         base class constructor and fix data size.
7430         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
7431         class constructor and fix data size.
7432         (Output_data_group::set_final_data_size): New method definition.
7433         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
7434         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
7435         class constructor and fix data size.
7436         (Output_relaxed_input_section): New class definition.
7437         (Output_section::Simple_input_section): New class definition.
7438         (Output_section::get_input_sections): Adjust parameter list.
7439         (Output_section::add_input_section_for_script): Same.
7440         (Output_section::save_states, Output_section::restore_states,
7441         Output_section::do_address_and_file_offset_have_reset_values,
7442         (Output_section::Input_section::Input_section): Handle
7443         RELAXED_INPUT_SECTION_CODE.  Add new overload for
7444         Output_relaxed_input_section.
7445         (Output_section::Input_section::is_input_section,
7446         Output_section::Input_section::set_output_section): Handle relaxed
7447         input section.
7448         (Output_section::Input_section::is_relaxed_input_section,
7449         Output_section::Input_section::output_section_data,
7450         Output_section::Input_section::relaxed_input_section): New method
7451         definitions.
7452         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
7453         value.
7454         (Output_section::Input_section::u1_): Update comments.
7455         (Output_section::Input_section::u2_): Add new union member poris.
7456         (Output_section::Checkpoint_output_section): New classs definition.
7457         (Output_section::relax_input_section): New method declaration.
7458         (Output_section::checkpoint_): New data member.
7459         (Output_segment): Update comments.
7460         (Output_segment::Output_segment): Un-privatize copy constructor.
7461         (Output_segment::operator=): Un-privatize.
7462         * script-sections.cc (Output_section_element::Input_section_list):
7463         Change element type to Output_section::Simple_input_section.
7464         (Output_section_element_dot_assignment::set_section_addresses):
7465         Register output section data for relaxation clean up.
7466         (Output_data_exression::Output_data_expression): Adjust call to base
7467         constructor to fix data size.
7468         (Output_section_element_data::set_section_addresses): Register
7469         Output_data_expression object for relaxation clean up.
7470         (struct Input_section_info): Replace Relobj pointer and section index
7471         pair with Output_section::Simple_input_section and Convert struct to a
7472         class.
7473         (Input_section_sorter::operator()): Adjust access to
7474         Input_section_info data member to use accessors.
7475         (Output_section_element_input::set_section_addresses): Use layout
7476         parameter.  Adjust code to use Output_section::Simple_input_section
7477         and Input_secction_info classes.  Register filler for relaxation
7478         clean up.
7479         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
7480         and section index pair with Output_section::Simple_input_section
7481         class.  Adjust code accordingly.
7482         (Phdrs_element::release_segment): New method definition.
7483         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
7484         segment list.
7485         (Script_sections::release_segments): New method definition.
7486         * gold/script-sections.h (Script_sections::release_segments): New
7487         method declaration.
7488         * gold/target.h (Target::may_relax, Target::relax,
7489         Target::do_may_relax, Target::do_relax): New method definitions.
7490
7491 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7492
7493         * arm.cc (has_signed_unsigned_overflow): New function.
7494         (Arm_relocate_functions::abs8): New function.
7495         (Target_arm::Scan::local): Handle R_ARM_ABS8.
7496         (Target_arm::Scan::global): Likewise.
7497         (Target_arm::relocate::relocate): Likewise.
7498         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7499         Likewise.
7500
7501 2009-09-16  Cary Coutant  <ccoutant@google.com>
7502
7503         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
7504         * testsuite/Makefile.in: Regenerate.
7505
7506 2009-09-11  Nick Clifton  <nickc@redhat.com>
7507
7508         * po/gold.pot: Updated by the Translation project.
7509
7510 2009-09-08  Cary Coutant  <ccoutant@google.com>
7511
7512         * output.cc (Output_file::open): Add execute permission to empty file.
7513         * testsuite/Makefile.am (permission_test): New test.
7514         * testsuite/Makefile.in: Regenerate.
7515
7516 2009-09-02  Ian Lance Taylor  <iant@google.com>
7517
7518         * output.cc (Output_file::resize): Call map_no_anonymous rather
7519         than map.
7520
7521 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
7522
7523         * gold.cc: Include "incremental.h".
7524         (queue_initial_tasks): Call Incremental_checker methods.
7525         * incremental.cc: Include "output.h".
7526         (Incremental_checker::can_incrementally_link_output_file): New
7527         method.
7528         * incremental.h (Incremental_checker): New class.
7529
7530         * output.cc (Output_file::open_for_modification): New method.
7531         (Output_file::map_anonymous): Changed return type to bool.  Record
7532         map in base_ field.
7533         (Output_file::map_no_anonymous): New method, broken out of map.
7534         (Output_file::map): Use map_no_anonymous and map_anonymous.
7535         * output.h (class Output_file): Update declarations.
7536
7537 2009-08-24  Cary Coutant  <ccoutant@google.com>
7538
7539         * options.h (Command_line::Pre_options): New class.
7540         (Command_line::pre_options): New member.
7541         * options.cc (gold::options::ready_to_register): New variable.
7542         (One_option::register_option): Do nothing if not registering options.
7543         Assert if same short option registered twice.
7544         (General_options::General_options): Turn off option registration when
7545         done constructing.
7546         (Command_line::Pre_options::Pre_options): New constructor.
7547
7548 2009-08-24  Cary Coutant  <ccoutant@google.com>
7549
7550         * options.h (General_options::no_keep_memory): Remove incorrect
7551         short option.
7552
7553 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7554
7555         * Makefile.am (am__skiplex, am__skipyacc): New.
7556         * Makefile.in: Regenerate.
7557
7558 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7559
7560         * Makefile.am (AM_CPPFLAGS): Renamed from ...
7561         (INCLUDES): ... this.
7562         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
7563         (AM_CPPFLAGS): Renamed from ...
7564         (INCLUDE): ... this.
7565         * Makefile.in, testsuite/Makefile.in: Regenerate.
7566
7567         * Makefile.in: Regenerate.
7568         * aclocal.m4: Likewise.
7569         * config.in: Likewise.
7570         * configure: Likewise.
7571         * testsuite/Makefile.in: Likewise.
7572
7573         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7574         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7575         * Makefile.in: Regenerate.
7576         * testsuite/Makefile.in: Regenerate.
7577
7578 2009-08-19  Cary Coutant  <ccoutant@google.com>
7579
7580         * resolve.cc (Symbol_table::resolve): Don't complain about defined
7581         symbols in shared libraries overridden by hidden or internal symbols
7582         in the main program.
7583
7584 2009-08-19  Chris Demetriou  <cgd@google.com>
7585
7586         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
7587         checking source file names in error messages.
7588
7589 2009-08-18  Doug Kwan  <dougkwan@google.com>
7590
7591         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
7592         an elcpp::Ehdr as parameter.  Adjust call to set_target.
7593         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
7594         an elfcpp::Ehdr as parameter.
7595         * object.cc (Object::set_target): Remove the version that looks up
7596         a target and sets it.
7597         (Sized_relobj::setup): Take a Target object instead of
7598         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
7599         (make_elf_sized_object): Find target and ask target to
7600         make an ELF object.
7601         * object.h: (Object::set_target): Remove the version that looks up
7602         a target and sets it.
7603         (Sized_relobj::setup): Take a Target object instead of
7604         an elfcpp:Ehdr as parameter.
7605         * target.cc: Include dynobj.h.
7606         (Target::do_make_elf_object_implementation): New.
7607         (Target::do_make_elf_object): New.
7608         * target.h (Target::make_elf_object): New template declaration.
7609         (Target::do_make_elf_object): New method declarations.
7610         (Target::do_make_elf_object_implementation): New template declaration.
7611
7612 2009-08-14  Ian Lance Taylor  <iant@google.com>
7613
7614         * gold.h (FUNCTION_NAME): Define.
7615         (gold_unreachable): Use FUNCTION_NAME.
7616
7617 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
7618
7619         * icf.cc (Icf::find_identical_sections): Issue a warning when a
7620         symbol in the --keep-unique list is not found.
7621
7622 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
7623
7624         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
7625         been maked as --keep-unique.
7626         (Icf::unfold_section): New function.
7627         * icf.h (Icf::unfold_section): New function.
7628         * options.h (General_options::keep_unique): New option.
7629         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
7630         * testsuite/Makefile.in: Regenerate.
7631         * testsuite/icf_keep_unique_test.sh: New file.
7632         * testsuite/icf_keep_unique_test.cc: New file.
7633
7634 2009-08-12  Cary Coutant  <ccoutant@google.com>
7635
7636         PR 10471
7637         * resolve.cc (Symbol_table::resolve): Check for references from
7638         dynamic objects to hidden and internal symbols.
7639         * testsuite/Makefile.am (hidden_test.sh): New test.
7640         * testsuite/Makefile.in: Regenerate.
7641         * testsuite/hidden_test.sh: New script.
7642         * testsuite/hidden_test_1.c: New test source.
7643         * testsuite/hidden_test_main.c: New test source.
7644
7645 2009-08-11  Doug Kwan  <dougkwan@google.com>
7646
7647         * arm.cc: Update comments.
7648         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
7649         segment to locate the .ARM.exidx section if present.
7650
7651 2009-08-09  Doug Kwan  <dougkwan@google.com>
7652
7653         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
7654         patch.
7655
7656 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
7657         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
7658         compiler warnings.
7659
7660 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
7661
7662         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
7663         valid tls_segment only for non-debug-section relocations.
7664         * testsuite/Makefile.am: Add gc_tls_test.
7665         * testsuite/Makefile.in: Regenerate.
7666         * testsuite/gc_tls_test.cc: New file.
7667         * testsuite/gc_tls_test.sh: New file.
7668
7669 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
7670
7671         * icf.cc: New file.
7672         * icf.h: New file.
7673         * Makefile.am (CCFILES): Add icf.cc.
7674         (HFILES): Add icf.h
7675         * Makefile.in: Regenerate.
7676         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
7677         * gc.h (gc_process_relocs): Populate lists used by icf to contain
7678         section, symbol and addend information for the relocs.
7679         * gold.cc (queue_middle_tasks): Call identical code folding.
7680         * gold.h: Add defines for multimap.
7681         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
7682         to the call of finalize_local_symbols.
7683         * main.cc (main): Create object of class Icf.
7684         * object.cc (Sized_relobj::do_layout): Allow this function to be
7685         called twice during icf.
7686         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
7687         to sections marked as identical by icf.
7688         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
7689         when available.
7690         (Sized_relobj::do_section_entsize): New function.
7691         * object.h (Object::section_entsize): New function.
7692         (Object::do_section_entsize): New pure virtual function.
7693         (Relobj::finalize_local_symbols): Add new parameter.
7694         (Relobj::do_section_entsize): New function.
7695         * options.h (General_options::icf): New option.
7696         (General_options::icf_iterations): New option.
7697         (General_options::print_icf_sections): New option.
7698         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
7699         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
7700         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
7701         icf.
7702         * symtab.cc (Symbol_table::is_section_folded): New function.
7703         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
7704         to sections marked as identical by icf.
7705         * symtab.h (Symbol_table::set_icf): New function.
7706         (Symbol_table::icf): New function.
7707         (Symbol_table::is_section_folded): New function.
7708         (Symbol_table::icf_): New data member.
7709         * target-reloc.h (relocate_section): Ignore sections folded by icf.
7710         * testsuite/Makefile.am: Add commands to build icf_test.
7711         * testsuite/Makefile.in: Regenerate.
7712         * testsuite/icf_test.sh: New file.
7713         * testsuite/icf_test.cc: New file.
7714
7715 2009-07-24  Chris Demetriou  <cgd@google.com>
7716
7717         * layout.cc (is_compressible_debug_section): Fix incorrect
7718         comment about compressed section names.
7719
7720 2009-07-20  Ian Lance Taylor  <ian@airs.com>
7721
7722         PR 10419
7723         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
7724
7725 2009-07-16  Ian Lance Taylor  <iant@google.com>
7726
7727         PR 10400
7728         * layout.h: #include <map>.
7729         (class Kept_section): Change from struct to class.  Add accessors
7730         and setters.  Add section size to Comdat_group mapping.  Change
7731         Comdat_group to std::map.  Add is_comdat_ field.  Add
7732         linkonce_size field in union.
7733         (class Layout): Update declaration of find_or_add_kept_section.
7734         Don't declare find_kept_object.
7735         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
7736         parameter.  Add object, shndx, is_comdat, and is_group_name
7737         parameters.  Change all callers.  Adjust for new Kept_section.
7738         (Layout::find_kept_object): Remove.
7739         * object.cc (Sized_relobj::include_section_group): Update use of
7740         Kept_section.  Rename secnum to shndx.  Only record
7741         Kept_comdat_section if sections are the same size.
7742         (Sized_relobj::include_linkonce_section): Update use of
7743         Kept_section.  Only record Kept_comdat_section if sections are the
7744         same size.  Set size of linkonce section.
7745         (Sized_relobj::map_to_kept_section): Update call to
7746         get_kept_comdat_section.
7747         * object.h (class Sized_relobj): Rename fields in
7748         Kept_comdat_section to drop trailing underscores; change object
7749         field to Relobj*.  Change Kept_comdat_section_table to store
7750         struct rather than pointer.
7751         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
7752         Add kept_object and kept_shndx parameters.  Change all callers.
7753         (Sized_relobj::get_kept_comdat_section): Change return type to
7754         bool.  Add kept_object and kept_shndx parameters.  Change all
7755         callers.
7756         * plugin.cc (Pluginobj::include_comdat_group): Update call to
7757         Layout::find_or_add_kept_section.
7758
7759 2009-07-09  Ian Lance Taylor  <iant@google.com>
7760
7761         * merge.cc (Object_merge_map::initialize_input_to_output_map):
7762         Reserve space in the hash table.
7763
7764 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
7765
7766         * fileread.cc (File_read::get_mtime): New method.
7767         * fileread.h (Timespec): New structure.
7768         (File_read::get_mtime): New method.
7769         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
7770         Renamed from timestamp_nsec.
7771         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
7772         Elf_Xword.
7773         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
7774         timestamp_nsec.
7775         (Incremental_inputs::report_archive): Save mtime; style fix.
7776         (Incremental_inputs::report_obejct): Save mtime; style fix.
7777         (Incremental_inputs::report_script): Save mtime; style fix.
7778         (Incremental_inputs::finalize_inputs): Style fix.
7779         (Incremental_inputs::finalize): Style fix.
7780         (Incremental_inputs::create_input_section_data): Store inputs
7781         mtime.
7782         * incremental.h (Incremental_inputs::report_script): Add mtime
7783         argument.
7784         (Incremental_inputs::Input_info::Input_info): Intialize only one
7785         union member.
7786         (Incremental_inputs::Input_info::archive): Move to nameless
7787         union.
7788         (Incremental_inputs::Input_info::obejct): Move to nameless union.
7789         (Incremental_inputs::Input_info::script): Move to nameless union.
7790         (Incremental_inputs::mtime): New field.
7791         * script.cc (read_input_script): Pass file mtime to
7792         Incremental_input.
7793         * script.h (Script_info::inputs): Style fix.
7794
7795 2009-07-01  Ian Lance Taylor  <ian@airs.com>
7796
7797         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
7798         instead of 32.
7799
7800 2009-06-24  Ian Lance Taylor  <iant@google.com>
7801
7802         PR 10156
7803         * layout.cc (Layout::choose_output_section): If we find an
7804         existing section, update the flags.
7805         (Layout::create_notes): New function, broken out of
7806         Layout::finalize.
7807         (Layout::finalize): Don't create note sections.
7808         (Layout::create_note): Don't crash if linker script discards
7809         section.
7810         (Layout::create_gold_note): Likewise.
7811         (Layout::create_build_id): Likewise.  Don't set
7812         after_input_sections on the section.
7813         (Layout::create_executable_stack_info): Remove target parameter.
7814         Change caller.
7815         * layout.h (class Layout): Declare create_notes.  Update
7816         declaration of create_executable_stack_info.
7817         * gold.cc (queue_middle_tasks): Call create_notes.
7818         * output.cc (Output_section::update_flags_for_input_section): Move
7819         here from output.h.  If SHF_ALLOC flag is newly set, mark address
7820         invalid.
7821         * output.h (Output_data::mark_address_invalid): New function.
7822         (class Output_section): Only declare, not define,
7823         update_flags_for_input_section.  Remove set_flags.
7824
7825 2009-06-24  Ian Lance Taylor  <iant@google.com>
7826
7827         * script-sections.cc (Output_section_definition::
7828         set_section_addresses): Rename shadowing local load_address to
7829         laddr.
7830
7831 2009-06-24  Ian Lance Taylor  <iant@google.com>
7832
7833         PR 10244
7834         * reloc.cc (relocate_sections): Skip empty relocation sections.
7835
7836 2009-06-23  Ian Lance Taylor  <iant@google.com>
7837
7838         PR 10156
7839         * layout.cc (Layout::create_note): Use choose_output_section
7840         rather than make_output_section.
7841
7842 2009-06-23  Ian Lance Taylor  <iant@google.com>
7843
7844         PR 10237
7845         * options.cc (General_options::parse_V): Set printed_version_.
7846         (General_options::General_options): Initialize printed_version_.
7847         * options.h (class General_options): Add printed_version_ field.
7848         * gold.cc (queue_initial_tasks): If there are no input files,
7849         don't give a fatal error if we printed the version information.
7850         (queue_middle_tasks): If using -r with a shared object, give a
7851         fatal error rather than an ordinary error.
7852
7853 2009-06-23  Ian Lance Taylor  <iant@google.com>
7854
7855         PR 10219
7856         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
7857         (Layout::make_output_section): Set have_stabstr_section_ if we see
7858         a .stab*str section.
7859         (Layout::finalize): Call link_stabs_sections.
7860         (Layout::link_stabs_sections): New file.
7861         * layout.h (class Layout): Add have_stabstr_section_ field.
7862         Declare link_stabs_sections.
7863
7864 2009-06-23  Doug Kwan  <dougkwan@google.com>
7865
7866         * Makefile.am (libgold_a_LIBADD): New.
7867         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
7868         * Makefile.in: Regenerate.
7869         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
7870         * configure: Regenerate.
7871         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
7872         * fileread.cc: Include sys/state.h
7873         * gold.h: Declare memmem and strndup if found missing.
7874         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
7875
7876 2009-06-23  Ian Lance Taylor  <iant@google.com>
7877
7878         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
7879         * configure: Rebuild.
7880
7881 2009-06-23  Ian Lance Taylor  <iant@google.com>
7882
7883         PR 10147
7884         * object.cc (Object::section_contents): Don't try to get a view if
7885         the section has length zero.
7886         (Object::handle_gnu_warning_section): If the section is empty, use
7887         the name of the section as the warning.
7888
7889 2009-06-23  Ian Lance Taylor  <iant@google.com>
7890
7891         PR 10133
7892         * stringpool.h (class Stringpool_template): Add optimize_ field.
7893         (Stringpool_template::set_optimize): New function.
7894         * stringpool.cc (Stringpool_template::Stringpool_template):
7895         Initialize optimize_ field.
7896         (Stringpool_template::set_string_offsets): Test local optimize
7897         fild rather than parameter.
7898         * layout.cc (Layout::Layout): Call set_optimize on the section
7899         name stringpool.
7900
7901 2009-06-22  Ian Lance Taylor  <iant@google.com>
7902
7903         PR 10030
7904         * yyscript.y: Parse TARGET.
7905         * script.cc (script_set_target): New function.
7906         * script-c.h (script_set_target): Declare.
7907         * options.cc (General_options::string_to_object_format): Rename
7908         from string_to_object_format in anonymous namespace.  Change
7909         callers.
7910         * options.h (class General_options): Declare
7911         string_to_object_format.
7912
7913 2009-06-22  Ian Lance Taylor  <iant@google.com>
7914
7915         * script-sections.cc (Script_sections::create_segments): Don't put
7916         program headers in a PT_LOAD segment if -n or -N.
7917
7918 2009-06-22  Ian Lance Taylor  <iant@google.com>
7919
7920         PR 10141
7921         * options.h (class General_options): Add -z lazy and -z now.  Sort
7922         -z options into alphabetical order.
7923         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
7924
7925 2009-06-21  Ian Lance Taylor  <iant@google.com>
7926
7927         * layout.cc (Layout::make_output_section): Call
7928         Target::new_output_section.
7929         (Layout::attach_allocated_section_to_segment): Put large section
7930         sections in a separate load segment with the large segment flag
7931         set.
7932         (Layout::segment_precedes): Sort large data segments after other
7933         load segments.
7934         (align_file_offset): New static function.
7935         (Layout::set_segment_offsets): Use align_file_offset.
7936         * output.h (class Output_section): Add is_small_section_ and
7937         is_large_section_ fields.
7938         (Output_section::is_small_section): New function.
7939         (Output_section::set_is_small_section):  New function.
7940         (Output_section::is_large_section): New function.
7941         (Output_section::set_is_large_section): New function.
7942         (Output_section::is_large_data_section): New function.
7943         (class Output_segment): Add is_large_data_segment_ field.
7944         (Output_segment::is_large_data_segment): New function.
7945         (Output_segment::set_is_large_data_segment): New function.
7946         * output.cc (Output_section::Output_section): Initialize new
7947         fields.
7948         (Output_segment::Output_segment): Likewise.
7949         (Output_segment::add_output_section): Add assertion that large
7950         data sections always go in large data segments.  Force small data
7951         sections to the end of the list of data sections.  Force small BSS
7952         sections to the start of the list of BSS sections.  For large BSS
7953         sections to the end of the list of BSS sections.
7954         * symtab.h (class Symbol): Declare is_common_shndx.
7955         (Symbol::is_defined): Check Symbol::is_common_shndx.
7956         (Symbol::is_common): Likewise.
7957         (class Symbol_table): Define enum Commons_section_type.  Update
7958         declarations.  Add small_commons_ and large_commons_ fields.
7959         * symtab.cc (Symbol::is_common_shndx): New function.
7960         (Symbol_table::Symbol_table): Initialize new fields.
7961         (Symbol_table::add_from_object): Put small and large common
7962         symbols in the right list.
7963         (Symbol_table::sized_finalized_symbol): Check
7964         Symbol::is_common_shndx.
7965         (Symbol_table::sized_write_globals): Likewise.
7966         * common.cc (Symbol_table::do_allocate_commons): Allocate new
7967         common symbol lists.  Don't call do_allocate_commons_list if the
7968         list is empty.
7969         (Symbol_table::do_allocate_commons_list): Remove is_tls
7970         parameter.  Add comons_section_type parameter.  Change all
7971         callers.  Handle small and large common symbols.
7972         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
7973         Symbol::is_common_shndx.
7974         * resolve.cc (symbol_to_bits): Likewise.
7975         * target.h (Target::small_common_shndx): New function.
7976         (Target::small_common_section_flags): New function.
7977         (Target::large_common_shndx): New function.
7978         (Target::large_common_section_flags): New function.
7979         (Target::new_output_section): New function.
7980         (Target::Target_info): Add small_common_shndx, large_common_shndx,
7981         small_common_section_flags, and large_common_section_flags
7982         fields.
7983         (Target::do_new_output_section): New virtual function.
7984         * arm.cc (Target_arm::arm_info): Initialize new fields.
7985         * i386.cc (Target_i386::i386_info): Likewise.
7986         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
7987         Likewise.
7988         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
7989         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
7990         (Target_x86_64::do_new_output_section): New function.
7991         * configure.ac: Define conditional MCMODEL_MEDIUM.
7992         * testsuite/Makefile.am (check_PROGRAMS): Add large.
7993         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
7994         (large_LDFLAGS): Define.
7995         * testsuite/large.c: New file.
7996         * testsuite/testfile.cc (Target_test::test_target_info):
7997         Initialize new fields.
7998         * configure, testsuite/Makefile.in: Rebuild.
7999
8000 2009-06-05  Doug Kwan  <dougkwan@google.com>
8001
8002         * Makefile.am (CCFILES): Add target.cc.
8003         * Makefile.in: Regenerate.
8004         * i386.cc (class Target_i386): Define new virtual method to
8005         override do_is_local_label_name in parent.
8006         * object.cc (Sized_relobj::do_count_local_symbols): Discard
8007         local symbols if --discard-locals or -X is given.
8008         * options.h (class General_options): Declare new options
8009         '--discard-locals' and '-X' for discarding locals.
8010         * target.h (class Target): Define new methods is_local_label_name.
8011         Declare new virtual method do_is_local_label_name.
8012         * target.cc: New file.
8013         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
8014         (check_SCRIPTS): Add discard_locals_test.sh.
8015         (check_DATA): Add discard_local_tests.syms.
8016         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
8017         (discard_local_tests.syms, discard_locals_test.o): New make rules.
8018         * testsuite/Makefile.in: Regenerate.
8019         * testsuite/discard_locals_test.c: New file.
8020         * testsuite/discard_locals_test.sh: Same.
8021
8022 2009-06-05  Doug Kwan  <dougkwan@google.com>
8023
8024         * object.cc (Sized_relobj::Sized_relobj): Initialize
8025         discarded_eh_frame_shndx_ to -1U.
8026         (Sized_relobj::do_layout): Record index of a discard .eh_frame
8027         section.
8028         (Sized_relobj::do_count_local_symbols): Skip local symbols in
8029         a discarded .eh_frame section.
8030         (Sized_relobj::do_finalize_local_symbols): Ditto.
8031         * object.h (class Sized_relobj): Declare new member
8032         discarded_eh_frame_shndx_.
8033         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
8034         (local_labels_test.o, local_labels_test): New rules.
8035         * testsuite/Makefile.in: Regenerate.
8036
8037 2009-06-04  Doug Kwan  <dougkwan@google.com>
8038
8039         * layout.cc (Layout::section_name_mapping): Add mapping for
8040         special ARM sections.
8041
8042 2009-06-03  Doug Kwan  <dougkwan@google.com>
8043
8044         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
8045         (utils::has_overflow): Same.
8046
8047 2009-06-03  Ian Lance Taylor  <iant@google.com>
8048
8049         * layout.cc (Layout::section_name_mapping): New array, replacing
8050         Layout::linkonce_mapping.
8051         (Layout::section_name_mapping_count): New variable, replacing
8052         Layout::linkonce_mapping_count.
8053         (Layout::linkonce_output_name): Remove.
8054         (Layout::output_section_name): Rewrite.
8055         * layout.h (class Layout): Rename Linkonce_mapping to
8056         Section_name_mapping, linkonce_mapping to section_name_mapping,
8057         linkonce_mapping_count to section_name_mapping_count.  Don't
8058         declare linkonce_output_name.
8059
8060 2009-06-03  Doug Kwan  <dougkwan@google.com>
8061
8062         * gold/arm.cc (namespace utils): New.
8063         (Target_arm::reloc_is_non_pic): Define new method.
8064         (class Arm_relocate_functions): New.
8065         (Target_arm::Relocate::relocate): Handle relocation types used by
8066         Android.
8067
8068 2009-06-03  Ian Lance Taylor  <iant@google.com>
8069
8070         * arm.cc (Target_arm::scan::global): Use || instead of |.
8071
8072 2009-06-02  Doug Kwan  <dougkwan@google.com>
8073
8074         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
8075         issued_non_pic_error_.
8076         (class Target_arm::Scan): Declare new method check_non_pic.
8077         Define new method symbol_needs_plt_entry.
8078         Declare new data member issued_non_pic_error_.
8079         (class Target_arm::Relocate): Declare new method
8080         should_apply_static_reloc.
8081         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
8082         (Target_arm::Scan::check_non_pic): Define new method.
8083         (Target_arm::Scan::local): Handle a small subset of reloc types used
8084         by Android.
8085         (Target_arm::Scan::local): Same.
8086         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
8087
8088 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
8089
8090         * incremental.cc (Incremental_inputs::report_command_line): Filter
8091         out --incremental-* options.
8092
8093 2009-05-29  Doug Kwan  <dougkwan@google.com>
8094
8095         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
8096         template class.
8097         (class Target_arm): Update comment.
8098         (Target_arm::Target_arm): Initialize new data members GOT_,
8099         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
8100         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
8101         and Target_arm::rel_dyn_section.
8102         Declare new_enum Target_arm::Got_type.
8103         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
8104         and DYNBSS_.
8105         Update commments for member do_dynsym_value.
8106         (Target_arm::got_size, Target_arm::plt_section,
8107         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
8108         new methods inside class defintion.
8109         (Target_arm::got_section): Define new method.
8110         (Target_arm::rel_dyn_section): Same.
8111         (Output_data_plt_arm): New template class.
8112         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
8113         (Output_data_plt_arm:do_adjust_output_section): Define new method.
8114         (Output_data_plt_arm::add_entry): Same.
8115         (Output_data_plt_arm::first_plt_entry): Define new
8116         static data member for PLT instruction template.
8117         (Output_data_plt_arm::plt_entry): Same.
8118         (Output_data_plt_arm::do_write): Define new method.
8119         (Target_arm::make_plt_entry): Same.
8120         (Target_arm::do_finalize_sections): Same.
8121         (Target_arm::do_dynsym_value): Same.
8122
8123 2009-05-28  Doug Kwan  <dougkwan@google.com>
8124
8125         * Makefile.am (TARGETSOURCES): Add arm.cc.
8126         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
8127         * Makefile.in: Regenerate.
8128         * arm.cc: New file.
8129         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
8130
8131 2009-05-26  Doug Kwan  <dougkwan@google.com>
8132
8133         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
8134         (General_options::check_excluded_libs): Strip off directories in
8135         archive name before matching like GNU ld does.
8136         * testsuite/Makefile.am (MOSTLYCLEANFILES,
8137         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
8138         (exclude_libs_test_LDFLAGS): Add linker option
8139         -Wl,--exclude-libs,libexclude_libs_test_3
8140         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
8141         an explicit archive without using -l.
8142         (alt/libexclude_libs_test_3.a): New make rule.
8143         * testsuite/Makefile.in: Regenerate.
8144         * testsuite/exclude_libs_test.c : Declare lib3_default().
8145         (main): Call it.
8146         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
8147         * exclude_libs_test_3.c: New file.
8148
8149 2009-05-26  Nick Clifton  <nickc@redhat.com>
8150
8151         * po/id.po: New Indonesian translation.
8152         * po/gold.pot: Updated template file.
8153
8154 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
8155
8156         * testsuite/Makefile.am: Add -ffunction-sections to compile
8157         gc_comdat_test files.  Add -Wl,--gc-sections to build
8158         gc_comdat_test.
8159         * testsuite/Makefile.in: Regenerate.
8160         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
8161
8162 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
8163
8164         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
8165         kept comdat section was garbage collected.
8166         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
8167         * testsuite/Makefile.in: Regenerate.
8168         * testsuite/gc_comdat_test.sh: New file.
8169         * testsuite/gc_comdat_test_1.cc: New file.
8170         * testsuite/gc_comdat_test_2.cc: New file.
8171
8172 2009-05-19  Doug Kwan  <dougkwan@google.com>
8173
8174         * archive.cc (Archive::Archive): Move constructor from archive.h
8175         to here.  Initialize no_export_.
8176         (Archive::get_elf_object_for_member): Set no_export flag of object.
8177         * archive.h (Archive::Archive): Move constructor body to
8178         archive.cc.
8179         (Archive::no_export): New method.
8180         (Archive::no_export_): New field.
8181         * object.h (Object::Object): Initialize no_export_ to false.
8182         (Object::no_export, Object::set_no_export): New methods.
8183         (Object::no_export_): New field.
8184         * options.cc (General_options::parse_exclude_libs): New method.
8185         (General_options::check_excluded_libs) Same.
8186         * options.h (exclude_libs): New option.
8187         (General_options::check_excluded_libs): New method declaration.
8188         (General_options::excluded_libs_): New field.
8189         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
8190         default or protected visibility if an object has no-export flag set.
8191         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
8192         (check_SCRIPTS): Add exclude_libs_test.sh.
8193         (check_DATA): Add exclude_libs_test.syms.
8194         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
8195         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
8196         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
8197         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
8198         (exclude_libs_test.syms, libexclude_libs_test_1.a,
8199         libexclude_libs_test_2.a): New rules.
8200         * testsuite/Makefile.in: Regenerate.
8201         * testsuite/exclude_libs_test.c: New file.
8202         * testsuite/exclude_libs_test.sh: Ditto.
8203         * testsuite/exclude_libs_test_1.c: Ditto.
8204         * testsuite/exclude_libs_test_2.c: Ditto.
8205
8206 2009-05-15  Ian Lance Taylor  <iant@google.com>
8207
8208         * configure.ac: Check for declarations for cases where libiberty.h
8209         checks HAVE_DECL_xxx.
8210         * configure, config.in: Rebuild.
8211
8212 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
8213
8214         * gold.h (Incremental_argument_list): Remove (invalid) forward
8215         declaration.
8216         * incremental.cc (Incremental_inputs::report_achive): New method.
8217         (Incremental_inputs::report_object): New method.
8218         (Incremental_inputs::report_script): New method.
8219         (Incremental_inputs::finalize_inputs): New method.
8220         (Incremental_inputs::finalize): Call finalize_inputs().
8221         (Incremental_inputs::sized_create_incremental_inputs_section_data):
8222         Create inputs entries.
8223         * incremental.h (Incremental_input_type): New enum.
8224         (Incremental_inputs::Incremental_input): Initialize new fields.
8225         (Incremental_inputs::report_inputs): New method.
8226         (Incremental_inputs::report_achive): New method.
8227         (Incremental_inputs::report_object): New method.
8228         (Incremental_inputs::report_script): New method.
8229         (Incremental_inputs::finalize_inputs): New method.
8230         (Incremental_inputs::Input_info): New struct.
8231         (Incremental_inputs::Input_info_map): New typedef.
8232         (Incremental_inputs::lock_): New field.
8233         (Incremental_inputs::Inputs_): New field.
8234         (Incremental_inputs::Inputs_map): New field.
8235         * main.cc (main): Call Incremental_input::report_inputs.
8236         * options.h (Input_argument_list): Typedef moved from
8237         Input_arguments.
8238         (Input_file_group::Files): Remove, use ::Input_argument_list.
8239         (Input_file_group::Input_argument_list): Remove, use
8240         ::Input_argument_list.
8241         * plugin.cc (Plugin_manager::add_input_file): Add error in
8242         incremental build.
8243         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
8244         functions.
8245         * script.cc (read_input_script): Call
8246         Incremental_input::report_script.
8247         * script.h (Script_info): New class.
8248
8249 2009-04-27  Ian Lance Taylor  <iant@google.com>
8250
8251         * x86_64.cc (do_adjust_output_section): Set entsize to
8252         plt_entry_size.
8253
8254 2009-04-23  Elliott Hughes  <enh@google.com>
8255
8256         * output.cc (Output_file::close): After short writes, continue
8257         writing from the correct offset in the buffer being written.
8258
8259 2009-04-23  Chris Demetriou  <cgd@google.com>
8260
8261         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
8262         * configure: Regenerate.
8263         * config.in: Regenerate.
8264         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
8265         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
8266
8267 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
8268
8269         * incremental.cc (Incremental_inputs_header_data): Renamed from
8270         Incremental_input_header_data.
8271         (Incremental_inputs_header_data::data_size): New field.
8272         (Incremental_inputs_header_data::put_input_file_count): Renamed
8273         from input_file_count.
8274         (Incremental_inputs_header_data::put_command_line_offset): Renamed
8275         from command_line_offset.
8276         (Incremental_inputs_header_data::put_reserved): Renamed from
8277         put_reserved.
8278         (Incremental_inputs_entry_data): Renamed from
8279         Incremental_input_entry_data.
8280         (Incremental_inputs_entry_data::data_size): New field.
8281         (Incremental_inputs::report_command_line): New method.
8282         (Incremental_inputs::finalize): New method.
8283         (Incremental_inputs::create_incremental_inputs_data): New method.
8284         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
8285         * incremental.h: New file.
8286         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
8287        (Layout::finalize): Create incremental inputs section in
8288         incremental builds.
8289        (Layout::create_incremental_info_sections): New method.
8290         * layout.h (Layout::incremental_inputs): New method.
8291        (Layout::create_incremental_info_sections): New method.
8292        (Layout::incremental_inputs_): New field.
8293         * main.cc (main): Notify Incremental_input of the command line.
8294
8295 2009-04-01  Ian Lance Taylor  <iant@google.com>
8296             Mikolaj Zalewski  <mikolajz@google.com>
8297
8298         * gold.h (reserve_unordered_map): Define, three versions, one for
8299         each version of Unordered_map.
8300         * layout.cc (Layout::Layout): Remove options parameter.  Add
8301         number_of_input_files parameter.  Don't initialize options_.
8302         Initialize number_of_input_files_ and resized_signatures_.  Move
8303         sections_are_attached_.
8304         (Layout::layout_group): Reserve space for group_signatures_.
8305         (Layout::find_or_add_kept_section): Change name parameter to be a
8306         reference.  Resize signatures_ map when it gets large enough.
8307         (Layout::layout_eh_frame): Use parameters->options() instead of
8308         this->options_.
8309         (Layout::make_output_section): Likewise.
8310         (Layout::attach_allocated_section_to_segment): Likewise.
8311         (Layout::finalize, Layout::create_executable_stack): Likewise.
8312         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
8313         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
8314         * layout.h (class Layout): Update declarations.  Remove options_
8315         field.  Add number_of_input_files_ and resized_signatures_
8316         fields.  Move sections_are_attached_ field.
8317         * main.cc (main): Pass number of input files to Layout
8318         constructor.  Don't pass options.
8319
8320 2009-03-30  Ian Lance Taylor  <iant@google.com>
8321
8322         * ffsll.c (ffsll): Correct implementation.
8323
8324 2009-03-27  Ian Lance Taylor  <iant@google.com>
8325
8326         * ffsll.c: New file.
8327         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
8328         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
8329         * ftruncate.c (ftruncate): Declare before definition.
8330         * mremap.c (mremap): Likewise.
8331         * pread.c (pread): Likewise.
8332         * configure, Makefile.in, config.in: Rebuild.
8333
8334         * mremap.c: New file.
8335         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
8336         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
8337         (mremap): Declare if HAVE_MREMAP is not defined.
8338         * configure, Makefile.in, config.in: Rebuild.
8339
8340 2009-03-27  Cary Coutant  <ccoutant@google.com>
8341
8342         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
8343         position independent.
8344         * sparc.cc (Target_sparc::check_non_pic): Likewise.
8345         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
8346
8347 2009-03-24  Cary Coutant  <ccoutant@google.com>
8348
8349         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
8350         an executable.
8351         (needs_dynamic_reloc): Likewise.
8352
8353 2009-03-24  Ian Lance Taylor  <iant@google.com>
8354
8355         * yyscript.y (file_cmd): Recognize EXTERN.
8356         (extern_name_list, extern_name_list_body): New nonterminals.
8357         * script.cc (script_add_extern): Define.
8358         * script-c.h (script_add_extern): Declare.
8359
8360 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
8361
8362         * object.cc (is_elf_object): Define.
8363         * object.h (is_elf_object): Declare.
8364         * archive.cc (Archive::get_elf_object_for_member): Call
8365         is_elf_object.
8366         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
8367
8368 2009-03-24  Elliott Hughes  <enh@google.com>
8369
8370         * output.cc (Output_file::map_anonymous): Define.
8371         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
8372         try an anonymous one.  Report the size if the mmap fails.
8373         * output.h (class Output_file): Declare map_anonymous.
8374
8375 2009-03-24  Ian Lance Taylor  <iant@google.com>
8376
8377         * target-select.cc (instantiate_target): Don't acquire the lock if
8378         the instantiated_target_ field has already been set.
8379
8380 2009-03-23  Ian Lance Taylor  <iant@google.com>
8381
8382         * gold-threads.h (class Initialize_lock): Define.
8383         * gold-threads.cc (class Initialize_lock_once): Define.
8384         (initialize_lock_control): New static variable.
8385         (initialize_lock_pointer): New static variable.
8386         (initialize_lock_once): New static function.
8387         (Initialize_lock::Initialize_lock): Define.
8388         (Initialize_lock::initialize): Define.
8389         * target-select.h: Include "gold-threads.h".
8390         (class Target_selector): Add lock_ and initialize_lock_ fields.
8391         Don't define instantiate_target, just declare it.
8392         * target-select.cc (Target_selector::Target_selector): Initialize
8393         new fields.
8394         (Target_selector::instantiate_target): Define.
8395         * descriptors.h: Include "gold-threads.h".
8396         (class Descriptors): Add initialize_lock_ field.
8397         * descriptors.cc (Descriptors::Descriptors): Initialize new
8398         field.
8399         (Descriptors::open): Use initialize_lock_ field
8400         * errors.h (class Errors): Add initialize_lock_ field.
8401         * errors.cc (Errors::Errors): Initialize new field.
8402         (Errors::initialize_lock): Use initialize_lock_ field.
8403         * powerpc.cc (class Target_selector_powerpc): Remove
8404         instantiated_target_ field.  In do_recognize call
8405         instantiate_target rather than do_instantiate_target.  In
8406         do_instantiate_target just allocate a new target.
8407         * sparc.cc (class Target_selector_sparc): Likewise.
8408
8409         * freebsd.h: New file.
8410         * i386.cc: Include "freebsd.h".
8411         (Target_i386): Derive from Target_freebsd rather than
8412         Sized_target.
8413         (Target_selector_i386): Derive from Target_selector_freebsd rather
8414         than Target_selector.
8415         * x86_64.cc: Include "freebsd.h".
8416         (Target_x86_64): Derive from Target_freebsd rather than
8417         Sized_target.
8418         (Target_selector_x86_64): Derive from Target_selector_freebsd
8419         rather than Target_selector.
8420         * target.h (class Target): Add adjust_elf_header and
8421         do_adjust_elf_header.
8422         * output.cc (Output_file_header:: do_sized_write): Call target
8423         adjust_elf_header routine.
8424         * configure.tgt: Set targ_osabi.
8425         * configure.ac: Define GOLD_DEFAULT_OSABI.
8426         * parameters.cc (Parameters::default_target): Pass
8427         GOLD_DEFAULT_OSABI to select_target.
8428         * target-select.h (class Target_selector): Make instantiate_target
8429         protected rather than private.
8430         * Makefile.am (HFILES): Add freebsd.h.
8431         * configure, Makefile.in, config.in: Rebuild.
8432
8433         * merge.cc (do_add_input_section): Correct pend value.  Change
8434         message about last entry not being null terminated from error to
8435         warning.
8436
8437 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
8438
8439         * incremental.cc: New file.
8440         * Makefile.am (CCFILES): Add incremental.cc.
8441         * Makefile.in: Rebuild.
8442
8443 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
8444
8445         * layout.cc (Layout::output_section_name): Preserve names
8446         of '.note.' sections.
8447
8448 2009-03-19  Ian Lance Taylor  <iant@google.com>
8449
8450         * descriptors.cc (Descriptors::open): Check that the options are
8451         valid before using them.
8452
8453 2009-03-18  Ian Lance Taylor  <iant@google.com>
8454
8455         * script-sections.h: Include <list>.
8456         (class Script_sections): Change Sections_elements from std::vector
8457         to std::list.  Typedef public Elements_iterator.  Add
8458         orphan_section_placement_, data_segment_align_start_, and
8459         saw_data_segment_align_ fields.  Remove data_segment_align_index_
8460         field.
8461         * script-sections.cc (class Orphan_section_placement): New class.
8462         (class Sections_element): Add virtual functions is_relro and
8463         orphan_section_init.  Remove virtual function place_orphan_here.
8464         (class Output_section_definition): Add is_relro and
8465         orphan_section_init.  Remove place_orphan_here.
8466         (class Orphan_output_section): Likewise.
8467         (Script_sections::Script_sections): Update for field changes.
8468         (Script_sections::data_segment_align): Set saw_data_segment_align_
8469         and data_segment_align_start_, not data_segment_align_index.
8470         (Script_sections::data_segment_relro_end): Check
8471         saw_data_segment_align_.  Use data_segment_align_start_ rather
8472         than data_segment_align_index_.
8473         (Script_sections::place_orphan): Rewrite to use
8474         Orphan_section_placement.
8475
8476 2009-03-17  Ian Lance Taylor  <iant@google.com>
8477
8478         * archive.cc (Archive::add_symbols): Check for a version attached
8479         to the symbol name in the archive map.
8480         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
8481         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
8482         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
8483         (ver_test_11.a): New target.
8484         * testsuite/Makefile.in: Rebuild.
8485
8486         * configure.ac: Check for chsize and posix_fallocate.  Replace
8487         ftruncate.
8488         * ftruncate.c: New file, from gnulib.
8489         * output.cc (posix_fallocate): Define dummy version if not
8490         HAVE_POSIX_FALLOCATE.
8491         (Output_file::map): Call posix_fallocate rather than lseek and
8492         write.
8493         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
8494         * configure, Makefile.in, config.in: Rebuild.
8495
8496 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
8497
8498         * layout.h (Layout::create_note): Add section_name parameter.
8499         * layout.cc (Layout::create_note): Likewise.
8500         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
8501
8502 2009-03-17  Ian Lance Taylor  <iant@google.com>
8503
8504         * descriptors.cc: Include "options.h".
8505         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
8506         (Descriptors::open): Always use O_CLOEXEC when opening a new
8507         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
8508         then set FD_CLOEXEC.
8509
8510         * sparc.cc (class Target_sparc): Add has_got_section.
8511         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
8512         make sure we have a GOT section.
8513
8514         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
8515         (Target_sparc::Scan::local): Likewise.
8516         (Target_sparc::Scan::global): Likewise.
8517         (Target_sparc::Relocate::relocate): Likewise.
8518         (Target_sparc::Relocate::relocate_tls): Likewise.
8519
8520         * symtab.cc (Symbol_table::define_default_version): New function,
8521         broken out of add_from_object.
8522         (Symbol_table::add_from_object): Call define_default_version.
8523         (Symbol_table::define_special_symbol): Add resolve_oldsym
8524         parameter.  Change all callers.  If the version for a symbol comes
8525         from a version script, resolve it with the symbol with the same
8526         name with no version.  Also add the symbol without a version if
8527         appropriate.
8528         (do_define_in_output_data): If resolving with oldsym, don't delete
8529         sym.
8530         (do_define_in_output_segment): Likewise.
8531         (do_define_as_constant): Likewise.
8532         * symtab.h (class Symbol_table): Update declarations.
8533
8534 2009-03-13  Ian Lance Taylor  <iant@google.com>
8535
8536         * readsyms.cc (Read_symbols::incompatible_warning): New function.
8537         (Read_symbols::requeue): New function.
8538         (Read_symbols::do_read_symbols): If make_elf_object fails because
8539         the target type is not configured, and the file was searched for,
8540         issue a warning and retry with the next directory.
8541         (Add_symbols::run): If the file has an incompatible format, and
8542         it was searched for, requeue the Read_symbols task.  On error,
8543         release the object.
8544         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
8545         dirindex parameter to constructor.  Change all callers.  Declare
8546         incompatible_warning and requeue.
8547         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
8548         input_argument_ and input_group_ fields.  Add them to
8549         constructor.  Change all callers.
8550         (class Read_script): Add dirindex_ field.  Add it to constructor.
8551         Change all callers.
8552         * archive.cc (Archive::setup): Remove input_objects parameter.
8553         Change all callers.
8554         (Archive::get_file_and_offset): Likewise.
8555         (Archive::read_all_symbols): Likewise.
8556         (Archive::read_symbols): Likewise.
8557         (Archive::get_elf_object_for_member): Remove input_objects
8558         parameter.  Add punconfigured parameter.  Change all callers.
8559         (Archive::add_symbols): Change return type to bool.  Check return
8560         value of include_member.
8561         (Archive::include_all_members): Likewise.
8562         (Archive::include_member): Change return type to bool.  Return
8563         false if first included object has incompatible target.  Set
8564         included_member_ field.
8565         (Add_archive_symbols::run): If add_symbols returns false, requeue
8566         Read_symbols task.
8567         * archive.h (class Archive): Add included_member_ field.
8568         Initialize it in constructor.  Add input_file and searched_for
8569         methods.  Update declarations.
8570         (class Add_archive_symbols): Add dirpath_, dirindex_, and
8571         input_argument_ fields.  Add them to constructor.  Change all
8572         callers.
8573         * script.cc: Include "target-select.h".
8574         (class Parser_closure): Add skip_on_incompatible_target_ and
8575         found_incompatible_target_ fields.  Add
8576         skip_on_incompatible_target parameter to constructor.  Change all
8577         callers.  Add methods skip_on_incompatible_target,
8578         clear_skip_on_incompatible_target, found_incompatible_target, and
8579         set_found_incompatible_target.
8580         (read_input_script): Add dirindex parameter.  Change all callers.
8581         If parser finds an incompatible target, requeue Read_symbols
8582         task.
8583         (script_set_symbol): Clear skip_on_incompatible_target in
8584         closure.
8585         (script_add_assertion, script_parse_option): Likewise.
8586         (script_start_sections, script_add_phdr): Likewise.
8587         (script_check_output_format): New function.
8588         * script.h (read_input_script): Update declaration.
8589         * script-c.h (script_check_output_format): Declare.
8590         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
8591         (ignore_cmd): Remove OUTPUT_FORMAT.
8592         * fileread.cc (Input_file::Input_file): Add explicit this.
8593         (Input_file::will_search_for): New function.
8594         (Input_file::open): Add pindex parameter.  Change all callers.
8595         * fileread.h (class Input_file): Add input_file_argument method.
8596         Declare will_search_for.  Update declarations.
8597         * object.cc (make_elf_object): Add punconfigured parameter.
8598         Change all callers.
8599         * object.h (class Object): Make input_file public.  Add
8600         searched_for method.
8601         (make_elf_object): Update declaration.
8602         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
8603         restart search.
8604         * dirsearch.h (class Dirsearch): Update declaration.
8605         * options.h (class General_options): Add --warn-search-mismatch.
8606         * parameters.cc (Parameters::is_compatible_target): New function.
8607         * parameters.h (class Parameters): Declare is_compatible_target.
8608         * workqueue.cc (Workqueue::add_blocker): New function.
8609         * workqueue.h (class Workqueue): Declare add_blocker.
8610
8611         * fileread.cc (Input_file::open): Remove options parameter.
8612         Change all callers.
8613         (Input_file::open_binary): Likewise.
8614         * script.cc (read_input_script): Likewise.
8615         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
8616         options parameter from constructor.  Change all callers.
8617         (class Read_script): Likewise.
8618         * fileread.h (class Input_file): Update declarations.
8619         * script.h (read_input_script): Update declaration.
8620
8621 2009-03-10  Nick Clifton  <nickc@redhat.com>
8622
8623         * po/es.po: New Spanish translation.
8624
8625 2009-03-06  Cary Coutant  <ccoutant@google.com>
8626
8627         * options.cc (parse_short_option): Keep dash_z from registering itself.
8628
8629 2009-03-03  Ian Lance Taylor  <iant@google.com>
8630
8631         PR 9918
8632         * target-reloc.h (relocate_section): Pass output_section to
8633         relocate.
8634         * i386.cc (Target_i386::should_apply_static_reloc): Add
8635         output_section parameter.  Change all callers.
8636         (Target_i386::Relocate::relocate): Add output_section parameter.
8637         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8638         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
8639         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
8640         * testsuite/two_file_shared.sh: New script.
8641         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
8642         (check_DATA): Add two_file_shared.dbg.
8643         (two_file_shared.dbg): New target.
8644         * testsuite/Makefile.in: Rebuild.
8645
8646 2009-03-01  Ian Lance Taylor  <iant@google.com>
8647
8648         * configure.ac: Check for byteswap.h.
8649         * configure: Rebuild.
8650         * config.in: Rebuild.
8651
8652 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
8653
8654         * layout.cc (Layout::find_or_add_kept_section): New function.
8655         (Layout::add_comdat): Removed.
8656         * layout.h (struct Kept_section): Move out of class Layout.
8657         Remove trailing underscores from field names.  Add group_sections
8658         field.  Rename group_ field to is_group.  Change all uses.
8659         (class Layout): Declare find_or_add_kept_section, not add_comdat.
8660         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
8661         comdat_groups_ field.
8662         (Sized_relobj::include_section_group): Use
8663         find_or_add_kept_section and Kept_section::group_sections.
8664         (Sized_relobj::include_linkonce_section): Likewise.
8665         * object.cc (class Sized_relobj): Don't define Comdat_group or
8666         Comdat_group_table.  Remove find_comdat_group and
8667         add_comdat_group.  Remove comdat_groups_ field.
8668         * plugin.cc (include_comdat_group): Use
8669         Layout::find_or_add_kept_section.
8670
8671 2009-02-28  Ian Lance Taylor  <iant@google.com>
8672
8673         * README: --gc-sections and map files are now supported.  Document
8674         some build requirements.
8675
8676         PR 6992
8677         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
8678         relocatable link set the value of the section symbol to zero.
8679         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
8680         relocatable link don't include the section address in the local
8681         symbol value.
8682
8683 2009-02-27  Ian Lance Taylor  <iant@google.com>
8684
8685         PR 6811
8686         * options.h (class Search_directory): Add is_system_directory.
8687         (class General_options): Declare is_in_system_directory.
8688         * options.cc (get_relative_sysroot): Make static.
8689         (get_default_sysroot): Make static.
8690         (General_optoins::is_in_system_directory): New function.
8691         * fileread.cc (Input_file::is_in_system_directory): New function.
8692         * fileread.h (class Input_file): Declare is_in_system_directory.
8693         * object.h (class Object): Add is_in_system_directory.
8694         (class Input_objects): Remove system_library_directory_ field.
8695         * object.cc (Input_objects::add_object): Don't set
8696         system_library_directory_.
8697         (input_objects::found_in_system_library_directory): Remove.
8698         * symtab.cc (Symbol_table::write_globals): Remove input_objects
8699         parameter.  Change all callers.
8700         (Symbol_table::sized_write_globals): Likewise.
8701         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
8702         Call Object::is_in_system_directory.
8703         * symtab.h (class Symbol_table): Update declarations.
8704
8705         PR 5990
8706         * descriptors.h (Open_descriptor): Add is_on_stack field.
8707         * descriptors.cc (Descriptors::open): If the descriptor is on the
8708         top of the stack, remove it.  Initialize is_on_stack field.
8709         (Descriptors::release): Only add pod to stack if it is not on the
8710         stack already.
8711         (Descriptors::close_some_descriptor): Clear stack_next and
8712         is_on_stack fields.
8713
8714         PR 7091
8715         * output.cc (Output_section::find_starting_output_address): Rename
8716         from starting_output_address; add PADDR parameter; change return
8717         type.
8718         * output.h (class Output_section): Declare
8719         find_starting_output_address instead of starting_output_address.
8720         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
8721         section symbol for which we can't find a merge section.
8722
8723         PR 9836
8724         * symtab.cc (Symbol_table::add_from_object): If the visibility is
8725         hidden or internal, force the symbol to be local.
8726         * resolve.cc (Symbol::override_visibility): Define.
8727         (Symbol::override_base): Use override_visibility.
8728         (Symbol_table::resolve): Likewise.
8729         (Symbol::override_base_with_special): Likewise.
8730         (Symbol_table::override_with_special): If the visibility is hidden
8731         or internal, force the symbol to be local.
8732         * symtab.h (class Symbol): Add set_visibility and
8733         override_visibility.
8734         * testsuite/ver_test_1.sh: New file.
8735         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
8736         (check_DATA): Add ver_test_1.syms.
8737         (ver_test_1.syms): New target.
8738         * testsuite/Makefile.in: Rebuild.
8739
8740 2009-02-25  Cary Coutant  <ccoutant@google.com>
8741
8742         * layout.cc (Layout::choose_output_section): Don't rename sections
8743         when using a linker script that has a SECTIONS clause.
8744         * Makefile.in: Regenerate.
8745
8746         * testsuite/Makefile.am (script_test_5.sh): New test case.
8747         * testsuite/Makefile.in: Regenerate.
8748         * testsuite/script_test_5.cc: New file.
8749         * testsuite/script_test_5.sh: New file.
8750         * testsuite/script_test_5.t: New file.
8751
8752 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
8753
8754         * archive.cc (Archive::include_member): Update calls to add_symbols.
8755         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
8756         the Layout argument.
8757         * dynobj.h (do_add_symbols): Add the Layout argument.
8758         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
8759         Layout argument.
8760         * object.h (Object::add_symbols): Add the Layout argument.
8761         (Object::do_add_symbols): Add the Layout argument.
8762         (Sized_relobj::do_add_symbols): Add the Layout argument.
8763         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
8764         Unify the two versions.
8765         (Add_plugin_symbols): Remove.
8766         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
8767         (Sized_pluginobj::do_add_symbols): Unify the two versions.
8768         (Add_plugin_symbols): Remove.
8769         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
8770         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
8771         (Add_symbols::run): Make it work with Pulginobj.
8772
8773 2009-02-06  Ian Lance Taylor  <iant@google.com>
8774
8775         * object.cc (Sized_relobj::do_layout): Make info message start
8776         with lower case letter.
8777
8778 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
8779
8780         * binary.cc: Fix file comment.
8781
8782         * options.h (enum Incremental_disposition): Define.
8783         (class General_options): Add new options: --incremental,
8784         --incremental_changed, --incremental_unchanged,
8785         --incremental_unknown.  Add incremental_disposition_ and
8786         implicit_incremental_ fields.
8787         (General_options::incremental_disposition): New function.
8788         (class Position_dependent_options): Add incremental_disposition
8789         option.
8790         (Position_dependent_options::copy_from_options): Set incremental
8791         dispositions.
8792         * options.cc (General_options::parse_incremental_changed): New
8793         function.
8794         (General_options::parse_incremental_unchanged): New function.
8795         (General_options::parse_incremental_unknown): New function.
8796         (General_options::General_options): Initialize new fields
8797         incremental_disposition_ and implicit_incremental_.
8798         (General_options::finalize): Check for uasge of --incremental-*
8799         without --incremental.
8800
8801 2009-02-06  Chris Demetriou  <cgd@google.com>
8802
8803         * gold.h (gold_undefined_symbol): Change to take only a Symbol
8804         pointer and to report location as the file name associated with
8805         the symbol.
8806         (gold_undefined_symbol_at_location): New function to replace the
8807         old gold_undefined_symbol functionality.
8808         * target-reloc.h (relocate_section): Update to use
8809         gold_undefined_symbol_at_location.
8810         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
8811         Call gold_undefined_symbol function rather than gold_error.
8812         * errors.h (Errors::undefined_symbol): Take location as a
8813         string, rather than calculating it from a relocation.
8814         * errors.cc (Errors::fatal): Print "fatal error:" before the
8815         formatted message.
8816         (Errors::error, Errors::error_at_location): Print "error: "
8817         before the formatted message.
8818         (Errors::undefined_symbol): Take location as a string, rather
8819         than calculating it from a relocation.
8820         (gold_undefined_symbol_at_location): New function akin to
8821         old gold_undefined_symbol, calculates location from relocation.
8822         (gold_undefined_symbol): Change to take only a Symbol pointer
8823         and to report location as the file name associated with the symbol.
8824         * testsuite/debug_msg.sh: Update for changed error messages.
8825         * testsuite/undef_symbol.sh: Likewise.
8826
8827 2009-02-04  Duncan Sands  <baldrick@free.fr>
8828
8829         PR 9812
8830         * reduced_debug_output.h
8831         (Output_reduced_debug_abbrev_section::failed): Use format for
8832         gold_warning.
8833         (Output_reduced_debug_info_section::faild): Likewise.
8834
8835 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
8836
8837         * script.cc (Lazy_demangler): New class.
8838         (Version_script_info::get_symbol_version_helper): Demangle a
8839         symbol only once.
8840
8841 2009-01-29  Cary Coutant  <ccoutant@google.com>
8842
8843         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
8844         to __tls_get_addr.
8845         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8846
8847 2009-01-28  Ian Lance Taylor  <iant@google.com>
8848
8849         * version.cc (version_string): Bump to 1.9.
8850
8851         * gold.h: Include <cstring> and <stdint.h>.
8852         * version.cc: Include <cstdio>.
8853         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
8854         warning.
8855         * reduced_debug_output.cc (insert_into_vector): Rename from
8856         Insert_into_vector; change all callers.  Use Swap_unaligned to
8857         avoid aliasing issue; remove union since it is unnecessary.
8858
8859 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
8860
8861         * Makefile.am (CCFILES): Add gc.cc.
8862         (HFILES): Add gc.h.
8863         * Makefile.in: Regenerate.
8864         * gold.cc (Gc_runner): New class.
8865         (queue_initial_tasks): Call garbage collection related tasks
8866         when corresponding options are invoked.
8867         (queue_middle_gc_tasks): New function.
8868         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
8869         processed early before laying out sections during garbage collection.
8870         * gold.h (queue_middle_gc_tasks): New function.
8871         (is_prefix_of): Move from "layout.cc".
8872         * i386.cc (Target_i386::gc_process_relocs): New function.
8873         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
8874         * main.cc (main): Create object of class "Garbage_collection".
8875         * object.cc (Relobj::copy_symbols_data): New function.
8876         (Relobj::is_section_name_included): New function.
8877         (Sized_relobj::do_layout): Allow this function to be called twice
8878         during garbage collection and defer layout of section during the
8879         first call.
8880         * object.h (Relobj::get_symbols_data): New function.
8881         (Relobj::is_section_name_included): New function.
8882         (Relobj::copy_symbols_data): New function.
8883         (Relobj::set_symbols_data): New function.
8884         (Relobj::get_relocs_data): New function.
8885         (Relobj::set_relocs_data): New function.
8886         (Relobj::is_output_section_offset_invalid): New pure virtual function.
8887         (Relobj::gc_process_relocs): New function.
8888         (Relobj::do_gc_process_relocs): New pure virtual function.
8889         (Relobj::sd_): New data member.
8890         (Sized_relobj::is_output_section_offset_invalid): New function.
8891         (Sized_relobj::do_gc_process_relocs): New function.
8892         * options.h (General_options::gc_sections): Modify to not be a no-op.
8893         (General_options::print_gc_sections): New option.
8894         * plugin.cc (Plugin_finish::run): Remove function call to
8895         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
8896         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
8897         * reloc.cc (Read_relocs::run): Add task to process relocs and
8898         determine unreferenced sections when doing garbage collection.
8899         (Gc_process_relocs): New class.
8900         (Sized_relobj::do_gc_process_relocs): New function.
8901         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
8902         sections that are garbage collected.
8903         * reloc.h (Gc_process_relocs): New class.
8904         * sparc.cc (Target_sparc::gc_process_relocs): New function.
8905         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
8906         symbols whose corresponding sections are garbage collected.
8907         (Symbol_table::Symbol_table): Add new parameter for the garbage
8908         collection object.
8909         (Symbol_table::gc_mark_undef_symbols): New function.
8910         (Symbol_table::gc_mark_symbol_for_shlib): New function.
8911         (Symbol_table::gc_mark_dyn_syms): New function.
8912         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
8913         as garbage.
8914         (Symbol_table::add_from_object): Likewise.
8915         (Symbol_table::add_from_relobj): When building shared objects, do not
8916         treat externally visible symbols as garbage.
8917         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
8918         table information for static and relocatable links.
8919         * symtab.h (Symbol_table::set_gc): New function.
8920         (Symbol_table::gc): New function.
8921         (Symbol_table::gc_mark_undef_symbols): New function.
8922         (Symbol_table::gc_mark_symbol_for_shlib): New function.
8923         (Symbol_table::gc_mark_dyn_syms): New function.
8924         (Symbol_table::gc_): New data member.
8925         * target.h (Sized_target::gc_process_relocs): New pure virtual
8926         function.
8927         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
8928         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
8929
8930 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
8931
8932         * options.h (General_options::gc_sections): Define as a no-op for now.
8933         (General_options::no_keep_memory): Ditto.
8934         (General_options::Bshareable): Define.
8935         * options.cc (General_options::finalize): Honor -Bshareable.
8936
8937 2009-01-20  Andreas Schwab  <schwab@suse.de>
8938
8939         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
8940         read the value in the contents, since we don't use it.  Use the
8941         template endianness when writing.
8942         (Relocate::relocate): Use it for R_PPC_REL16_HA.
8943
8944 2009-01-19  Andreas Schwab  <schwab@suse.de>
8945
8946         * configure.tgt (powerpc64-*): Fix targ_obj.
8947
8948 2009-01-15  Ian Lance Taylor  <iant@google.com>
8949
8950         * object.cc (Sized_relobj::write_local_symbols): Don't write out
8951         local symbols when stripping all symbols.
8952
8953 2009-01-14  Cary Coutant  <ccoutant@google.com>
8954
8955         * output.cc (Output_reloc): Add explicit instantiations.
8956
8957 2009-01-14  Cary Coutant  <ccoutant@google.com>
8958
8959         * archive.cc (Archive::get_elf_object_for_member): Remove call
8960         to File_read::claim_for_plugin.
8961         * descriptors.cc (Descriptors::open): Remove reference to
8962         is_claimed.
8963         (Descriptors::claim_for_plugin): Remove.
8964         * descriptors.h (Descriptors::claim_for_plugin): Remove.
8965         (Descriptors::is_claimed): Remove.
8966         (claim_descriptor_for_plugin): Remove.
8967         * fileread.cc (File_read::claim_for_plugin): Remove.
8968         * fileread.h (File_read::claim_for_plugin): Remove.
8969         (File_read::descriptor): Reopen descriptor if necessary.
8970         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
8971         (Plugin_manager::all_symbols_read): Add task parameter. Change
8972         all callers.
8973         (Plugin_manager::get_input_file): New function.
8974         (Plugin_manager::release_input_file): New function.
8975         (Pluginobj::Pluginobj): Add filesize parameter and initialize
8976         corresponding data member.
8977         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
8978         and pass to base constructor. Change all callers.
8979         (get_input_file, release_input_file): New functions.
8980         (make_sized_plugin_object): Add filesize parameter. Change all callers.
8981         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
8982         (Plugin_manager::all_symbols_read): Add task parameter.
8983         (Plugin_manager::get_input_file): New function.
8984         (Plugin_manager::release_input_file): New function.
8985         (Plugin_manager::task_): New data member.
8986         (Pluginobj::Pluginobj): Add filesize parameter.
8987         (Pluginobj::filename): New function.
8988         (Pluginobj::descriptor): New function.
8989         (Pluginobj::filesize): New function.
8990         (Pluginobj::filesize_): New data member.
8991         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
8992         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
8993         File_read::claim_for_plugin; use Object::unlock to unlock the file.
8994
8995         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
8996         with archive libraries.
8997         * testsuite/Makefile.in: Regenerate.
8998         * testsuite/plugin_test.c (struct sym_info): New type.
8999         (get_input_file, release_input_file): New static variables.
9000         (onload): Capture new transfer vector entries.
9001         (claim_file_hook): Stop reading at end of file according to filesize.
9002         Factor out parsing of readelf output into separate function.
9003         (all_symbols_read_hook): Exercise get_input_file and release_input_file
9004         APIs and get the source file name from the symbol table.  Convert
9005         source file name to corresponding object file name.  Print info
9006         message when adding new input files.
9007         (parse_readelf_line): New function.
9008         * testsuite/plugin_test_1.sh: Add checks for new info messages.
9009         * testsuite/plugin_test_2.sh: Likewise.
9010         * testsuite/plugin_test_3.sh: Likewise.
9011         * testsuite/plugin_test_4.sh: New test case.
9012
9013 2009-01-07  Ian Lance Taylor  <iant@google.com>
9014
9015         * version.cc (version_string): Bump to 1.8.
9016
9017 2008-12-23  Cary Coutant  <ccoutant@google.com>
9018
9019         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
9020         * plugin.cc (Plugin_manager::finish): Rename as
9021         layout_deferred_objects.  Move cleanup to separate function.
9022         (Plugin_manager::cleanup): New function.
9023         (Plugin_finish::run): Call layout_deferred_objects and cleanup
9024         separately.
9025         * plugin.h (Plugin_manager::finish): Rename as
9026         layout_deferred_objects.
9027         (Plugin_manager::cleanup): New function.
9028         (Plugin_manager::cleanup_done): New field.
9029
9030 2008-12-23  Cary Coutant  <ccoutant@google.com>
9031
9032         * plugin.cc (is_visible_from_outside): New function.
9033         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
9034         so we don't return "IR only" status for exported symbols or -r links.
9035
9036         * testsuite/Makefile.am (plugin_test_3): New test case.
9037         * testsuite/Makefile.in: Regenerate.
9038         * testsuite/plugin_test_3.sh: New file.
9039
9040 2008-12-22  Cary Coutant  <ccoutant@google.com>
9041
9042         * object.cc (Sized_relobj::layout_section): New function.
9043         (Sized_relobj::do_layout): Defer layout of input sections until after
9044         plugin has provided replacement files.
9045         (Sized_relobj::do_layout_deferred_sections): New function.
9046         * object.h (Relobj::set_section_offset): Remove virtual keyword.
9047         (Relobj::layout_deferred_sections): New function.
9048         (Relobj::do_layout_deferred_sections): New function.
9049         (Sized_relobj::do_layout_deferred_sections): New function.
9050         (Sized_relobj::layout_section): New function.
9051         (Sized_relobj::Deferred_layout): New structure.
9052         (Sized_relobj::deferred_layout_): New field.
9053         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
9054         Change all callers.  Layout deferred sections.
9055         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
9056         references.
9057         (Plugin_hook::run): Move code from do_plugin_hook inline.
9058         (Plugin_hook::do_plugin_hook): Remove.
9059         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
9060         (Plugin_manager::finish): Renamed, was cleanup.
9061         (Plugin_manager::should_defer_layout): New function.
9062         (Plugin_manager::add_deferred_layout_object): New function.
9063         (Plugin_manager::Deferred_layout_list): New type.
9064         (Plugin_manager::deferred_layout_objects_): New field.
9065         (Plugin_hook::do_plugin_hook): Remove.
9066
9067 2008-12-17  Ian Lance Taylor  <iant@google.com>
9068
9069         * options.h (class General_options): Add --no case for
9070         --export-dynamic.
9071
9072 2008-12-16  Cary Coutant  <ccoutant@google.com>
9073
9074         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
9075         vector.
9076         (Plugin_manager::claim_file): Create plugin object even if
9077         plugin did not call the add_symbols callback.
9078         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
9079         asking for more symbols than were added.
9080         * testsuite/Makefile.am (plugin_test_1): Add test case with
9081         no global symbols.
9082         (empty.syms): New target.
9083         * testsuite/Makefile.in: Regenerate.
9084         * testsuite/plugin_test.c (claim_file_hook): Add new debug
9085         message. Don't call add_symbols if no globals.
9086         (all_symbols_read_hook): Don't provide replacement for empty
9087         claimed file.
9088
9089 2008-12-12  Ian Lance Taylor  <iant@google.com>
9090
9091         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
9092         r_type == 0 for a local symbol with r_sym == 0.
9093         (scan_relocatable_relocs): Pass r_sym to
9094         local_non_section_strategy.
9095         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
9096         r_sym parameter.
9097
9098         * configure.ac: Update test for TLS descriptors: they are
9099         supported as of glibc 2.9.
9100         * configure: Rebuild.
9101
9102 2008-12-11  Ian Lance Taylor  <iant@google.com>
9103
9104         PR 7091
9105         * target-reloc.h (Default_scan_relocatable_relocs): For each
9106         function, map r_type == 0 to RELOC_DISCARD.
9107
9108 2008-12-10  Cary Coutant  <ccoutant@google.com>
9109
9110         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
9111         object to override a kept COMDAT group from a plugin object.
9112
9113 2008-12-09  Ian Lance Taylor  <iant@google.com>
9114
9115         PR 7088
9116         * yyscript.y (file_cmd): Handle INPUT.
9117
9118         * testsuite/initpri1.c: Change all declarations to be full
9119         prototypes by adding void, to avoid compiler warnings.
9120
9121 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
9122
9123         * options.cc (General_options::parse_plugin_opt): New.
9124         (General_options::add_plugin): The argument now is just the filename.
9125         (General_options::add_plugin_option): New.
9126         * options.h (plugin_opt): New.
9127         (add_plugin): Change argument name.
9128         (add_plugin_option): New.
9129         * plugin.cc (Plugin::load): Don't parse the plugin option.
9130         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
9131         (Plugin::add_option): New.
9132         (Plugin::args_): Change type.
9133         (Plugin::filename_): New.
9134         (Plugin_manager::add_plugin_option): New.
9135         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
9136         * testsuite/Makefile.in: Regenerate.
9137
9138 2008-12-05  Cary Coutant  <ccoutant@google.com>
9139
9140         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
9141         Handle --strip-lto-sections option.
9142         * options.h (strip_lto_sections): New option.
9143
9144 2008-12-01  Cary Coutant  <ccoutant@google.com>
9145
9146         * plugin.cc (ld_plugin_message): Change format parameter to const.
9147         Fix mismatch between new[] and delete.
9148
9149 2008-11-14  Cary Coutant  <ccoutant@google.com>
9150
9151         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
9152         instead of -1U.
9153
9154 2008-11-05  Craig Silverstein  <csilvers@google.com>
9155
9156         * options.cc (General_options::parse_dynamic_list): New function.
9157         * options.h (General_options): New flags dynamic_list,
9158         dynamic_list_data, dynamic_list_cpp_new, and
9159         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
9160         (General_options::in_dynamic_list): New function.
9161         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
9162         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
9163         (Lex::can_continue_name): Likewise.
9164         (yylex): Likewise.
9165         (read_script_file): New parameter script_options.
9166         (read_dynamic_list): New function.
9167         (Script_options::define_dynamic_list): New function.
9168         (dynamic_list_keyword_parsecodes): New variable.
9169         (dynamic_list_keywords): New variable.
9170         * script.h (Script_options::define_dynamic_list): New function
9171         prototype.
9172         (read_dynamic_list): New function prototype.
9173         * symtab.cc (strprefix): New macro.
9174         (Symbol::should_add_dynsym_entry): Support dynamic_list,
9175         dynamic_list_data, dynamic_list_cpp_new, and
9176         dynamic_list_cpp_typeinfo.
9177         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
9178         (dynamic_list_expr): New rule.
9179         (dynamic_list_nodes): Likewise.
9180         (dynamic_list_node): Likewise.
9181         * testsuite/Makefile.am (dynamic_list): New test.
9182         * testsuite/Makefile.in: Regenerated.
9183         * testsuite/dynamic_list.t: New file.
9184         * testsuite/dynamic_list.sh: New file.
9185
9186 2008-11-05  Craig Silverstein  <csilvers@google.com>
9187
9188         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
9189         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
9190         (t11_last): Likewise.
9191         * testsuite/ver_test_6.c (main): Likewise.
9192
9193 2008-10-07  Cary Coutant  <ccoutant@google.com>
9194
9195         * options.c (General_options::finalize): Add check for -static and
9196         -shared.
9197         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
9198         is not empty.
9199
9200 2008-10-02  Cary Coutant  <ccoutant@google.com>
9201
9202         * plugin.cc (make_sized_plugin_object): Fix conditional
9203         compilation to work when not all targets are enabled.
9204
9205 2008-09-29  Cary Coutant  <ccoutant@google.com>
9206
9207         * archive.cc (Archive::get_file_and_offset): Use filename instead
9208         of name to get library path.
9209         (Archive::include_member): Unlock external member of a thin archive.
9210
9211         * testsuite/Makefile.am (TEST_AR): New variable.
9212         (thin_archive_test_1): New test.
9213         (thin_archive_test_2): New test.
9214         * testsuite/Makefile.in: Regenerate.
9215         * testsuite/thin_archive_main.cc: New file.
9216         * testsuite/thin_archive_test_1.cc: New file.
9217         * testsuite/thin_archive_test_2.cc: New file.
9218         * testsuite/thin_archive_test_3.cc: New file.
9219         * testsuite/thin_archive_test_4.cc: New file.
9220
9221 2008-09-29  Cary Coutant  <ccoutant@google.com>
9222
9223         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
9224         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
9225         instead of -1U.
9226         (Sized_relobj::do_finalize_local_symbols): Likewise.
9227         (Sized_relobj::map_to_kept_section): Likewise.
9228         * object.h (Sized_relobj::invalid_address): New constant.
9229         (Sized_relobj::do_output_section_offset): Check for invalid_address
9230         and return -1ULL.
9231         * output.cc (Output_reloc::local_section_offset): Use constant
9232         invalid_address instead of -1U.
9233         (Output_reloc::get_address): Likewise.
9234         (Output_section::output_address): Change -1U to -1ULL.
9235         * output.h (Output_reloc::invalid_address): New constant.
9236         * reloc.cc (Sized_relobj::write_sections): Use constant
9237         invalid_address instead of -1U.
9238         (Sized_relobj::relocate_sections): Likewise.
9239         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
9240         values for merge sections.
9241         * target-reloc.h (relocate_for_relocatable): Use constant
9242         invalid_address instead of -1U.
9243
9244 2008-09-19  Cary Coutant  <ccoutant@google.com>
9245
9246         Add plugin functionality for link-time optimization (LTO).
9247         * configure.ac (plugins): Add --enable-plugins option.
9248         * configure: Regenerate.
9249         * config.in: Regenerate.
9250         * Makefile.am (LIBDL): New variable.
9251         (CCFILES): Add plugin.cc.
9252         (HFILES): Add plugin.h.
9253         (ldadd_var): Add LIBDL.
9254         * Makefile.in: Regenerate.
9255
9256         * archive.cc: Include "plugin.h".
9257         (Archive::setup): Don't preread archive symbols when using a plugin.
9258         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
9259         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
9260         files.
9261         (Archive::include_member): Add symbols from plugin objects.
9262         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
9263         * descriptors.cc (Descriptors::open): Check for file descriptors
9264         abandoned by plugins.
9265         (Descriptors::claim_for_plugin): New function.
9266         * descriptors.h (Descriptors::claim_for_plugin): New function.
9267         (Open_descriptor::is_claimed): New field.
9268         (claim_descriptor_for_plugin): New function.
9269         * fileread.cc (File_read::claim_for_plugin): New function.
9270         * fileread.h (File_read::claim_for_plugin): New function.
9271         (File_read::descriptor): New function.
9272         * gold.cc: Include "plugin.h".
9273         (queue_initial_tasks): Add task to call plugin hooks for generating
9274         new object files.
9275         * main.cc: Include "plugin.h".
9276         (main): Load plugin libraries.
9277         * object.h (Pluginobj): Declare.
9278         (Object::pluginobj): New function.
9279         (Object::do_pluginobj): New function.
9280         (Object::set_target): New function.
9281         * options.cc: Include "plugin.h".
9282         (General_options::parse_plugin): New function.
9283         (General_options::General_options): Initialize plugins_ field.
9284         (General_options::add_plugin): New function.
9285         * options.h (Plugin_manager): Declare.
9286         (General_options): Add --plugin option.
9287         (General_options::has_plugins): New function.
9288         (General_options::plugins): New function.
9289         (General_options::add_plugin): New function.
9290         (General_options::plugins_): New field.
9291         * plugin.cc: New file.
9292         * plugin.h: New file.
9293         * readsyms.cc: Include "plugin.h".
9294         (Read_symbols::do_read_symbols): Check for archive before checking
9295         for ELF file.  Call plugin hooks to claim files.
9296         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
9297         from a real object file; force override when processing replacement
9298         files.
9299         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
9300         (Symbol::init_base_object): Likewise.
9301         (Symbol::init_base_output_data): Likewise.
9302         (Symbol::init_base_output_segment): Likewise.
9303         (Symbol::init_base_constant): Likewise.
9304         (Symbol::init_base_undefined): Likewise.
9305         (Symbol::output_section): Assert that object is not a plugin.
9306         (Symbol_table::add_from_pluginobj): New function.
9307         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
9308         undefined.
9309         (Symbol_table::sized_write_globals): Likewise.
9310         (Symbol_table::add_from_pluginobj): Instantiate template.
9311         * symtab.h (Sized_pluginobj): Declare.
9312         (Symbol::in_real_elf): New function.
9313         (Symbol::set_in_real_elf): New function.
9314         (Symbol::in_real_elf_): New field.
9315         (Symbol_table::add_from_pluginobj): New function.
9316
9317         * testsuite/Makefile.am (AM_CFLAGS): New variable.
9318         (LIBDL): New variable.
9319         (LDADD): Add LIBDL.
9320         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
9321         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
9322         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
9323         (MOSTLYCLEANFILES): Likewise.
9324         * testsuite/Makefile.in: Regenerate.
9325         * testsuite/plugin_test.c: New file.
9326         * testsuite/plugin_test_1.sh: New file.
9327         * testsuite/plugin_test_2.sh: New file.
9328
9329 2008-09-16  Ian Lance Taylor  <iant@google.com>
9330
9331         * target-reloc.h (relocate_section): Check whether a symbol is
9332         defined by the ABI before reporting an undefined symbol error.
9333         * target.h (Target::is_defined_by_abi): Make parameter const.
9334         (Target::do_is_defined_by_abi): Likewise.
9335         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
9336         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
9337         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
9338         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
9339         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
9340         * testsuite/Makefile.in: Rebuild.
9341
9342         * fileread.cc (make_view): Add casts to avoid warning.
9343
9344 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
9345
9346         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
9347         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
9348
9349 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
9350
9351         * options.h (General_options::output_is_executable): New.
9352         (General_options::output_is_pie): New.
9353         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
9354         for shared libraries.
9355         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
9356
9357 2008-09-11  Chris Demetriou  <cgd@google.com>
9358
9359         * options.h (origin): New -z option.
9360         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
9361         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
9362         in DT_FLAGS_1.
9363
9364 2008-09-05  Cary Coutant  <ccoutant@google.com>
9365
9366         * fileread.cc (File_read::make_view): Add check for attempt to map
9367         beyond end of file.
9368
9369 2008-09-05  Cary Coutant  <ccoutant@google.com>
9370
9371         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
9372         explicit instantiations.
9373
9374 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
9375
9376         PR gold/6858
9377         * options.cc (General_options::finalize): Allow undefined symbols
9378         in shlibs if linking -shared.
9379
9380         PR gold/6859
9381         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
9382         symbols as not needing a dynsym entry.
9383
9384 2008-08-20  Craig Silverstein  <csilvers@google.com>
9385
9386         * fileread.cc (File_read::open): Do not lock the file unless it
9387         was successfully opened.
9388
9389 2008-08-14  Cary Coutant  <ccoutant@google.com>
9390
9391         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
9392         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
9393         * testsuite/tls_test.cc (struct int128): 128-bit struct
9394         for testing TLS relocs with non-zero addend.
9395         (v12): New TLS variable.
9396         (t12): New test.
9397         (t_last): Add check for v12.
9398         * testsuite/tls_test.h (t12): New function.
9399         * testsuite/tls_test_main.cc (thread_routine): Call new test.
9400
9401 2008-08-13  Ian Lance Taylor  <iant@google.com>
9402
9403         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
9404         set tls_segment_ or relro_segment_.
9405         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
9406         when appropriate.
9407         * output.h (Output_section::clear_is_relro): New function.
9408         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
9409         sections specially even when output_data_ is empty.
9410         (Output_segment::maximum_alignment): When first section is relro,
9411         only force alignment for PT_LOAD segments.
9412         * script.cc (script_data_segment_align): New function.
9413         (script_data_segment_relro_end): New function.
9414         * script-c.h (script_data_segment_align): Declare.
9415         (script_data_segment_relro_end): Declare.
9416         * script-sections.h (class Script_sections): Declare
9417         data_segment_align and data_segment_relro_end.  Add fields
9418         segment_align_index_ and saw_relro_end_.
9419         * script-sections.cc (class Sections_element): Add set_is_relro
9420         virtual function.  Add new bool* parameter to place_orphan_here.
9421         Add get_output_section virtual function.
9422         (class Output_section_definition): Add set_is_relro.  Add new
9423         bool* parameter to place_orphan_here.  Add get_output_section.
9424         Add is_relro_ field.
9425         (Output_section_definition::Output_section_definition): Initialize
9426         evaluated_address_, evaluated_load_address, evaluated_addralign_,
9427         and is_relro_ fields.
9428         (Output_section_definition::place_orphan_here): Add is_relro
9429         parameter.
9430         (Output_section_definition::set_section_addresses): Set relro for
9431         output section.
9432         (Output_section_definition::alternate_constraint): Likewise.
9433         (class Orphan_output_section): Add new bool* parameter to
9434         place_orphan_here.  Add get_output_section.
9435         (Orphan_output_section::place_orphan_here): Add is_relro
9436         parameter.
9437         (Script_sections::Script_sections): Initialize
9438         data_segment_align_index_ and saw_relro_end_.
9439         (Script_sections::data_segment_align): New function.
9440         (Script_sections::data_segment_relro_end): New function.
9441         (Script_sections::place_orphan): Set or clear is_relro.
9442         (Script_sections::set_section_addresses): Force alignment of first
9443         TLS section.
9444         * yyscript.y (exp): Call script_data_segment_align and
9445         script_data_segment_relro_end.
9446         * testsuite/relro_script_test.t: New file.
9447         * testsuite/relro_test.cc (using_script): Declare.
9448         (t1, t2): Test using_script.
9449         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
9450         (relro_script_test_SOURCES): Define.
9451         (relro_script_test_DEPENDENCIES): Define.
9452         (relro_script_test_LDFLAGS): Define.
9453         (relro_script_test_LDADD): Define.
9454         (relro_script_test.so): New target.
9455         * testsuite/Makefile.in: Rebuild.
9456
9457 2008-08-06  Cary Coutant <ccoutant@google.com>
9458
9459         * archive.cc (Archive::total_archives, Archive::total_members)
9460         (Archive::total_members_loaded): New variables.
9461         (Archive::setup): Add parameter.  Add option to preread
9462         archive symbols.
9463         (Archive::read_armap): Add counter.
9464         (Archive::get_file_and_offset): New function.
9465         (Archive::get_elf_object_for_member): New function.
9466         (Archive::read_all_symbols): New function.
9467         (Archive::read_symbols): New function.
9468         (Archive::add_symbols): Add counters.
9469         (Archive::include_all_members): Use armap to find members if it's
9470         already built.
9471         (Archive::include_member): Skip reading symbols if already read.
9472         Factored code into Archive::get_file_and_offset and
9473         Archive::get_elf_object_for_member.  Changed call to
9474         Mapfile::report_include_archive_member.
9475         (Archive::print_stats): New function.
9476         * archive.h: Declare Object and Read_symbols_data classes.
9477         (Archive::Archive): Add initializers for new members.
9478         (Archive::setup): Add parameter.
9479         (Archive::print_stats): New function.
9480         (Archive::total_archives, Archive::total_members)
9481         (Archive::total_members_loaded): New variables.
9482         (Archive::get_file_and_offset): New function.
9483         (Archive::get_elf_object_for_member): New function.
9484         (Archive::read_all_symbols): New function.
9485         (Archive::read_symbols): New function.
9486         (Archive::Archive_member): New class.
9487         (Archive::members_): New member.
9488         (Archive::num_members_): New member.
9489         * main.cc: Include archive.h.
9490         (main): Call Archive::print_stats.
9491         * mapfile.cc (Mapfile::report_include_archive_member): Delete
9492         archive parameter; member_name is now the fully-decorated name.
9493         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
9494         * options.h: (General_options): Add --preread-archive-symbols option.
9495         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
9496         Archive::setup.
9497
9498 2008-08-04  Ian Lance Taylor  <iant@google.com>
9499
9500         * symtab.h (Symbol::use_plt_offset): New function.
9501         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
9502         * powerpc.cc (Relocate::relocate): Likewise.
9503         * sparc.cc (Relocate::relocate): Likewise.
9504         * x86_64.cc (Relocate::relocate): Likewise.
9505         * testsuite/weak_plt.sh: New test.
9506         * testsuite/weak_plt_main.cc: New test.
9507         * testsuite/weak_plt_shared.cc: New test.
9508         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
9509         (check_PROGRAMS): Add weak_plt.
9510         (check_DATA): Add weak_plt_shared.so.
9511         (weak_plt_main_pic.o, weak_plt): New targets.
9512         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
9513         * testsuite/Makefile.in: Rebuild.
9514
9515         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
9516         gcctestdir/ld.
9517         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
9518         * testsuite/Makefile.in: Rebuild.
9519
9520 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
9521
9522         * Makefile.am (POTFILES.in): Set LC_ALL=C.
9523         * Makefile.in: Regenerate.
9524         * po/POTFILES.in: Regenerate.
9525
9526 2008-07-29  Ian Lance Taylor  <iant@google.com>
9527
9528         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
9529         symbols before other symbols.
9530         * testsuite/script_test_2.cc (test_addr): Declare.
9531         (test_addr_alias): Declare.
9532         (main): Check that test_addr and test_addr_alias have the right
9533         values.
9534         * testsuite/script_test_2.t: Define test_addr_alias and
9535         test_addr.
9536
9537 2008-07-24  Ian Lance Taylor  <iant@google.com>
9538
9539         PR 5990
9540         * descriptors.cc: New file.
9541         * descriptors.h: New file.
9542         * gold-threads.h (class Hold_optional_lock): New class.
9543         * fileread.cc: Include "descriptors.h".
9544         (File_read::~File_read): Release descriptor rather than closing
9545         it.
9546         (File_read::open) [file]: Call open_descriptor rather than open.
9547         Set is_descriptor_opened_.
9548         (File_read::open) [memory]: Assert that descriptor is not open.
9549         (File_read::reopen_descriptor): New function.
9550         (File_read::release): Release descriptor.
9551         (File_read::do_read): Make non-const.  Reopen descriptor.
9552         (File_read::read): Make non-const.
9553         (File_read::make_view): Reopen descriptor.
9554         (File_read::do_readv): Likewise.
9555         * fileread.h (class File_read): Add is_descriptor_opened_ field.
9556         Update declarations.
9557         * layout.cc: Include "descriptors.h".
9558         (Layout::create_build_id): Use open_descriptor rather than open.
9559         * output.cc: Include "descriptors.h".
9560         (Output_file::open): Use open_descriptor rather than open.
9561         * archive.cc (Archive::const_iterator): Change Archive to be
9562         non-const.
9563         (Archive::begin, Archive::end): Make non-const.
9564         (Archive::count_members): Likewise.
9565         * archive.h (class Archive): Update declarations.
9566         * object.h (Object::read): Make non-const.
9567         * Makefile.am (CCFILES): Add descriptors.cc.
9568         (HFILES): Add descriptors.h.
9569         * Makefile.in: Rebuild.
9570
9571         PR 6716
9572         * gold.h: Always include <clocale>.  Add Solaris workarounds
9573         following code in binutils/sysdep.h.
9574
9575         PR 6048
9576         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
9577         this->eh_frame_hdr_ is NULL before using it.
9578
9579         * dynobj.cc (Versions::Versions): Update comment.
9580
9581         * dynobj.cc (Versions::Versions): If there is an soname, use it as
9582         the base version name.
9583
9584         * stringpool.cc (Stringpool_template::add_with_length): Set key to
9585         array size plus one.
9586         (Stringpool_template::set_string_offsets): Subtract one from key
9587         before using it as an array index.
9588         (Stringpool_template::get_offset_with_length): Likewise.
9589         (Stringpool_template::write_to_buffer): Likewise.
9590         * stringpool.h (Stringpool_template::get_offset_from_key):
9591         Likewise.
9592
9593 2008-07-23  Ian Lance Taylor  <iant@google.com>
9594
9595         PR 6658
9596         * object.h (Merged_symbol_value::value): Do our best to handle a
9597         negative addend.
9598
9599         PR 6647
9600         * script.cc (Version_script_info::get_versions): Don't add empty
9601         version tag to return value.
9602         (Version_script_info::get_symbol_version_helper): Change return
9603         type to bool.  Add pversion parameter.  Change all callers.
9604         (script_register_vers_node): Don't require a non-NULL tag.
9605         * script.h (class Version_script_info): Update declarations.
9606         (Version_script_info::get_symbol_version): Change return type to
9607         bool.  Add version parameter.  Change all callers.
9608         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
9609         handling.  Handle an empty version from a version script.
9610         (Symbol_table::define_special_symbol): Likewise.
9611         * testsuite/ver_test_10.script: New file.
9612         * testsuite/ver_test_10.sh: New file.
9613         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
9614         (check_DATA): Add ver_test_10.syms.
9615         (ver_test_10.syms, ver_test_10.so): New target.
9616         * testsuite/Makefile.in: Rebuild.
9617
9618 2008-07-23  Simon Baldwin  <simonb@google.com>
9619
9620         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
9621         to zero for undefined symbols from dynamic libraries.
9622
9623 2008-07-23  Ian Lance Taylor  <iant@google.com>
9624
9625         * symtab.cc (Symbol_table::resolve): Remove version parameter.
9626         Change all callers.
9627         * symtab.h (class Symbol_table): Update declaration.
9628         * testsuite/ver_test_9.cc: New file.
9629         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
9630         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
9631         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
9632         (ver_test_9.so, ver_test_9.o): New targets.
9633         * testsuite/Makefile.in: Rebuild.
9634
9635 2008-07-22  Ian Lance Taylor  <iant@google.com>
9636
9637         * options.h (class General_options): Define --check-sections.
9638         * layout.cc (Layout::set_segment_offsets): Handle
9639         --check-sections.
9640
9641         * options.h (class General_options): Define -n/--nmagic and
9642         -N/--omagic.
9643         * options.cc (General_options::finalize): For -n/--nmagic or
9644         -N/--omagic, set -static.
9645         * layout.cc (Layout::attach_allocated_section_to_segment): If
9646         -N/--omagic, don't put read-only and read-write sections in
9647         different segments.
9648         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
9649         finding a read-only segment.
9650         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
9651         don't set the minimum segment alignment to the common page size,
9652         and don't set the file offset to the address modulo the page size.
9653         * script-sections.cc (Script_sections::create_segments): If
9654         -n/--omagic, don't put read-only and read-write sections in
9655         different segments.
9656
9657         * cref.cc: New file.
9658         * cref.h: New file.
9659         * options.h (class General_options): Add --print-symbol-counts.
9660         * main.cc (main): Issue defined symbol report if requested.
9661         * archive.cc (Archive::interpret_header): Make into a const member
9662         function.
9663         (Archive::add_symbols): Call Input_objects::archive_start and
9664         archive_stop.
9665         (Archive::const_iterator): Define new class.
9666         (Archive::begin, Archive::end): New functions.
9667         (Archive::include_all_members): Rewrite to use iterator.
9668         (Archive::count_members): New function.
9669         * archive.h (class Archive): Update declarations.
9670         (Archive::filename): New function.
9671         * object.cc: Include "cref.h".
9672         (Sized_relobj::Sized_relobj): Initialize defined_count_.
9673         (Sized_relobj::do_get_global_symbol_counts): New function.
9674         (Input_objects::add_object): Add object to cross-referencer.
9675         (Input_objects::archive_start): New function.
9676         (Input_objects::archive_stop): New function.
9677         (Input_objects::print_symbol_counts): New function.
9678         * object.h: Declare Cref and Archive.
9679         (Object::get_global_symbol_counts): New function.
9680         (Object::do_get_global_symbol_counts): New pure virtual function.
9681         (class Sized_relobj): Add defined_count_ field.  Update
9682         declarations.
9683         (class Input_objects): Add cref_ field.  Update constructor.
9684         Update declarations.
9685         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
9686         defined_count_.
9687         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
9688         symbol counts.
9689         (Sized_dynobj::do_get_global_symbol_counts): New function.
9690         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
9691         defined_count_.  Update declarations.  Define Symbols typedef.
9692         * symtab.cc (Symbol_table::add_from_relobj): Add defined
9693         parameter.  Change all callers.
9694         (Symbol_table::add_from_dynobj): Add sympointers and defined
9695         parameters.  Change all callers.
9696         * symtab.h (class Symbol_table): Update declarations.
9697         * Makefile.am (CCFILES): Add cref.cc.
9698         (HFILES): Add cref.h.
9699         * Makefile.in: Rebuild.
9700
9701 2008-07-22  Simon Baldwin  <simonb@google.com>
9702
9703         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
9704         to zero when writing undefined symbols.
9705
9706 2008-07-22  Ian Lance Taylor  <iant@google.com>
9707
9708         * output.cc (Output_section::add_input_section): Don't try to
9709         merge empty merge sections.
9710
9711 2008-07-21  Craig Silverstein  <csilvers@google.com>
9712
9713         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9714         Include symbol version in error message.
9715
9716 2008-07-20  Chris Demetriou  <cgd@google.com>
9717
9718         * configure.ac (gold_cv_c_random_seed): New configured variable.
9719         (RANDOM_SEED_CFLAGS): New substituted variable.
9720         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
9721         * configure: Rebuild.
9722         * Makefile.in: Likewise.
9723         * testsuite/Makefile.in: Likewise.
9724
9725 2008-07-18  Ian Lance Taylor  <iant@google.com>
9726
9727         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
9728         where we see NAME/NULL and NAME/VERSION  as separate symbols.
9729         * testsuite/ver_test_main.cc (main): Call t4.
9730         (t4, t4_2a): Define.
9731         * testsuite/ver_test_2.cc (t4_2): Define.
9732         * testsuite/ver_test_2.script: Put t4_2a in VER2.
9733         * testsuite/ver_test_4.cc (t4_2a): Define.
9734         * testsuite/ver_test_4.script: Put t4_2a in VER2.
9735         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
9736
9737 2008-07-17  Ian Lance Taylor  <iant@google.com>
9738
9739         * dynobj.cc (Versions::add_def): If we give an error about a
9740         missing version, go ahead and create the version anyhow.
9741
9742 2008-07-10  Ian Lance Taylor  <iant@google.com>
9743
9744         Handle output sections with more than 0x7fffffff bytes.
9745         * object.h (class Relobj): Change map_to_output_ to
9746         output_sections_, and just keep a section pointer.  Change all
9747         uses.  Move comdat group support to Sized_relobj.
9748         (Relobj::is_section_specially_mapped): Remove.
9749         (Relobj::output_section): Remove poff parameter.  Change all
9750         callers.
9751         (Relobj::output_section_offset): New function.
9752         (Relobj::set_section_offset): Rewrite.
9753         (Relobj::map_to_output): Remove.
9754         (Relobj::output_sections): New function.
9755         (Relobj::do_output_section_offset): New pure virtual function.
9756         (Relobj::do_set_section_offset): Likewise.
9757         (class Sized_relobj): Add section_offsets_ field.  Add comdat
9758         group support from Relobj.  Update declarations.
9759         (Sized_relobj::get_output_section_offset): New function.
9760         (Sized_relobj::do_output_section_offset): New function.
9761         (Sized_relobj::do_set_section_offset): New function.
9762         * object.cc (Relobj::output_section_address): Remove.
9763         (Sized_relobj::Sized_relobj): Initialize new fields.
9764         (Sized_relobj::include_section_group): Cast find_kept_object to
9765         Sized_relobj.
9766         (Sized_relobj::include_linkonce_section): Likewise.
9767         (Sized_relobj::do_layout): Use separate arrays for output section
9768         and output offset.
9769         (Sized_relobj::do_count_local_symbols): Change map_to_output to
9770         output_sections.
9771         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
9772         output_sections and section_offsets.
9773         (Sized_relobj::write_local_symbols): Likewise.
9774         (map_to_kept_section): Compute output address directly.
9775         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
9776         output_sections and section_offsets.
9777         (Sized_relobj::write_sections): Likewise.
9778         (Sized_relobj::relocate_sections): Likewise.
9779         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
9780         * output.h (class Output_reloc): Update declarations.  Change
9781         u2_.relobj to Sized_relobj*.
9782         (class Output_data_reloc): Change add functions to use
9783         Sized_relobj*.
9784         * output.cc (Output_reloc::Output_reloc): Change relobj to
9785         Sized_relobj*.
9786         (Output_reloc::local_section_offset): Change return type to
9787         Elf_Addr.  Use get_output_section_offset.
9788         (Output_reloc::get_address): Likewise.
9789         (Output_section::is_input_address_mapped): Don't call
9790         is_section_specially_mapped.
9791         (Output_section::output_offset): Likewise.
9792         (Output_section::output_address): Likewise.
9793         (Output_section::starting_output_address): Likewise.
9794         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
9795         parameter to Sized_relobj*.
9796         (Copy_relocs::need_copy_reloc): Likewise.
9797         (Copy_relocs::save): Likewise.
9798         * copy-relocs.h (class Copy_relocs): Update declarations.
9799         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
9800         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
9801         * target-reloc.h (relocate_for_relocatable): Change
9802         offset_in_output_section type to Elf_Addr.  Change code that uses
9803         it as well.
9804         * layout.cc (Layout::layout): Always set *off.
9805         * mapfile.cc (Mapfile::print_input_section): Use
9806         output_section_offset.
9807         * i386.cc (Target_i386::copy_reloc): Change object parameter to
9808         Sized_relobj*.
9809         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
9810         * sparc.cc (Target_sparc::copy_reloc): Likewise.
9811         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
9812
9813 2008-07-03  Ian Lance Taylor  <iant@google.com>
9814
9815         * layout.cc (Layout::include_section): Do not discard unrecognized
9816         SHT_STRTAB sections.
9817
9818 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
9819
9820         * script.cc (Lex::can_continue_name): Make '?' allowable in
9821         version-script names.
9822         * testsuite/version_script.map: Change glob pattern to use '?'
9823
9824 2008-06-30  Manish Singh  <yosh@gimp.org>
9825
9826         PR 6585
9827         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
9828         Correct typo.
9829
9830 2008-06-30  Ian Lance Taylor  <iant@google.com>
9831
9832         PR 6660
9833         PR 6682
9834         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
9835         versions]: Don't try to read the value in the contents, since we
9836         don't use it.  Use the template endianness when writing.
9837
9838 2008-06-25  Cary Coutant  <ccoutant@google.com>
9839
9840         * fileread.cc (File_read::make_view): Assert on zero-length view.
9841         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
9842         symbol table when there are no symbols to read.
9843
9844 2008-06-23  Craig Silverstein  <csilvers@google.com>
9845
9846         * version.cc (version_string): Bump to 1.7
9847
9848 2008-06-18  Craig Silverstein  <csilvers@google.com>
9849
9850         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
9851         constant 0xFFFF to type Valtype.
9852         (Powerpc_relocate_functions::rel16_ha): Likewise.
9853
9854 2008-06-17  Ian Lance Taylor  <iant@google.com>
9855
9856         * output.h (Output_section::Input_section): Initialize p2align_ to
9857         zero for Output_section_data constructors.
9858         (Output_section::Input_section::addralign): If not an input
9859         section, return the alignment of the Output_section_data.
9860         * testsuite/copy_test.cc: New file.
9861         * testsuite/copy_test_1.cc: New file.
9862         * testsuite/copy_test_2.cc: New file.
9863         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
9864         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
9865         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
9866         (copy_test_1_pic.o, copy_test_1.so): New targets.
9867         (copy_test_2_pic.o, copy_test_2.so): New targets.
9868         * testsuite/Makefile.in: Rebuild.
9869
9870         * script-sections.cc (Script_sections::place_orphan): Initialize
9871         local variable exact.
9872
9873 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
9874
9875         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
9876
9877 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
9878             David S. Miller  <davem@davemloft.net>
9879
9880         * powerpc.cc: New file.
9881         * Makefile.am (TARGETSOURCES): Add powerpc.cc
9882         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
9883         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
9884         * Makefile.in: Rebuild.
9885
9886 2008-06-09  Ian Lance Taylor  <iant@google.com>
9887
9888         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
9889         <exception>.
9890         (throwing, orig_terminate): New static variables.
9891         (terminate_handler): New static function.
9892         (t2): Set terminate handler.
9893
9894 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
9895
9896         PR 6584
9897         * binary.cc (Binary_to_elf::sized_convert): Fix .data
9898         alignment.
9899
9900 2008-05-30  Cary Coutant  <ccoutant@google.com>
9901
9902         * archive.cc (Archive::include_all_members) Correct to step
9903         over symbol table and extended name table in thin archives.
9904
9905 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
9906
9907         PR 6407
9908         * target-reloc.h (relocate_for_relocatable): Fix new_offset
9909         calculation.
9910
9911 2008-05-28  Caleb Howe  <cshowe@google.com>
9912
9913         * reduced_debug_output.cc: New file.
9914         * reduced_debug_output.h: New file.
9915         * options.h (class General_options): Add --strip-debug-non-line.
9916         * options.cc (General_options::finalize): Add strip_debug_non_line
9917         to the strip heirarchy.
9918         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
9919         fields.
9920         * layout.cc: Include "reduced_debug_output.h".
9921         (Layout::Layout): Initialize new fields.
9922         (line_only_debug_sections): New static array.
9923         (is_lines_only_debug_sections): New static inline function.
9924         (Layout::include_section): Handle --strip-debug-non-line.
9925         (Layout::make_output_section): If --strip-debug-non-line, build
9926         new output sections for .debug_abbrev and .debug_info.
9927         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
9928         gold.  Warn about possible overflow.
9929         (read_signed_LEB_128): Likewise.
9930         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
9931         (read_signed_LEB_128): Declare.
9932         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
9933         (HFILES): Add reduced_debug_output.h.
9934         * Makefile.in: Rebuild.
9935
9936 2008-05-21  Ian Lance Taylor  <iant@google.com>
9937
9938         * mapfile.cc: New file.
9939         * mapfile.h: New file.
9940         * options.h (class General_options): Add -M/--print-map and -Map.
9941         * options.cc (General_options::finalize): Make -M equivalent to
9942         -Map -.
9943         * main.cc: Include <cstdio> and "mapfile.h".
9944         (main): Open mapfile if requested.
9945         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
9946         constructor.  Change caller.
9947         (queue_initial_tasks): Add mapfile parameter.  Change caller.
9948         (queue_middle_tasks): Likewise.
9949         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
9950         declarations.
9951         * archive.cc: Include "mapfile.h".
9952         (Archive::add_symbols): Add mapfile parameter.  Change all
9953         callers.  Pass mapfile, symbol, and reason to include_member.
9954         (Archive::include_all_members): Add mapfile parameter.  Change all
9955         callers.
9956         (Archive::include_member): Add mapfile, sym, and why parameters.
9957         Change all callers.  Report inclusion to map file.
9958         * archive.h: Include "fileread.h".
9959         (class Archive): Update declarations.
9960         (Archive::file): New const method.
9961         (class Add_archive_symbols): Add mapfile_ field.  Update
9962         constructor.  Change all callers.
9963         * readsyms.h (class Read_symbols): Likewise.
9964         (class Finish_group): Likewise.
9965         (class Read_script): Likewise.
9966         * common.cc: Include "mapfile.h".
9967         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
9968         all callers.
9969         (Symbol_table::do_allocate_commons): Likewise.
9970         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
9971         symbol allocation to mapfile.
9972         * common.h (class Allocate_commons_task): Add mapfile_ field.
9973         Update constructor.  Change all callers.
9974         * symtab.h (class Symbol_table): Update declarations.
9975         * layout.cc: Include "mapfile.h".
9976         (Layout_task_runner::run): Print information to mapfile.
9977         (Layout::create_gold_note): Change Output_data_fixed_space to
9978         Output_data_zero_fill.
9979         (Layout::create_build_id): Likewise.
9980         (Layout::print_to_mapfile): New function.
9981         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
9982         constructor.  Change caller.
9983         (class Layout): Declare print_to_mapfile.
9984         * output.cc (Output_section::Input_section::print_to_mapfile): New
9985         function.
9986         (Output_section::add_input_section): If producing a map, always
9987         add to input_sections_ list.
9988         (Output_section::do_print_to_mapfile): New function.
9989         (Output_segment::print_sections_to_mapfile): New function.
9990         (Output_segment::print_section_list_to_mapfile): New function.
9991         * output.h: Include "mapfile.h".
9992         (Output_data::print_to_mapfile): New function.
9993         (Output_data::do_print_to_mapfile): New virtual function.
9994         (Output_segment_headers::do_print_to_mapfile): New function.
9995         (Output_file_header::do_print_to_mapfile): New function.
9996         (Output_data_const::do_print_to_mapfile): New function.
9997         (class Output_data_const_buffer): Add map_name_ field.  Update
9998         constructor.  Change all callers.  Add do_print_to_mapfile
9999         function.
10000         (class Output_data_fixed_space): Likewise.
10001         (class Output_data_space): Likewise.
10002         (class Output_data_zero_fill): New class.
10003         (Output_data_strtab::do_print_to_mapfile): New function.
10004         (Output_data_reloc_base::do_print_to_mapfile): New function.
10005         (Output_relocatable_relocs::do_print_to_mapfile): New function.
10006         (Output_data_group::do_print_to_mapfile): New function.
10007         (Output_data_got::do_print_to_mapfile): New function.
10008         (Output_data_dynamic::do_print_to_mapfile): New function.
10009         (Output_symtab_xindex::do_print_to_mapfile): New function.
10010         (class Output_section): Declare do_print_to_mapflie.  Declare
10011         print_to_mapfile in Input_section.
10012         (class Output_segment): Declare new functions.
10013         * object.h (Sized_relobj::symbol_count): New function.
10014         * script-sections.cc
10015         (Output_section_element_dot_assignment::set_section_addresses):
10016         Change Output_data_fixed_space to Output_data_zero_fill.
10017         (Output_data_expression::do_print_to_mapfile): New function.
10018         * script.cc (read_input_script): Add mapfile parameter.  Change
10019         all callers.
10020         * script.h (read_input_script): Update declaration.
10021         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
10022         (Eh_frame::do_print_to_mapfile): New function.
10023         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
10024         (Output_merge_string::do_print_to_mapfile): New function.
10025         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
10026         function.
10027         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
10028         function.
10029         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
10030         function.
10031         * Makefile.am (CCFILES): Add mapfile.cc.
10032         (HFILES): Add mapfile.h.
10033         * Makefile.in: Rebuild.
10034
10035 2008-05-19  Ian Lance Taylor  <iant@google.com>
10036
10037         * options.h (class General_options): Add -z relro.
10038         * layout.cc (Layout::Layout): Initialize relro_segment_.
10039         (Layout::add_output_section_data): Return the output section.
10040         (Layout::make_output_section): Rcognize relro sections and mark
10041         them appropriately.
10042         (Layout::attach_allocated_section_to_segment): Put relro sections
10043         in a PT_GNU_RELRO segment.
10044         (Layout::create_initial_dynamic_sections): Mark the .dynamic
10045         section as relro.
10046         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
10047         PT_TLS segments.
10048         (Layout::linkonce_mapping): Map d.rel.ro.local to
10049         .data.rel.ro.local.
10050         (Layout::output_section_name): Us .data.rel.ro.local for any
10051         section which begins with that.
10052         * layout.h (class Layout): Update add_output_section_data
10053         declaration.  Add relro_segment_ field.
10054         * output.cc (Output_section::Output_section): Initialize is_relro_
10055         and is_relro_local_ fields.
10056         (Output_segment::add_output_section): Group relro sections.
10057         (Output_segment::is_first_section_relro): New function.
10058         (Output_segment::maximum_alignment): If there is a relro section,
10059         align the segment to the common page size.
10060         (Output_segment::set_section_addresses): Track whether we are
10061         looking at relro sections.  If the last section is a relro
10062         section, align to the common page size.
10063         (Output_segment::set_section_list_addresses): Add in_relro
10064         parameter.  Change all callers.  Align to the page size when
10065         moving from relro to non-relro section.
10066         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
10067         segment.
10068         * output.h (class Output_section): Add is_relro_ and
10069         is_relro_local_ fields.
10070         (Output_section::is_relro): New function.
10071         (Output_section::set_is_relro): New function.
10072         (Output_section::is_relro_local): New function.
10073         (Output_section::set_is_relro_local): New function.
10074         (class Output_segment): Update declarations.
10075         * i386.cc (Target_i386::got_section): Mark .got section as relro.
10076         * sparc.cc (Target_sparc::got_section): Likewise.
10077         * x86_64.cc (Target_x86_64::got_section): Likewise.
10078         * testsuite/relro_test_main.cc: New file.
10079         * testsuite/relro_test.cc: New file.
10080         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
10081         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
10082         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
10083         (relro_test.so, relro_test_pic.o): New targets.
10084         * testsuite/Makefile.in: Rebuild.
10085
10086 2008-05-16  Ian Lance Taylor  <iant@google.com>
10087
10088         * output.cc (Output_segment::add_output_section): Remove front
10089         parameter.
10090         * output.h (class Output_segment): Remove
10091         add_initial_output_section and overloaded add_output_section.
10092         Update declaration of remaining add_output_section.
10093         * layout.cc (Layout::create_interp): Call add_output_section
10094         rather than add_initial_output_section.
10095         (Layout::finish_dynamic_section): Likewise.
10096
10097         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
10098         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
10099         know the dynamic type.
10100         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
10101         field.  Initialize it in constructor.
10102         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
10103         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
10104         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
10105         reloc.
10106
10107         * output.cc (Output_reloc::get_address): Change return type to
10108         Elf_Addr.
10109         * output.h (class Output_reloc): Update get_address declaration.
10110         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
10111         for section addresses.
10112
10113 2008-05-09  Ian Lance Taylor  <iant@google.com>
10114
10115         PR 6493
10116         * gold.cc (gold_nomem): Use return value of write.
10117
10118 2008-05-08  Ian Lance Taylor  <iant@google.com>
10119
10120         * symtab.c (Symbol::init_base_output_data): Add version
10121         parameter.  Change all callers.
10122         (Symbol::init_base_output_segment): Likewise.
10123         (Symbol::init_base_constant): Likewise.
10124         (Symbol::init_base_undefined): Likewise.
10125         (Sized_symbol::init_output_data): Likewise.
10126         (Sized_symbol::init_output_segment): Likewise.
10127         (Sized_symbol::init_constant): Likewise.
10128         (Sized_symbol::init_undefined): Likewise.
10129         (Symbol_table::do_define_in_output_data): If the new symbol has a
10130         version, mark it as the default.
10131         (Symbol_table::do_define_in_output_segment): Likewise.
10132         (Symbol_table::do_define_as_constant): Likewise.
10133         * symtab.h (class Symbol): Update declarations.
10134         (class Sized_symbol): Likewise.
10135         * resolve.cc (Symbol::override_version): New function.
10136         (Symbol::override_base): Call override_version.
10137         (Symbol::override_base_with_special): Likewise.
10138         * testsuite/ver_script_8.script: New file.
10139         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
10140         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
10141         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
10142         (ver_test_8_1.so, ver_test_8_2.so): New targets.
10143
10144 2008-05-06  Ian Lance Taylor  <iant@google.com>
10145
10146         PR 6049
10147         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
10148         functions.
10149         (class General_options): Remove existing --undefined, and add
10150         --no-undefined instead.  Add new --undefined as synonym for -u.
10151         * archive.cc (Archive::add_symbols): Check whether symbol was
10152         named with -u.
10153         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
10154         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
10155         all uses.  Add IS_UNDEFINED.  Update declarations to split
10156         different versions of init_base.  Declare init_base_undefined.
10157         (Symbol::is_defined): Handle IS_UNDEFINED.
10158         (Symbol::is_undefined): Likewise.
10159         (Symbol::is_weak_undefined): Call is_undefined.
10160         (Symbol::is_absolute): Handle IS_CONSTANT.
10161         (class Sized_symbol): Update declarations to split different
10162         versions of init.  Declare init_undefined.
10163         (class Symbol_table): Declare new functions.
10164         * symtab.cc (Symbol::init_base_object): Rename from init_base.
10165         Change all callers.
10166         (Symbol::init_base_output_data): Likewise.
10167         (Symbol::init_base_output_segment): Likewise.
10168         (Symbol::init_base_constant): Likewise.
10169         (Symbol::init_base_undefined): New function.
10170         (Sized_symbol::init_object): Rename from init.  Change all
10171         callers.
10172         (Sized_symbol::init_output_data): Likewise.
10173         (Sized_symbol::init_output_segment): Likewise.
10174         (Sized_symbol::init_constant): Likewise.
10175         (Sized_symbol::init_undefined): New function.
10176         (Symbol_table::add_undefined_symbols_from_command_line): New
10177         function.
10178         (Symbol_table::do_add_undefined_symbols_from_command_line): New
10179         function.
10180         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
10181         (Symbol::output_section): Likewise.
10182         (Symbol::set_output_section): Likewise.
10183         (Symbol_table::sized_finalize_symbol): Likewise.
10184         (Symbol_table::sized_write_globals): Likewise.
10185         * resolve.cc (Symbol_table::should_override): Likewise.
10186         (Symbol::override_base_with_special): Likewise.
10187
10188         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
10189         symbol, change it to have default visibility.
10190         * testsuite/protected_1.cc: New file.
10191         * testsuite/protected_2.cc: New file.
10192         * testsuite/protected_3.cc: New file.
10193         * testsuite/protected_main_1.cc: New file.
10194         * testsuite/protected_main_2.cc: New file.
10195         * testsuite/protected_main_3.cc: New file.
10196         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
10197         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
10198         (protected_1_LDFLAGS, protected_1_LDADD): Define.
10199         (protected_1.so): New target.
10200         (protected_1_pic.o, protected_2_pic.o): New targets.
10201         (protected_3_pic.o): New target.
10202         (check_PROGRAMS): Add protected_2.
10203         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
10204         (protected_2_LDFLAGS, protected_2_LDADD): Define.
10205         * testsuite/Makefile.in: Rebuild.
10206
10207         * options.h (DEFINE_var): Add set_user_set_##varname__.
10208         (DEFINE_bool_alias): New macro.
10209         (class General_options): Define -Bstatic using DEFINE_bool_alias
10210         rather than DEFINE_special.  Add --undefined as an alias for -z
10211         defs.
10212         * options.cc (General_options::parse_Bstatic): Remove.
10213
10214         * options.h (class General_options): Add --fatal-warnings.
10215         * main.cc (main): Implement --fatal-warnings.
10216         * errors.h (Errors::warning_count): New function.
10217
10218         * options.h (class General_options): Add -Bsymbolic-functions.
10219         * symtab.h (Symbol::is_preemptible): Check for
10220         -Bsymbolic-functions.
10221
10222 2008-05-05  Ian Lance Taylor  <iant@google.com>
10223
10224         * options.h (DEFINE_bool): For DASH_Z, create the negative option
10225         as noVARNAME rather than no-VARNAME.
10226         (class General_options): Add option -z combreloc.
10227         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
10228         get_address.
10229         (Output_reloc::sort_before) [SHT_REL]: New function.
10230         (Output_reloc::sort_before) [SHT_RELA]: New function.
10231         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
10232         Sort_relocs_comparison.
10233         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
10234         parameter.  Change all callers.
10235         (Output_data_reloc::Output_data_reloc) [both versions]: Add
10236         sort_relocs parameter.  Change all callers.
10237         * output.cc (Output_reloc::get_address): New function, broken out
10238         of write_rel.
10239         (Output_reloc::write_rel): Call it.
10240         (Output_reloc::compare): New function.
10241         (Output_data_reloc_base::do_write): Optionally sort relocs.
10242
10243         * configure.ac: If targ_extra_obj is set, link it in.
10244         * configure.tgt: Initialize all variables.
10245         (x86_64*): Set targ_extra_obj and targ_extra_size.
10246         * configure: Rebuild.
10247
10248         * object.cc (Sized_relobj::include_section_group): Adjust section
10249         indexes read from group data.  Build vector to pass to
10250         layout_group.
10251         * layout.cc (Layout::layout_group): Add flags and shndxes
10252         parameters.  Remove contents parameter.  Change caller.  Update
10253         explicit instantiations.
10254         * layout.h (class Layout): Update layout_group declaration.
10255         * output.cc (Output_data_group::Output_data_group): Add flags and
10256         input_shndxes parameters.  Remove contents parameter.  Change
10257         caller.
10258         (Output_data_group::do_write): Change input_sections_ to
10259         input_shndxes_.
10260         * output.h (class Output_data_group): Update constructor
10261         declaration.  Rename input_sections_ to input_shndxes_.
10262         * testsuite/many_sections_test.cc: Add template.
10263
10264 2008-04-30  Cary Coutant  <ccoutant@google.com>
10265
10266         * target-reloc.h (relocate_section): Fix dead-pointer bug.
10267
10268         * layout.cc (Layout::include_section): Refactored check for debug
10269         info section.
10270         (Layout::add_comdat): Add new parameters.  Change type
10271         of signature parameter.  Add object and shndx to signatures table.
10272         (Layout::find_kept_object): New function.
10273         * layout.h: Include <cstring>.
10274         (Layout::is_debug_info_section): New function.
10275         (Layout::add_comdat): Add new parameters.
10276         (Layout::find_kept_object): New function.
10277         (Layout::Kept_section): New struct.
10278         (Layout::Signatures): Change type of map range.
10279         * object.cc (Relobj::output_section_address): New function.
10280         (Sized_relobj::include_section_group): Add new parameters.  Change
10281         calls to Layout::add_comdat.  Change to build table of kept comdat
10282         groups and table mapping discarded sections to kept sections.
10283         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
10284         (Sized_relobj::do_layout): Change calls to include_section_group and
10285         include_linkonce_section.
10286         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
10287         value to zero when section is discarded.
10288         (Sized_relobj::map_to_kept_section): New function.
10289         * object.h (Relobj::output_section_address): New function.
10290         (Relobj::Comdat_group): New type.
10291         (Relobj::find_comdat_group): New function.
10292         (Relobj::Comdat_group_table): New type.
10293         (Relobj::Kept_comdat_section): New type.
10294         (Relobj::Kept_comdat_section_table): New type.
10295         (Relobj::add_comdat_group): New function.
10296         (Relobj::set_kept_comdat_section): New function.
10297         (Relobj::get_kept_comdat_section): New function.
10298         (Relobj::comdat_groups_): New field.
10299         (Relobj::kept_comdat_sections_): New field.
10300         (Symbol_value::input_value): Update comment.
10301         (Sized_relobj::map_to_kept_section) New function.
10302         (Sized_relobj::include_linkonce_section): Add new parameter.
10303         * target-reloc.h (Comdat_behavior): New type.
10304         (get_comdat_behavior): New function.
10305         (relocate_section): Add code to map a discarded section to the
10306         corresponding kept section when applying a relocation.
10307
10308 2008-04-30  Craig Silverstein  <csilvers@google.com>
10309
10310         * dwarf_reader.cc (next_generation_count): New static var.
10311         (Addr2line_cache_entry): New struct.
10312         (addr2line_cache): New static var.
10313         (Dwarf_line_info::one_addr2line): Added caching.
10314         (Dwarf_line_info::clear_addr2line_cache): New function.
10315         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
10316         cache-size parameter.
10317         (Dwarf_line_info::one_addr2line_cache): New function.
10318         * symtab.cc (Symbol_table::detect_odr_violations): Pass
10319         new cache-size argument to one_addr2line(), and clear cache.
10320
10321 2008-04-28  Cary Coutant  <ccoutant@google.com>
10322
10323         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
10324         R_386_PC8 relocations.
10325
10326 2008-04-23  Ian Lance Taylor  <iant@google.com>
10327
10328         * object.cc (Sized_relobj::include_section_group): Check for
10329         invalid section group.
10330
10331         * object.cc (make_elf_object): Correct test for 64-bit ELF file
10332         header size.
10333
10334         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
10335         than read for file header.
10336         * archive.cc (Archive::include_member): Likewise.
10337
10338 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
10339
10340         * aclocal.m4: Regenerate.
10341         * configure: Regenerate.
10342
10343 2008-04-19  Ian Lance Taylor  <iant@google.com>
10344
10345         * version.cc (version_string): Bump to 1.6.
10346
10347         * testsuite/Makefile.am (many_sections_r_test): New target.
10348         (many_sections_r_test_SOURCES): Remove.
10349         (many_sections_r_test_DEPENDENCIES): Remove.
10350         (many_sections_r_test_LDFLAGS): Remove.
10351         (many_sections_r_test_LDADD): Remove.
10352
10353         * object.cc (Sized_relobj::do_add_symbols): Always pass
10354         local_symbol_count_ to add_from_relobj.
10355
10356         * testsuite/Makefile.am (many_sections_check.h): Only check one in
10357         every thousand variables.
10358         * testsuite/Makefile.in: Rebuild.
10359
10360         * object.cc (Xindex::initialize_symtab_xindex): New function.
10361         (Xindex::read_symtab_xindex): New function.
10362         (Xindex::sym_xindex_to_shndx): New function.
10363         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
10364         available.
10365         (Sized_relobj::do_initialize_xindex): New function.
10366         (Sized_relobj::do_read_symbols): Adjust section links.
10367         (Sized_relobj::symbol_section_and_value): Add is_ordinary
10368         parameter.  Change all callers.
10369         (Sized_relobj::include_section_group): Adjust section links and
10370         symbol section indexes.
10371         (Sized_relobj::do_layout): Adjust section links.
10372         (Sized_relobj::do_count_local_symbols): Adjust section links and
10373         symbol section indexes.
10374         (Sized_relobj::do_finalize_local_symbols): Distinguish between
10375         ordinary and special symbols.
10376         (Sized_relobj::write_local_symbols): Add symtab_xindex and
10377         dynsym_xindex parameters.  Change all callers.  Adjust section
10378         links.  Use SHN_XINDEX when needed.
10379         (Sized_relobj::get_symbol_location_info): Adjust section links.
10380         Don't get fooled by special symbols.
10381         * object.h (class Xindex): Define.
10382         (class Object): Add xindex_ parameter.  Declare virtual functoin
10383         do_initialize_xindex.
10384         (Object::adjust_sym_shndx): New function.
10385         (Object::set_xindex): New protected function.
10386         (class Symbol_value): Add is_ordinary_shndx_ field.
10387         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
10388         (Symbol_value::value): Assert ordinary section.
10389         (Symbol_value::initialize_input_to_output_map): Likewise.
10390         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
10391         Change all callers.
10392         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
10393         all callers.
10394         (class Sized_relobj): Update declarations.
10395         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
10396         parameter.  Change all callers.
10397         (Sized_relobj::adjust_shndx): New function.
10398         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
10399         field.
10400         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
10401         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
10402         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
10403         (Sized_dynobj::read_dynsym_section): Adjust section links.
10404         (Sized_dynobj::read_dynamic): Likewise.
10405         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
10406         section links.
10407         (Sized_dynobj::do_initialize_xindex): New function.
10408         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
10409         do_initialize_xindex.
10410         (Sized_dynobj::adjust_shndx): New function.
10411         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
10412         dynsym_xindex_ fields.
10413         (Layout::finalize): Add a call to set_section_indexes before
10414         creating the symtab sections.
10415         (Layout::set_section_indexes): Don't do anything if the section
10416         already has a section index.
10417         (Layout::create_symtab_sections): Add shnum parameter.  Change
10418         caller.  Create .symtab_shndx section if needed.
10419         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
10420         caller.
10421         (Layout::allocated_output_section_count): New function.
10422         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
10423         needed.
10424         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
10425         fields.  Update declarations.
10426         (Layout::symtab_xindex): New function.
10427         (Layout::dynsym_xindex): New function.
10428         (class Write_symbols_task): Add layout_ field.
10429         (Write_symbols_task::Write_symbols_task): Add layout parameter.
10430         Change caller.
10431         * output.cc (Output_section_headers::Output_section_headers): Add
10432         shstrtab_section parameter.  Change all callers.
10433         (Output_section_headers::do_sized_write): Store overflow values
10434         for section count and section string table section index in
10435         section header zero.
10436         (Output_file_header::do_sized_write): Check for overflow of
10437         section count and section string table section index.
10438         (Output_symtab_xindex::do_write): New function.
10439         (Output_symtab_xindex::endian_do_write): New function.
10440         * output.h (class Output_section_headers): Add shstrtab_section_.
10441         Update declarations.
10442         (class Output_symtab_xindex): Define.
10443         (Output_section::has_out_shndx): New function.
10444         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
10445         field.
10446         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
10447         Change all callers.
10448         (Sized_symbol::init): Likewise.
10449         (Symbol::output_section): Check for ordinary symbol.
10450         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
10451         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
10452         callers.
10453         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
10454         Change all callers.  Simplify handling of symbols from sections
10455         not included in the link.
10456         (Symbol_table::add_from_dynobj): Handle ordinary symbol
10457         distinction.
10458         (Weak_alias_sorter::operator()): Assert that symbols are
10459         ordinary.
10460         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
10461         distinction.
10462         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
10463         parameters.  Change all callers.
10464         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
10465         symbol distinction.  Use SHN_XINDEX when needed.
10466         (Symbol_table::write_section_symbol): Add symtab_xindex
10467         parameter.  Change all callers.
10468         (Symbol_table::sized_write_section_symbol): Likewise.  Use
10469         SHN_XINDEX when needed.
10470         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
10471         declarations.
10472         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
10473         (Symbol::is_defined): Check is_ordinary.
10474         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
10475         (Symbol::is_absolute, Symbol::is_common): Likewise.
10476         (class Sized_symbol): Update declarations.
10477         (class Symbol_table): Update declarations.
10478         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
10479         parameters.  Change all callers.
10480         (Sized_symbol::override): Likewise.
10481         (Symbol_table::override): Likewise.
10482         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
10483         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
10484         is_ordinary, and orig_st_shndx parameters.  Change all callers.
10485         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
10486         to be in an ordinary section.
10487         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
10488         object and is_ordinary parameters.  Change all callers.
10489         (Sized_dwarf_line_info::read_relocs): Add object parameter.
10490         Change all callers.  Don't add undefined or non-ordinary symbols
10491         to reloc_map_.
10492         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
10493         Change all callers.
10494         * dwarf_reader.h (class Sized_dwarf_line_info): Update
10495         declarations.
10496         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
10497         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
10498         (Sized_relobj::relocate_sections): Likewise.
10499         * target-reloc.h (scan_relocs): Adjust section symbol index.
10500         (scan_relocatable_relocs): Likewise.
10501         * i386.cc (Scan::local): Check for ordinary symbols.
10502         * sparc.cc (Scan::local): Likewise.
10503         * x86_64.cc (Scan::local): Likewise.
10504         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
10505         to symbol_section_and_value.
10506         * testsuite/many_sections_test.cc: New file.
10507         * testsuite/Makefile.am (BUILT_SOURCES): Define.
10508         (check_PROGRAMS): Add many_sections_test.
10509         (many_sections_test_SOURCES): Define.
10510         (many_sections_test_DEPENDENCIES): Define.
10511         (many_sections_test_LDFLAGS): Define.
10512         (BUILT_SOURCES): Add many_sections_define.h.
10513         (many_sections_define.h): New target.
10514         (BUILT_SOURCES): Add many_sections_check.h.
10515         (many_sections_check.h): New target.
10516         (check_PROGRAMS): Add many_sections_r_test.
10517         (many_sections_r_test_SOURCES): Define.
10518         (many_sections_r_test_DEPENDENCIES): Define.
10519         (many_sections_r_test_LDFLAGS): Define.
10520         (many_sections_r_test_LDADD): Define.
10521         (many_sections_r_test.o): New target.
10522         * testsuite/Makefile.in: Rebuild.
10523
10524 2008-04-17  Cary Coutant  <ccoutant@google.com>
10525
10526         * errors.cc (Errors::info): New function.
10527         (gold_info): New function.
10528         * errors.h (Errors::info): New function.
10529         * gold.h (gold_info): New function.
10530         * object.cc (Input_objects::add_object): Print trace output.
10531         * options.cc (options::parse_set): New function.
10532         (General_options::parse_wrap): Deleted.
10533         (General_options::General_options): Deleted initializer.
10534         * options.h (options::String_set): New typedef.
10535         (options::parse_set): New function.
10536         (DEFINE_set): New macro.
10537         (General_options::wrap): Changed to use DEFINE_set. Changed
10538         callers of any_wrap_symbols and is_wrap_symbol.
10539         (General_options::trace, General_options::trace_symbol):
10540         New options.
10541         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
10542         (General_options::wrap_symbols_): Deleted.
10543         * symtab.cc (Symbol_table::add_from_object): Print trace output.
10544
10545 2008-04-17  David S. Miller  <davem@davemloft.net>
10546
10547         * options.cc (General_options::parse_V): New function.
10548         * options.h: Add entries for -V and -Qy.
10549
10550 2008-04-17  Ian Lance Taylor  <iant@google.com>
10551
10552         * common.cc (Symbol_table::allocate_commons): Remove options
10553         parameter.  Change caller.
10554         (Symbol_table::do_allocate_commons): Remove options parameter.
10555         Change caller.  Just call do_allocate_commons_list twice.
10556         (Symbol_table::do_allocate_commons_list): New function, broken out
10557         of do_allocate_commons.
10558         * common.h (class Allocate_commons_task): Remove options_ field.
10559         Update constructor.
10560         * symtab.cc (Symbol_table::Symbol_table): Initialize
10561         tls_commons_.
10562         (Symbol_table::add_from_object): Put TLS common symbols on
10563         tls_commons_ list.
10564         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
10565         which are IN_OUTPUT_DATA.
10566         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
10567         allocate_commons and do_allocate_commons declarations.  Declare
10568         do_allocate_commons_list.
10569         * gold.cc (queue_middle_tasks): Update creation of
10570         Allocate_commons_task to not pass options.
10571         * testsuite/Makefile.am (INCLUDES): Add -I.. .
10572         (TLS_TEST_C_FLAGS): New variable.
10573         (tls_test_c_pic.o): New target.
10574         (tls_test_shared.so): Link in tls_test_c_pic.o.
10575         (tls_test_c_pic_ie.o): New target.
10576         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
10577         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
10578         (tls_test_c.o): New target.
10579         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
10580         (tls_pic_test_LDADD): Likewise.
10581         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
10582         (tls_shared_gd_to_ie_test_LDADD): Likewise.
10583         (tls_test_c_gnu2.o): New target.
10584         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
10585         tls_test_c_gnu2.o.
10586         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
10587         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
10588         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
10589         * testsuite/tls_test.cc: Include "config.h".
10590         (t_last): Call t11_last.
10591         * testsuite/tls_test.h (t11, t11_last): Declare.
10592         * testsuite/tls_test_c.c: New file.
10593         * testsuite/tls_test_main.cc (thread_routine): Call t11.
10594         * configure.ac: Check for OpenMP support.
10595         * configure, config.in, Makefile.in: Rebuild.
10596         * testsuite/Makefile.in: Rebuild.
10597
10598 2008-04-16  Cary Coutant  <ccoutant@google.com>
10599
10600         * i386.cc (Target_i386::define_tls_base_symbol): New function.
10601         (Target_i386::tls_base_symbol_defined_): New field.
10602         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10603         (Target_i386::Scan::global): Likewise.
10604         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
10605         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
10606         (Target_x86_64::tls_base_symbol_defined_): New field.
10607         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10608         (Target_x86_64::Scan::global): Likewise.
10609
10610 2008-04-16  Cary Coutant  <ccoutant@google.com>
10611
10612         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
10613         (Symbol::needs_plt_entry): Allow weak undefined symbols.
10614         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
10615         building shared libraries.
10616         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
10617         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
10618         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
10619         * testsuite/Makefile.in: Rebuild.
10620         * testsuite/weak_undef.h: New file.
10621         * testsuite/weak_undef_file1.cc: Add extra test cases.
10622         * testsuite/weak_undef_file2.cc: Likewise.
10623         * testsuite/weak_undef_test.cc: Likewise.
10624
10625 2008-04-16  David S. Miller  <davem@davemloft.net>
10626
10627         * sparc.cc (Target_sparc::Scan): Change from struct to class.
10628         Add issued_non_pic_error_ field.  Declare check_non_pic.
10629         (Target_sparc::Scan::check_non_pic): New function.
10630         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
10631         (Target_sparc::Scan::global): Likewise.
10632
10633         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
10634         * configure: Rebuild.
10635
10636         * options.h (DEFINE_enable): New macro.
10637         (new_dtags): New enable option.
10638         (initfirst, interpose, loadfltr, nodefaultlib,
10639         nodelete, nodlopen, nodump): New -z options.
10640         * layout.cc (Layout:finish_dynamic_section): If new
10641         dtags enabled, emit DT_RUNPATH.  Also, emit a
10642         DT_FLAGS_1 containing any specified -z flags.
10643
10644 2008-04-16  Ian Lance Taylor  <iant@google.com>
10645
10646         * copy-relocs.cc: New file.
10647         * copy-relocs.h: New file.
10648         * reloc.cc: Remove Copy_relocs code.
10649         * reloc.h: Likewise.
10650         * reloc-types.h (struct Reloc_types) [both versions]: Add
10651         get_reloc_addend_noerror.
10652         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
10653         variants of add_global which take an addend which must be zero.
10654         * i386.cc: Include "copy-relocs.h".
10655         (class Target_i386): Change type of copy_relocs_ to variable,
10656         update initializer.
10657         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
10658         Change all callers.
10659         (Target_i386::do_finalize_sections): Change handling of
10660         copy_relocs_.
10661         * sparc.cc: Include "copy-relocs.h".
10662         (class Target_sparc): Change type of copy_relocs_ to variable,
10663         update initializer.
10664         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
10665         Change all callers.
10666         (Target_sparc::do_finalize_sections): Change handling of
10667         copy_relocs_.
10668         * x86_64.cc: Include "copy-relocs.h".
10669         (class Target_x86_64): Change type of copy_relocs_ to variable,
10670         update initializer.
10671         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
10672         class.  Change all callers.
10673         (Target_x86_64::do_finalize_sections): Change handling of
10674         copy_relocs_.
10675         * Makefile.am (CCFILES): Add copy-relocs.cc.
10676         (HFILES): Add copy-relocs.h.
10677
10678         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
10679
10680         * testsuite/script_test_4.sh: Permit leading zeroes.
10681
10682 2008-04-15  Ian Lance Taylor  <iant@google.com>
10683
10684         * script-sections.cc (Script_sections::create_segments): Use
10685         header_size_adjustment even when there is enough room for the
10686         headers.
10687         * testsuite/script_test_4.sh: New file.
10688         * testsuite/script_test_4.t: New file.
10689         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
10690         (check_DATA): Add script_test_4.stdout.
10691         (MOSTLYCLEANFILES): Likewise.
10692         (script_test_4): New target.
10693         (script_test_4.stdout): New target.
10694         * testsuite/Makefile.in: Rebuild.
10695
10696         * sparc.cc: Add definitions for Output_data_plt_sparc class
10697         constants.
10698
10699 2008-04-14  David S. Miller  <davem@davemloft.net>
10700
10701         * sparc.cc: New file.
10702         * Makefile.am (TARGETSOURCES): Add sparc.cc
10703         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
10704         * configure.tgt: Document targ_extra_size and
10705         targ_extra_big_endian.  Add entries for sparc-* and
10706         sparc64-*.
10707         * configure.ac: Handle targ_extra_size and
10708         targ_extra_big_endian.
10709         * Makefile.in: Rebuild.
10710         * configure: Likewise.
10711         * po/POTFILES.in: Likewise.
10712         * po/gold.pot: Likewise.
10713
10714 2008-04-14  Ian Lance Taylor  <iant@google.com>
10715
10716         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
10717         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
10718         in the name/type/flags to section mapping.  Don't call
10719         allocate_output_section.
10720         (Layout::choose_output_section): Change parameter from adjust_name
10721         to is_input_section.  Don't permit input sections after sections
10722         are attached to segments.  Don't call allocate_output_section.
10723         (Layout::layout_eh_frame): Call update_flags_for_input_section,
10724         not write_enable_output_section.
10725         (Layout::make_output_section): Don't push to
10726         unattached_section_list_ nor call attach_to_segment.  Call
10727         attach_section_to_segment if sections are attached.
10728         (Layout::attach_sections_to_segments): New function.
10729         (Layout::attach_section_to_segment): New function.
10730         (Layout::attach_allocated_section_to_segment): Rename from
10731         attach_to_segment.  Remove flags parameter.
10732         (Layout::allocate_output_section): Remove function.
10733         (Layout::write_enable_output_section): Remove function.
10734         * layout.h (class Layout): Update for above changes.  Add new
10735         field sections_are_attached_.
10736         * output.h (Output_section::update_flags_for_input_section): New
10737         function.
10738         * output.cc (Output_section::add_input_section): Call
10739         update_flags_for_input_section.
10740         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
10741
10742 2008-04-11  Cary Coutant  <ccoutant@google.com>
10743
10744         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
10745         thought unnecessary.
10746         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
10747
10748 2008-04-11  Ian Lance Taylor  <iant@google.com>
10749
10750         * output.h (class Output_section_data): Remove inline definition
10751         of set_addralign.
10752         * output.cc (Output_section_data::set_addralign): New function.
10753
10754 2008-04-11  Cary Coutant  <ccoutant@google.com>
10755
10756         Add support for TLS descriptors for i386 and x86_64.
10757         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
10758         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
10759         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
10760         GOT_TYPE_TLS_DESC.
10761         (Target_i386::got_mod_index_entry): Remove unnecessary code.
10762         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
10763         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
10764         relocations.
10765         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
10766         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
10767         Fix problem with initial-exec relocations.
10768         (Target_i386::Relocate::relocate_tls): Likewise.
10769         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
10770         relaxation.
10771         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
10772         support for section-plus-offset dynamic table entries.
10773         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
10774         (Output_data_dynamic::Dynamic_entry): Add support for
10775         section-plus-offset dynamic table entries.
10776         (Output_data_dynamic::Classification): Likewise.
10777         (Output_data_dynamic::classification_): Renamed offset_.
10778         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
10779         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
10780         (Target_x86_64::make_plt_section): New function.
10781         (Target_x86_64::reserve_tlsdesc_entries): New function.
10782         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
10783         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
10784         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
10785         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
10786         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
10787         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
10788         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
10789         add extra PLT entry for TLS descriptors.
10790         (Output_data_plt_x86_64::got_): New field.
10791         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
10792         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
10793         fields.
10794         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
10795         descriptors.
10796         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
10797         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
10798         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
10799         R_386_TLS_DESC_CALL relocations.
10800         (Target_x86_64::Scan::global): Likewise.
10801         (Target_x86_64::do_finalize_sections): Add dynamic table entries
10802         for TLS descriptors.
10803         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
10804         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
10805         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
10806         GD-to-IE relaxation.
10807         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
10808         and TLS_DESCRIPTORS.
10809         * Makefile.in: Rebuild.
10810         * configure: Rebuild.
10811         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
10812         (tls_test_shared2.so): New target.
10813         (tls_shared_gd_to_ie_test_SOURCES): New variable.
10814         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
10815         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
10816         (tls_shared_gd_to_ie_test_LDADD): New variable.
10817         (tls_shared_gnu2_gd_to_ie_test): New target.
10818         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
10819         New targets.
10820         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
10821         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
10822         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
10823         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
10824         (tls_shared_gnu2_test): New target.
10825         (tls_test_gnu2_shared.so): New target.
10826         (tls_shared_gnu2_test_SOURCES): New variable.
10827         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
10828         (tls_shared_gnu2_test_LDFLAGS): New variable.
10829         (tls_shared_gnu2_test_LDADD): New variable.
10830         * testsuite/Makefile.in: Rebuild.
10831         * testsuite/Makefile.
10832
10833 2008-04-11  Ian Lance Taylor  <iant@google.com>
10834
10835         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
10836         justsyms.t.
10837         * testsuite/Makefile.in: Rebuild.
10838
10839         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
10840         long.
10841         * testsuite/script_test_2.cc (main): Adjust test.
10842
10843 2008-04-11  David S. Miller  <davem@davemloft.net>
10844             Ian Lance Taylor  <iant@google.com>
10845
10846         * options.h (General_options): Add entries for '-Y' and
10847         '-relax'.
10848         * options.cc (General_options:finalize): If -Y was used, add those
10849         entries to the library path instead of the default "/lib" and
10850         "/usr/lib".
10851
10852 2008-04-11  David S. Miller  <davem@davemloft.net>
10853
10854         * testsuite/justsyms.t: Start at 0x100.
10855         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
10856         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
10857         long.
10858         * testsuite/script_test_2.cc: Adjust string and section length
10859         checks.
10860
10861 2008-04-09  Ian Lance Taylor  <iant@google.com>
10862
10863         PR gold/5996
10864         * script-sections.cc (Sections_element::allocate_to_segment): Add
10865         orphan parameter.
10866         (Output_section_definition::allocate_to_segment): Likewise.
10867         (Orphan_output_section::allocate_to_segment): Likewise.
10868         (Script_sections::attach_sections_using_phdrs_clause): Don't
10869         propagate non-PT_LOAD segments to orphan sections.
10870         * testsuite/Makefile.am (script_test_3.stdout): Generate using
10871         readelf rather than objdump.
10872         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
10873         .interp section and PT_INTERP segment are the same size.
10874         * testsuite/Makefile.in: Rebuild.
10875
10876         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
10877         aliases for symbols defined in the same object.
10878         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
10879         (weak_alias_test_SOURCES): New variable.
10880         (weak_alias_test_DEPENDENCIES): New variable.
10881         (weak_alias_test_LDFLAGS): New variable.
10882         (weak_alias_test_LDADD): New variable.
10883         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
10884         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
10885         (weak_alias_test_3.o): New target.
10886         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
10887         * testsuite/weak_alias_test_main.cc: New file.
10888         * testsuite/weak_alias_test_1.cc: New file.
10889         * testsuite/weak_alias_test_2.cc: New file.
10890         * testsuite/weak_alias_test_3.cc: New file.
10891
10892 2008-04-08  Ian Lance Taylor  <iant@google.com>
10893
10894         * options.h (class General_options): Add --noinhibit-exec option.
10895         * main.cc (main): Check --noinhibit-exec.
10896
10897         * options.h (class General_options): Define --wrap as a special
10898         option.  Add wrap_symbols_ field.
10899         (General_options::any_wrap_symbols): New function.
10900         (General_options::is_wrap_symbol): New function.
10901         * options.cc (General_options::parse_wrap): New function.
10902         (General_options::General_options): Initialize wrap_symbols_.
10903         * symtab.cc (Symbol_table::wrap_symbol): New function.
10904         (Symbol_table::add_from_object): Handle --wrap.
10905         * symtab.h (class Symbol_table): Declare wrap_symbol.
10906         * target.h (Target::wrap_char): New function.
10907         (Target::Target_info): Add wrap_char field.
10908         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
10909         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10910         * testsuite/testfile.cc (Target_test::test_target_info):
10911         Likewise.
10912
10913         * errors.cc (Errors::undefined_symbol): Mention symbol version if
10914         there is one.
10915
10916         * layout.h (class Layout): Add added_eh_frame_data_ field.
10917         * layout.cc (Layout::Layout): Initialize new field.
10918         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
10919         output section until we find a section we merged successfully.
10920         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
10921         that the size be non-zero.
10922
10923         * merge.cc (Object_merge_map::get_output_offset): Remove inline
10924         qualifier.
10925
10926 2008-04-08  Craig Silverstein  <csilvers@google.com>
10927
10928         * configure.ac: Export new conditional variable HAVE_ZLIB.
10929         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
10930         on HAVE_ZLIB.
10931         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
10932         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10933
10934 2008-04-07  Ian Lance Taylor  <iant@google.com>
10935
10936         * version.cc (version_string): Set to "1.5".
10937
10938         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
10939         Add issued_non_pic_error_ field.  Declare check_non_pic.
10940         (Target_x86_64::Scan::check_non_pic): New function.
10941         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
10942         (Target_x86_64::Scan::global): Likewise.
10943
10944         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
10945         addend parameter.  Change caller.  Handle merge sections.
10946         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
10947         Address to Addend.  Don't add in the result of
10948         local_section_offset, pass down the addend and use the returned
10949         value.
10950         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
10951         Update declarations of local_section_offset and symbol_value.
10952         * testsuite/two_file_test_1.cc (t18): New function.
10953         * testsuite/two_file_test_2.cc (f18): New function.
10954         * testsuite/two_file_test_main.cc (main): Call t18.
10955         * testsuite/two_file_test.h (t18, f18): Declare.
10956
10957         * configure.ac: Don't test for objdump, c++filt, or readelf.
10958         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
10959         conditionals.
10960         (TEST_READELF): New variable.
10961         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
10962         (check_PROGRAMS): Add two_file_strip_test.
10963         (two_file_strip_test): New target.
10964         (check_PROGRAMS): Add two_file_same_shared_strip_test.
10965         (two_file_same_shared_strip_test_SOURCES): New variable.
10966         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
10967         (two_file_same_shared_strip_test_LDFLAGS): New variable.
10968         (two_file_same_shared_strip_test_LDADD): New variable.
10969         (two_file_shared_strip.so): New target.
10970         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
10971         (ver_test_5.syms, ver_test_7.syms): Likewise.
10972         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
10973         (strip_test_3.stdout): Use TEST_OBJDUMP.
10974         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10975
10976 2008-04-04  Cary Coutant  <ccoutant@google.com>
10977
10978         * symtab.h (Symbol::is_weak_undefined): New function.
10979         (Symbol::is_strong_undefined): New function.
10980         (Symbol::is_absolute): New function.
10981         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
10982         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
10983         absolute symbols.
10984         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
10985         (weak_undef_test): New target.
10986         * testsuite/Makefile.in: Rebuild.
10987         * testsuite/weak_undef_file1.cc: New file.
10988         * testsuite/weak_undef_file2.cc: New file.
10989         * testsuite/weak_undef_test.cc: New file.
10990
10991 2008-04-03  Craig Silverstein  <csilvers@google.com>
10992
10993         * compressed_output.h (class Output_compressed_section): Use
10994         unsigned buffer.
10995         * compressed_output.cc (zlib_compress): Use unsigned buffers,
10996         add zlib header.
10997         (zlib_compressed_suffix): Removed.
10998         (Output_compressed_section::set_final_data_size): Use unsigned
10999         buffers.
11000         * testsuite/Makefile.am (flagstest_compress_debug_sections):
11001         Fix linker invocation.
11002         (flagstest_o_specialfile_and_compress_debug_sections):
11003         Likewise.
11004         * testsuite/Makefile.in: Regenerated.
11005
11006 2008-04-02  David S. Miller  <davem@davemloft.net>
11007
11008         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
11009         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
11010
11011 2008-04-02  Craig Silverstein  <csilvers@google.com>
11012
11013         * TODO: New file.
11014
11015 2008-04-02  Ian Lance Taylor  <iant@google.com>
11016
11017         * fileread.cc (File_read::find_view): Add byteshift and vshifted
11018         parameters.  Update for new key type to views_.  Change all
11019         callers.
11020         (File_read::read): Adjust for byteshift in returned view.
11021         (File_read::add_view): New function, broken out of
11022         find_and_make_view.
11023         (File_read::make_view): New function, broken out of
11024         find_and_make_view.
11025         (File_read::find_or_make_view): Add offset and aligned
11026         parameters.  Rewrite accordingly.  Change all callers.
11027         (File_read::get_view): Add offset and aligned parameters.  Adjust
11028         for byteshift in return value.
11029         (File_read::get_lasting_view): Likewise.
11030         * fileread.h (class File_read): Update declarations.
11031         (class File_read::View): Add byteshift_ field.  Add byteshift to
11032         constructor.  Add byteshift method.
11033         * archive.h (Archive::clear_uncached_views): New function.
11034         (Archive::get_view): Add aligned parameter.  Change all callers.
11035         * object.h (Object::get_view): Add aligned parameter.  Change all
11036         callers.
11037         (Object::get_lasting_view): Likewise.
11038
11039         * fileread.cc (File_read::release): Don't call clear_views if
11040         there are multiple objects.
11041         * fileread.h (File_read::clear_uncached_views): New function.
11042         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
11043         on the archive.
11044
11045 2008-03-31  Cary Coutant  <ccoutant@google.com>
11046
11047         Add thin archive support.
11048         * archive.cc (Archive::armagt): New const.
11049         (Archive::setup): Remove task parameter and calls to unlock.
11050         (Archive::unlock_nested_archives): New function.
11051         (Archive::read_header): Add nested_off parameter. Change
11052         all callers.
11053         (Archive::interpret_header): Likewise.
11054         (Archive::include_all_members): Change to handle thin
11055         archives.
11056         (Archive::include_member): Likewise.
11057         * archive.h (Archive::Archive): Add new parameters and
11058         initializers.
11059         (Archive::armagt): New const.
11060         (Archive::setup): Remove task parameter.
11061         (Archive::unlock_nested_archives): New function.
11062         (Archive::read_header): Add nested_off parameter.
11063         (Archive::interpret_header): Likewise.
11064         (Archive::Nested_archive_table): New typedef.
11065         (Archive::is_thin_archive_): New field.
11066         (Archive::nested_archives_): New field.
11067         (Archive::options_): New field.
11068         (Archive::dirpath_): New field.
11069         (Archive::task_): New field.
11070         * readsyms.cc (Read_symbols::do_read_symbols): Add check
11071         for thin archives.  Pass additional parameters to
11072         Archive::Archive.  Unlock the archive file after calling
11073         Archive::setup.
11074
11075 2008-03-29  Ian Lance Taylor  <iant@google.com>
11076
11077         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
11078         version symbol to be local.
11079         * testsuite/ver_test_4.sh: New file.
11080         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
11081         (check_DATA): Add ver_test_4.syms.
11082         (ver_test_4.syms): New target.
11083         * testsuite/Makefile.in: Rebuild.
11084
11085         * output.cc
11086         (Output_section::Input_section_sort_entry::has_priority): New
11087         function.
11088         (Output_section::Input_section_sort_entry::match_file_name): New
11089         function.
11090         (Output_section::Input_section_sort_entry::match_section_name):
11091         Remove.
11092         (Output_section::Input_section_sort_entry::match_section_name_prefix):
11093         Remove.
11094         (Output_section::Input_section_sort_entry::match_section_file):
11095         Remove.
11096         (Output_section::Input_section_sort_compare::operator()): Rewrite
11097         using new Input_section_sort_entry functions.  Sort crtbegin and
11098         crtend first.  Sort sections with no priority before sections with
11099         a priority.
11100         * testsuite/initpri1.c (d3): Check j != 4.
11101         (cd5): New constructor/destructor function.
11102         (main): Check j != 2.
11103
11104         * symtab.cc (Symbol_table::add_from_object): If we don't use the
11105         new symbol when resolving, don't call set_is_default.
11106         * testsuite/ver_test_7.cc: New file.
11107         * testsuite/ver_test_7.sh: New file.
11108         * testsuite/Makefile.am (ver_test_7.so): New target.
11109         (ver_test_7.o): New target.
11110         (check_SCRIPTS): Add ver_test_7.sh.
11111         (check_DATA): Add ver_test_7.syms.
11112         (ver_test_7.syms): New target.
11113
11114 2008-03-28  Ian Lance Taylor  <iant@google.com>
11115
11116         * layout.cc (Layout::layout): If we see an input section with a
11117         name that needs sorting, set the must_sort flag for the output
11118         section.
11119         (Layout::make_output_section): If the name of the output section
11120         indicates that it might require sorting, set the may_sort flag.
11121         * output.h (Output_section::may_sort_attached_input_sections): New
11122         function.
11123         (Output_section::set_may_sort_attached_input_sections): New
11124         function.
11125         (Output_section::must_sort_attached_input_sections): New
11126         function.
11127         (Output_section::set_must_sort_attached_input_sections): New
11128         function.
11129         (class Output_section): Declare Input_section_sort_entry.  Define
11130         Input_section_sort_compare.  Declare
11131         sort_attached_input_sections.  Add new fields:
11132         may_sort_attached_input_sections_,
11133         must_sort_attached_input_sections_,
11134         attached_input_sections_are_sorted_.
11135         * output.cc (Output_section::Output_section): Initialize new
11136         fields.
11137         (Output_section::add_input_section): Add an entry to
11138         input_sections_ if may_sort or must_sort are true.
11139         (Output_section::set_final_data_size): Call
11140         sort_attached_input_sections if necessary.
11141         (Output_section::Input_section_sort_entry): Define new class.
11142         (Output_section::Input_section_sort_compare::operator()): New
11143         function.
11144         (Output_section::sort_attached_input_sections): New function.
11145         * configure.ac: Check whether the compiler supports constructor
11146         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
11147         * testsuite/initpri1.c: New file.
11148         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
11149         CONSTRUCTOR_PRIORITY.
11150         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
11151         (initpri1_LDFLAGS): New variable.
11152         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11153
11154 2008-03-27  Ian Lance Taylor  <iant@google.com>
11155
11156         * common.cc (Sort_commons::operator): Correct sorting algorithm.
11157         * testsuite/common_test_1.c: New file.
11158         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
11159         (common_test_1_SOURCES): New variable.
11160         (common_test_1_DEPENDENCIES): New variable.
11161         (common_test_1_LDFLAGS): New variable.
11162
11163         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
11164         and commons_ correctly when NAME/VERSION does not override
11165         NAME/NULL.
11166         * testsuite/ver_test_6.c: New file.
11167         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
11168         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
11169         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
11170
11171 2008-03-26  Ian Lance Taylor  <iant@google.com>
11172
11173         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
11174         of an undefined symbol from a version script.
11175         * testsuite/Makefile.am (ver_test_5.so): New target.
11176         (ver_test_5.o): New target.
11177         (check_SCRIPTS): Add ver_test_5.sh.
11178         (check_DATA): Add ver_test_5.syms.
11179         (ver_test_5.syms): New target.
11180         * testsuite/ver_test_5.cc: New file.
11181         * testsuite/ver_test_5.script: New file.
11182         * testsuite/ver_test_5.sh: New file.
11183         * Makefile.in, testsuite/Makefile.in: Rebuild.
11184
11185         PR gold/5986
11186         Fix problems building gold with gcc 4.3.0.
11187         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
11188         (gold_error_at_location, gold_warning_at_location): Use it.
11189         * configure.ac: Check whether we can compile and use a template
11190         function with a printf attribute.
11191         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
11192         when jumping over bytes.
11193         * object.cc: Instantiate Object::read_section_data.
11194         * debug.h: Include <cstring>
11195         * dwarf_reader.cc: Include <algorithm>
11196         * main.cc: Include <cstring>.
11197         * options.cc: Include <cstring>.
11198         * output.cc: Include <cstring>.
11199         * script.cc: Include <cstring>.
11200         * script.h: Include <string>.
11201         * symtab.cc: Include <cstring> and <algorithm>.
11202         * target-select.cc: Include <cstring>.
11203         * version.cc: Include <string>.
11204         * testsuite/testmain.cc: Include <cstdlib>.
11205         * configure, config.in: Rebuild.
11206
11207 2008-03-25  Ian Lance Taylor  <iant@google.com>
11208
11209         * options.cc: Include "../bfd/bfdver.h".
11210         (options::help): Print bug reporting address.
11211
11212         * version.cc (print_version): Adjust output for current value of
11213         BFD_VERSION_STRING.
11214
11215         * NEWS: New file.
11216
11217         * options.cc (options::help): Print list of supported targets.
11218         * target-select.h: Include <vector>.
11219         (class Target_selector): Make machine_, size_, and is_big_endian_
11220         fields const.  Add bfd_name_ and instantiated_target_ fields.
11221         (Target_selector::Target_selector): Add bfd_name parameter.
11222         (Target_selector::recognize): Make non-virtual, call
11223         do_recognize.
11224         (Target_selector::recognize_by_name): Make non-virtual, call
11225         do_recognize_by_name.
11226         (Target_selector::supported_names): New function.
11227         (Target_selector::bfd_name): New function.
11228         (Target_selector::do_instantiate_target): New pure virtual
11229         function.
11230         (Target_selector::do_recognize): New virtual function.
11231         (Target_selector::do_recognize_by_name): New virtual function.
11232         (Target_selector::instantiate_target): New private function.
11233         (supported_target_names): Declare.
11234         * target-select.cc (Target_selector::Target_selector): Update for
11235         new parameter and fields.
11236         (select_target_by_name): Check that the name matches before
11237         calling recognize_by_name.
11238         (supported_target_names): New function.
11239         * i386.cc (class Target_selector_i386): Update Target_selector
11240         constructor call.  Remove recognize and recognize_by_name.  Add
11241         do_instantiate_target.
11242         * x86_64.cc (class Target_selector_x86_64): Likewise.
11243         * testsuite/testfile.cc (class Target_selector_test): Update for
11244         changes to Target_selector.
11245
11246         * README: Rewrite, with some notes on unsupported features.
11247
11248 2008-03-24  Cary Coutant  <ccoutant@google.com>
11249
11250         * i386.cc (Target_i386::Got_type): New enum declaration.
11251         (Target_i386::Scan::local): Updated callers of Output_data_got
11252         member functions.
11253         (Target_i386::Scan::global): Likewise.
11254         (Target_i386::Relocate::relocate): Likewise.
11255         (Target_i386::Relocate::relocate_tls): Likewise.
11256         * object.h (Got_offset_list): New class.
11257         (Sized_relobj::local_has_got_offset): Added got_type parameter.
11258         (Sized_relobj::local_got_offset): Likewise.
11259         (Sized_relobj::set_local_got_offset): Likewise.
11260         (Sized_relobj::local_has_tls_got_offset): Removed.
11261         (Sized_relobj::local_tls_got_offset): Removed.
11262         (Sized_relobj::set_local_tls_got_offset): Removed.
11263         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
11264         * output.cc (Output_data_got::add_global): Added got_type parameter.
11265         (Output_data_got::add_global_with_rel): Likewise.
11266         (Output_data_got::add_global_with_rela): Likewise.
11267         (Output_data_got::add_global_pair_with_rel): New function.
11268         (Output_data_got::add_global_pair_with_rela): New function.
11269         (Output_data_got::add_local): Added got_type parameter.
11270         (Output_data_got::add_local_with_rel): Likewise.
11271         (Output_data_got::add_local_with_rela): Likewise.
11272         (Output_data_got::add_local_pair_with_rel): New function.
11273         (Output_data_got::add_local_pair_with_rela): New function.
11274         (Output_data_got::add_global_tls): Removed.
11275         (Output_data_got::add_global_tls_with_rel): Removed.
11276         (Output_data_got::add_global_tls_with_rela): Removed.
11277         (Output_data_got::add_local_tls): Removed.
11278         (Output_data_got::add_local_tls_with_rel): Removed.
11279         (Output_data_got::add_local_tls_with_rela): Removed.
11280         * output.h (Output_data_got::add_global): Added got_type parameter.
11281         (Output_data_got::add_global_with_rel): Likewise.
11282         (Output_data_got::add_global_with_rela): Likewise.
11283         (Output_data_got::add_global_pair_with_rel): New function.
11284         (Output_data_got::add_global_pair_with_rela): New function.
11285         (Output_data_got::add_local): Added got_type parameter.
11286         (Output_data_got::add_local_with_rel): Likewise.
11287         (Output_data_got::add_local_with_rela): Likewise.
11288         (Output_data_got::add_local_pair_with_rel): New function.
11289         (Output_data_got::add_local_pair_with_rela): New function.
11290         (Output_data_got::add_global_tls): Removed.
11291         (Output_data_got::add_global_tls_with_rel): Removed.
11292         (Output_data_got::add_global_tls_with_rela): Removed.
11293         (Output_data_got::add_local_tls): Removed.
11294         (Output_data_got::add_local_tls_with_rel): Removed.
11295         (Output_data_got::add_local_tls_with_rela): Removed.
11296         * resolve.cc (Symbol::override_base_with_special): Removed
11297         reference to has_got_offset_ field.
11298         * symtab.cc (Symbol::init_fields): Replaced initialization
11299         of got_offset_ with got_offsets_.  Removed initialization
11300         of has_got_offset_
11301         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
11302         (Symbol::got_offset): Likewise.
11303         (Symbol::set_got_offset): Likewise.
11304         (Symbol::has_tls_got_offset): Removed.
11305         (Symbol::tls_got_offset): Removed.
11306         (Symbol::set_tls_got_offset): Removed.
11307         (Symbol::got_offset_): Removed.
11308         (Symbol::tls_mod_got_offset_): Removed.
11309         (Symbol::tls_pair_got_offset_): Removed.
11310         (Symbol::got_offsets_): New field.
11311         (Symbol::has_got_offset): Removed.
11312         (Symbol::has_tls_mod_got_offset): Removed.
11313         (Symbol::has_tls_pair_got_offset): Removed.
11314         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
11315         (Target_x86_64::Scan::local): Updated callers of Output_data_got
11316         member functions.
11317         (Target_x86_64::Scan::global): Likewise.
11318         (Target_x86_64::Relocate::relocate): Likewise.
11319         (Target_x86_64::Relocate::relocate_tls): Likewise.
11320
11321 2008-03-25  Ben Elliston  <bje@au.ibm.com>
11322
11323         * yyscript.y: Fix spelling error in comment.
11324
11325 2008-03-24  Ian Lance Taylor  <iant@google.com>
11326
11327         * options.h (class General_options): Define build_id option.
11328         * layout.h (class Layout): Declare write_build_id, create_note,
11329         create_build_id.  Add build_id_note_ member.
11330         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
11331         "libiberty.h", "md5.h", "sha1.h".
11332         (Layout::Layout): Initialize eh_frame_data_,
11333         eh_frame_hdr_section_, and build_id_note_.
11334         (Layout::finalize): Call create_build_id.
11335         (Layout::create_note): New function, broken out of
11336         Layout::create_gold_note.
11337         (Layout::create_gold_note): Call create_note.
11338         (Layout::create_build_id): New function.
11339         (Layout::write_build_id): New function.
11340         (Close_task_runner::run): Call write_build_id.
11341
11342         * x86_64.cc: Correct license to GPLv3.
11343
11344 2008-03-23  Ian Lance Taylor  <iant@google.com>
11345
11346         * options.cc: Include "demangle.h".
11347         (parse_optional_string): New function.
11348         (parse_long_option): Handle takes_optional_argument.
11349         (parse_short_option): Update dash_z initializer.  Handle
11350         takes_optional_argument.
11351         (General_options::General_options): Initialize do_demangle_.
11352         (General_options::finalize): Set do_demangle_.  Handle demangling
11353         style.
11354         * options.h (parse_optional_string): Declare.
11355         (struct One_option): Add optional_arg field.  Update constructor.
11356         Update call constructor calls.  Add takes_optional_argument
11357         function.
11358         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
11359         (DEFINE_optional_string): Define.
11360         (General_options::demangle): Change from DEFINE_bool to
11361         DEFINE_optional_string.
11362         (General_options::no_demangle): New function.
11363         (General_options::do_demangle): New function.
11364         (General_options::set_do_demangle): New function.
11365         (General_options::execstack_status_): Move definition to end of
11366         class definition.
11367         (General_options::static_): Likewise.
11368         (General_options::do_demangle_): New field.
11369         * object.cc (big_endian>::get_symbol_location_info): Call
11370         Options::do_demangle, not Options::demangle.
11371         * symtab.cc (demangle): Likewise.
11372
11373 2008-03-22  Ian Lance Taylor  <iant@google.com>
11374
11375         * gold.h: Include <cstddef> and <sys/types.h>
11376         * options.h: Include <cstring>.
11377
11378 2008-03-21  Ian Lance Taylor  <iant@google.com>
11379
11380         * Added source code to GNU binutils.