* archive.cc (Lib_group::add_symbols): Lock object before deleting its
[external/binutils.git] / gold / ChangeLog
1 2010-08-23  Cary Coutant  <ccoutant@google.com>
2
3         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
4         symbols data.
5         (Lib_group::include_member): Unlock object after deleting its
6         symbols data.
7         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
8         the bug fixed here.
9
10 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
11             Cary Coutant  <ccoutant@google.com>
12
13         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
14         constructor, and set_blocker.
15         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
16         readsyms_blocker_.
17         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
18         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
19         * testsuite/Makefile.am (start_lib_test): New test case.
20         * testsuite/Makefile.in: Regenerate.
21         * testsuite/start_lib_test_main.c: New file.
22         * testsuite/start_lib_test_1.c: New file.
23         * testsuite/start_lib_test_2.c: New file.
24         * testsuite/start_lib_test_3.c: New file.
25
26 2010-08-19  Ian Lance Taylor  <iant@google.com>
27
28         * Makefile.in: Rebuild with automake 1.11.1.
29         * aclocal.m4: Likewise.
30         * testsuite/Makefile.in: Likewise.
31
32 2010-08-19  Ian Lance Taylor  <iant@google.com>
33
34         PR 10893
35         * i386.cc (class Output_data_plt_i386): Update declarations.
36         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
37         local_ifuncs_ fields.
38         (Target_i386::do_plt_section_for_global): New function.
39         (Target_i386::do_plt_section_for_local): New function.
40         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
41         parameter; change all callers.  Initialize global_ifuncs_ and
42         local_ifuncs_.  If doing a static link define __rel_iplt_start and
43         __rel_iplt_end.
44         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
45         (Output_data_plt_i386::add_local_ifunc_entry): New function.
46         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
47         symbols.
48         (Target_i386::make_plt_section): New function, broken out of
49         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
50         (Target_i386::make_plt_entry): Call make_plt_section.
51         (Target_i386::make_local_ifunc_plt_entry): New function.
52         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
53         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
54         R_386_IRELATIVE to switch.
55         (Target_i386::Scan::global): Likewise.
56         (Target_i386::Relocate::relocate): Likewise.
57         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
58         switch.
59         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
60         (Target_x86_64::do_plt_section_for_global): New function.
61         (Target_x86_64::do_plt_section_for_local): New function.
62         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
63         parameter; change all callers.  If doing a static link define
64         __rela_iplt_start and __rela_iplt_end.
65         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
66         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
67         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
68         to point to .plt.
69         (Target_x86_64::make_local_ifunc_plt_entry): New function.
70         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
71         switch.
72         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
73         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
74         R_X86_64_IRELATIVE to switch.
75         (Target_x86_64::Scan::global): Likewise.
76         (Target_x86_64::Relocate::relocate): Likewise.
77         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
78         switch.
79         * target.h (class Target): Add plt_section_for_global and
80         plt_section_for_local functions.  Add do_plt_section_for_global
81         and do_plt_section_for_local virtual functions.
82         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
83         clarifying comments.
84         (Symbol::use_plt_offset): Handle IFUNC symbol.
85         * object.cc (Sized_relobj::Sized_relobj): Initialize
86         local_plt_offsets_.
87         (Sized_relobj::local_has_plt_offset): New function.
88         (Sized_relobj::local_plt_offset): New function.
89         (Sized_relobj::set_local_plt_offset): New function.
90         (Sized_relobj::do_count): Handle IFUNC symbol.
91         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
92         a bit away from input_shndx_ field.  Add set_is_func_symbol and
93         is_ifunc_symbol functions.
94         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
95         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
96         local_plt_offsets_ field.
97         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
98         * output.h (class Output_section_data): Add non-const
99         output_section function.
100         (class Output_data_got): Update declarations.
101         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
102         Add use_plt_offset parameter to global and local constructors.
103         Change all callers.  Change local_sym_index_ field to 31 bits.
104         Change GSYM_CODE and CONSTANT_CODE accordingly.
105         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
106         doing a static link don't set sh_link field.
107         (Output_data_got::Got_entry::write): Use PLT offset if
108         appropriate.
109         (Output_data_got::add_global_plt): New function.
110         (Output_data_got::add_local_plt): New function.
111         * target-reloc.h (relocate_section): Handle IFUNC symbol.
112         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
113         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
114         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
115         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
116         IFUNC conditional.
117         * testsuite/ifunc-sel.h: New file.
118         * testsuite/ifuncmain1.c: New file.
119         * testsuite/ifuncmain1vis.c: New file.
120         * testsuite/ifuncmod1.c: New file.
121         * testsuite/ifuncdep2.c: New file.
122         * testsuite/ifuncmain2.c: New file.
123         * testsuite/ifuncmain3.c: New file.
124         * testsuite/ifuncmod3.c: New file.
125         * testsuite/ifuncmain4.c: New file.
126         * testsuite/ifuncmain5.c: New file.
127         * testsuite/ifuncmod5.c: New file.
128         * testsuite/ifuncmain6pie.c: New file.
129         * testsuite/ifuncmod6.c: New file.
130         * testsuite/ifuncmain7.c: New file.
131         * configure, testsuite/Makefile.in: Rebuild.
132
133 2010-08-18  Ian Lance Taylor  <iant@google.com>
134
135         * incremental.cc
136         (Output_section_incremental_inputs::write_input_files): Add cast
137         to avoid signed/unsigned comparison warning.
138         (Output_section_incremental_inputs::write_info_blocks): Likewise.
139
140 2010-08-12  Cary Coutant  <ccoutant@google.com>
141
142         * common.cc (Sort_commons::operator()): Remove unnecessary code.
143
144 2010-08-13  Ian Lance Taylor  <iant@google.com>
145
146         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
147
148 2010-08-12  Cary Coutant  <ccoutant@google.com>
149             Doug Kwan  <dougkwan@google.com>
150
151         * resolve.cc (Symbol_table::should_override): When a weak dynamic
152         defintion overrides non-weak undef, remember that the original undef
153         is not weak.
154         * symtab.cc (Symbol_table::sized_write_global): For undef without
155         an original weak binding, set binding to global in output.
156         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
157         * testsuite/Makefile.in: Regenerate.
158         * testsuite/strong_ref_weak_def.sh: New file.
159         * testsuite/strong_ref_weak_def_1.c: Ditto.
160         * testsuite/strong_ref_weak_def_2.c: Ditto.
161
162 2010-08-12  Cary Coutant  <ccoutant@google.com>
163
164         * testsuite/incremental_test.sh: Rewrite.
165         * testsuite/incremental_test_1.c: Rewrite.
166         * testsuite/incremental_test_2.c: Rewrite.
167
168 2010-08-12  Cary Coutant  <ccoutant@google.com>
169
170         * arm.cc (Target_arm::got_size): Add const.
171         (Target_arm::got_entry_count): New function.
172         (Target_arm::plt_entry_count): New function.
173         (Target_arm::first_plt_entry_offset): New function.
174         (Target_arm::plt_entry_size): New function.
175         (Output_data_plt_arm::entry_count): New function.
176         (Output_data_plt_arm::first_plt_entry_offset): New function.
177         (Output_data_plt_arm::get_plt_entry_size): New function.
178         * i386.cc (Target_i386::got_size): Add const.
179         (Target_i386::got_entry_count): New function.
180         (Target_i386::plt_entry_count): New function.
181         (Target_i386::first_plt_entry_offset): New function.
182         (Target_i386::plt_entry_size): New function.
183         (Output_data_plt_i386::entry_count): New function.
184         (Output_data_plt_i386::first_plt_entry_offset): New function.
185         (Output_data_plt_i386::get_plt_entry_size): New function.
186         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
187         find_incremental_inputs_sections.  Dump incremental_got_plt section.
188         * incremental.cc: Include target.h.
189         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
190         parameter.  Adjust all callers.  Find incremental_got_plt section.
191         (Incremental_inputs::create_data_sections): Create incremental_got_plt
192         section.
193         (Output_section_incremental_inputs::set_final_data_size): Calculate
194         size of incremental_got_plt section.
195         (Output_section_incremental_inputs::do_write): Write the
196         incremental_got_plt section.
197         (Got_plt_view_info): New struct.
198         (Local_got_offset_visitor): New class.
199         (Global_got_offset_visitor): New class.
200         (Global_symbol_visitor_got_plt): New class.
201         (Output_section_incremental_inputs::write_got_plt): New function.
202         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
203         Add parameter.  Adjust all callers.
204         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
205         (Incremental_inputs::got_plt_section): New function.
206         (Incremental_inputs::got_plt_section_): New data member.
207         (Incremental_got_plt_reader): New class.
208         * layout.cc (Layout::create_incremental_info_sections): Add the
209         incremental_got_plt section.
210         * object.h (Got_offset_list::get_list): New function.
211         (Got offset_list::for_all_got_offsets): New function.
212         (Sized_relobj::local_got_offset_list): New function.
213         * powerpc.cc (Target_powerpc::got_size): Add const.
214         (Target_powerpc::got_entry_count): New function.
215         (Target_powerpc::plt_entry_count): New function.
216         (Target_powerpc::first_plt_entry_offset): New function.
217         (Target_powerpc::plt_entry_size): New function.
218         (Output_data_plt_powerpc::entry_count): New function.
219         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
220         (Output_data_plt_powerpc::get_plt_entry_size): New function.
221         * sparc.cc (Target_sparc::got_size): Add const.
222         (Target_sparc::got_entry_count): New function.
223         (Target_sparc::plt_entry_count): New function.
224         (Target_sparc::first_plt_entry_offset): New function.
225         (Target_sparc::plt_entry_size): New function.
226         (Output_data_plt_sparc::entry_count): New function.
227         (Output_data_plt_sparc::first_plt_entry_offset): New function.
228         (Output_data_plt_sparc::get_plt_entry_size): New function.
229         * symtab.h (Symbol::got_offset_list): New function.
230         (Symbol_table::for_all_symbols): New function.
231         * target.h (Sized_target::got_entry_count): New function.
232         (Sized_target::plt_entry_count): New function.
233         (Sized_target::plt_entry_size): New function.
234         * x86_64.cc (Target_x86_64::got_size): Add const.
235         (Target_x86_64::got_entry_count): New function.
236         (Target_x86_64::plt_entry_count): New function.
237         (Target_x86_64::first_plt_entry_offset): New function.
238         (Target_x86_64::plt_entry_size): New function.
239         (Output_data_plt_x86_64::entry_count): New function.
240         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
241         (Output_data_plt_x86_64::get_plt_entry_size): New function.
242
243 2010-08-12  Cary Coutant  <ccoutant@google.com>
244
245         * archive.cc: Include incremental.h.
246         (Archive::Archive): Initialize incremental_info_.
247         (Archive::include_member): Record archive members in incremental info.
248         (Add_archive_symbols::run): Record begin and end of an archive in
249         incremental info.
250         (Lib_group::include_member): Record objects in incremental info.
251         * archive.h (Incremental_archive_entry): Forward declaration.
252         (Archive::set_incremental_info): New member function.
253         (Archive::incremental_info): New member function.
254         (Archive::Unused_symbol_iterator): New class.
255         (Archive::unused_symbols_begin): New member function.
256         (Archive::unused_symbols_end): New member function.
257         (Archive::incremental_info_): New data member.
258         * incremental-dump.cc (find_input_containing_global): New function.
259         (dump_incremental_inputs): Dump new incremental info sections.
260         * incremental.cc: Include symtab.h.
261         (Output_section_incremental_inputs): New class.
262         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
263         new incremental info sections.
264         (Sized_incremental_binary::do_check_inputs): Likewise.
265         (Incremental_inputs::report_archive): Remove.
266         (Incremental_inputs::report_archive_begin): New function.
267         (Incremental_inputs::report_archive_end): New function.
268         (Incremental_inputs::report_object): New function.
269         (Incremental_inputs::finalize_inputs): Remove.
270         (Incremental_inputs::report_input_section): New function.
271         (Incremental_inputs::report_script): Rewrite.
272         (Incremental_inputs::finalize): Do nothing but finalize string table.
273         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
274         (Incremental_inputs::sized_create_inputs_section_data): Remove.
275         (Incremental_inputs::create_data_sections): New function.
276         (Incremental_inputs::relocs_entsize): New function.
277         (Output_section_incremental_inputs::set_final_data_size): New function.
278         (Output_section_incremental_inputs::do_write): New function.
279         (Output_section_incremental_inputs::write_header): New function.
280         (Output_section_incremental_inputs::write_input_files): New function.
281         (Output_section_incremental_inputs::write_info_blocks): New function.
282         (Output_section_incremental_inputs::write_symtab): New function.
283         * incremental.h (Incremental_script_entry): Forward declaration.
284         (Incremental_object_entry): Forward declaration.
285         (Incremental_archive_entry): Forward declaration.
286         (Incremental_inputs): Forward declaration.
287         (Incremental_inputs_header_data): Remove.
288         (Incremental_inputs_header): Remove.
289         (Incremental_inputs_header_write): Remove.
290         (Incremental_inputs_entry_data): Remove.
291         (Incremental_inputs_entry): Remove.
292         (Incremental_inputs_entry_write): Remove.
293         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
294         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
295         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
296         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
297         Likewise.
298         (Incremental_input_entry): New class.
299         (Incremental_script_entry): New class.
300         (Incremental_object_entry): New class.
301         (Incremental_archive_entry): New class.
302         (Incremental_inputs::Incremental_inputs): Initialize new data members.
303         (Incremental_inputs::report_inputs): Remove.
304         (Incremental_inputs::report_archive): Remove.
305         (Incremental_inputs::report_archive_begin): New function.
306         (Incremental_inputs::report_archive_end): New function.
307         (Incremental_inputs::report_object): Change prototype.
308         (Incremental_inputs::report_input_section): New function.
309         (Incremental_inputs::report_script): Change prototype.
310         (Incremental_inputs::get_reloc_count): New function.
311         (Incremental_inputs::set_reloc_count): New function.
312         (Incremental_inputs::create_data_sections): New function.
313         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
314         (Incremental_inputs::inputs_section): New function.
315         (Incremental_inputs::symtab_section): New function.
316         (Incremental_inputs::relocs_section): New function.
317         (Incremental_inputs::get_stringpool): Add const.
318         (Incremental_inputs::command_line): Add const.
319         (Incremental_inputs::inputs): Remove.
320         (Incremental_inputs::command_line_key): New function.
321         (Incremental_inputs::input_file_count): New function.
322         (Incremental_inputs::input_files): New function.
323         (Incremental_inputs::relocs_entsize): New function.
324         (Incremental_inputs::sized_create_inputs_section_data): Remove.
325         (Incremental_inputs::finalize_inputs): Remove.
326         (Incremental_inputs::Input_info): Remove.
327         (Incremental_inputs::lock_): Remove.
328         (Incremental_inputs::inputs_): Change type.
329         (Incremental_inputs::inputs_map_): Remove.
330         (Incremental_inputs::current_object_entry_): New data member.
331         (Incremental_inputs::inputs_section_): New data member.
332         (Incremental_inputs::symtab_section_): New data member.
333         (Incremental_inputs::relocs_section_): New data member.
334         (Incremental_inputs::reloc_count_): New data member.
335         (Incremental_inputs_reader): New class.
336         (Incremental_symtab_reader): New class.
337         (Incremental_relocs_reader): New class.
338         * layout.cc (Layout::finalize): Move finalization of incremental info
339         and creation of incremental info sections to follow finalization of
340         symbol table.  Set offsets for postprocessing sections.
341         (Layout::create_incremental_info_sections): Call
342         Incremental_inputs::create_data_sections.  Add incremental symtab
343         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
344         sections to layout after input sections.
345         * layout.h (struct Timespec): Forward declaration.
346         (Layout::incremental_inputs): Add const.
347         (Layout::create_incremental_info_sections): Add parameter.
348         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
349         * object.cc: Include incremental.h.
350         (Relobj::finalize_incremental_relocs): New function.
351         (Sized_relobj::do_layout): Record input sections in incremental info.
352         * object.h (Object::output_section): New function.
353         (Object::output_section_offset): Moved from Relobj.
354         (Object::get_incremental_reloc_base): New function.
355         (Object::get_incremental_reloc_count): New function.
356         (Object::do_output_section): New function.
357         (Object::do_output_section_offset): Moved from Relobj.
358         (Object::do_get_incremental_reloc_base): New function.
359         (Object::do_get_incremental_reloc_count): New function.
360         (Object::Object): Initialize new data members.
361         (Relobj::output_section): Renamed do_output_section and moved to
362         protected.
363         (Relobj::output_section_offset): Moved to Object.
364         (Relobj::do_get_incremental_reloc_base): New function.
365         (Relobj::do_get_incremental_reloc_count): New function.
366         (Relobj::allocate_incremental_reloc_counts): New function.
367         (Relobj::count_incremental_reloc): New function.
368         (Relobj::finalize_incremental_relocs): New function.
369         (Relobj::next_incremental_reloc_index): New function.
370         (Relobj::reloc_counts_): New data member.
371         (Relobj::reloc_bases_): New data member.
372         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
373         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
374         (Sized_relobj::incremental_relocs_scan): New function.
375         (Sized_relobj::incremental_relocs_scan_reltype): New function.
376         (Sized_relobj::incremental_relocs_write): New function.
377         (Sized_relobj::incremental_relocs_write_reltype): New function.
378         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
379         incremental link.
380         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
381         archives and object files elsewhere.
382         (Add_symbols::run): Report object files here.
383         (Finish_group::run): Report end of archive at end of group.
384         * reloc.cc: Include layout.h, incremental.h.
385         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
386         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
387         (Sized_relobj::incremental_relocs_scan): New function.
388         (Sized_relobj::incremental_relocs_scan_reltype): New function.
389         (Sized_relobj::do_relocate_sections): Write incremental relocations.
390         (Sized_relobj::incremental_relocs_write): New function.
391         (Sized_relobj::incremental_relocs_write_reltype): New function.
392         * script.cc (read_input_script): Rewrite test for incremental link.
393         Change call to Incremental_inputs::report_script.
394         * symtab.h (Symbol_table::first_global_index): New function.
395         (Symbol_table::output_count): New function.
396
397 2010-08-12  Doug Kwan  <dougkwan@google.com>
398
399         * arm.cc (Target_arm::merge_object_attributes): Check command line
400         options --no-wchar-size-warning and --no-enum-size-warning.
401         * options.h (General_options): Add ld-compatible options
402         --no-enum-size-warning and --no-wchar-size-warning.
403
404 2010-08-04  Ian Lance Taylor  <iant@google.com>
405
406         * x86_64.cc (Target_x86_64::Scan::local): Use
407         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
408         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
409         (Target_x86_64::Scan::global): Likewise.
410         (Target_x86_64::Relocate::relocate): Likewise.
411         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
412         Likewise.
413
414 2010-08-03  Cary Coutant  <ccoutant@google.com>
415
416         * merge.cc (Output_merge_string::do_add_input_section): Count strings
417         to reserve space in merged_strings vector. Keep total input size
418         for stats.
419         (Output_merge_string::do_print_merge_stats): Print total input size.
420         * merge.h (Output_merge_string): Add input_size_ field.
421         * stringpool.cc (Stringpool_template::string_length): Move
422         implementations out of Stringpool_template class and place in
423         stringpool.h.
424         * stringpool.h (string_length): Move out of Stringpool_template.
425
426 2010-08-03  Ian Lance Taylor  <iant@google.com>
427
428         PR 11712
429         * layout.cc (relaxation_loop_body): If address of load segment is
430         set, adjust address to include headers if possible.
431
432 2010-08-03  Ian Lance Taylor  <iant@google.com>
433
434         * version.cc (version_string): Bump to 1.10.
435
436 2010-08-03  Ian Lance Taylor  <iant@google.com>
437
438         PR 11805
439         * layout.h (enum Output_section_order): Define.
440         (class Layout): Update declarations.
441         * layout.cc (Layout::get_output_section): Add order parameter.
442         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
443         is_first_non_relro parameters.  Change all callers.
444         (Layout::choose_output_section): Likewise.
445         (Layout::add_output_section_data): Likewise.
446         (Layout::make_output_section): Likewise.  Set order.
447         (Layout::default_section_order): New function.
448         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
449         * output.cc (Output_section::Output_section): Initialize order_.
450         Don't initialize deleted fields.
451         (Output_segment::Output_segment): Don't initialize deleted
452         fields.
453         (Output_segment::add_output_section_to_load): New function
454         replacing add_output_section.  Change all callers to call this or
455         add_output_section_to_nonload.
456         (Output_segment::add_output_section_to_nonload): New function.
457         (Output_segment::remove_output_section): Rewrite.
458         (Output_segment::add_initial_output_data): Likewise.
459         (Output_segment::has_any_data_sections): Likewise.
460         (Output_segment::is_first_section_relro): Likewise.
461         (Output_segment::maximum_alignment): Likewise.
462         (Output_segment::has_dynamic_reloc): New function replacing
463         dynamic_reloc_count.  Change all callers.
464         (Output_segment::has_dynamic_reloc_list): New function replacing
465         dynamic_reloc_count_list.  Change all callers.
466         (Output_segment::set_section_addresses): Rewrite.
467         (Output_segment::set_offset): Rewrite.
468         (Output_segment::find_first_and_last_list): Remove.
469         (Output_segment::set_tls_offsets): Rewrite.
470         (Output_segment::first_section_load_address): Likewise.
471         (Output_segment::output_section_count): Likewise.
472         (Output_segment::section_with_lowest_load_address): Likewise.
473         (Output_segment::write_section_headers): Likewise.
474         (Output_segment::print_sections_to_map): Likewise.
475         * output.h (class Output_data): Remove dynamic_reloc_count_
476         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
477         (Output_data::add_dynamic_reloc): Rewrite.
478         (Output_data::has_dynamic_reloc): New function.
479         (Output_data::dynamic_reloc_count): Remove.
480         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
481         is_last_relro_, is_first_non_relro_, is_interp_,
482         is_dynamic_linker_section_ fields.  Add order and set_order
483         functions.  Remove is_relro_local, set_is_relro_local,
484         is_last_relro, set_is_last_relro, is_first_non_relro,
485         set_is_first_non_relro functions, is_interp, set_is_interp,
486         is_dynamic_linker_section, and set_is_dynamic_linker_section
487         functions.
488         (class Output_segment): Change Output_data_list from std::list to
489         std:;vector.  Add output_lists_ field.  Remove output_data_ and
490         output_bss_ fields.  Update declarations.
491
492 2010-08-02  Ian Lance Taylor  <iant@google.com>
493
494         * arm.cc (Target_arm::gc_process_relocs): Use typename.
495         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
496         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
497
498 2010-08-02  Ian Lance Taylor  <iant@google.com>
499
500         PR 11855
501         * script.cc (Script_options::Script_options): Initialize
502         symbol_definitions_ and symbol_references_.
503         (Script_options::add_symbol_assignment): Update
504         symbol_definitions_ and symbol_references_.
505         (Script_options::add_symbol_reference): New function.
506         (script_symbol): New function.
507         * script.h (class Script_options): Add symbol_definitions_ and
508         symbol_references_ fields.
509         (Script_options::referenced_const_iterator): New type.
510         (Script_options::referenced_begin): New function.
511         (Script_options::referenced_end): New function.
512         (Script_options::is_referenced): New function.
513         (Script_options::any_unreferenced): New function.
514         * script-c.h (script_symbol): Declare.
515         * yyscript.y (exp): Call script_symbol.
516         * symtab.cc: Include "script.h".
517         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
518         Change all callers.  Check symbols referenced by scripts.
519         (Symbol_table::add_undefined_symbols_from_command_line): Add
520         layout parameter.  Change all callers.
521         (Symbol_table::do_add_undefined_symbols_from_command_line):
522         Likewise.  Break out loop body.  Check symbols referenced by
523         scripts.
524         (Symbol_table::add_undefined_symbol_from_command_line): New
525         function broken out of
526         do_add_undefined_symbols_from_command_line.
527         * symtab.h (class Symbol_table): Update declarations.
528         * archive.cc: Include "layout.h".
529         (Archive::should_include_member): Add layout parameter.  Change
530         all callers.  Check for symbol mentioned in expression.
531         * archive.h (class Archive): Update declaration.
532         * object.cc (Sized_relobj::do_should_include_member): Add layout
533         parameter.
534         * object.h (Object::should_include_member): Add layout parameter.
535         Change all callers.
536         (Object::do_should_include_member): Add layout parameter.
537         (class Sized_relobj): Update declaration.
538         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
539         parameter.
540         * dynobj.h (class Sized_dynobj): Update declaration.
541         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
542         layout parameter.
543         * plugin.h (class Sized_pluginobj): Update declaration.
544
545 2010-08-02  Ian Lance Taylor  <iant@google.com>
546
547         PR 11866
548         * output.cc (Output_segment::set_offset): Search for the first and
549         last sections rather than assuming that the list is in order.
550         (Output_segment::find_first_and_last_list): New function.
551         * output.h (class Output_segment): Update declarations.
552         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
553         (relro_strip_test_SOURCES): New variable.
554         (relro_strip_test_DEPENDENCIES): New variable.
555         (relro_strip_test_LDFLAGS): New variable.
556         (relro_strip_test_LDADD): New variable.
557         (relro_strip_test.so): New target.
558
559 2010-08-02  Ian Lance Taylor  <iant@google.com>
560
561         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
562         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
563         (Target_i386::got_tlsdesc_section): New function.
564         (Target_i386::got_section): Create space for GOT entries for
565         TLSDESC relocations.
566         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
567         R_386_TLS_GOTDESC.
568         (Target_i386::Scan::global): Likewise.
569         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
570         using TLSDESC GOT.
571         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
572         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
573         (Target_x86_64::got_tlsdesc_section): New function.
574         (Target_x86_64::got_section): Create space for GOT entries for
575         TLSDESC relocations.
576         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
577         R_386_TLS_GOTDESC.
578         (Target_x86_64::Scan::global): Likewise.
579         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
580         using TLSDESC GOT.
581
582 2010-08-02  Ian Lance Taylor  <iant@google.com>
583
584         * testsuite/final_layout.sh: Use dc to convert from hex to
585         decimal.
586
587 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
588
589         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
590         paramter to the call to gold::gc_process_relocs.
591         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
592         paramter to the call to gold::gc_process_relocs.
593         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
594         parameter to the call to gold::gc_process_relocs.
595         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
596         template parameter to the call to gold::gc_process_relocs.
597         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
598         paramter to the call to gold::gc_process_relocs.
599         * gc.h (get_embedded_addend_size): New function.
600         (gc_process_relocs): Save the size of the reloc for use by ICF.
601         * icf.cc (get_section_contents): Get the addend from the text section
602         for SHT_REL relocation sections.
603         * icf.h (Icf::Reloc_addend_size_info): New typedef.
604         (Icf::Reloc_info): Add new member reloc_addend_size_info.
605         * int_encoding.h (read_from_pointer): New overloaded function.
606         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
607         * testsuite/icf_sht_rel_addend_test.sh: New file.
608         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
609         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
610
611 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
612
613         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
614         * Makefile.in: Regenerate.
615         * testsuite/Makefile.in: Regenerate.
616
617 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
618
619         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
620         * gold/testsuite/debug_msg.cc: Likewise.
621         * gold/testsuite/odr_violation1.cc
622         * gold/testsuite/odr_violation2.cc
623
624 2010-07-21  Cary Coutant  <ccoutant@google.com>
625
626         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
627         string, and length fields.
628         (Output_merge_string::Merged_strings_list): New type.
629         (Output_merge_string::Merged_strings_lists): New typedef.
630         (Output_merge_string): Replace merged_strings_ with
631         merged_strings_lists_.
632         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
633         Merged_strings_list per input object and section.  Don't store pointer
634         to the string.  Don't store length with each merged string entry.
635         (Output_merge_string::finalize_merged_data): Loop over list of merged
636         strings lists.  Recompute length of each merged string.
637
638 2010-07-15  Cary Coutant  <ccoutant@google.com>
639
640         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
641         here.
642
643 2010-07-14  Ian Lance Taylor  <iant@google.com>
644
645         * descriptors.cc (Descriptors::open): Report correct name in error
646         message.
647
648 2010-07-13  Doug Kwan  <dougkwan@google.com>
649
650         * arm.cc (Arm_input_section::Arm_input_section): For a
651         SHT_ARM_EXIDX section, always keeps the input sections.
652         (Arm_input_section::set_exidx_section_link): New method.
653         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
654         has_errors_ to false.
655         (Arm_exidx_input_section::has_errors,
656         Arm_exidx_input_section::set_has_errors): New methods.
657         (Arm_exidx_input_section::has_errors_): New data member.
658         (Arm_relobj::get_exidx_shndx_list): New method.
659         (Arm_output_section::append_text_sections_to_list): Do not skip
660         section without SHF_EXECINSTR.
661         (Arm_output_section::fix_exidx_coverage): Skip input sections with
662         errors.
663         (Arm_relobj::make_exidx_input_section): Add new parameter for text
664         section header.  Make error messages more verbose.  Check for
665         a non-executable section linked to an EXIDX section.
666         (Arm_relobj::do_read_symbols): Remove error checking, which has been
667         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
668         check that there is no deferred EXIDX section if we exit early.
669         Instead of not making an EXIDX section in case of an error, make one
670         and set the has_errors flag of it.
671         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
672         in a relocatable link.
673         (Target_arm::do_relax): Look for the EXIDX output section instead of
674         assuming that it is called .ARM.exidx.
675         (Target_arm::fix_exidx_coverage): Add a new parameter for input
676         section list.  Do not check for SHF_EXECINSTR section flags but
677         skip any input section with errors.
678         * output.cc (Output_section::Output_section): Initialize
679         always_keeps_input_sections_ to false.
680         (Output_section::add_input_section): Check for
681         always_keeps_input_sections_.
682         *  output.h (Output_section::always_keeps_input_sections,
683         Output_section::set_always_keeps_input_sections): New methods.
684         (Output_section::always_keeps_input_sections): New data member.
685
686 2010-07-13  Rafael Espindola  <espindola@google.com>
687
688         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
689         * fileread.h (Input_file): Add try_extra_search_path and find_file.
690
691 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
692             Ian Lance Taylor  <iant@google.com>
693
694         * output.h (Output_section_lookup_maps::add_merge_section):
695         Correct check of whether value was inserted.
696         (Output_section_lookup_maps::add_merge_input_section): Likewise.
697         (Output_section_lookup_maps::add_relaxed_input_section):
698         Likewise.
699         * arm.cc (Target_arm::got_section): Remove used local os.
700         * i386.cc (Target_i386::got_section): Likewise.
701         * x86_64.cc (Target_x86_64::got_section): Likewise.
702         * sparc.cc (Target_sparc::got_section): Likewise.
703         (Target_sparc::relocate): Remove unused local have_got_offset.
704         * powerpc.cc (Target_powerpc::relocate): Likewise.
705
706 2010-07-13  Ian Lance Taylor  <iant@google.com>
707
708         * compressed_output.cc (zlib_decompress): Fix signature in
709         !HAVE_ZLIB_H case.
710
711         * archive.cc (Archive::include_member): Unlock an external member
712         of a thin archive.  Don't bother to delete an object we know is
713         NULL.
714
715 2010-07-12  Cary Coutant  <ccoutant@google.com>
716
717         * compressed_output.cc (zlib_decompress): New function.
718         (get_uncompressed_size): New function.
719         (decompress_input_section): New function.
720         * compressed_output.h (get_uncompressed_size): New function.
721         (decompress_input_section): New function.
722         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
723         Handle compressed debug sections.
724         * layout.cc (is_compressed_debug_section): New function.
725         (Layout::output_section_name): Map compressed section names to
726         canonical names.
727         * layout.h (is_compressed_debug_section): New function.
728         (is_debug_info_section): Recognize compressed debug sections.
729         * merge.cc: Include compressed_output.h.
730         (Output_merge_data::do_add_input_section): Handle compressed
731         debug sections.
732         (Output_merge_string::do_add_input_section): Handle compressed
733         debug sections.
734         * object.cc: Include compressed_output.h.
735         (Sized_relobj::Sized_relobj): Initialize new data members.
736         (build_compressed_section_map): New function.
737         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
738         * object.h (Object::section_is_compressed): New method.
739         (Object::do_section_is_compressed): New method.
740         (Sized_relobj::Compressed_section_map): New type.
741         (Sized_relobj::do_section_is_compressed): New method.
742         (Sized_relobj::compressed_sections_): New data member.
743         * output.cc (Output_section::add_input_section): Handle compressed
744         debug sections.
745         * reloc.cc: Include compressed_output.h.
746         (Sized_relobj::write_sections): Handle compressed debug sections.
747
748 2010-07-08  Cary Coutant  <ccoutant@google.com>
749
750         * resolve.cc (Symbol_table::resolve): Remember whether undef was
751         weak when resolving to a dynamic def.
752         (Symbol_table::should_override): Add adjust_dyndef flag; set it
753         for weak undef/dynamic def cases. Adjust callers.
754         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
755         undef_binding_weak_.
756         (Symbol_table::sized_write_globals): Adjust symbol binding.
757         (Symbol_table::sized_write_symbol): Add binding parameter.
758         * symtab.h (Symbol::set_undef_binding): New method.
759         (Symbol::is_undef_binding_weak): New method.
760         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
761         (Symbol_table::should_override): Add new parameter.
762         (Symbol_table::sized_write_symbol): Add new parameter.
763
764         * testsuite/weak_undef_file1.cc: Add new test case.
765         * testsuite/weak_undef_file2.cc: Fix header comment.
766         * testsuite/weak_undef_test.cc: Add new test case.
767
768 2010-06-29  Doug Kwan  <dougkwan@google.com>
769
770         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
771         Initialize USE_SYMBOL_.
772         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
773         definition.
774         (Arm_reloc_property::uses_symbol_): New data member declaration.
775         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
776         uses symbol value and symbol is undefined but not weakly undefined.
777
778 2010-06-28  Rafael Espindola  <espindola@google.com>
779
780         * plugin.cc (Plugin::load): Use dlerror.
781
782 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
783
784         * symtab.cc (detect_odr_violations): When reporting an ODR
785         violation, report an object where the symbol is defined.
786
787 2010-06-25  Doug Kwan  <dougkwan@google.com>
788
789         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
790         (Target_arm::section_may_have_icf_unsafe_pointers): New method
791         definition.
792         (Target_arm::Scan::local_reloc_may_be_function_pointer,
793         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
794         target hook to detect function points.
795         (Target_arm::Scan::possible_function_pointer_reloc): New method.
796         * icf.h (Icf::check_section_for_function_pointers): Change type of
797         parameter SECTION_NAME to const reference to std::string.  Use
798         target hook to determine if section may have unsafe pointers.
799         * target.h (Target::section_may_have_icf_unsafe_pointers): New
800         method definition.
801
802 2010-06-21  Rafael Espindola  <espindola@google.com>
803
804         * fileread.cc (Input_file::find_fie): New
805         (Input_file::open): Use Input_file::find_fie.
806         * fileread.h (Input_file::find_fie): New
807         * plugin.cc (set_extra_library_path): New.
808         (Plugin::load): Add set_extra_library_path to the transfer vector.
809         (Plugin_manager::set_extra_library_path): New.
810         (Plugin_manager::add_input_file): Use the extra search path if set.
811         (set_extra_library_path(): New.
812         * plugin.h (Plugin_manager): Add set_extra_library_path and
813         extra_search_path_.
814
815 2010-06-19  Cary Coutant  <ccoutant@google.com>
816
817         * layout.cc (gdb_sections): Add .debug_types.
818         (lines_only_debug_sections): Likewise.
819
820 2010-06-18  Rafael Espindola  <espindola@google.com>
821
822         * plugin.cc (add_input_file,add_input_library)
823         (Plugin_manager::add_input_file): Make filename arguments const.
824         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
825         const.
826
827 2010-06-16  Doug Kwan  <dougkwan@google.com>
828
829         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
830         .ARM.attributes section if we have not merged any input
831         attributes sections.
832
833 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
834
835         * arm.cc: Allow combining objects with no EABI version
836         information.
837
838 2010-06-15  Rafael Espindola  <espindola@google.com>
839
840         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
841
842 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
843
844         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
845         (struct iovec): Correct !HAVE_READV definition.
846
847 2010-06-10  Cary Coutant  <ccoutant@google.com>
848
849         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
850         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
851         reloc sections.
852         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
853
854         PR 11683
855         * symtab.h (Symbol::is_placeholder): New member function.
856         * target-reloc.h (relocate_section): Check for placeholder symbols.
857
858         * testsuite/Makefile.am (plugin_test_8): New test.
859         (plugin_test_9): New test.
860         * testsuite/Makefile.in: Regenerate.
861
862 2010-06-09  Nick Clifton  <nickc@redhat.com>
863
864         * yyscript.y (input_list_element): Allow strings prefixed with
865         the '-' character.  Treat these as libraries.
866         * script.cc (script_add_library): New function.  Adds a library
867         specified by "-l<name>" found in an input script.
868         * script-c.h: Add prototype for script_add_library.
869
870 2010-06-07  Doug Kwan  <dougkwan@google.com>
871
872         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
873         Restrict stub-group size to be within long conditional branch
874         range when working around cortex-A8 erratum.
875
876 2010-06-07  Damien Diederen  <dd@crosstwine.com>
877
878         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
879         #ifdef typo.
880
881 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
882
883         PR gold/11658
884         * output.cc
885         (Output_section::Input_section_sort_entry::compare_section_ordering):
886         Change to return non-zero correctly.
887         (Output_section::Input_section_sort_section_order_index_compare
888         ::operator()): Change to fix ambiguity in comparisons.
889
890 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
891
892         * gold.h (is_wildcard_string): New function.
893         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
894         (Layout::layout_eh_frame): Ditto.
895         (Layout::find_section_order_index): New method.
896         (Layout::read_layout_from_file): New method.
897         * layout.h (Layout::find_section_order_index): New method.
898         (Layout::read_layout_from_file): New method.
899         (Layout::input_section_position_): New private member.
900         (Layout::input_section_glob_): New private member.
901         * main.cc (main): Call read_layout_from_file here.
902         * options.h (--section-ordering-file): New option.
903         * output.cc (Output_section::input_section_order_specified_): New
904         member.
905         (Output_section::Output_section): Initialize new member.
906         (Output_section::add_input_section): Add new parameter.
907         Keep input sections when --section-ordering-file is used.
908         (Output_section::set_final_data_size): Sort input sections when
909         section ordering file is specified.
910         (Output_section::Input_section_sort_entry): Add new parameter.
911         Check sorting type.
912         (Output_section::Input_section_sort_entry::compare_section_ordering):
913         New method.
914         (Output_section::Input_section_sort_compare::operator()): Change to
915         consider section_order_index.
916         (Output_section::Input_section_sort_init_fini_compare::operator()):
917         Change to consider section_order_index.
918         (Output_section::Input_section_sort_section_order_index_compare
919         ::operator()): New method.
920         (Output_section::sort_attached_input_sections): Change to sort
921         according to section order when specified.
922         (Output_section::add_input_section<32, true>): Add new parameter.
923         (Output_section::add_input_section<64, true>): Add new parameter.
924         (Output_section::add_input_section<32, false>): Add new parameter.
925         (Output_section::add_input_section<64, false>): Add new parameter.
926         * output.h (Output_section::add_input_section): Add new parameter.
927         (Output_section::input_section_order_specified): New
928         method.
929         (Output_section::set_input_section_order_specified): New method.
930         (Input_section::Input_section): Initialize section_order_index_.
931         (Input_section::section_order_index): New method.
932         (Input_section::set_section_order_index): New method.
933         (Input_section::section_order_index_): New member.
934         (Input_section::Input_section_sort_section_order_index_compare): New
935         struct.
936         (Output_section::input_section_order_specified_): New member.
937         * script-sections.cc (is_wildcard_string): Delete and move modified
938         method to gold.h.
939         (Output_section_element_input::Output_section_element_input): Modify
940         call to is_wildcard_string.
941         (Output_section_element_input::Input_section_pattern
942         ::Input_section_pattern): Ditto.
943         (Output_section_element_input::Output_section_element_input): Ditto.
944         * testsuite/Makefile.am (final_layout): New test case.
945         * testsuite/Makefile.in: Regenerate.
946         * testsuite/final_layout.cc: New file.
947         * testsuite/final_layout.sh: New file.
948
949 2010-06-01  Rafael Espindola  <espindola@google.com>
950
951         * plugin.cc (Plugin::load): Pass the output name to the plugin.
952
953 2010-06-01  Rafael Espindola  <espindola@google.com>
954
955         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
956         visibility of symbols.
957
958 2010-05-27  Doug Kwan  <dougkwan@google.com>
959
960         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
961         from start of output section instead of address for a local symbol
962         in a merged or relaxed section when doing a relocatable link.
963
964 2010-05-26  Rafael Espindola  <espindola@google.com>
965
966        PR 11604
967         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
968         adding sections the garbage collector removed.
969         * gold/testsuite/Makefile.am: Add test.
970         * gold/testsuite/Makefile.in: Regenerate.
971         * gold/testsuite/plugin_test_7.sh: New.
972         * gold/testsuite/plugin_test_7_1.c: New.
973         * gold/testsuite/plugin_test_7_2.c: New.
974
975 2010-05-26  Rafael Espindola  <espindola@google.com>
976
977         * script-sections.cc (Output_section_definition::set_section_addresses):
978         Check for --section-start.
979
980 2010-05-26  Doug Kwan  <dougkwan@google.com>
981
982         * arm.cc (Arm_scan_relocatable_relocs): New class.
983         (Target_arm::relocate_special_relocatable): New method.
984         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
985         (Arm_relocate_functions::thumb_branch_common): Same.
986         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
987         instead of Default_scan_relocatable_relocs.
988         * target-reloc.h (relocate_for_relocatable): Let target handle
989         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
990         * target.h (Sized_target::relocate_special_relocatable): New method.
991
992 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
993
994         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
995
996 2010-05-23  Doug Kwan  <dougkwan@google.com>
997
998         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
999         instead of a cast.
1000         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
1001         with a direct branch, not a conditional branch, to a stub.
1002         * merge.cc (Output_merge_base::record_input_section): New method
1003         defintion.
1004         (Output_merge_data::do_add_input_section): Record input section if
1005         keeps-input-sections flag is set.
1006         (Output_merge_string::do_add_input_section): Ditto.
1007         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
1008         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
1009         INPUT_SECTIONS_.
1010         (Output_merge_base::keeps_input_sections,
1011         Output_merge_base::set_keeps_input_sections,
1012         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
1013         method definitions.
1014         (Output_merge_base::Input_sections): New type declaration.
1015         (Output_merge_base::input_sections_begin,
1016         Output_merge_base::input_sections_end,
1017         Output_merge_base::do_set_keeps_input_sections): New method definitions.
1018         (Output_merge_base::bool keeps_input_sections_,
1019         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
1020         Output_merge_base::input_sections_): New data members.
1021         (Output_merge_data::do_set_keeps_input_sections): New method
1022         defintion.
1023         (Output_merge_string::do_set_keeps_input_sections): Ditto.
1024         * output.cc (Output_section::Input_section::relobj): Move method
1025         defintion from class declaration to here and handle merge sections.
1026         (Output_section::Input_section::shndx): Ditto.
1027         (Output_section::Output_section): Remove initializations of removed
1028         data members and initialize new data member LOOKUP_MAPS_.
1029         (Output_section::add_input_section): Set keeps-input-sections flag
1030         for a newly created merge output section as appropriate.  Adjust code
1031         to use Output_section_lookup_maps class.
1032         (Output_section::add_relaxed_input_section): Adjst code for lookup
1033         maps code refactoring.
1034         (Output_section::add_merge_input_section): Add a new parameter
1035         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
1036         class.  If adding input section to a newly created merge output
1037         section fails, remove the new merge section.
1038         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
1039         Adjust code for use of the Output_section_lookup_maps class.
1040         (Output_section::find_merge_section): Ditto.
1041         (Output_section::build_lookup_maps): New method defintion.
1042         (Output_section::find_relaxed_input_section): Adjust code to use
1043         Output_section_lookup_maps class.
1044         (Output_section::get_input_sections): Export merge sections.  Adjust
1045         code to use Output_section_lookup_maps class.
1046         (Output_section:::add_script_input_section): Adjust code to use
1047         Output_section_lookup_maps class.  Update lookup maps for merge
1048         sections also.
1049         (Output_section::discard_states): Use Output_section_lookup_maps.
1050         (Output_section::restore_states): Same.
1051         * output.h (Merge_section_properties): Move class defintion out of
1052         Output_section.
1053         (Output_section_lookup_maps): New class.
1054         (Output_section::Input_section::is_merge_section): New method
1055         defintion.
1056         (Output_section::Input_section::relobj): Move defintion out of class
1057         defintion.  Declare method only.
1058         (Output_section::Input_section::shndx): Ditto.
1059         (Output_section::Input_section::output_merge_base): New method defintion.
1060         (Output_section::Input_section::u2_.pomb): New union field.
1061         (Output_section::Merge_section_by_properties_map,
1062         Output_section::Output_section_data_by_input_section_map,
1063         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
1064         Remove types.
1065         (Output_section::add_merge_input_section): Add new parameter
1066         KEEPS_INPUT_SECTIONS.
1067         (Output_section::build_lookup_maps): New method declaration.
1068         (Output_section::merge_section_map_,
1069         Output_section::merge_section_by_properties_map_,
1070         Output_section::relaxed_input_section_map_,
1071         Output_section::is_relaxed_input_section_map_valid_): Remove data
1072         members.
1073         (Output_section::lookup_maps_): New data member.
1074
1075 2010-05-21  Doug Kwan  <dougkwan@google.com>
1076
1077         PR gold/11619
1078         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
1079         avoid a compilation error.
1080
1081 2010-05-19  Rafael Espindola  <espindola@google.com>
1082
1083         * script-sections.cc (Output_section_definition::allocate_to_segment):
1084         Update the phdrs_list even when the output section is NULL.
1085         * testsuite/Makefile.am: Add test.
1086         * testsuite/Makefile.in: Regenerate.
1087         * testsuite/script_test_9.cc: New.
1088         * testsuite/script_test_9.sh: New.
1089         * testsuite/script_test_9.t: New.
1090
1091 2010-05-19  Doug Kwan  <dougkwan@google.com>
1092
1093         * arm.cc (Arm_input_section::original_size): New method.
1094         (Arm_input_section::do_addralign): Add a cast.
1095         (Arm_input_section::do_output_offset): Remove static cast.
1096         (Arm_input_section::original_addralign,
1097          Arm_input_section::original_size_): Change type to uint32_t.
1098         (Arm_input_section::init): Add safe casts for section alignment
1099         and size.
1100         (Arm_input_section::set_final_data_size): Do not set address and
1101         offset of stub table.
1102         (Arm_output_section::fix_exidx_coverage): Change use of of
1103         Output_section::Simple_input_section to that of
1104         Output_section::Input_section.
1105         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
1106         except for the first pass.
1107         * output.cc (Output_section::get_input_sections): Change type of
1108         input_sections to std::list<Input_section>.
1109         (Output_section::add_script_input_section): Rename from
1110         Output_section::add_simple_input_section.  Change type of SIS
1111         parameter from Simple_input_section to Input_section.
1112         * output.h (Output_section::Simple_input_section): Remove class.
1113         (Output_section::Input_section): Change class visibility to public.
1114         (Output_section::Input_section::addralign): Use stored alignments
1115         for special input sections if set.
1116         (Output_section::Input_section::set_addralign): New method.
1117         (Output_section::get_input_sections): Change parameter type from
1118         list of Simple_input_section to list of Input_section.
1119         (Output_section::add_script_input_section): Rename from
1120         Output_section::add_simple_input_section. Change first parameter's
1121         type from Simple_input_section to Input_section and remove the
1122         second and third parameters.
1123         * script-sections.cc (Input_section::Input_section_list): Change
1124         type to list of Output_section::Input_section/
1125         (Input_section_info::Input_section_info): Change parameter type of
1126         INPUT_SECTION to Output_section::Input_section.
1127         (Input_section_info::input_section): Change return type.
1128         (Input_section_info::input_section_): Change type to
1129         Output_section::Input_section.
1130         (Output_section_element_input::set_section_addresses): Adjust code
1131         to use Output_section::Input_section instead of
1132         Output_section::Simple_input_section.  Adjust code for renaming
1133         of Output_section::add_simple_input_section.
1134         (Orphan_output_section::set_section_addresses): Ditto.
1135
1136 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
1137
1138         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
1139         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
1140
1141 2010-05-18  Rafael Espindola  <espindola@google.com>
1142
1143         * options.cc (General_options::finalize): Handle -nostdlib.
1144         * options.h (nostdlib): New option.
1145         * script.cc (script_add_search_dir): Handle -nostdlib.
1146
1147 2010-05-12  Doug Kwan  <dougkwan@google.com>
1148
1149         * arm.cc (Target_arm::do_finalize_sections): Create an empty
1150         attributes section only if there no attributes section after merging.
1151         (Target_arm::merge_object_attributes): Move value of
1152         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
1153         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
1154         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
1155         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
1156         and arm_attr_merge_7.stdout.
1157         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
1158         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
1159         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
1160         arm_attr_merge_7b.o): New rules.
1161         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
1162         arm_attr_merge_7
1163         * testsuite/Makefile.in: Regenerate.
1164         * testsuite/arm_attr_merge.sh: New file.
1165         * testsuite/arm_attr_merge_[67][ab].s: Same.
1166
1167 2010-05-05  Nick Clifton  <nickc@redhat.com>
1168
1169         * po/es.po: Updated Spanish translation.
1170
1171 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
1172
1173         * Makefile.am (install-exec-local): Properly install gold as
1174         default cross linker.
1175         * Makefile.in: Regenerated.
1176
1177 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
1178             Nick Clifton  <nickc@redhat.com>
1179
1180         * configure.ac (install_as_default): Define and set to false
1181         unless --enable-gold or --enable-gold=both/gold has been
1182         specified.
1183         * configure: Regenerate.
1184
1185         * Makefile.am (install-exec-local): Install the executable as
1186         'ld.gold'.  If install_as_default is true then also install it as
1187         'ld'.
1188         * Makefile.in: Regenerated.
1189
1190 2010-04-24  Ian Lance Taylor  <iant@google.com>
1191
1192         * layout.cc (Layout::layout_reloc): In relocatable link don't
1193         combine reloc sections for grouped sections.
1194
1195 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
1196
1197         * gc.h (gc_process_relocs): Pass information on relocs pointing to
1198         sections that are not ordinary to icf.
1199         * icf.cc (get_section_contents): Handle relocation pointing to section
1200         with no object or shndx information.
1201         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
1202         * testsuite/Makefile.in: Regenerate.
1203         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
1204         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
1205
1206 2010-04-22  Ian Lance Taylor  <iant@google.com>
1207
1208         * expression.cc (Expression::Expression_eval_info): Add
1209         result_alignment_pointer field.
1210         (Expression::eval_with_dot): Add result_alignment_pointer
1211         parameter.  Change all callers.
1212         (Expression::eval_maybe_dot): Likewise.
1213         (class Binary_expression): Add alignment_pointer parameter to
1214         left_value and right_value.  Change all callers.
1215         (BINARY_EXPRESSION): Set result alignment.
1216         (class Trinary_expression): Add alignment_pointer parameter to
1217         arg2_value and arg3_value.  Change all callers.
1218         (Trinary_cond::value): Set result alignment.
1219         (Max_expression::value, Min_expression::value): Likewise.
1220         (Align_expression::value): Likewise.
1221         * script-sections.cc (class Sections_element): Add dot_alignment
1222         parameter to set_section_addresses virtual function.  Update
1223         instantiations.
1224         (class Output_section_element): Likewise.
1225         (Script_sections::create_segments): Add dot_alignment parameter.
1226         Change all callers.
1227         (Script_sections::create_segments_from_phdrs_clause): Likewise.
1228         (Script_sections::set_phdrs_clause_addresses): Likewise.
1229         * script-sections.h: Update declarations.
1230         * script.h: Update declarations.
1231         * output.h (Output_segment::set_minimum_p_align): Don't decrease
1232         min_p_align.
1233         * testsuite/script_test_3.t: Set large alignment.
1234         * testsuite/script_test_3.sh: Make sure that at least one LOAD
1235         segment has expected alignment.
1236
1237 2010-04-22  Nick Clifton  <nickc@redhat.com>
1238
1239         * po/gold.pot: Updated by the Translation project.
1240         * po/vi.po: Updated Vietnamese translation.
1241
1242 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
1243
1244         * testsuite/Makefile.am (check_PROGRAMS): Add
1245         icf_virtual_function_folding_test.
1246         * testsuite/Makefile.in: Regenerated.
1247
1248 2010-04-15  Andrew Haley  <aph@redhat.com>
1249
1250         * options.h (merge_exidx_entries): New option.
1251         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
1252         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
1253         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
1254         (Target_arm::merge_exidx_entries): New function.
1255         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
1256         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
1257         to Arm_exidx_fixup constructor.
1258         Add new arg, merge_exidx_entries.
1259         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
1260         Arm_output_section::fix_exidx_coverage.
1261
1262 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
1263
1264         * icf.cc (get_section_contents): Check for preemptible functions.
1265         Ignore addend when appropriate.
1266         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
1267         section folded.
1268         (add_from_relobj): Check for section folded.
1269         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
1270         * symtab.h (should_add_dynsym_entry): Add new parameter.
1271         * target-reloc.h (scan_relocs): Check for section folded.
1272         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
1273         Check reloc types for function pointers in shared objects.
1274         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
1275         case.
1276         (icf_preemptible_functions_test): New test case.
1277         (icf_string_merge_test): New test case.
1278         * testsuite.Makefile.in: Regenerate.
1279         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
1280         bar_glob.  Refactor code.
1281         * testsuite/icf_preemptible_functions_test.cc: New file.
1282         * testsuite/icf_preemptible_functions_test.sh: New file.
1283         * testsuite/icf_string_merge_test.cc: New file.
1284         * testsuite/icf_string_merge_test.sh: New file.
1285         * testsuite/icf_virtual_function_folding_test.cc: New file.
1286         * testsuite/icf_virtual_function_folding_test.sh: New file.
1287
1288 2010-04-14  Doug Kwan  <dougkwan@google.com>
1289
1290         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
1291         for local symbol recounting if we remove a section due to ICF.
1292         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
1293         there are no regular objects in input.
1294
1295 2010-04-13  Doug Kwan  <dougkwan@google.com>
1296
1297         * arm.cc (Arm_input_section::set_final_data_size): Compute
1298         accurate final data size instead of using current data size.
1299
1300 2010-04-09  Doug Kwan  <dougkwan@google.com>
1301
1302         * layout.cc (Layout::choose_output_section): Handle script section
1303         types.
1304         (Layout::make_output_section_for_script): Add section type parameter.
1305         Handle script section types.
1306         * layout.h (Layout::make_output_section_for_script): Add section
1307         type parameter.
1308         * output.cc (Output_section::Output_section): Initialize data member
1309         is_noload_.
1310         (Output_section::do_reset_address_and_file_offset): Do not set address
1311         to 0 if section is a NOLOAD section.
1312         * output.h (Output_section::is_noload): New method.
1313         (Output_section::set_is_noload): Ditto.
1314         (Output_section::is_noload_): New data member.
1315         * script-c.h (Script_section_type): New enum type.
1316         (struct Parser_output_section_header): Add new file section_type.
1317         * script-sections.cc (Sections_element::output_section_name): Add
1318         parameter for returning script section type.
1319         (Output_section_definition::output_section_name): Ditto.
1320         (Output_section_definition::section_type)P; New method.
1321         (Output_section_definiton::script_section_type_name): Ditto.
1322         (Output_section_definition::script_section_type_): New data member.
1323         (Output_section_definition::Output_section_definition): Initialize
1324         data member Output_section_definition::script_section_type_.
1325         (Output_section_definition::create_sections): Pass script section type
1326         to Layout::make_output_section_for_script.
1327         (Output_section_definition::output_section_name): Return script
1328         section type to caller.
1329         (Output_section_definition::set_section_address): Do not advance
1330         dot value and load address if section type is NOLOAD.  Set address
1331         of NOLOAD sections regardless of section flags.
1332         (Output_section_definition::print): Print section type if it is
1333         not SCRIPT_SECTION_TYPE_NONE.
1334         (Output_section_definition::section_type): New method.
1335         (Output_section_definition::script_section_type_name): Ditto.
1336         (Script_sections::output_section_name): Add new parameter
1337         PSECTION_TYPE for returning script section type.  Pass it to
1338         section elements.  Handle discard sections.
1339         (Sort_output_sections::operator()): Handle NOLOAD sections.
1340         * script-sections.h (Script_sections::Section_type): New enum type.
1341         (Script_sections::output_section_name): Add a new parameter for
1342         returning script section type.
1343         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
1344         INFO and NOLOAD.
1345         * yyscript.y (union): Add new field SECTION_TYPE.
1346         (COPY, DSECT, INFO, NOLOAD): New tokens.
1347         (opt_address_and_section_type): Change type to output_section_header.
1348         (section_type): New non-terminal
1349         (section_header): Handle section type.
1350         (opt_address_and_section_type): Return section type value.
1351
1352 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
1353
1354         * testsuite/plugin_common_test_1.c (foo): Add prototype.
1355         * testsuite/plugin_common_test_2.c (foo): Likewise.
1356
1357 2010-04-08  Doug Kwan  <dougkwan@google.com>
1358
1359         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
1360         Output_merge_data.
1361         * output.cc (Output_section::add_merge_input_section): Simplify
1362         code and return status of Output_merge_base::add_input_section.
1363         Update merge section map only if Output_merge_base::add_input_section
1364         returns true.
1365
1366 2010-04-07  Doug Kwan  <dougkwan@google.com>
1367
1368         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
1369         if section is marked as containing instructions but has no mapping
1370         symbols.
1371         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
1372         correct section index.
1373         (Arm_relobj::find_linked_text_section): Ditto.
1374
1375 2010-04-07  Cary Coutant  <ccoutant@google.com>
1376
1377         * archive.cc (include_member): Destroy Read_symbols_data object before
1378         releasing file.
1379         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
1380         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
1381         (Read_symbols_data::~Read_symbols_data) New destructor.
1382         (Section_relocs::Section_relocs) New constructor.
1383         (Section_relocs::~Section_relocs) New destructor.
1384         (Read_relocs_data::Read_relocs_data) New constructor.
1385         (Read_relocs_data::~Read_relocs_data) New destructor.
1386         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
1387         pointers to NULL after deleting.
1388
1389 2010-04-07  Doug Kwan  <dougkwan@google.com>
1390
1391         * arm.cc: Replace "endianity" with "endianness" in comments.
1392         (Arm_exidx_cantunwind): Ditto.
1393         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
1394         (Arm_relobj::merge_flags_and_attributes): New method.
1395         (Arm_relobj::merge_flags_and_attributes_): New data member.
1396         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
1397         (Arm_relobj::scan_sections_for_stubs): Ditto.
1398         (Arm_relobj::do_read_symbols): Check to see if we really want to
1399         merge processor-specific flags and attributes.  Exit early if
1400         an object is empty except for section names and the undefined symbol.
1401         (Target_arm::do_finalize_sections): Move check for ELF format to
1402         Arm_relobj::do_read_symbols.  Merge processor specific flags and
1403         attributes from a regular object only when we have determined that
1404         it is aapropriate.  Do not create an .ARM.attributes section in
1405         output if there is no regular input object.
1406         (Target_arm::merge_processor_specific_flags): Check
1407         --warn-mismatch before printing any error.
1408         (Target_arm::merge_object_attributes): Ditto.
1409         * gold.cc (queue_middle_tasks): Handle the case in which there is
1410         no regular object in input.
1411         * options.cc (General_options::parse_EB): New method.
1412         (General_options::parse_EL): Same.
1413         (General_options::General_options): Initialize endianness_.
1414         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
1415         New options.
1416         (General_options::Endianness): New enum.
1417         (General_options::endianness): New method.
1418         (General_options::endianness_): New data member.
1419         * parameters.cc (Parameters::set_options): Check target endianness.
1420         (Parameters::set_target_once): Ditto.
1421         (Parameters::check_target_endianness): New method.
1422         (parameters_force_valid_target): If either -EL or -EB is specified,
1423         use it to define endianness of default target.
1424         * parameters.h (Parameters::check_target_endianness): New method
1425         declaration.
1426         * target.h (class Target): Change "endianity" to "endianness"
1427         in comments.
1428
1429 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
1430
1431         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
1432         * configure: Regenerate.
1433         * Makefile.in: Regenerate.
1434         * testsuite/Makefile.in: Regenerate.
1435
1436 2010-04-06  Cary Coutant  <ccoutant@google.com>
1437
1438         gcc PR lto/42757
1439         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
1440         prevailing definitions of common symbols.
1441         * testsuite/plugin_test_6.sh: New test case.
1442         * testsuite/plugin_common_test_1.c: New test case.
1443         * testsuite/plugin_common_test_2.c: New test case.
1444         * testsuite/Makefile.am (plugin_test_6): New test case.
1445         * testsuite/Makefile.in: Regenerate.
1446
1447 2010-04-06  Nick Clifton  <nickc@redhat.com>
1448
1449         * po/vi.po: New Vietnamese translation.
1450
1451 2010-03-30  Doug Kwan  <dougkwan@google.com>
1452
1453         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
1454
1455 2010-03-25  Doug Kwan  <dougkwan@google.com>
1456
1457         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
1458         to avoid a conversion warning on a 32-bit host.
1459
1460 2010-03-24  Ian Lance Taylor  <iant@google.com>
1461
1462         * testsuite/script_test_3.t: Add a TLS segment.
1463         * testsuite/Makefile.am (check_PROGRAMS): Add
1464         tls_phdrs_script_test.
1465         (tls_phdrs_script_test_SOURCES): Define.
1466         (tls_phdrs_script_test_DEPENDENCIES): Define.
1467         (tls_phdrs_script_test_LDFLAGS): Define.
1468         (tls_phdrs_script_test_LDADD): Define.
1469         * testsuite/Makefile.in: Rebuild.
1470
1471 2010-03-23  Cary Coutant  <ccoutant@google.com>
1472
1473         * fileread.cc (find_or_make_view): Fix comment.
1474
1475 2010-03-23  Ian Lance Taylor  <iant@google.com>
1476
1477         * script-sections.cc (class Orphan_section_placement): Define
1478         PLACE_TLS and PLACE_TLS_BSS.
1479         (Orphan_section_placement::Orphan_section_placement): Initialize
1480         new places.
1481         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
1482         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
1483         (tls_script_test_SOURCES): Define.
1484         (tls_script_test_DEPENDENCIES): Define.
1485         (tls_script_test_LDFLAGS): Define.
1486         (tls_script_test_LDADD): Define.
1487         * testsuite/Makefile.in: Rebuild.
1488
1489 2010-03-22  Doug Kwan  <dougkwan@google.com>
1490
1491         * arm.cc (Arm_relocate_functions::abs8,
1492         Arm_relocate_functions::abs16): Use correct check for overflow
1493         specified in the ARM ELF specs.
1494         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
1495         target of a BLX instruction specially.
1496         (Reloc_stub::stub_type_for_reloc): Ditto.
1497         (Relocate::relocate): Use symbolic names instead of numeric relocation
1498         codes to report error.
1499         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
1500         workaround.
1501         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
1502         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
1503         thumb2_blx_out_of_range.stdout
1504         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
1505         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
1506         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
1507         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
1508         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
1509         thumb2_blx_in_range, thumb2_blx_in_range.o,
1510         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
1511         thumb2_blx_out_of_range.o): New rules.
1512         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
1513         thumb2_blx_in_range and thumb2_blx_out_of_range.
1514         * testsuite/Makefile.in: Regenerate.
1515         * arm_branch_in_range.sh: Add tests for THUMB BLX.
1516         * testsuite/thumb_blx_in_range.s: New file.
1517         * testsuite/thumb_blx_out_of_range.s: New file.
1518
1519 2010-03-22  Rafael Espindola  <espindola@google.com>
1520
1521         * archive.cc (Should_include): Move to archive.h.
1522         (should_include_member): Make it a member of Archive.
1523         (Lib_group): New.
1524         (Add_lib_group_symbols): New.
1525         * archive.h: Include options.h.
1526         (Archive_member): Moved from Archive.
1527         (Should_include): Moved from archive.cc.
1528         (Lib_group): New.
1529         (Add_lib_group_symbols): New.
1530         * dynobj.cc (do_should_include_member): New.
1531         * dynobj.h (do_should_include_member): New.
1532         * gold.cc (queue_initial_tasks): Update call to queue.
1533         * main.cc (main): Print lib group stats.
1534         * object.cc (do_should_include_member): New.
1535         * object.h: Include archive.h.
1536         (Object::should_include_member): New.
1537         (Object::do_should_include_member): New.
1538         (Sized_relobj::do_should_include_member): New.
1539         * options.cc (General_options::parse_start_lib): New.
1540         (General_options::parse_end_lib): New.
1541         (Input_arguments::add_file): Handle lib groups.
1542         (Input_arguments::start_group): Check we are not in a lib.
1543         (Input_arguments::start_lib): New.
1544         (Input_arguments::end_lib): New.
1545         * options.h (General_options): Add start_lib and end_lib.
1546         (Input_argument::lib_): New.
1547         (Input_argument::lib): New.
1548         (Input_argument::is_lib): New.
1549         (Input_file_lib): New.
1550         (Input_arguments::in_lib_): New.
1551         (Input_arguments::in_lib): New.
1552         (Input_arguments::start_lib): New.
1553         (Input_arguments::end_lib_): New.
1554         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
1555         in unused members as preempted.
1556         (Sized_pluginobj::do_should_include_member): New.
1557         * plugin.h (Sized_pluginobj::do_should_include_member): New.
1558         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
1559         return the blocker.
1560         (Read_symbols::do_whole_lib_group): New.
1561         (Read_symbols::do_lib_group): New.
1562         (Read_symbols::do_read_symbols): Handle lib groups.
1563         (Read_symbols::get_name): Handle lib groups.
1564         * readsyms.h (Read_symbols): Add an archive member pointer.
1565         (Read_symbols::do_whole_lib_group): New.
1566         (Read_symbols::do_lib_group): New.
1567         (Read_symbols::member_): New.
1568         * script.cc (read_input_script): Update call to queue_soon.
1569
1570 2010-03-19  Doug Kwan  <dougkwan@google.com>
1571
1572         * arm.cc (Stub_table::Stub_table): Initialize new data members
1573         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
1574         (Stub_table::add_reloc_stub): Assign stub offset and update
1575         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
1576         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
1577         New data members.
1578         (Stub_table::update_data_size_and_addralign): Use
1579         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
1580         instead of going over all reloc stubs.
1581         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
1582         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
1583         Stringpool_template::offset_ to size of Stringpool_char.
1584         (Stringpool_template::new_key_offset): Remove code to initialize
1585         Stringpool_template::offset_.
1586         * stringpool.h (Stringpool_template::set_no_zero_null): Set
1587         Stringpool_template::offset_ to zero.
1588
1589 2010-03-15  Doug Kwan  <dougkwan@google.com>
1590
1591         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
1592         offset_.
1593         (Stringpool_template::new_key_offset): New method.
1594         (Stringpool_template::add_string): Assign offsets when adding new
1595         strings.
1596         (Stringpool_template::set_string_offsets): Do not set string offsets
1597         when not optimizing.
1598         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
1599         member size_.
1600         (Chunked_vector::clear): Clear size_.
1601         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
1602         (Chunked_vector::size): Return size_.
1603         (Chunked_vector::push_back): Use size_ to find insert position.
1604         (Chunked_vector::size_): New data member.
1605         (Stringpool_template::set_no_zero_null): Assert string set is empty.
1606         (Stringpool_template::new_key_offset): New method declaration.
1607         (Stringpool_template::offset_): New data member.
1608
1609 2010-03-15   Rafael Espindola  <espindola@google.com>
1610
1611         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
1612         Add_symbols' constructor.
1613         * readsyms.h (Add_symbols): Remove the input_group member.
1614
1615 2010-03-10  Ian Lance Taylor  <iant@google.com>
1616
1617         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
1618         target to ask whether a reference to a symbol requires a stack
1619         split.
1620         * target.h (Target::is_call_to_non_split): New function.
1621         (Target::do_is_call_to_non_split): Declare virtual function.
1622         * target.cc: Include "symtab.h".
1623         (Target::do_is_call_to_non_split): New function.
1624         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
1625
1626 2010-03-10  Cary Coutant  <ccoutant@google.com>
1627
1628         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
1629         (File_read::open[1]): Remove initial mapping of whole_file_view_.
1630         (File_read::open[2]): Add whole_file_view_ to list of views.
1631         (File_read::make_view): Remove test of whole_file_view_.
1632         (File_read::find_or_make_view): Create whole_file_view_ if
1633         necessary.
1634         (File_read::clear_views): Replace bool parameter with enum;
1635         adjust all callers.  Don't delete views with permanent data;
1636         do delete cached views and views from archives if
1637         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
1638         if clearing the corresponding view.
1639         * fileread.h (File_read::Clear_views_mode): New enum.
1640         (File_read::View::is_permanent_view): New method.
1641         (File_read::clear_views): Replace bool parameter
1642         with enum; adjust all callers.
1643         * options.h (General_options): Change keep_files_mapped option;
1644         add map_whole_files.
1645         * readsyms.cc (Add_symbols::run): Delete sd_ object before
1646         releasing the file.
1647         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
1648         the file.
1649
1650 2010-03-10  David S. Miller  <davem@davemloft.net>
1651
1652         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
1653
1654 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
1655
1656         * icf.cc (get_section_contents): Add '@' marker after processing the
1657         merge reloc.
1658
1659 2010-03-08  Doug Kwan  <dougkwan@google.com>
1660
1661         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
1662         due to a conversion warning.
1663         (Arm_relobj::update_output_local_symbol_count): Check for local
1664         symbol with unset output index.
1665
1666 2010-03-05  Ian Lance Taylor  <iant@google.com>
1667
1668         * options.h (class General_options): Add --spare-dynamic-tags.
1669         * output.cc (Output_data_dynamic::set_final_data_size): Implement
1670         --spare-dynamic-tags.
1671
1672 2010-03-05  Ian Lance Taylor  <iant@google.com>
1673
1674         * incremental.cc: Include "libiberty.h".
1675
1676 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
1677
1678         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
1679         function, is_info_ member.
1680         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
1681         (Versions::Versions): Update caller.
1682         (Versions::define_base_version): Likewise.
1683         (Versions::add_def): Likewise.
1684
1685 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
1686
1687         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
1688         (Scan::possible_function_pointer_reloc): New function.
1689         (Scan::local_reloc_may_be_function_pointer): Change to call
1690         possible_function_pointer_reloc.
1691         (Scan::global_reloc_may_be_function_pointer): Ditto.
1692         * icf.h (Icf::check_section_for_function_pointers): Change to reject
1693         relocations in ".data.rel.ro._ZTV" section.
1694         * testsuite/icf_safe_so_test.sh: Change to pass i386.
1695         * testsuite/icf_safe_so_test.cc: Ditto.
1696         * testsuite/icf_safe_test.cc: Ditto.
1697         * testsuite/icf_safe_test.sh: Ditto.
1698
1699 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1700             Ian Lance Taylor  <iant@google.com>
1701
1702         * target-reloc.h (relocate_section): Check the symbol table index
1703         for -1U before setting the local symbol index.
1704         (scan_relocatable_relocs): If copying the relocation, record that
1705         the local symbol is required.
1706         * object.h (Symbol_value::is_output_symtab_index_set): New
1707         function.
1708         (Symbol_value::may_be_discarded_from_output_symtab): New
1709         function.
1710         (Symbol_value::has_output_symtab_entry): New function.
1711         (Symbol_value::needs_output_symtab_entry): Remove.
1712         (Symbol_value::output_symtab_index): Make sure the symbol index is
1713         set.
1714         (Symbol_value::set_output_symtab_index): Make sure the symbol
1715         index is not set.  Make sure the new index is valid.
1716         (Symbol_value::set_must_have_output_symtab_entry): New function.
1717         (Symbol_value::has_output_dynsym_entry): New function.
1718         (Symbol_value::set_output_dynsym_index): Make sure the new index
1719         is valid.
1720         (Sized_relobj::set_must_have_output_symtab_entry): New function.
1721         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
1722         local symbol if permitted.
1723         (Sized_relobj::do_finalize_local_symbols): Call
1724         is_output_symtab_index_set rather than needs_output_symtab_entry.
1725         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
1726         rather than needs_output_symtab_entry.  Call
1727         has_output_dynsym_entry rather than needs_output_dynsym_entry.
1728         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
1729         is_output_symtab_index_set rather than needs_output_symtab_entry.
1730         * testsuite/discard_locals_relocatable_test.c: New file.
1731         * testsuite/discard_locals_test.sh: Test -r.
1732         * testsuite/Makefile.am (check_DATA): Add
1733         discard_locals_relocatable_test1.syms,
1734         discard_local_relocatable_test2.syms.
1735         (MOSTLYCLEANFILES): Likewise.  Also add
1736         discard_locals_relocatable_test1.lout and
1737         discard_locals_relocatable_test2.out.
1738         (discard_locals_relocatable_test1.syms): New target.
1739         (discard_locals_relocatable_test.o): New target.
1740         (discard_locals_relocatable_test1.out): New target.
1741         (discard_locals_relocatable_test2.syms): New target.
1742         (discard_locals_relocatable_test2.out): New target.
1743         (various): Add missing ../ld-new dependencies.
1744         * testsuite/Makefile.in: Rebuild.
1745
1746 2010-03-03  Nick Clifton  <nickc@redhat.com>
1747
1748         * po/fi.po: New Finnish translation.
1749
1750 2010-03-01  Doug Kwan  <dougkwan@google.com>
1751
1752         * layout.cc (Layout::Layout): Force section types of .init_array*,
1753         .preinit_array* and .fini_array* sections.
1754         * output.cc (Output_section::Input_section_sort_entry::has_priority):
1755         Fix check of return value of std::string::find.().
1756         (Output_section::Input_section_sort_compare::operator()): Remove
1757         comment about .init_array.
1758         (Output_section::Input_section_sort_init_fini_compare::operator()):
1759         New method.
1760         (Output_section::sort_attached_input_sections): Handle .init_array
1761         and .fini_array specially.
1762         * output.h (Output_section::Inut_section_sort_compare): Update
1763         comment.
1764         (Output_section::Input_section_sort_init_fini_compare): New struct.
1765
1766 2010-02-26  Doug Kwan  <dougkwan@google.com>
1767
1768         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
1769         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
1770         * testsuite/debug_msg.sh: Avoid matching source line number for
1771         use of global variable undef_int.
1772
1773 2010-02-26  Doug Kwan  <dougkwan@google.com>
1774
1775         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
1776         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
1777         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
1778         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
1779         * options.cc (General_options::General_options): Initialize member
1780         fix_v4bx_.
1781         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
1782         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
1783         and rm_no_fix_v4bx.stdout
1784         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
1785         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
1786         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
1787         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
1788         and arm_no_fix_v4bx.
1789         * Makefile.in: Regenerate.
1790         * testsuite/arm_fix_v4bx.s: New file.
1791         * testsuite/arm_fix_v4bx.sh: Ditto.
1792
1793 2010-02-24  Doug Kwan  <dougkwan@google.com>
1794
1795         * arm.cc (Target_arm::got_section): Make the .got section the first
1796         non RELRO section in the data segment.
1797         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
1798         suffixes of section names.
1799
1800 2010-02-24  Doug Kwan  <dougkwan@google.com>
1801
1802         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
1803         flags and attributes merging if an input file is a binary file.
1804         * fileread.cc (Input_file::open): Record format of original file.
1805         * fileread.h (Input_file::Format): New enum type.
1806         (Input_file::Input_file): Initialize data member format_.
1807         (Input_file::format): New method definition.
1808         (Input_file::format_):: New data member.
1809
1810 2010-02-24  Doug Kwan  <dougkwan@google.com>
1811
1812         * arm.cc (Arm_output_data_got): New class.
1813         (ARM_TCB_SIZE): New constant
1814         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
1815         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
1816         If user uses a script with a SECTIONS clause, issue only a warning
1817         for a misplaced EXIDX input section.  Otherwise, issue an error.
1818         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
1819         garbage collection.
1820         (Target_arm::got_mode_index_entry): Handle static linking.
1821         (Target_arm::Scan::local): Ditto.
1822         (Target_arm::Scan::global): Ditto.
1823         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
1824         all incorrectly implemented relocations.
1825         (Target_arm::fix_exidx_coverage): Pass layout to
1826         Arm_output_section::fix_exidx_coverage.
1827         * layout.cc (Layout::section_name_mapping): Remove trailing dots
1828         from ".ARM.exidx." and ".ARM.extab.".
1829
1830 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1831
1832         * arm.cc (Target_arm::do_finalize_sections): Create attribute
1833         section if it does not already exist.
1834         * attributes.cc (Attributes_section_data::Attributes_section_data):
1835         Don't crash if size is zero.
1836
1837 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1838             Ian Lance Taylor  <iant@google.com>
1839
1840         * gold.cc (queue_middle_tasks): If no input files were opened,
1841         exit.
1842         * workqueue.h (Task_function::Task_function): Assert that there is
1843         a blocker.
1844
1845 2010-02-22  Doug Kwan  <dougkwan@google.com>
1846
1847         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
1848         * icf.cc (get_section_contents): Cast snprintf arguments to long long
1849         types to avoid warnings due to different uint64_t implementations
1850         on different hosts.
1851
1852 2010-02-21  Doug Kwan  <dougkwan@google.com>
1853
1854         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
1855         handling of the maximum backward branch offset.
1856         (Arm_relocate_functions::thumb_branch_common): Ditto.
1857         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
1858         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
1859         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
1860         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
1861         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
1862         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
1863         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
1864         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
1865         thumb_bl_out_of_range thumb_bl_out_of_range.o,
1866         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
1867         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
1868         thumb2_bl_out_of_range.o): New rules.
1869         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
1870         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
1871         thumb2_bl_out_of_range
1872         * testsuite/Makefile.in: Regenerate.
1873         * testsuite/arm_bl_in_range.s: New file.
1874         * testsuite/arm_bl_out_of_range.s: Ditto.
1875         * testsuite/arm_branch_in_range.sh: Ditto.
1876         * testsuite/arm_branch_range.t: Ditto.
1877         * testsuite/thumb2_branch_range.t: Ditto.
1878         * testsuite/thumb_bl_in_range.s: Ditto.
1879         * testsuite/thumb_bl_out_of_range.s: Ditto.
1880         * testsuite/thumb_branch_range.t: Ditto.
1881
1882 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
1883
1884         * gc.h (gc_process_relocs): Change vectors to point to the new list.
1885         Add reloc offset information.
1886         * icf.cc (get_section_contents): Change iterators to point to the new
1887         vectors. Add reloc offset information to the contents.
1888         * icf.h (Icf::Sections_reachable_info): New typedef.
1889         (Icf::Sections_reachable_list): New typedef.
1890         (Icf::Offset_info): New typedef.
1891         (Icf::Reloc_info): New struct typedef.
1892         (Icf::Reloc_info_list): New typedef.
1893         (Icf::symbol_reloc_list): Delete method.
1894         (Icf::addend_reloc_list): Delete method.
1895         (Icf::section_reloc_list): Delete method.
1896         (Icf::reloc_info_list): New method.
1897         (Icf::reloc_info_list_): New member.
1898
1899 2010-02-19  Doug Kwan  <dougkwan@google.com>
1900
1901         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
1902         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
1903         * arm.cc (Arm_relocation_functions): New forward declaration.
1904         (Target_arm::Target_arm): Initialize new data members
1905         got_mod_index_offset_ and tls_base_symbol_defined_.
1906         (Target_arm::Relocate::relocate_tls): New method.
1907         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
1908          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
1909         New methods.
1910         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
1911         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
1912         (Target_arm::got_mod_index_offset_,
1913         Target_arm::tls_base_symbol_defined_): New data members.
1914         (Target_arm::Scan::local, Target::Scan::global,
1915         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
1916         relocations.
1917
1918 2010-02-18  Doug Kwan  <dougkwan@google.com>
1919
1920         * arm.cc (Arm_relobj::find_linked_text_section): New method.
1921         (Arm_relobj::make_exidx_input_section): Pass section index of linked
1922         text section as a parameter becuase some broken tools may not set
1923         the link in section header.
1924         (Target_arm::has_got_section): New method.
1925         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
1926         without any mapping symbol as data only.  Remove warning.
1927         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
1928         link in its section header, try to discover the link by inspecting the
1929         REL31 relocation at the beginning of the section.
1930         (Target_arm::Scan::check_non_pic): Report name of offending relocation
1931         in error message.
1932         (Target_arm::Scan::global): Treat any reference to the symbol
1933         _GLOBAL_OFFSET_TABLE_ as a GOT access.
1934
1935 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
1936
1937         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
1938         (Scan::global_reloc_may_be_function_pointer): New function.
1939         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
1940         (Scan::global_reloc_may_be_function_pointer): New function.
1941         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
1942         (Scan::global_reloc_may_be_function_pointer): New function.
1943         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
1944         (Scan::global_reloc_may_be_function_pointer): New function.
1945         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
1946         (Scan::global_reloc_may_be_function_pointer): New function.
1947         (Scan::possible_function_pointer_reloc): New function.
1948         (Target_x86_64::can_check_for_function_pointers): New function.
1949         * gc.h (gc_process_relocs): Scan relocation types to determine if
1950         function pointers were taken for targets that support it.
1951         * icf.cc (Icf::find_identical_sections): Include functions for
1952         folding in safe ICF whose pointer is not taken.
1953         * icf.h (Secn_fptr_taken_set): New typedef.
1954         (fptr_section_id_): New member.
1955         (section_has_function_pointers): New function.
1956         (set_section_has_function_pointers): New function.
1957         (check_section_for_function_pointers): New function.
1958         * options.h: Fix comment for safe ICF option.
1959         * target.h (can_check_for_function_pointers): New function.
1960         * testsuite/Makefile.am: Add icf_safe_so_test test case.
1961         Modify icf_safe_test for X86-64.
1962         * testsuite/Makefile.in: Regenerate.
1963         * testsuite/icf_safe_so_test.cc: New file.
1964         * testsuite/icf_safe_so_test.sh: New file.
1965         * testsuite/icf_safe_test.cc (kept_func_3): New function.
1966         (main): Change to take pointer to function kept_func_3.
1967         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
1968         folding is done correctly for X86-64.
1969
1970 2010-02-12  David S. Miller  <davem@davemloft.net>
1971
1972         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
1973         is_symbolless parameter.
1974         (Output_reloc<SHT_REL>::is_symbolless): New.
1975         (Output_reloc<SHT_REL>::is_symbolless_): New.
1976         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
1977         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
1978         (Output_reloc<SHT_RELA>::is_symbolless): New.
1979         (Output_data_reloc::add_global): Handle is_symbolless.
1980         (Output_data_reloc::add_global_relative): Likewise.
1981         (Output_data_reloc::add_local): Likewise.
1982         (Output_data_reloc::add_local_relative): Likewise.
1983         (Output_data_reloc::add_symbolless_global_addend): New.
1984         (Output_data_reloc::add_symbolless_local_addend): New.
1985         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
1986         is_symbolless.
1987         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
1988         instead of ->is_relative_
1989         (Output_reloc::write): Likewise.
1990         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
1991         (Output_reloc::write_rel): Simplify.
1992
1993         * sparc.cc (Target_sparc::Scan::local): Use
1994         ->add_symbolless_local_addend as needed.
1995         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
1996         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
1997         based upon relocation offset.
1998
1999 2010-02-11  Doug Kwan  <dougkwan@google.com>
2000
2001         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
2002         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
2003         beginning of function.
2004         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
2005         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
2006         parameter is_32bit in calls to should_apply_static_reloc.
2007         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
2008         (check_DATA): Add arm_abs_global.stdout.
2009         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
2010         arm_abs_global.stdout): New rules.
2011         (MOSTLLYCLEANFILES): Add arm_abs_global
2012         * Makefile.in: Regenerate.
2013         * testsuite/arm_abs_global.s: New file.
2014         * testsuite/arm_abs_global.sh: Ditto.
2015         * testsuite/arm_abs_lib.s: Ditto.
2016
2017 2010-02-11  Ian Lance Taylor  <iant@google.com>
2018
2019         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
2020         Read_relocs task.
2021         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
2022         Allocate_commons_task first.
2023         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
2024         task, rather than symtab_lock_.
2025         (Gc_process_relocs::~Gc_process_relocs): New function.
2026         (Gc_process_relocs::is_runnable): Check this_blocker_.
2027         (Gc_process_relocs::locks): Use next_blocker_ rather than
2028         blocker_.
2029         (Scan_relocs::~Scan_relocs): New function.
2030         (Scan_relocs::is_runnable): Check this_blocker_ rather than
2031         symtab_lock_.
2032         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
2033         next_blocker_.
2034         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
2035         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
2036         constructor accordingly.
2037         (class Gc_process_relocs): Likewise.
2038         (class Scan_relocs): Likewise.
2039         * common.h (class Allocate_commons_task): Remove symtab_lock_
2040         field, and corresponding constructor parameter.
2041         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
2042         symtab_lock_.
2043         (Allocate_commons_task::locks): Likewise.
2044
2045 2010-02-11  Ian Lance Taylor  <iant@google.com>
2046
2047         * gold-threads.h (class Once): Define.
2048         (class Initialize_lock): Rewrite as child of Once.
2049         * gold-threads.cc (class Once_initialize): Define.
2050         (once_pointer_control): New static variable.
2051         (once_pointer, once_arg): New static variables.
2052         (c_run_once): New static function.
2053         (Once::Once, Once::run_once, Once::internal_run): New functions.
2054         (class Initialize_lock_once): Remove.
2055         (initialize_lock_control): Remove.
2056         (initialize_lock_pointer): Remove.
2057         (initialize_lock_once): Remove.
2058         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
2059         (Initialize_lock::initialize): Rewrite.
2060         (Initialize_lock::do_run_once): New function.
2061         * archive.cc (Archive::interpret_header): Only clear name if it is
2062         not already empty.
2063         * fileread.cc: Include "gold-threads.h"
2064         (file_counts_lock): New static variable.
2065         (file_counts_initialize_lock): Likewise.
2066         (File_read::release): Only increment counts when using --stats.
2067         Use a lock around the increment.
2068         * parameters.cc (class Set_parameters_target_once): Define.
2069         (set_parameters_target_once): New static variable.
2070         (Parameters::Parameters): Move here from parameters.h.
2071         (Parameters::set_target): Rewrite.
2072         (Parameters::set_target_once): New function.
2073         (Parameters::clear_target): Move here and rewrite.
2074         * parameters.h (class Parameters): Update declarations.  Add
2075         set_parameters_target_once_ field.
2076         (Parameters::Parameters): Move to parameters.cc.
2077         (Parameters::clear_target): Likewise.
2078         * readsyms.cc (Read_symbols::do_group): Create a Start_group
2079         task.
2080         (Start_group::~Start_group): New function.
2081         (Start_group::is_runnable): New function.
2082         (Start_group::locks, Start_group::run): New functions.
2083         (Finish_group::run): Change saw_undefined to size_t.
2084         * readsyms.h (class Start_group): Define.
2085         (class Finish_group): Change saw_undefined_ field to size_t.
2086         (Finish_group::Finish_group): Remove saw_undefined and
2087         this_blocker parameters.  Change all callers.
2088         (Finish_group::set_saw_undefined): New function.
2089         (Finish_group::set_blocker): New function.
2090         * symtab.h (class Symbol_table): Change saw_undefined to return
2091         size_t.  Change saw_undefined_ field to size_t.
2092         * target-select.cc (Set_target_once::do_run_once): New function.
2093         (Target_selector::Target_selector): Initialize set_target_once_
2094         field.  Don't initialize lock_ and initialize_lock_ fields.
2095         (Target_selector::instantiate_target): Rewrite.
2096         (Target_selector::set_target): New function.
2097         * target-select.h (class Set_target_once): Define.
2098         (class Target_selector): Update declarations.  Make
2099         Set_target_once a friend.  Remove lock_ and initialize_lock_
2100         fields.  Add set_target_once_ field.
2101
2102 2010-02-10  Ian Lance Taylor  <iant@google.com>
2103
2104         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
2105         queueing any tasks.
2106         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
2107         (queue_middle_tasks): Add all blockers before queueing any tasks.
2108         (queue_final_tasks): Likewise.
2109         * token.h (Task_token::add_blockers): New function.
2110         * object.h (Input_objects::number_of_relobjs): New function.
2111
2112 2010-02-10  Ian Lance Taylor  <iant@google.com>
2113
2114         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
2115         shared, not if not position independent.
2116         * x86_64.cc (Relocate::relocate_tls): Likewise.
2117         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
2118         (tls_pie_pic_test): New target.
2119         * testsuite/Makefile.in: Rebuild.
2120
2121         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
2122         (tls_test_main_pie.o, tls_test_pie.o): New targets.
2123         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
2124         * testsuite/Makefile.in: Rebuild.
2125
2126 2010-02-09  David S. Miller  <davem@davemloft.net>
2127
2128         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
2129         R_SPARC_RELATIVE using ->add_local_relative().
2130         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
2131
2132         * output.h (Output_data_dynamic::add_section_size): New method
2133         that takes two Output_data objects.
2134         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
2135         entry param.  Handle it in initializers.
2136         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
2137         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
2138         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
2139         arg.
2140         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
2141         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
2142         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
2143         for dynrel_includes_plt.
2144         * i386.cc (Target_i386::do_finalize_sections): Likewise.
2145         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2146         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
2147         before .rela.plt
2148         (Target_sparc::do_finalize_sections): Update to pass true for
2149         dynrel_includes_plt.
2150         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
2151         output before .rela.plt
2152         (Target_powerpc::do_finalize_sections): Update to pass true for
2153         dynrel_includes_plt when 32-bit.
2154
2155 2010-02-08  Doug Kwan  <dougkwan@google.com>
2156
2157         * arm.cc (Arm_relobj::simple_input_section_output_address): New
2158         method.
2159         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
2160         Arm_relobj::scan_section_for_cortex_a8_stubs,
2161         Arm_relobj::do_relocation_section): Instead of calling
2162         Output_section::output_address, use faster
2163         Arm_relobj::simple_input_section_output_address.
2164
2165 2010-02-08  David S. Miller  <davem@davemloft.net>
2166
2167         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
2168         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
2169         relocation helper function.
2170
2171         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
2172         just like R_SPARC_GOT{10,13,22}.
2173         (Target_sparc::Scan::local): Likewise.
2174         (Target_sparc::Relocate:relocate): Likewise.
2175
2176 2010-02-06  Ian Lance Taylor  <iant@google.com>
2177
2178         * configure.ac: Rewrite targetobjs duplicate removal code to use
2179         only shell constructs.
2180         * configure: Rebuild.
2181
2182 2010-02-05  Doug Kwan  <dougkwan@google.com>
2183
2184         PR 11247
2185         * arm.cc (Arm_relobj::section_is_scannable): New method.
2186         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
2187         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
2188
2189 2010-02-04  Doug Kwan  <dougkwan@google.com>
2190
2191         PR 11247
2192         * arm-reloc-property.cc (cstdio): Include.
2193         * configure.ac (targetobjs): Remove duplicates.
2194         * configure: Regenerate.
2195         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
2196         big and little endian version for a given address size.
2197
2198 2010-02-03  Doug Kwan  <dougkwan@google.com>
2199
2200         * arm-reloc-property.cc
2201         (Arm_reloc_property_table::reloc_name_in_error_message): New method
2202         definition.
2203         * arm-reloc-property.h
2204         (Arm_reloc_property_table::get_implemented_static_reloc_property):
2205         New method definition.
2206         (Arm_reloc_property_table::reloc_name_in_error_message): New method
2207         declaration.
2208         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
2209         overflow to N.
2210         (GOT_PREL): Change implemented to Y.
2211         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
2212         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
2213         (Arm_relocate_functions::movw_abs_nc): Remove method.
2214         (Arm_relocate_functions::movt_abs): Ditto.
2215         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
2216         (Arm_relocate_functions::thm_movt_abs): Ditto.
2217         (Arm_relocate_functions::movw_rel_nc): Ditto.
2218         (Arm_relocate_functions::movw_rel): Ditto.
2219         (Arm_relocate_functions::movt_rel): Ditto.
2220         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
2221         (Arm_relocate_functions:thm_movw_rel): Ditto.
2222         (Arm_relocate_functions:thm_movt_rel): Ditto.
2223         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
2224         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
2225         New method definitions.
2226         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
2227         (Arm_relocation_functions::arm_grp_ldr): Ditto.
2228         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
2229         (Arm_relocation_functions::arm_grp_ldc): Ditto.
2230         (Target_arm::Relocate::relocate): Check for non-static or
2231         unimplemented relocation code and exit early.  Change calls to
2232         Target_arm::reloc_uses_thumb_bit and
2233         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
2234         instead.  Refactor code to handle similar relocations to increase
2235         code sharing.  Remove check for unsupported relocation code in switch
2236         statement.
2237         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
2238         relocation property table to find out size.  Change error message to
2239         print out the name of a relocation code instead of the numeric value.
2240         (Target_arm::scan_reloc_for_stub): Use relocation property table
2241         instead of calling Target_arm::reloc_uses_thumb_bit().
2242
2243 2010-02-02  Doug Kwan  <dougkwan@google.com>
2244
2245         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
2246         types of relaxed input section.
2247
2248 2010-02-02  Doug Kwan  <dougkwan@google.com>
2249
2250         * Makefile.am (HFILES): Add arm-reloc-property.h.
2251         (DEFFILES): New.
2252         (TARGETSOURCES): Add arm-reloc-property.cc
2253         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
2254         (libgold_a_SOURCES): $(DEFFILES)
2255         * Makefile.in: Regenerate.
2256         * arm-reloc-property.cc: New file.
2257         * arm-reloc-property.h: New file.
2258         * arm-reloc.def: New file.
2259         * arm.cc: Update comments.
2260         (arm-reloc-property.h): New included header.
2261         (arm_reloc_property_table): New global variable.
2262         (Target_arm::do_select_as_default_target): New method definition.
2263         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
2264         arm-reloc-property to targ_extra_obj.
2265         * parameters.cc (set_parameters_target): Call
2266         Target::select_as_default_target().
2267         * target.h (Target::select_as_default_target): New method definition.
2268         (Target::do_select_as_default_target): Same.
2269
2270 2010-02-01  Doug Kwan  <dougkwan@google.com>
2271
2272         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
2273         first_output_text_section_.
2274         (Arm_exidx_fixup::first_output_text_section): New method definition.
2275         (Arm_exidx_fixup::first_output_text_section_): New data member.
2276         (Arm_exidx_fixup::process_exidx_section): Record the first text
2277         output section seen.
2278         (Arm_output_section::fix_exidx_coverage): Set correct linked section
2279         and entsize in output section header.
2280
2281 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2282
2283         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
2284         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
2285         (Arm_relocate_functions::thm_alu11): New Method.
2286         (Arm_relocate_functions::thm_pc8): New Method.
2287         (Arm_relocate_functions::thm_pc12): New Method.
2288         (Target_arm::Scan::local): Handle the relocations.
2289         (Target_arm::Scan::global): Likewise.
2290         (Target_arm::Relocate::relocate): Likewise.
2291         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
2292
2293 2010-01-29  Doug Kwan  <dougkwan@google.com>
2294
2295         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
2296         of relocation types as ld.
2297
2298 2010-01-29  Doug Kwan  <dougkwan@google.com>
2299
2300         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
2301         to public.
2302         (Arm_relocate_functions::thumb_branch_common): Ditto.
2303         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
2304         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
2305         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
2306         Arm_relocate_functions::jump24): Remove.
2307         (Target_arm::Relocate::relocate): Adjust code to call
2308         Arm_relocation_functions::arm_branch_common and
2309         Arm_relocation_functions::thumb_branch_common instead of their removed
2310         wrappers.  Merge switch-cases together to reduce source code size.
2311
2312 2010-01-29  Doug Kwan  <dougkwan@google.com>
2313
2314         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
2315         output_local_symbol_count_needs_update_.
2316         (Arm_relobj::output_local_symbol_count_needs_update,
2317          Arm_relobj::set_output_local_symbol_count_needs_update,
2318          Arm_relobj::update_output_local_symbol_count): New methods.
2319         (Arm_relobj::output_local_symbol_count_needs_update_): New data
2320         member.
2321         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
2322         of pointed function as in a R_ARM_PREL31 relocation.
2323         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
2324         for output local symbol count updating.
2325         (Target_arm::do_relax): Update output local symbol counts in objects
2326         if necessary.
2327         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
2328
2329 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2330
2331         * arm.cc: Added support for the ARM relocations:
2332         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
2333         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
2334         (Arm_relocate_functions::movw_rel_nc): Renamed (was
2335         movw_prel_nc).
2336         (Arm_relocate_functions::movw_rel): New method.
2337         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
2338         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
2339         thm_movw_prel_nc).
2340         (Arm_relocate_functions::thm_movw_rel): New method.
2341         (Arm_relocate_functions::thm_movt_rel): Renamed (was
2342         thm_movt_prel).
2343         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
2344         relocations.
2345         (Target_arm::Scan::global): Likewise.
2346         (Target_arm::Relocate::relocate): Likewise.
2347         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
2348         Likewise.
2349
2350 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2351
2352         * arm.cc: Added support for ARM group relocations.
2353         (Target_arm::reloc_needs_sym_origin): New method.
2354         (Arm_relocate_functions::calc_grp_kn): New method.
2355         (Arm_relocate_functions::calc_grp_residual): New method.
2356         (Arm_relocate_functions::calc_grp_gn): New method.
2357         (Arm_relocate_functions::arm_grp_alu): New Method.
2358         (Arm_relocate_functions::arm_grp_ldr): New Method.
2359         (Arm_relocate_functions::arm_grp_ldrs): New Method.
2360         (Arm_relocate_functions::arm_grp_ldc): New Method.
2361         (Target_arm::Scan::local): Handle the ARM group relocations.
2362         (Target_arm::Scan::global): Likewise.
2363         (Target_arm::Relocate::relocate): Likewise.
2364         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
2365         Likewise.
2366
2367 2010-01-26  Doug Kwan  <dougkwan@google.com>
2368
2369         * arm.cc (set): Include.
2370         (class Arm_exidx_fixup): Change type of last_input_section_ to const
2371         pointer type.
2372         (Arm_output_section::Text_section_list): New type.
2373         (Arm_output_section::append_text_sections_to_list): New method.
2374         (Arm_output_section::fix_exidx_coverage): Ditto.
2375         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
2376         (Arm_relobj::convert_input_section_to_relaxed_section): Use
2377         Relobj::set_section_offset() instead of
2378         Sized_relobj::invalidate_section_offset().
2379         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
2380         parameter for section headers. Ignore relocation sections for
2381         unallocated sections and EXIDX sections.
2382         (Target_arm::fix_exidx_coverage): New method.
2383         (Target_arm::output_section_address_less_than): New type.
2384         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
2385         linked text section instead of the EXIDX section.
2386         (Arm_output_section::create_stub_group): Add an assertion to check
2387         that this is not an EXIDX output section.
2388         (Arm_output_section::append_text_sections_to_list): New method.
2389         (Arm_output_section::fix_exidx_coverage): Ditto.
2390         (Arm_relobj::scan_sections_for_stubs): Adjust call to
2391         Arm_relobj::section_needs_reloc_stub_scanning.
2392         (Target_arm::do_relax): Fix EXIDX output section coverage in the
2393         first pass.
2394         (Target_arm::fix_exidx_coverage): New method.
2395         * object.h (Relobj::set_output_section): New method.
2396         (Sized_relobj::invalidate_section_offset): Remove method.
2397         (Sized_relobj::do_invalidate_section_offset): Remove method.
2398         (Sized_relobj::do_set_section_offset): Handle offset value -1.
2399
2400 2010-01-25  Doug Kwan  <dougkwan@google.com>
2401
2402         * arm.cc (Arm_exidx_merged_section::do_output_offset):
2403         Fix warning due to signed and unsigned comparison on a 32-bit host.
2404
2405 2010-01-22  Doug Kwan  <dougkwan@google.com>
2406
2407         * arm.cc (Target_arm::do_relax): Record an output section for section
2408         offset adjustment it contains any stub table that has changed.
2409         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
2410         offsets in an output section if necessary.
2411         * output.cc (Output_section::Output_section): Initialize
2412         section_offsets_need_adjustments_.
2413         (Output_section::add_input_section_for_script): Renamed to
2414         Output_section::add_simple_input_section.
2415         (Output_section::save_states): Add a comment.
2416         (Output_section::discard_states): New method defintion.
2417         (Output_section::adjust_section_offsets): Same.
2418         * output.h (Output_section::add_input_section_for_script): Renamed to
2419         Output_section::add_simple_input_section.
2420         (Output_section::discard_states): New method declaration.
2421         (Output_section::adjust_section_offsets): Same.
2422         (Output_section::section_offsets_need_adjustment,
2423         Output_section::set_section_offsets_need_adjustment): New method
2424         definitions.
2425         (Output_section::section_offsets_need_adjustment_): New data member.
2426         * script-sections.cc
2427         (Output_section_element_input::set_section_address): Adjust code for
2428         renaming of Output_section::add_input_section_for_script.
2429         (Orphan_output_section::set_section_address): Same.
2430
2431 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2432
2433         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
2434         Fix_v4bx enum values .
2435         * gold/options.h (General_options): New option definitions.
2436         (General_options::fix_v4bx): New method.
2437         (General_options::Fix_v4bx): New enum.
2438         * gold/options.cc (General_options::parse_fix_v4bx): New method.
2439         (General_options::parse_fix_v4bx_interworking): New method.
2440
2441 2010-01-22  Doug Kwan  <dougkwan@google.com>
2442
2443         * arm.cc (Arm_exidx_fixup): New class.
2444
2445 2010-01-21  Doug Kwan  <dougkwan@google.com>
2446
2447         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
2448         classes.
2449         (Arm_exidx_section_offset_map): New type.
2450
2451 2010-01-21  Doug Kwan  <dougkwan@google.com>
2452
2453         * arm.cc (Arm_exidx_input_section): New class.
2454         (Arm_relobj::exidx_input_section_by_link,
2455         Arm_relobj::exidx_input_section_by_shndx,
2456         Arm_relobj::make_exidx_input_section): New methods.
2457         (read_arm_attributes_section): Remove.
2458         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
2459         information about them.
2460         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
2461         to here.
2462
2463 2010-01-20  Doug Kwan  <dougkwan@google.com>
2464
2465         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
2466         Input_section_specifier to Section_id.
2467         (Target_arm::new_arm_input_section: Adjust code for change of key
2468         type.
2469         (Target_arm::find_arm_input_section): Ditto.
2470         * gc.h (object.h): Include for Section_id nand Section_id_hash.
2471         (Section_id): Remove.
2472         (Garbage_collection::Section_id_hash): Remove.
2473         * icf.h (object.h): Include for Section_id nand Section_id_hash.
2474         (Section_id): Remove.
2475         (Icf::Section_id_hash): Remove.
2476         * object.h (Section_id, Const_section_id, Section_id_hash,
2477         Const_section_id_hash): New type definitions.
2478         * output.cc (Output_section::add_relaxed_input_section): Change to
2479         use Const_section_id instead of Input_section_specifier as key type.
2480         (Output_section::add_merge_input_section): Ditto.
2481         (Output_section::build_relaxation_map): Change to use Section_id
2482         instead of Input_section_specifier as key type.
2483         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
2484         Ditto.
2485         (Output_section::convert_input_sections_to_relaxed_sections): Change
2486         to use Const_section_id instead of Input_section_specifier as key type.
2487         (Output_section::find_merge_section): Ditto.
2488         (Output_section::find_relaxed_input_section): Ditto.
2489         * output.h (Input_section_specifier): Remove class.
2490         (Output_section::Output_section_data_by_input_section_map): Change
2491         key type to Const_section_id.
2492         (Output_section::Output_relaxed_input_section_by_input_section_map):
2493         Ditto.
2494         (Output_section::Relaxation_map): Change key type to Section_id.
2495
2496 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2497
2498         * gold/arm.cc: Added support for R_ARM_V4BX relocation
2499         (class Arm_v4bx_stub): New class.
2500         (DEF_STUBS): Updated definition to support v4_veneer_bx.
2501         (Stub_factory::make_arm_v4bx_stub): New method.
2502         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
2503         (Stub_table::empty): Handle v4bx stubs.
2504         (Stub_table::add_arm_v4bx_stub): New method.
2505         (Stub_table::find_arm_v4bx_stub): New method.
2506         (Arm_relocate_functions::v4bx): New method.
2507         (Target_arm::fix_v4bx): New method.
2508         (Target_arm::Target_arm): Handle R_ARM_V4BX.
2509         (Stub_table::relocate_stubs): Likewise.
2510         (Stub_table::do_write): Likewise.
2511         (Stub_table::update_data_size_and_addralign): Likewise.
2512         (Stub_table::finalize_stubs):  Likewise.
2513         (Target_arm::Scan::local): Likewise.
2514         (Target_arm::Scan::global): Likewise.
2515         (Target_arm::do_finalize_sections): Likewise.
2516         (Target_arm::Relocate::relocate): Likewise.
2517         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
2518         Likewise.
2519         (Target_arm::scan_reloc_for_stub): Likewise.
2520         (Target_arm::scan_reloc_section_for_stubs): Likewise.
2521
2522 2010-01-19  Ian Lance Taylor  <iant@google.com>
2523
2524         * output.cc (Output_section_headers::do_sized_write): Write large
2525         segment count to sh_info field.
2526         (Output_file_header::do_sized_write): For large segment count,
2527         write PN_XNUM to e_phnum field.
2528
2529 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2530
2531         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
2532         (Arm_relocate_functions::thm_jump8): New function.
2533         (Arm_relocate_functions::thm_jump11): New function.
2534         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
2535         R_ARM_THM_JUMP11.
2536         (Target_arm::Scan::global): Likewise.
2537         (Target_arm::Relocate::relocate): Likewise.
2538         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
2539         Likewise.
2540
2541 2010-01-14  Doug Kwan  <dougkwan@google.com>
2542
2543         * arm.cc (map, utility): Include headers.
2544         (Target_arm::apply_cortex_a8_workaround): New method.
2545         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
2546         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
2547         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
2548         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
2549         the --[no-]fix-cortex-a8 command line options.
2550         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
2551         (Target_arm::relocate_stub): Use addend in instruction template.
2552         * options.h (DEFINE_bool): Set the user-set flag.
2553         (General_options): Add --[no-]-fix-cortex options.
2554         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
2555         : Update fast look-up map after conversion.
2556
2557 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
2558
2559         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
2560         in the first pass of do_layout.
2561
2562 2010-01-13  Doug Kwan  <dougkwan@google.com>
2563
2564         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
2565         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
2566         apparent compiler problem of not folding static constant integral
2567         data members of elfcpp::Elf_sizes<32>.
2568
2569 2010-01-13  Doug Kwan  <dougkwan@google.com>
2570
2571         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
2572         Arm_relobj::section_needs_cortex_a8_stub_scanning,
2573         Arm_relobj::scan_section_for_cortex_a8_erratum,
2574         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
2575         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
2576         sections to scan for relocation stubs into a new method
2577         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
2578         relocation and Cortex-A8 stub scanning.
2579         (Target_arm::do_relax): Force stubs to be after stubbed sections
2580         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
2581         the beginning of a new relaxation pass.  Update a comment.
2582         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
2583
2584 2010-01-12  Ian Lance Taylor  <iant@google.com>
2585
2586         * target-reloc.h (visibility_error): New inline function.
2587         (relocate_section): Call visibility_error.
2588         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
2589         (MOSTLYCLEANFILES): Likewise.
2590         (protected_4_pic.o, protected_3.err): New targets.
2591         * testsuite/protected_4.cc: New file.
2592
2593 2010-01-12  Doug Kwan  <dougkwan@google.com>
2594
2595         * arm.cc (Cortex_a8_reloc): New class.
2596         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
2597         and cortex_a8_relocs_info_.
2598         (Target_arm::fix_cortex_a8): New method definition.
2599         (Target_arm::Cortex_a8_relocs_info): New type.
2600         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
2601         New data member declarations.
2602         (Target_arm::scan_reloc_for_stub): Record information about
2603         relocations for THUMB branches that might be exempted from the
2604         Cortex-A8 workaround.
2605         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
2606         at the beginning of a relaxation pass.
2607
2608 2010-01-12  Doug Kwan  <dougkwan@google.com>
2609
2610         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
2611         (Arm_relobj::Mapping_symbol_position,
2612          Arm_reloj::Mapping_symbol_position_less,
2613          Arm_relobj::Mapping_symbols_info): New types.
2614         (Target_arm::is_mapping_symbol_name): New method definition.
2615         (Arm_relobj::do_count_local_symbols): Save information about mapping
2616         symbols.
2617
2618 2010-01-11  Doug Kwan  <dougkwan@google.com>
2619
2620         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
2621         Arm_relocate_functions::thumb32_branch_upper,
2622         Arm_relocate_functions::thumb32_branch_lower,
2623         Arm_relocate_functions::thumb32_cond_branch_offset,
2624         Arm_relocate_functions::thumb32_cond_branch_upper,
2625         Arm_relocate_functions::thumb32_cond_branch_lower,
2626         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
2627         branch offset encoding.
2628         (Arm_relocate_functions::thumb_branch_common): Use new branch
2629         offset encoding methods to avoid code duplication.
2630         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
2631         (Stub_addend_reader::operator()): Use new branch encoding method
2632         to avoid code duplication.
2633
2634 2010-01-11  Doug Kwan  <dougkwan@google.com>
2635
2636         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
2637         (Target_arm::do_finalize_sections): Define special EXIDX section
2638         symbols only if referenced.
2639         * gc.h (Garbage_collection::add_reference): New method.
2640         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
2641         code duplication.
2642
2643 2010-01-11  Ian Lance Taylor  <iant@google.com>
2644
2645         * script.cc (Version_script_info::build_expression_list_lookup):
2646         Change complaing about duplicate wildcard match from error to
2647         warning.
2648
2649         * script.cc (class Lazy_demangler): Recreate--revert part of patch
2650         of 2009-12-30.
2651         (Version_script_info::Version_script_info): Initialize globs_,
2652         default_version_, default_is_global_, and exact_.  Don't
2653         initialize globals_ or locals_.
2654         (Version_script_info::build_lookup_tables): Build local symbols
2655         first.
2656         (Version_script_info::unquote): New function.
2657         (Version_script_info::add_exact_match): New function.
2658         (Version_script_info::build_expression_list_lookup): Remove lookup
2659         parameter.  Add is_global parameter.  Change all callers.  Handle
2660         wildcard pattern specially.  Unquote pattern.  Call
2661         add_exact_match.
2662         (Version_script_info::get_name_to_match): New function.
2663         (Version_script_info::get_symbol_version): New function.
2664         (Version_script_info::get_symbol_version_helper): Remove.
2665         (Version_script_info::check_unmatched_names): Call unquote.
2666         * script.h (class Version_script_info): Change get_symbol_version
2667         to be non-inline and add is_global parameter; change all callers.
2668         Rewrite symbol_is_local.  Update declarations.  Define struct
2669         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
2670         Remove globals_ and locals_ members.  Add exact_, globs_,
2671         default_version_, is_global_.
2672         (Version_script_info::Glob): Remove pattern, add expression and
2673         is_global.  Update constructor.  Change all callers.
2674         * dynobj.cc (Versions::finalize): Mark the version symbol as the
2675         default version.
2676         (Versions::symbol_section_contents): If a symbol is undefined, or
2677         defined in a dynamic object, set the version index to
2678         VER_NDX_LOCAL.
2679         * symtab.cc (Symbol_table::add_from_relobj): Don't call
2680         symbol_is_local.
2681         (Symbol_table::add_from_pluginobj): Likewise.
2682         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
2683
2684 2010-01-11  Doug Kwan  <dougkwan@google.com>
2685
2686         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
2687         (incremental_dump_LDADD): Add linking option for libintl.
2688         * Makefile.in: Regenerate.
2689
2690 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
2691
2692         PR gold/11144
2693         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
2694         instead of -Ds.
2695         * testsuite/Makefile.in: Regenerated.
2696
2697 2010-01-10  Doug Kwan  <dougkwan@google.com>
2698
2699         * options.h (DEFINE_var): Use parentheses around argument varname__
2700         in macro body to avoid any unintended subsequent substitutions.
2701
2702 2010-01-10  Ian Lance Taylor  <iant@google.com>
2703
2704         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
2705         candidates before doing symbol resolution.
2706
2707         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
2708         ODR candidates if only one is weak.
2709
2710 2010-01-08  Ian Lance Taylor  <iant@google.com>
2711
2712         * script.cc (Version_script_info::build_expression_list_lookup):
2713         Don't warn about ambiguous version, just record the ambiguity.
2714         (Version_script_info::get_symbol_version_helper): Give error if
2715         version is ambiguous.
2716
2717 2010-01-08  Doug Kwan  <dougkwan@google.com>
2718
2719         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
2720           prev_data_size_ and prev_addralign_.  Remove initializer for
2721           deleted data member has_been_changed_.
2722           (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
2723           to determine if the table is empty.
2724           (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
2725           Remove.
2726           (Stub_table::add_reloc_stub): Define method in class definition
2727           instead of just declaring it there.
2728           (Stub_table::add_cortex_a8_stub): New method definition.
2729           (Stub_table::update_data_size_and_addralign): Ditto.
2730           (Stub_table::finalize_stubs): Ditto.
2731           (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
2732           (Stub_table::do_addralign_): Return address alignment in the
2733           (Stub_table::do_reset_address_and_file_offset): Define method in
2734           class definition instead of declaring it there.  Set current data
2735           size to be the data size of the previous pass.
2736           (Stub_table::set_final_data_size): Use current data size as the
2737           final data size.
2738           (Stub_table::relocate_stub): Change parameter type of stub from
2739           Reloc_stub pointer to Stub pointer.
2740           (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
2741           (Stub_table::Cortex_a8_stub_list): New typedef.
2742           (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
2743            Stub_table::prev_addralign_): New data member.
2744           (Arm_relobj::Arm_relobj): Initialize data member
2745           section_has_cortex_a8_workaround_.
2746           (Arm_relobj::section_has_cortex_a8_workaround,
2747            Arm_relobj::mark_section_for_cortex_a8_workaround): New method
2748            definitions.
2749           (Arm_relobj::section_has_cortex_a8_workaround_): New data member
2750           declarations.
2751           (Target_arm::relocate_stub): Change parameter type of stub from
2752           Reloc_stub pointer to Stub pointer.
2753           (Insn_template::size, Insn_template::alignment): Handle
2754           THUMB16_SPECIAL_TYPE.
2755           (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
2756            Stub_table::update_data_size_and_addralign,
2757            Stub_table::apply_cortex_a8_workaround_to_address_range): New method
2758           definitions.
2759           (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
2760           (Stub_table::do_write): Ditto.
2761           (Target_arm::do_relax): Adjust code for changes in Stub_table.
2762
2763 2010-01-08  Ian Lance Taylor  <iant@google.com>
2764
2765         PR 11108
2766         * symtab.h (class Symbol): Remove fields is_target_special_ and
2767         has_plt_offset_.  Add field is_defined_in_discarded_section_.
2768         (Symbol::is_defined_in_discarded_section): New function.
2769         (Symbol::set_is_defined_in_discarded_section): New function.
2770         (Symbol::has_plt_offset): Rewrite.
2771         (Symbol::set_plt_offset): Verify that new offset is not -1U.
2772         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
2773         Don't initialize is_target_special_ or has_plt_offset_.
2774         Initialize is_defined_in_discarded_section_.
2775         (Symbol_table::add_from_relobj): If appropriate, set
2776         is_defined_in_discarded_section.
2777         * resolve.cc (Symbol::override_base_with_special): Don't test
2778         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
2779         * target-reloc.h (relocate_section): Do special handling for
2780         symbols defined in discarded sections for global symbols as well
2781         as local symbols.
2782
2783 2010-01-08  Ian Lance Taylor  <iant@google.com>
2784
2785         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
2786         the SHT_SYMTAB case.
2787
2788 2010-01-08  Ian Lance Taylor  <iant@google.com>
2789
2790         * object.cc (Sized_relobj::do_layout): Don't get confused if
2791         layout_eh_frame returns NULL.
2792
2793 2010-01-08  Ian Lance Taylor  <iant@google.com>
2794
2795         PR 11084
2796         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
2797         dynamic symbol table, use the normal symbol table.
2798         (Sized_dynobj::do_read_symbols): Remove assertion about type of
2799         symbol table.
2800
2801 2010-01-08  Ian Lance Taylor  <iant@google.com>
2802
2803         PR 11072
2804         * layout.cc (Layout::include_section): Remove .gnu_debuglink
2805         sections.
2806
2807 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
2808
2809         * version.cc (print_version): Change to "Copyright 2010".
2810
2811 2010-01-08  Ian Lance Taylor  <iant@google.com>
2812
2813         PR 10287
2814         PR 11063
2815         * i386.cc (class Target_i386): Change return type of plt_section
2816         to be non-const.
2817         (class Output_data_plt_i386): Add tls_desc_rel_ field.
2818         (Output_data_plt_i386::Output_data_plt_i386): Initialize
2819         tls_desc_rel_ field.
2820         (Output_data_plt_i386::rel_tls_desc): New function.
2821         (Target_i386::rel_tls_desc_section): New function.
2822         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
2823         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
2824         R_386_TLS_DESC reloc in rel_tls_desc_section.
2825         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
2826         Define struct Tlsdesc_info.
2827         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
2828         (Target_x86_64::do_reloc_symbol_index): New function.
2829         (Target_x86_64::add_tlsdesc_info): New function.
2830         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
2831         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
2832         tlsdesc_rel_ field.
2833         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
2834         all callers.
2835         (Output_data_plt_x86_64::rela_tlsdesc): New function.
2836         (Target_x86_64::rela_tlsdesc_section): New function.
2837         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
2838         handling.
2839         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
2840         (Target_x86_64::do_reloc_addend): New function.
2841         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
2842         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
2843         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
2844         (Output_reloc::type): New function.
2845         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
2846         (Output_reloc::is_target_specific): New function.
2847         (Output_reloc::target_arg): New function.
2848         (class Output_reloc) [SHT_RELA]: Add four new constructors for
2849         absolute relocs and target specific relocs.
2850         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
2851         add_target_specific.
2852         (class Output_data_reloc) [SHT_RELA]: Likewise.
2853         * output.cc (Output_reloc::Output_reloc): Add four new versions
2854         for absolute relocs and target specific relocs.
2855         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
2856         (Output_reloc::get_symbol_index): Likewise.
2857         (Output_reloc::local_section_offset): Check that local_sym_index_
2858         is not TARGET_CODE or 0.
2859         (Output_reloc::symbol_value): Likewise.
2860         (Output_reloc::write) [SHT_RELA]: Call target for target specific
2861         reloc.
2862         * target.h (class Target): Add reloc_symbol_index and reloc_addend
2863         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
2864         functions.
2865         * layout.cc (add_target_dynamic_tags): Use output section for
2866         DT_PLTRELSZ and DT_JMPREL.
2867
2868 2010-01-07  Ian Lance Taylor  <iant@google.com>
2869
2870         PR 11061
2871         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
2872         function.
2873         (class Output_data_reloc_generic): Define.
2874         (class Output_data_reloc_base): Change base class to
2875         Output_data_reloc_generic.  Change add() method to call
2876         bump_relative_reloc_count for a relative reloc.  Remove
2877         sort_relocs_ field.
2878         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
2879         to sort_relocs().
2880         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
2881         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
2882         appropriate.
2883         * layout.h (class Layout): Update declaration.
2884
2885 2010-01-07  Ian Lance Taylor  <iant@google.com>
2886
2887         * output.h (class Output_data): Add const version of
2888         output_section and do_output_section.
2889         (class Output_section_data): Add const version of
2890         do_output_section.
2891         (class Output_section): Likewise.
2892         * layout.cc (Layout::add_target_dynamic_tags): New function.
2893         * layout.h (class Layout): Update declarations.
2894         * arm.cc (Target_arm::do_finalize_sections): Use
2895         add_target_dynamic_tags.
2896         * i386.cc (Target_i386::do_finalize_sections): Likewise.
2897         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
2898         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
2899         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2900
2901 2010-01-07  Ian Lance Taylor  <iant@google.com>
2902
2903         PR 11042
2904         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
2905         object as needed.
2906
2907 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
2908             Ian Lance Taylor  <iant@google.com>
2909
2910         PR 11019
2911         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
2912         Xindex::read_symtab_xindex.
2913
2914 2010-01-07  Doug Kwan  <dougkwan@google.com>
2915
2916         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
2917         (Insn_template::thumb16_bcond_insn): New method declaration.
2918         (Insn_template): Fix spelling.
2919         (Stub::thumb16_special): New method declaration.
2920         (Stub::do_write): Define virtual method which was previously pure
2921         virtual.
2922         (Stub::do_thumb16_special): New method declaration.
2923         (Stub::do_fixed_endian_write): New template member.
2924         (Reloc_stub::do_write): Remove.
2925         (Reloc_stub::do_fixed_endian_write): Remove.
2926         (Cortex_a8_stub): New class definition.
2927         (Stub_factory::make_cortex_a8_stub): New method definition.
2928         (Stub_factory::Stub_factory): Add missing static storage class
2929         qualifier for elf32_arm_stub_a8_veneer_blx.
2930
2931 2010-01-07  Ian Lance Taylor  <iant@google.com>
2932
2933         PR 10980
2934         * options.h (class General_options): Add --warn-unresolved-symbols
2935         and --error-unresolved-symbols.
2936         * errors.cc (Errors::undefined_symbol): Implement
2937         --warn-unresolved-symbols.
2938
2939         * options.h (class General_options): Add -z text and -z textoff.
2940         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
2941
2942 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
2943
2944         * gc.h (Garbage_collection::Cident_section_map): New typedef.
2945         (Garbage_collection::cident_sections): New function.
2946         (Garbage_collection::add_cident_section): New function.
2947         (Garbage_collection::cident_sections_): New member.
2948         (gc_process_relocs): Add references to sections whose names are C
2949         identifiers.
2950         * gold.h (cident_section_start_prefix): New constant.
2951         (cident_section_stop_prefix): New constant.
2952         (is_cident): New function.
2953         * layout.cc (Layout::define_section_symbols): Replace string constants
2954         with the newly defined constants.
2955         * object.cc (Sized_relobj::do_layout): Track sections whose names are
2956         C identifiers.
2957         * testsuite/Makefile.am: Add gc_orphan_section_test.
2958         * testsuite/Makefile.in: Regenerate.
2959         * testsuite/gc_orphan_section_test.cc: New file.
2960         * testsuite/gc_orphan_section_test.sh: New file.
2961
2962 2010-01-06  Ian Lance Taylor  <iant@google.com>
2963
2964         PR 10980
2965         * options.h (class General_options): Add --warn-shared-textrel.
2966         * layout.cc (Layout::finish_dynamic_section): Implement
2967         --warn-shared-textrel.
2968
2969         PR 10980
2970         * options.h (class General_options): Add --warn-multiple-gp.
2971
2972 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2973
2974         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
2975         $(THREADSLIB) and $(LIBDL).
2976         * Makefile.in: Rebuild.
2977
2978 2010-01-06  Ian Lance Taylor  <iant@google.com>
2979
2980         PR 10980
2981         * options.cc (General_options::parse_section_start): New function.
2982         (General_options::section_start): New function.
2983         (General_options::General_options): Initialize all members.
2984         * options.h: Include <map>
2985         (class General_options): Add --section-start.  Add section_starts_
2986         member.
2987         * layout.cc (Layout::attach_allocated_section_to_segment): If
2988         --section-start was used, set the address of the segment.  Remove
2989         local sort_sections.
2990         (Layout::relaxation_loop_body): If the address of the load segment
2991         has been set by --section-start, don't use it.
2992         * output.h (Output_segment::update_flags_for_output_section): New
2993         function.
2994         * output.cc (Output_segment::add_output_section): Call
2995         update_flags_for_output_section.
2996
2997 2010-01-05  Ian Lance Taylor  <iant@google.com>
2998
2999         PR 10980
3000         * options.h (class General_options): Add --undefined-version.
3001         * script.cc (struct Version_expression): Add was_matched_by_symbol
3002         field.
3003         (Version_script_info::matched_symbol): New function.
3004         (Version_script_info::get_symbol_version_helper): Call
3005         matched_symbol.
3006         (Version_script_info::check_unmatched_names): New function.
3007         * script.h (class Version_script_info): Update declarations.
3008         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
3009
3010         * options.h (class General_options): Use DEFINE_bool_alias for
3011         allow_multiple_definition.
3012         * resolve.cc (Symbol_table::should_override): Don't test
3013         allow_multiple_definition.
3014
3015         PR 10980
3016         * options.h (class General_options): Add --cref.
3017         * main.cc (main): Print cref table if --cref.  Don't close mapfile
3018         until after printing cref table.
3019         * cref.cc: Include "symtab.h".
3020         (class Cref_inputs): Define Cref_table_compare and Cref_table.
3021         (Cref_table_compare::operator()): New function.
3022         (Cref_inputs::gather_cref): New function.
3023         (filecol): New static const.
3024         (Cref_inputs::print_cref): New function.
3025         (Cref::print_cref): New function.
3026         * cref.h: Include <cstdio>.
3027         (class Cref): Update declarations.
3028         * mapfile.h (Mapfile::file): New function.
3029         * object.h (class Object): Define Symbols.  Declare virtual
3030         do_get_global_symbols.
3031         (Object::get_global_symbols): New function.
3032         * object.cc (Input_objects::add_object): Pass object to cref_ if
3033         --cref.
3034         (Input_objects::archive_start): Likewise.
3035         (Input_objects::archive_stop): Likewise.
3036         (Input_objects::print_cref): New function.
3037         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
3038         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
3039         --cref.
3040         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
3041         function.
3042         * plugin.h (class Sized_pluginobj): Update declarations.
3043
3044 2010-01-05  Ian Lance Taylor  <iant@google.com>
3045
3046         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
3047         to is_default_version.  Rename insdef to insdefault.
3048         (Symbol_table::add_from_relobj): Rename def to is_default_version
3049         and local to is_forced_local.
3050         (Symbol_table::add_from_pluginobj): Likewise.
3051         (Symbol_table::add_from_dynobj): Likewise.
3052         (Symbol_table::define_special_symbol): Rename insdef to
3053         insdefault.
3054
3055 2010-01-04  Ian Lance Taylor  <iant@google.com>
3056
3057         PR 10980
3058         * options.h (class General_options): Add
3059         --allow-multiple-definition and -z muldefs.
3060         * resolve.cc (Symbol_table::should_override): Don't warn about a
3061         multiple symbol definition if --allow-multiple-definition or -z
3062         muldefs.
3063
3064         PR 10980
3065         * options.h (class General_options): Add --add-needed and
3066         --copy-dt-needed-entries.  Tweak --as-needed help entry.
3067         * object.cc (Input_objects::check_dynamic_dependencies): Give an
3068         error if --copy-dt-needed-entries aka --add-needed is used and
3069         would cause a change in behaviour.
3070
3071         PR 10980
3072         * options.h (class General_options): Add -G as a short version of
3073         --shared.  Add no-op options -assert, -g, and -i.
3074
3075 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
3076
3077         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
3078         check for .text or .gnu.linkonce.t sections.
3079         * icf.cc (Icf::find_identical_sections): Ditto.
3080         Change the detection for mangled function name within the section
3081         name.
3082         * icf.h (is_section_foldable_candidate): New function.
3083
3084 2009-12-30  Ian Lance Taylor  <iant@google.com>
3085
3086         PR 10980
3087         * options.h (class General_options): Permit two dashes with
3088         --retain-symbols-file.
3089
3090 2009-12-30  Ian Lance Taylor  <iant@google.com>
3091
3092         PR 10979
3093         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
3094         don't put the file header and segment headers in the text
3095         segment.
3096
3097         PR 10979
3098         * common.cc (Sort_commons::operator()): Stabilize sort when both
3099         entries are NULL.
3100         (Symbol_table::do_allocate_commons_list): When allocating common
3101         symbols, skip a symbol which is no longer common.
3102         * symtab.h (Symbol::is_common): Test whether the symbol comes from
3103         an object before checking its type.
3104         * testsuite/common_test_2.c: New file.
3105         * testsuite/common_test_3.c: New file.
3106         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
3107         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
3108         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
3109         (common_test_2_pic.o, common_test_2.so): New targets.
3110         (common_test_3_pic.o, common_test_3.so): New targets.
3111         * testsuite/Makefile.in: Rebuild.
3112
3113         PR 10979
3114         * script.cc (read_input_script): If we see a new SECTIONS clause,
3115         and we have added an input section, give an error.
3116         * layout.h (class Layout): Add have_added_input_section function.
3117         Add have_added_input_section_ field.
3118         * layout.cc (Layout::Layout): Initialize
3119         have_added_input_section_.
3120         (Layout::layout): Set have_added_input_section_.
3121         (Layout::layout_eh_frame): Likewise.
3122
3123 2009-12-30  Ian Lance Taylor  <iant@google.com>
3124
3125         PR 10931
3126         * options.h (class General_options): Add --sort-common option.
3127         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
3128         * common.cc (Sort_common): Add sort_order parameter to
3129         constructor.  Add sort_order_ field.
3130         (Sort_commons::operator): Check sort_order_.
3131         (Symbol_table::allocate_commons): Determine the sort order.
3132         (Symbol_table::do_allocate_commons): Add sort_order parameter.
3133         Change all callers.
3134         (Symbol_table::do_allocate_commons_list): Likewise.
3135
3136 2009-12-30  Ian Lance Taylor  <iant@google.com>
3137
3138         PR 10916
3139         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
3140         symbols from this object, don't change the visibility of an
3141         undefined symbol.
3142         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
3143
3144 2009-12-30  Ian Lance Taylor  <iant@google.com>
3145
3146         PR 10861
3147         * script.h (class Version_script_info): Define Language enum.
3148         Update declarations.  Define Glob, Exact, and Lookup types.  Add
3149         new fields globals_, locals_, and is_finalized_.
3150         * script.cc: Various formatting fixes.
3151         (class Parser_closure): Change language_stack_ from a vector of
3152         std::string to one of Version_script_info::Language.  Adjust all
3153         uses accordingly.
3154         (class Lazy_demangler): Remove.
3155         (struct Version_expression): Change language from std::string to
3156         Version_script_info::Language.
3157         (Version_script_info::Version_script_info): New function.
3158         (Version_script_info::~Version_script_info): Don't call clear.
3159         (Version_script_info::finalize): New function.
3160         (Version_script_info::build_lookup_tables): New function.
3161         (Version_script_info::build_expression_list_lookup): New
3162         function.
3163         (Version_script_info::get_symbol_version_helper): Rewrite to use
3164         lookup tables.
3165         (Version_script_info::print_expression_list): Adjust to use
3166         Version_script_info::Language.
3167         (script_push_lex_into_version_mode): Check that the version script
3168         has not been finalized.
3169         (version_script_push_lang): Change language string to
3170         Version_script_info::Language.
3171         * options.cc (Command_line::version_script): New function.
3172         * options.h (class General_options): Add finalize_dynamic_list
3173         function.  Change version_script from declaration to definition.
3174         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
3175         * testsuite/version_script.map: Remove duplicate def of foo.
3176         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
3177         version_script.map.
3178         * testsuite/Makefile.in: Rebuild.
3179
3180 2009-12-30  Ian Lance Taylor  <iant@google.com>
3181
3182         PR 10843
3183         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
3184         if the input symbol index is 0, make the output symbol index 0.
3185
3186 2009-12-30  Ian Lance Taylor  <iant@google.com>
3187
3188         PR 10670
3189         * options.h (class General_options): Add -x/--discard-all.
3190         * object.cc (Sized_relobj::do_count_local_symbols): Handle
3191         --discard-all.  If the local symbol needs a dynamic entry, check
3192         that before handling --discard-locals.
3193
3194 2009-12-30  Ian Lance Taylor  <iant@google.com>
3195
3196         PR 10450
3197         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
3198         flags to PF_R.
3199         (Output_segment::add_output_section): Don't change the flags if
3200         the type is PT_TLS.
3201
3202         PR 10450
3203         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
3204         GNU hash table if they need a dynamic value.  Otherwise, don't add
3205         them if they are defined in a dynamic object or are forced local.
3206
3207 2009-12-29  Ian Lance Taylor  <iant@google.com>
3208
3209         PR 10450
3210         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
3211         .gnu.hash table for a 32-bit target.
3212
3213         PR 10450
3214         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
3215         regular and a dynamic object only needs a dynamic symbol table
3216         entry if it is externally visible.
3217
3218         PR 10450
3219         * i386.cc (class Target_i386): Initialize global_offset_table_ in
3220         constructor.  Add global_offset_table_ field.
3221         (Target_i386::got_section): Set global_offset_table_.
3222         (Target_i386::do_finalize_sections): Set global_offset_table_
3223         size.
3224         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
3225         in constructor.  Add global_offset_table_ field.
3226         (Target_x86_64::got_section): Set global_offset_table_.
3227         (Target_x86_64::do_finalize_sections): Set global_offset_table_
3228         size.
3229
3230         * layout.cc (Layout::Layout): Initialize increase_relro_.
3231         (Layout::get_output_section): Add is_relro, is_last_relro, and
3232         is_first_non_relro parameters.  Change all callers.
3233         (Layout::choose_output_section): Likewise.
3234         (Layout::add_output_section_data): Likewise.
3235         (Layout::make_output_section): Likewise.
3236         (Layout::set_segment_offsets): Clear increase_relro when using a
3237         linker script.
3238         * layout.h (class Layout): Add increase_relro method.  Add
3239         increase_relro_ field.  Update declarations.
3240         * output.cc (Output_section::Output_section): Initialize
3241         is_last_relro_ and is_first_non_relro_.
3242         (Output_segment::add_output_section): Group relro sections is
3243         do_sort is true.  Handle is_last_relro and is_first_non_relro.
3244         (Output_segment::maximum_alignment): Remove relro handling.
3245         (Output_segment::set_section_addresses): Add increase_relro
3246         parameter.  Change all callers.  Add initial alignment to align
3247         relro sections on separate page.  Remove old relro handling.
3248         (Output_segment::set_section_list_addresses): Remove in_relro
3249         parameter.  Change all callers.
3250         (Output_segment::set_offset): Add increase parameter.  Change all
3251         callers.  Remove old relro handling.
3252         * output.h (class Output_section): Add new methods: is_last_relro,
3253         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
3254         Add is_last_relro_ and is_first_non_relro_ fields.
3255         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
3256         Create separate .got.plt section.  Call increase_relro.
3257         * x86_64.cc (Target_x86_64::got_section): Likewise.
3258         * testsuite/relro_script_test.t: Add .got.plt.
3259
3260         PR 10450
3261         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
3262         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
3263         (Layout::finalize): Call set_dynamic_symbol_size.
3264         (Layout::set_dynamic_symbol_size): New function.
3265         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
3266         set_dynamic_symbol_size.
3267
3268         PR 10450
3269         * output.h (class Output_section): Add is_entsize_zero_ field.
3270         * output.cc (Output_section::Output_section): Initialize
3271         is_entsize_zero_.
3272         (Output_section::set_entsize): If two different entsizes are
3273         requested, force it to zero.
3274         (Output_section::add_input_section): Set flags for .debug_str
3275         before updating section flags.  Set entsize.
3276         (Output_section::update_flags_for_input_section): Set SHF_MERGE
3277         and SHF_STRING if all input sections have those flags.
3278
3279 2009-12-29   Rafael Espindola  <espindola@google.com>
3280
3281         * main.cc (main): Fix the sys time reporting.
3282         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
3283         reporting.
3284
3285 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
3286
3287         * options.cc (General_options::parse_version): Allow -v to exit
3288         without an error if there is nothing to link.
3289
3290 2009-12-29  Ian Lance Taylor  <iant@google.com>
3291
3292         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
3293         using a version of gcc before 4.1.
3294         * configure: Rebuild.
3295
3296 2009-12-28  Chris Demetriou  <cgd@google.com>
3297
3298         * attributes.cc (Output_attributes_section_data::do_write): Use
3299         std::vector::front rather than std::vector::data.
3300
3301 2009-12-28  Ian Lance Taylor  <iant@google.com>
3302
3303         * symtab.h (class Symbol_table): Add enum Defined.
3304         * resolve.cc (Symbol_table::should_override): Add defined
3305         parameter.  Change all callers.  Test whether object is NULL
3306         before calling a method on it.
3307         (Symbol_table::report_resolve_problem): Add defined parameter.
3308         Change all callers.
3309         (Symbol_table::should_override_with_special): Likewise.
3310         * symtab.cc (Symbol_table::define_in_output_data): Add defined
3311         parameter.  Change all callers.
3312         (Symbol_table::do_define_in_output_data): Likewise.
3313         (Symbol_table::define_in_output_segment): Likewise.
3314         (Symbol_table::do_define_in_output_segment): Likewise.
3315         (Symbol_table::define_as_constant): Likewise.
3316         (Symbol_table::do_define_as_constant): Likewise.
3317         * script.h (class Symbol_assignment): Add is_defsym parameter to
3318         constructor; change all callers.
3319         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
3320         parameter.  Change all callers.  Add is_defsym_ field.
3321         (class Parser_closure): Add parsing_defsym parameter to
3322         constructor; change all callers.  Add parsing_defsym accessor
3323         function.  Add parsing_defsym_ field.
3324
3325 2009-12-28  Ian Lance Taylor  <iant@google.com>
3326
3327         * gold.cc (queue_middle_tasks): Fix formatting.
3328         * object.cc (Relobj::is_section_name_included): Likewise.
3329
3330 2009-12-23  Ian Lance Taylor  <iant@google.com>
3331
3332         * i386.cc (Target_i386::do_calls_non_split): Recognize
3333         -fsplit-stack prologue for a function with a static chain.
3334         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
3335         -fsplit-stack prologue when using %r11.
3336
3337 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
3338
3339         * options.cc (General_options::parse_version): Make -v continue and do
3340         the link like GNU ld does.
3341
3342 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
3343
3344         * Makefile.am (CCFILES): Add timer.cc.
3345         (HFILES): Add timer.h.
3346         * configure.ac: Check for sysconf and times.
3347         * main.cc: include timer.h.
3348         (main): Use Timer instead of get_run_time.
3349         * timer.cc: New.
3350         * timer.h: New.
3351         * workqueue.cc: include timer.h.
3352         (Workqueue::find_and_run_task):
3353         Report user, sys and wall time.
3354         * Makefile.in: Regenerate.
3355         * config.in: Regenerate.
3356         * configure: Regenerate.
3357
3358 2009-12-16  Doug Kwan  <dougkwan@google.com>
3359
3360         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
3361         sections.
3362         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
3363         relaxed input sections.
3364         * output.cc (Output_section::find_relaxed_input_section): Change
3365         return type to Output_relaxed_input_section pointer.  Adjust code
3366         for new type of relaxed_input_section_map_.
3367         * output.h (Output_section::find_relaxed_input_section): Change
3368         return type to Output_relaxed_input_section pointer.
3369         (Output_section::Output_relaxed_input_section_by_input_section_map):
3370         New type.
3371         (Output_section::relaxed_input_section_map_): Change type to
3372         Output_section::Output_relaxed_input_section_by_input_section_map.
3373         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
3374         input section.
3375
3376 2009-12-15  Ian Lance Taylor  <iant@google.com>
3377
3378         * layout.cc (Layout::create_shstrtab): Only write out after input
3379         sections if we are compressing debug sections.
3380
3381 2009-12-15  Ian Lance Taylor  <iant@google.com>
3382
3383         * archive.cc (Archive::add_symbols): Only look up a symbol without
3384         a version if there is, in fact, a version.
3385
3386 2009-12-14  Ian Lance Taylor  <iant@google.com>
3387
3388         Revert -Wshadow changes, all changes from:
3389         2009-12-11  Doug Kwan  <dougkwan@google.com>
3390         2009-12-11  Nick Clifton  <nickc@redhat.com>
3391         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
3392
3393 2009-12-11  Doug Kwan  <dougkwan@google.com>
3394
3395         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
3396         due to -Wshadow.
3397         * attributes.cc (Object_attribute::size): Ditto.
3398         (Attributes_section_data::size): Ditto.
3399         (Attributes_section_data::Attributes_section_data): Ditto.
3400         (Output_attributes_section_data::do_write): Ditto.
3401         * attributes.h (Object_attribute::set_type): Ditto.
3402         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
3403
3404 2009-12-11  Nick Clifton  <nickc@redhat.com>
3405
3406         * archive.cc: Fix shadowed variable warnings.
3407         * arm.cc: Likewise.
3408         * compressed_output.cc: Likewise.
3409         * compressed_output.h: Likewise.
3410         * configure: Likewise.
3411         * dwarf_reader.cc: Likewise.
3412         * dynobj.cc: Likewise.
3413         * dynobj.h: Likewise.
3414         * ehframe.cc: Likewise.
3415         * ehframe.h: Likewise.
3416         * errors.cc: Likewise.
3417         * expression.cc: Likewise.
3418         * fileread.cc: Likewise.
3419         * fileread.h: Likewise.
3420         * freebsd.h: Likewise.
3421         * i386.cc: Likewise.
3422         * icf.cc: Likewise.
3423         * incremental.h: Likewise.
3424         * layout.cc: Likewise.
3425         * layout.h: Likewise.
3426         * mapfile.cc: Likewise.
3427         * merge.cc: Likewise.
3428         * merge.h: Likewise.
3429         * object.cc: Likewise.
3430         * object.h: Likewise.
3431         * options.h: Likewise.
3432         * output.cc: Likewise.
3433         * output.h: Likewise.
3434         * parameters.cc: Likewise.
3435         * plugin.cc: Likewise.
3436         * powerpc.cc: Likewise.
3437         * reduced_debug_output.cc: Likewise.
3438         * reduced_debug_output.h: Likewise.
3439         * reloc.cc: Likewise.
3440         * reloc.h: Likewise.
3441         * resolve.cc: Likewise.
3442         * script-sections.cc: Likewise.
3443         * script.cc: Likewise.
3444         * script.h: Likewise.
3445         * sparc.cc: Likewise.
3446         * symtab.cc: Likewise.
3447         * symtab.h: Likewise.
3448         * target-select.cc: Likewise.
3449         * target-select.h: Likewise.
3450         * token.h: Likewise.
3451         * workqueue.cc: Likewise.
3452         * workqueue.h: Likewise.
3453         * x86_64.cc: Likewise.
3454
3455 2009-12-10  Doug Kwan  <dougkwan@google.com>
3456
3457         * arm.cc (attributes.h): New include.
3458         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
3459         (Arm_relobj::~Arm_relobj): Delete object pointed by
3460         attributes_section_data_.
3461         (Arm_relobj::attributes_section_data): New method definition.
3462         (Arm_relobj::attributes_section_data_): New data member declaration.
3463         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
3464         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
3465         attributes_section_data_.
3466         (Arm_dynobj::attributes_section_data): New method definition.
3467         (Arm_dynobj::attributes_section_data_): New data member declaration.
3468         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
3469         initialization value of may_use_blx_ to false.
3470         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
3471         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
3472         object attributes to compute results instead of hard-coding.
3473         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
3474         Target_arm::get_secondary_compatible_arch,
3475         Target_arm::set_secondary_compatible_arch
3476         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
3477         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
3478         New method declarations.
3479         (Target_arm::get_aeabi_object_attribute): New method definition.
3480         (Target_arm::attributes_section_data_): New data member declaration.
3481         (read_arm_attributes_section): New template definition.
3482         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
3483         (Arm_dynobj::do_read_symbols): Ditto.
3484         (Target_arm::do_finalize_sections): Merge attributes sections from
3485         input.  Check for BLX use after attributes section merging.
3486         Fix __exidx_start and __exidx_end visibility.  Create an
3487         .ARM.attributes section if necessary.
3488         (Target_arm::get_secondary_compatible_arch,
3489         Target_arm::set_secondary_compatible_arch,
3490         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
3491         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
3492         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
3493         New method definitions.
3494
3495 2009-12-09  Ian Lance Taylor  <iant@google.com>
3496
3497         * plugin.cc (Plugin::load): Don't cast from void* to a function
3498         pointer.
3499
3500 2009-12-09  Ian Lance Taylor  <iant@google.com>
3501
3502         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
3503         information fields.
3504
3505 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
3506
3507         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
3508         Replace two_file_shared_1.so with two_file_shared_2.so.
3509         * testsuite/Makefile.in: Regenerated.
3510
3511 2009-12-08  Doug Kwan  <dougkwan@google.com>
3512
3513         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
3514         (HFILES): Add attributes.h and int_encoding.h.
3515         * Makefile.in: Regenerate.
3516         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
3517         function definitions to int_encoding.cc
3518         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
3519         prototypes to int_encoding.h
3520         * reduced_debug_output.cc (int_encoding.h): New include.
3521         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
3522         function definitions to int_encoding.cc
3523         (insert_into_vector, read_from_pointer): Move template definitions to
3524         int_encoding.h
3525         * attributes.cc: New file.
3526         * attributes.h: New file.
3527         * int_encoding.cc: New file.
3528         * int_encoding.h: New file.
3529
3530 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
3531
3532         PR gold/11055
3533         * incremental-dump.cc (dump_incremental_inputs): New.
3534         (main): Use dump_incremental_inputs.
3535
3536 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
3537
3538         PR gold/10893
3539         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
3540         checking elfcpp::STT_FUNC.
3541         (Target_i386::Relocate::relocate): Likewise.
3542         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3543
3544         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
3545         symbols from shared libraries into normal FUNC symbols.
3546
3547         * symtab.h (Symbol): Add is_func and use it.
3548
3549 2009-12-05  Doug Kwan  <dougkwan@google.com>
3550
3551         * arm.cc (Target_arm::arm_info): Initialize new fields
3552         attributes_section and attributes_vendor.
3553         * i386.cc (Target_i386::i386_info): Same.
3554         * object.cc (Sized_relobj::do_layout): Skip attribute section.
3555         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
3556         fields attributes_section and attributes_vendor.
3557         * sparc.cc (Target_sparc::sparc_info): Same.
3558         * target.h (Target::attributes_section, Target::attributes_vendor,
3559         Target::is_attributes_section, Target::attribute_arg_type,
3560         Target::attributes_order): New method definitions.
3561         (Target::Target_info::attributes_section,
3562         Target::Target_info::attributes_vendor): New fields.
3563         (Target::do_attribute_arg_type, Target::do_attributes_order): New
3564         virtual method definitions.
3565         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
3566         attributes_section and attributes_vendor.
3567         * testsuite/testfile.cc (Target_test::test_target_info): Same.
3568
3569 2009-12-05  Doug Kwan  <dougkwan@google.com>
3570
3571         * arm.cc: Update comments about interworking and stub generation.
3572         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
3573         considered as non-PIC.
3574         (Arm_relocate_functions::base_abs): Fix formatting.
3575         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
3576         of function to use GOT entry address instead of offset.
3577         (Target_arm::Scan::global): Issue an error if a symbol would need a
3578         PLT does not get one because it is untyped.  Remove code to create
3579         dynamic symbols for relative branches.
3580         (Target_arm::Relocate::relocate: Use 0 instead of false since function
3581         takes unsigned integer instead of boolean.
3582
3583 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
3584
3585         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
3586         (two_file_test_LDADD): Likewise.
3587         (common_test_1_LDADD): Likewise.
3588         (exception_test_LDADD) Likewise.
3589         (weak_test_LDADD): Likewise.
3590         (many_sections_test_LDADD): Likewise.
3591         (initpri1_LDADD): Likewise.
3592         (script_test_1_LDADD): Likewise.
3593         (script_test_2_LDADD): Likewise.
3594         (justsyms_LDADD): Likewise.
3595         (binary_test_LDADD): Likewise.
3596         (large_LDADD): Likewise.
3597         * testsuite/Makefile.in: Regenerated.
3598
3599 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
3600
3601         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
3602         (Symbol_table::override_with_special): Likewise.
3603         (Symbol_table::add_from_object): Likewise.
3604
3605 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
3606
3607         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
3608         Don't set the data_offset twice.
3609
3610 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
3611
3612         * testsuite/Makefile.in: Regenerate.
3613
3614 2009-12-03  Doug Kwan  <dougkwan@google.com>
3615
3616         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
3617         (Target_arm::do_finalize_sections): Add parameter for symbol table
3618         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
3619         * i386.cc (Target_i386::do_finalize_sections): Add an additional
3620         parameter for symbol table pointer.
3621         * layout.cc (Layout::finalize): Call Target::finalize_sections with
3622         an additional parameter for a pointer to symbol table.
3623         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
3624         parameter for a symbol table pointer.
3625         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
3626         * target.h (Target::finalize_sections, Target::do_finalize_sections):
3627         Ditto.
3628         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
3629         parameter for a symbol table pointer.
3630
3631 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
3632
3633         * incremental.cc (Incremental_inputs_header)
3634         (Incremental_inputs_header_write, Incremental_inputs_entry)
3635         (Incremental_inputs_entry_write): Move ...
3636         * incremental.h (Incremental_inputs_header)
3637         (Incremental_inputs_header_write, Incremental_inputs_entry)
3638         (Incremental_inputs_entry_write): here.
3639
3640 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
3641
3642         * incremental.cc (make_sized_incremental_binary): Set the target.
3643         Error if it is incompatible.
3644         * output.h (Output_file): Add filename method.
3645
3646 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
3647
3648         * incremental.cc (Incremental_inputs_entry): Remove unused argument
3649         from the get_* methods.
3650
3651 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
3652
3653         * incremental-dump.cc (main): Check that the offeset of a script is 0.
3654         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
3655         Write 0 for the data_offset of scripts.
3656
3657 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
3658
3659         * testsuite/Makefile.am: Add the incremental_test.sh test.
3660         * testsuite/incremental_test.sh: New.
3661         * testsuite/incremental_test_1.c: New.
3662         * testsuite/incremental_test_2.c: New.
3663
3664 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
3665
3666        * incremental-dump.cc (main): Fix typos.
3667
3668 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
3669
3670         PR gold/11025
3671         * incremental-dump.cc (main): Use llu to print 64 bit values.
3672
3673 2009-11-26  Per Ã˜yvind Karlsen <peroyvind@mandriva.org>
3674             H.J. Lu  <hongjiu.lu@intel.com>
3675
3676         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
3677         $(LIBDL).
3678         (incremental_dump_LDADD): Likewise.
3679         * Makefile.in: Regenerated.
3680
3681 2009-11-25  Doug Kwan  <dougkwan@google.com>
3682
3683         Revert:
3684
3685         2009-11-25  Doug Kwan  <dougkwan@google.com>
3686
3687                 * arm.cc (Target_arm::Target_arm): Move method definition
3688                 outside of class definition.  Add code to handle
3689                 --target1-rel, --target1-abs and --target2= options.
3690                 (Target_arm::get_reloc_reloc_type): Change method to be
3691                 non-static and const.
3692                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
3693                 New data member declaration.
3694                 (Target_arm::Scan::local, Target_arm::Scan::global,
3695                 Target_arm::Relocate::relocate,
3696                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
3697                 Adjust call to Target_arm::get_real_reloc_type.
3698                 (Target_arm::get_real_reloc_type): Use command line options
3699                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
3700                 * options.h (--target1-rel, --target1-abs, --target2): New
3701                 ARM-only options.
3702
3703 2009-11-25  Doug Kwan  <dougkwan@google.com>
3704
3705         * arm.cc (Target_arm::Target_arm): Move method definition outside of
3706         class definition.  Add code to handle --target1-rel, --target1-abs
3707         and --target2= options.
3708         (Target_arm::get_reloc_reloc_type): Change method to be non-static
3709         and const.
3710         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
3711         member declaration.
3712         (Target_arm::Scan::local, Target_arm::Scan::global,
3713         Target_arm::Relocate::relocate,
3714         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
3715         call to Target_arm::get_real_reloc_type.
3716         (Target_arm::get_real_reloc_type): Use command line options to
3717         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
3718         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
3719         options.
3720
3721 2009-11-25  Doug Kwan  <dougkwan@google.com>
3722
3723         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
3724         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
3725         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
3726         formatting.
3727         (Arm_relocate_functions::thm_call): Replace body with a call to
3728         Arm_relocate_functions::thumb_branch_common.
3729         (Arm_relocate_functions::thm_jump24,
3730         Arm_relocate_functions::thm_xpc22): New method definitions.
3731         (Arm_relocate_functions::thumb_branch_common): New method definition.
3732         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
3733         operator.
3734         (Target_arm::Relocate::relocate): Adjust call to thm_call.
3735         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
3736
3737 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
3738
3739         * Makefile.am: Build incremental-dump
3740         * Makefile.in: Regenerate.
3741         * incremental-dump.cc: New.
3742         * incremental.cc (Incremental_inputs_header_data,
3743         Incremental_inputs_entry_data): Move to incremental.h
3744         * incremental.h: (Incremental_inputs_header_data,
3745         Incremental_inputs_entry_data): Move from incremental.cc
3746
3747 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
3748
3749         * incremental.cc (Incremental_inputs_header,
3750         Incremental_inputs_header_write, Incremental_inputs_entry,
3751         Incremental_inputs_entry_write): Add a typedef with the data type.
3752
3753 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
3754
3755         * incremental.cc (Incremental_inputs_header,
3756         Incremental_inputs_header_write, Incremental_inputs_entry,
3757         Incremental_inputs_entry_write): Update comment about which
3758         type has the filed descriptions.
3759
3760 2009-11-15  Doug Kwan  <dougkwan@google.com>
3761
3762         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
3763         (Arm_relocate_functions::arm_branch_common): Change method defintion
3764         in class definition to a method declaration and update list of formal
3765         parameters.
3766         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
3767         Arm_relocation_functions::jump24): Adjust call to
3768         Arm_relocate_functions::arm_branch_common.  Update list of formal
3769         parameters.
3770         (Arm_relocate_functions::xpc25): New method definition.
3771         (Arm_relocate_functions::arm_branch_common): Move method defintion
3772         out from class definition.  Use stubs for mode-switching and extending
3773         branch ranges.
3774         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
3775         specially.  Change code to enable use of stubs in ARM branches.
3776
3777 2009-11-10  Doug Kwan  <dougkwan@google.com>
3778
3779         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
3780         in method declaration.
3781         (Target_arm::relocate_stub): New method declaration.
3782         (Target_arm::default_target): Change to return a pointer instead of
3783         a const reference.
3784         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
3785         Target_arm::default_target.
3786         (Arm_Relobj::do_relocate_sections): Remove options paramater in
3787         method definition.
3788         (Target_arm::relocate_section): Adjust view.
3789         (Target_arm::relocate_stub): New method definition.
3790
3791 2009-11-10  Doug Kwan  <dougkwan@google.com>
3792
3793         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
3794         a format warning.
3795         * incremental.cc (open_incremental_binary): Initialized local
3796         variables to avoid warnings.
3797         * object.cc (make_elf_object): Ditto.
3798         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
3799         a format warning.
3800
3801 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
3802
3803         PR gold/10930
3804         * testsuite/plugin_test.c: Include "config.h".
3805
3806 2009-11-09  Doug Kwan  <dougkwan@google.com>
3807
3808         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
3809         (arm_symbol_value): Remove.
3810         (Arm_relocate_functions::arm_branch_common,
3811         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
3812         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
3813         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
3814         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
3815         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
3816         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
3817         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
3818         Arm_relocate_functions::thm_mobw_abs_nc,
3819         Arm_relocate_functions::thm_mov_abs,
3820         Arm_relocate_functions::movw_prel_nc,
3821         Arm_relocate_functions::thm_movt_abs,
3822         Arm_relocate_functions::movt_prel,
3823         Arm_relocate_functions::thm_movw_prel_nc,
3824         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
3825         (Target_arm::Relocate::relocate): Only decompose address into two
3826         parts if relocation type uses the thumb-bit and pass the actual
3827         bit instead of a flag indicating that the thumb-bit is used.  Adjust
3828         calls to methods in Arm_relocate_functions for this change.
3829
3830 2009-11-08  Ian Lance Taylor  <iant@google.com>
3831
3832         PR 10925
3833         * reloc.cc: Instantiate
3834         Sized_relobj::initialize_input_to_output_maps and
3835         Sized_relobj:free_input_to_output_maps.
3836
3837 2009-11-06  Ian Lance Taylor  <iant@google.com>
3838
3839         PR 10876
3840         * defstd.cc (in_segment): Set only_if_ref true for "end".
3841
3842 2009-11-06  Doug Kwan  <dougkwan@google.com>
3843
3844         * arm.cc (class Reloc_stub): Correct a comment.
3845         (Target_arm::Target_arm): Initialize arm_input_section_map_.
3846         (Target_arm::scan_section_for_stubs): New method declaration.
3847         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
3848         Change methods from private to protected.
3849         (Target_arm::do_may_relax): New method definition.
3850         (Target_arm::do_relax, Target_arm::group_sections,
3851         Target_arm::scan_reloc_for_stub,
3852         Target_arm::scan_reloc_section_for_stubs): New method declarations.
3853         (Target_arm::arm_input_section_map_): New data member declaration.
3854         (Target_arm::scan_reloc_for_stub,
3855         Target_arm::scan_reloc_section_for_stubs,
3856         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
3857         Target_arm::do_relax): New method definitions.
3858
3859 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
3860
3861         * configure.ac: Check for (struct stat)::st_mtim
3862         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
3863         * config.in: Regenerate.
3864         * configure: Regenerate.
3865
3866 2009-11-05  Ian Lance Taylor  <iant@google.com>
3867
3868         PR 10910
3869         * output.cc (Output_segment::add_output_section): Add missing
3870         return statement.
3871
3872 2009-11-04  Ian Lance Taylor  <iant@google.com>
3873
3874         PR 10880
3875         * object.h (class Object): Add is_needed and set_is_needed
3876         methods.  Add is_needed_ field.  Make bool fields into bitfields.
3877         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
3878         defined in a dynamic object and referenced by a regular object,
3879         set is_needed for the dynamic object.
3880         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
3881         if the file is marked with as_needed and it is not needed.
3882
3883 2009-11-04  Ian Lance Taylor  <iant@google.com>
3884
3885         PR 10887
3886         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
3887         tags if data is discarded by linker script.
3888         * i386.cc (Target_i386::do_finalize_sections): Likewise.
3889         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
3890         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
3891         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3892
3893 2009-11-04  Ian Lance Taylor  <iant@google.com>
3894
3895         * layout.cc (Layout::get_output_section): Add is_interp and
3896         is_dynamic_linker_section parameters.  Change all callers.
3897         (Layout::choose_output_section): Likewise.
3898         (Layout::make_output_section): Likewise.
3899         (Layout::add_output_section_data): Add is_dynamic_linker_section
3900         parameter.  Change all callers.
3901         * layout.h (class Layout): Update declarations.
3902         * output.h (class Output_section): Add is_interp, set_is_interp,
3903         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
3904         Add is_interp_, is_dynamic_linker_section_ fields.  Change
3905         generate_code_fills_at_write_ to a bitfield.
3906         * output.cc (Output_section::Output_sections): Initialize new
3907         fields.
3908         (Output_segment::add_output_section): Add do_sort parameter.
3909         Change all callers.
3910
3911 2009-11-03  Ian Lance Taylor  <iant@google.com>
3912
3913         PR 10860
3914         * options.h (class General_options): Add --warn-common.
3915         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
3916         merging two common symbols.
3917         (Symbol_table::should_override): Handle --warn-common when merging
3918         a common symbol with a defined symbol.  Use report_resolve_problem
3919         for multiple definitions.
3920         (Symbol_table::report_resolve_problem): New function.
3921         * symtab.h (class Symbol_table): Declare report_resolve_problem.
3922
3923 2009-11-03  Doug Kwan  <dougkwan@google.com>
3924
3925         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
3926         stub_factory_.
3927         (Target_arm::stub_factory): New method definition.
3928         (Target_arm::new_arm_input_section,
3929         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
3930         Target_arm::reloc_uses_thumb_bit): New method declarations.
3931         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
3932         New type definitions.
3933         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
3934         member declarations.
3935         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
3936         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
3937         New method definitions.
3938
3939 2009-11-03  Ian Lance Taylor  <iant@google.com>
3940
3941         * options.h (class General_options): Add --warn_constructors.
3942
3943 2009-11-03  Ian Lance Taylor  <iant@google.com>
3944
3945         PR 10893
3946         * defstd.cc (in_section): Add entries for __rel_iplt_start,
3947         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
3948
3949 2009-11-03  Ian Lance Taylor  <iant@google.com>
3950
3951         PR 10895
3952         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
3953         --msgid-bugs-address.
3954         (install-pdf): New target.
3955         (install-data_yes): Look up one directory to find mkinstalldirs.
3956
3957 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
3958
3959         * po/Make-in (.po.gmo): Don't generate .gmo files in source
3960         tree.
3961
3962 2009-10-30  Doug Kwan  <dougkwan@google.com>
3963
3964         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
3965
3966 2009-10-30  Doug Kwan  <dougkwan@google.com>
3967
3968         * arm.cc (Stub_addend_reader): New struct template definition
3969         and partial specializations.
3970         (Stub_addend_reader::operator()): New method definition for a
3971         partially specialized template.
3972
3973 2009-10-30  Doug Kwan  <dougkwan@google.com>
3974
3975         * arm.cc (Arm_relobj::processor_specific_flags): New method
3976         definition.
3977         (Arm_relobj::do_read_symbols): New method declaration.
3978         (Arm_relobj::processor_specific_flags_): New data member declaration.
3979         (Arm_dynobj): New class definition.
3980         (Target_arm::do_finalize_sections): Add input_objects parameter.
3981         (Target_arm::do_adjust_elf_header): New method declaration.
3982         (Target_arm::are_eabi_versions_compatible,
3983         (Target_arm::merge_processor_specific_flags): New method declaration.
3984         (Target_arm::do_make_elf_object): New overloaded method definitions
3985         and declaration.
3986         (Arm_relobj::do_read_symbols): New method definition.
3987         (Arm_dynobj::do_read_symbols): Ditto.
3988         (Target_arm::do_finalize_sections): Add input_objects parameters.
3989         Merge processor-specific flags from all input objects.
3990         (Target_arm::are_eabi_versions_compatible,
3991         Target_arm::merge_processor_specific_flags,
3992         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
3993         New method definitions.
3994         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
3995         Input_objects pointer type parameter.
3996         * layout.cc (Layout::finalize): Pass input objects to target's.
3997         finalize_sections function.
3998         * output.cc (Output_file_header::do_sized_write): Set ELF file
3999         header's processor-specific flags.
4000         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
4001         Input_objects pointer type parameter.
4002         * sparc.cc (Target_sparc::do_finalize_sections): Same.
4003         * target.h (Input_objects): New forward class declaration.
4004         (Target::processor_specific_flags,
4005         Target::are_processor_specific_flags_sect): New method definitions.
4006         (Target::finalize_sections): Add input_objects parameter.
4007         (Target::Target): Initialize processor_specific_flags_ and
4008         are_processor_specific_flags_set_.
4009         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
4010         parameter.
4011         (Target::set_processor_specific_flags): New method definition.
4012         (Target::processor_specific_flags_,
4013         Target::are_processor_specific_flags_set_): New data member
4014         declarations.
4015         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
4016         Input_objects pointer type parameter.
4017
4018 2009-10-30  Doug Kwan  <dougkwan@google.com>
4019
4020         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
4021
4022 2009-10-28  Ian Lance Taylor  <iant@google.com>
4023
4024         * object.h (class Relobj): Drop options parameter from
4025         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
4026         do_scan_relocs, do_relocate.  Change all callers.
4027         (class Sized_relobj): Drop options parameters from
4028         do_gc_process_relocs, do_scan_relocs, do_relocate,
4029         do_relocate_sections, relocate_sections, emit_relocs_scan,
4030         emit_relocs_scan_reltype.  Change all callers.
4031         (struct Relocate_info): Remove options field and all references to
4032         it.
4033         * reloc.h (class Read_relocs): Remove options constructor
4034         parameter and options_ field.  Change all callers.
4035         (class Gc_process_relocs, class Scan_relocs): Likewise.
4036         (class Relocate_task): Likewise.
4037         * target-reloc.h (scan_relocs): Remove options parameter.  Change
4038         all callers.
4039         (scan_relocatable_relocs): Likewise.
4040         * target.h (class Sized_target): Remove options parameter from
4041         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
4042         all callers.
4043         * gc.h (gc_process_relocs): Remove options parameter.  Change all
4044         callers.
4045         * arm.cc: Update functions to remove options parameters.
4046         * i386.cc: Likewise.
4047         * powerpc.cc: Likewise.
4048         * sparc.cc: Likewise.
4049         * x86_64.cc: Likewise.
4050         * testsuite/testfile.cc: Likewise.
4051
4052 2009-10-28  Doug Kwan  <dougkwan@google.com>
4053
4054         * arm.cc (Arm_relobj): New class definition.
4055         (Arm_relobj::scan_sections_for_stubs,
4056         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
4057         New method definitions.
4058
4059 2009-10-28  Cary Coutant  <ccoutant@google.com>
4060
4061         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
4062         (Plugin::cleanup_done_): New member.
4063         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
4064         (Plugin_manager::cleanup_done_): Remove.
4065         (Plugin_manager::add_input_file): Edit error message.
4066         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
4067         (Plugin_manager::cleanup): Remove use of cleanup_done_.
4068
4069 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
4070
4071         * fileread.cc: (File_read::View::~View): Use the new
4072         data_ownership_ filed.
4073         (File_read::~File_read): Dispose the new whole_file_view_.
4074         (File_read::open): Mmap the whole file if needed.
4075         (File_read::open): Use whole_file_view_ instead of contents_.
4076         (File_read::find_view): Use whole_file_view_ if applicable.
4077         (File_read::do_read): Use whole_file_view_ instead of contents_.
4078         (File_read::make_view): Use whole_file_view_ instead of contents_,
4079         update File_read::View::View call.
4080         (File_read::find_or_make_view): Update File_read::View::View
4081         call.
4082         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
4083         remove contents_
4084         (File_read::View::Data_ownership): New enum.
4085         (File_read::View::View): Replace bool mapped_ with Data_ownership
4086         argument.
4087         (File_read::View::mapped_): Remove (replaced by data_ownership_).
4088         (File_read::View::data_ownership_): New field.
4089         (File_read::contents_): Remove (replaced by whole_file_view_).
4090         (File_read::whole_file_view_): New field.
4091         * options.h (class General_options): Add --keep-files-mapped.
4092
4093 2009-10-27  Cary Coutant  <ccoutant@google.com>
4094
4095         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
4096         * testsuite/Makefile.am (plugin_test_5): New test case.
4097         * testsuite/Makefile.in: Regenerate.
4098
4099 2009-10-25  Doug Kwan  <dougkwan@google.com>
4100
4101         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
4102         from private to protected to allow access by child class.
4103         (Sized_relobj::do_relocate_sections): New method declaration.
4104         (Sized_relobj::relocate_sections): Virtualize.
4105         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
4106         Sized_relobj::relocate_sections.  Instantiate template explicitly
4107         for different target sizes and endianity.
4108
4109 2009-10-24  Doug Kwan  <dougkwan@google.com>
4110
4111         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
4112         (Arm_input_section::as_arm_input_section): New method.
4113         (Arm_output_section): New class definition.
4114         (Arm_output_section::create_stub_group,
4115         Arm_output_section::group_sections): New method definitions.
4116
4117 2009-10-22  Doug Kwan  <dougkwan@google.com>
4118
4119         * arm.cc (Arm_input_section): New class definition.
4120         (Arm_input_section::init, Arm_input_section:do_write,
4121         Arm_input_section::set_final_data_size,
4122         Arm_input_section::do_reset_address_and_file_offset): New method
4123         definitions.
4124
4125 2009-10-21  Doug Kwan  <dougkwan@google.com>
4126
4127         * arm.cc (Stub_table, Arm_input_section): New forward class
4128         declarations.
4129         (Stub_table): New class defintion.
4130         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
4131         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
4132         New method definition.
4133
4134 2009-10-21  Doug Kwan  <dougkwan@google.com>
4135
4136         * arm.cc: Update copyright comments.
4137         (Target_arm): New forward class template declaration.
4138         (Arm_address): New type.
4139         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
4140         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
4141         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
4142         constants.
4143         (Insn_template): Same.
4144         (DEF_STUBS): New macro.
4145         (Stub_type): New enum type.
4146         (Stub_template): New class definition.
4147         (Stub): Same.
4148         (Reloc_stub): Same.
4149         (Stub_factory): Same.
4150         (Target_arm::Target_arm): Initialize may_use_blx_ and
4151         should_force_pic_veneer_.
4152         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
4153         Target_arm::should_force_pic_veneer,
4154         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
4155         Target_arm::using_thumb_only, Target_arm:;default_target): New
4156         method defintions.
4157         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
4158         New data member declarations.
4159         (Insn_template::size, Insn_template::alignment): New method defintions.
4160         (Stub_template::Stub_template): New method definition.
4161         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
4162         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
4163         (Stub_factory::Stub_factory): New method definition.
4164         * gold.h (string_hash): New template.
4165         * output.h (Input_section_specifier::hash_value): Use
4166         gold::string_hash.
4167         (Input_section_specifier::string_hash): Remove.
4168         * stringpool.cc (Stringpool_template::string_hash): Use
4169         gold::string_hash.
4170
4171 2009-10-20  Doug Kwan  <dougkwan@google.com>
4172
4173         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
4174         symbols of relaxed input sections.
4175         * output.h (Output_section::find_relaxed_input_section): Make
4176         method public.
4177
4178 2009-10-16  Doug Kwan  <dougkwan@google.com>
4179
4180         * dynobj.cc (Versions::Versions): Initialize version_script_.
4181         Only insert base version symbol definition for a shared object
4182         if version script defines any version versions.
4183         (Versions::define_base_version): New method definition.
4184         (Versions::add_def): Check that base version is not needed.
4185         (Versions::add_need): Define base version lazily.
4186         * dynobj.h (Versions::define_base_version): New method declaration.
4187         (Versions::needs_base_version_): New data member declaration.
4188         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
4189         (check_DATA): Add no_version_test.stdout.
4190         (libno_version_test.so, no_version_test.o no_version_test.stdout):
4191         New make rules.
4192         * testsuite/Makefile.in: Regenerate.
4193         * testsuite/no_version_test.c: New file.
4194         * testsuite/no_version_test.sh: Ditto.
4195
4196 2009-10-16  Doug Kwan  <dougkwan@google.com>
4197
4198         * expression.cc (class Segment_start_expression): New class definition.
4199         (Segment_start_expression::value): New method definition.
4200         (script_exp_function_segment_start): Return a new
4201         Segment_start_expression.
4202         * gold/script-c.h (script_saw_segment_start_expression): New function
4203         prototype.
4204         * script-sections.cc (Script_sections::Script_sections): Initialize
4205         SAW_SEGMENT_START_EXPRESSION_ to false.
4206         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
4207         and -Tbbs options to specify section addresses if given in
4208         command line and no SEGMENT_START expression is seen in a script.
4209         * script-sections.h (Script_sections::saw_segment_start_expression,
4210         Script_sections::set_saw_segment_start_expression): New method
4211         definition.
4212         (Script_sections::saw_segment_start_expression_): New data member
4213         declaration.
4214         * script.cc (script_saw_segment_start_expression): New function.
4215         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
4216         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
4217         script_test_7.sh and script_test_8.sh.
4218         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
4219         script_test_8.stdout.
4220         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
4221         (script_test_6, script_test_6.stdout, script_test_7,
4222         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
4223         * Makefile.in: Regenerate.
4224         * testsuite/script_test_6.sh: New file.
4225         * testsuite/script_test_6.t: Same.
4226         * testsuite/script_test_7.sh: Same.
4227         * testsuite/script_test_7.t: Same.
4228         * testsuite/script_test_8.sh: Same.
4229
4230 2009-10-16  Doug Kwan  <dougkwan@google.com>
4231
4232         * output.cc (Output_segment::set_section_list_address): Cast
4233         expressions to unsigned long long type to avoid format warnings.
4234
4235 2009-10-15  Ian Lance Taylor  <iant@google.com>
4236
4237         * script.cc (Script_options::add_symbol_assignment): Always add a
4238         dot assignment to script_sections_.
4239         * script-sections.cc (Script_sections::add_dot_assignment):
4240         Initialize if necessary.
4241
4242         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
4243         program headers with no load segment if there is a linker script.
4244
4245         * layout.cc (Layout::set_segment_offsets): Align the file offset
4246         to the segment aligment for -N or -n with no load segment.
4247         * output.cc (Output_segment::add_output_section): Don't crash if
4248         the first section is a TLS section.
4249         (Output_segment::set_section_list_addresses): Print an error
4250         message if the address moves backward in a linker script.
4251         * script-sections.cc
4252         (Output_section_element_input::set_section_addresses): Don't
4253         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
4254         (Orphan_output_section::set_section_addresses): Likewise.
4255
4256 2009-10-15  Doug Kwan  <dougkwan@google.com>
4257
4258         * layout.cc (Layout::finish_dynamic_section): Generate tags
4259         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
4260         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
4261         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
4262
4263 2009-10-14  Ian Lance Taylor  <iant@google.com>
4264
4265         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
4266         fields.
4267         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
4268         data_shdr fields of relinfo.
4269         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
4270         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
4271         R_386_TLS_LDO_32, adjust based on section flags.
4272         (Target_i386::Relocate::fix_up_ldo): Remove.
4273
4274 2009-10-13  Ian Lance Taylor  <iant@google.com>
4275
4276         Add support for -pie.
4277         * options.h (class General_options): Add -pie and
4278         --pic-executable.
4279         (General_options::output_is_position_independent): Test -pie.
4280         (General_options::output_is_executable): Return true if not shared
4281         and not relocatable.
4282         (General_options::output_is_pie): Remove.
4283         * options.cc (General_options::finalize): Reject incompatible uses
4284         of -pie.
4285         * gold.cc (queue_middle_tasks): A -pie link is not static.
4286         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
4287         * symtab.cc (Symbol::final_value_is_known): Return false if
4288         output_is_position_independent.
4289         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
4290         output_is_position_independent.
4291         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
4292         output_is_position_independent.
4293         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
4294         output_is_position_independent.
4295         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
4296         two_file_pie_test.
4297         (basic_pie_test.o, basic_pie_test): New targets.
4298         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
4299         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
4300         (two_file_pie_test): New target.
4301         * testsuite/Makefile.in: Rebuild.
4302         * README: Remove note saying that -pie is not supported.
4303
4304 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
4305
4306         * options.h (class General_options): Add -init and -fini.
4307         * layout.cc (Layout::finish_dynamic_section): Emit
4308         given init and fini functions.
4309
4310 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
4311
4312         * gc.h (gc_process_relocs): Check if icf is enabled using new
4313         function.
4314         * gold.cc (queue_initial_tasks): Likewise.
4315         (queue_middle_tasks): Likewise.
4316         * object.cc (do_layout): Likewise.
4317         * symtab.cc (is_section_folded): Likewise.
4318         * main.cc (main): Likewise.
4319         * reloc.cc (Read_relocs::run): Likewise.
4320         (Sized_relobj::do_scan_relocs): Likewise.
4321         * icf.cc (is_function_ctor_or_dtor): New function.
4322         (Icf::find_identical_sections): Check if function is ctor or dtor when
4323         safe icf is chosen.
4324         * options.h (General_options::icf): Change option to be an enum.
4325         (Icf_status): New enum.
4326         (icf_enabled): New method.
4327         (icf_safe_folding): New method.
4328         (set_icf_status): New method.
4329         (icf_status_): New variable.
4330         * (options.cc) (General_options::finalize): Set icf_status_.
4331         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
4332         icf_test and icf_keep_unique_test to use the --icf enum flag.
4333         * testsuite/icf_safe_test.sh: New file.
4334         * testsuite/icf_safe_test.cc: New file.
4335
4336 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
4337
4338         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
4339         includes to gc.h and icf.h.
4340         * arm.cc: Include gc.h.
4341         * gold.cc: Likewise.
4342         * i386.cc: Likewise.
4343         * powerpc.cc: Likewise.
4344         * sparc.cc: Likewise.
4345         * x86_64.cc: Likewise.
4346         * gc.h: Include icf.h.
4347
4348 2009-10-11  Ian Lance Taylor  <iant@google.com>
4349
4350         * plugin.cc: Include "gold.h" before other header files.
4351
4352 2009-10-10  Chris Demetriou  <cgd@google.com>
4353
4354         * options.h (Input_file_argument::Input_file_type): New enum.
4355         (Input_file_argument::is_lib_): Replace with...
4356         (Input_file_argument::type_): New member.
4357         (Input_file_argument::Input_file_argument): Take Input_file_type
4358         'type' rather than boolean 'is_lib' as second argument.
4359         (Input_file_argument::is_lib): Use type_.
4360         (Input_file_argument::is_searched_file): New function.
4361         (Input_file_argument::may_need_search): Handle is_searched_file.
4362         * options.cc (General_options::parse_library): Support -l:filename.
4363         (General_options::parse_just_symbols): Update for Input_file_argument
4364         changes.
4365         (Command_line::process): Likewise.
4366         * archive.cc (Archive::get_file_and_offset): Likewise.
4367         * plugin.cc (Plugin_manager::release_input_file): Likewise.
4368         * script.cc (read_script_file, script_add_file): Likewise.
4369         * fileread.cc (Input_file::Input_file): Likewise.
4370         (Input_file::will_search_for): Handle is_searched_file.
4371         (Input_file::open): Likewise.
4372         * readsyms.cc (Read_symbols::get_name): Likewise.
4373         * testsuite/Makefile.am (searched_file_test): New test.
4374         * testsuite/Makefile.in: Regenerate.
4375         * testsuite/searched_file_test.cc: New file.
4376         * testsuite/searched_file_test_lib.cc: New file.
4377
4378 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
4379             Ian Lance Taylor  <iant@google.com>
4380
4381         * descriptor.cc: Include <cstdio> and "binary-io.h".
4382         (Descriptors::open): Open the files in binary mode always.
4383         * script.cc (Lex::get_token): Treat \r as whitespace.
4384
4385 2009-10-09  Ian Lance Taylor  <iant@google.com>
4386
4387         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
4388
4389 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
4390             Ian Lance Taylor  <iant@google.com>
4391
4392         * configure.ac: Check for readv function also.
4393         * fileread.cc (readv): Define if not HAVE_READV.
4394         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
4395         does not exist.
4396         * config.in: Regenerate.
4397         * configure: Regenerate.
4398
4399 2009-10-09  Doug Kwan  <dougkwan@google.com>
4400
4401         * layout.cc (Layout::make_output_section): Call target hook to make
4402         ordinary output section.
4403         (Layout::finalize): Adjust parameter list of call the
4404         Target::may_relax().
4405         * layout.h (class Layout::section_list): New method.
4406         * merge.h (Output_merge_base::entsize): Change visibility to public.
4407         (Output_merge_base::is_string, Output_merge_base::do_is_string):
4408         New methods.
4409         (Output_merge_string::do_is_string): New method.
4410         * object.cc (Sized_relobj::do_setup): renamed from
4411         Sized_relobj::set_up.
4412         * object.h (Sized_relobj::adjust_shndx,
4413         Sized_relobj::initializ_input_to_output_maps,
4414         Sized_relobj::free_input_to_output_maps): Change visibilities to
4415         protected.
4416         (Sized_relobj::setup): Virtualize.
4417         (Sized_relobj::do_setup): New method declaration.
4418         (Sized_relobj::invalidate_section_offset,
4419         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
4420         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
4421         * options.cc (parse_int): New function.
4422         * options.h (parse_int): New declaration.
4423         (DEFINE_int): New macro.
4424         (stub_group_size): New option.
4425         * output.cc (Output_section::Output_section): Initialize memebers
4426         merge_section_map_, merge_section_by_properties_map_,
4427         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
4428         (Output_section::add_input_section): Handled deferred code-fill
4429         generation and remove an old comment.
4430         (Output_section::add_relaxed_input_section): New method definition.
4431         (Output_section::add_merge_input_section): Use merge section by
4432         properties map to speed to search.  Update merge section maps
4433         as appropriate.
4434         (Output_section::build_relaxation_map): New method definition.
4435         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4436         Same.
4437         (Output_section::relax_input_section): Renamed to
4438         Output_section::convert_input_sections_to_relaxed_sections and change
4439         interface to take a vector of pointers to relaxed sections.
4440         (Output_section::find_merge_section,
4441         Output_section::find_relaxed_input_section): New method definitions.
4442         (Output_section::is_input_address_mapped,
4443         Output_section::output_offset, Output_section::output_address):
4444         Use output section data maps to speed up searching.
4445         (Output_section::find_starting_output_address): Add comments.
4446         (Output_section::do_write,
4447         Output_section::write_to_postprocessing_buffer): Do code-fill
4448         generation as appropriate.
4449         (Output_section::get_input_sections): Invalidate relaxed input section
4450         map.
4451         (Output_section::restore_states): Adjust type of checkpoint .
4452         Invalidate relaxed input section map.
4453         * output.h (Output_merge_base): New class declaration.
4454         (Input_section_specifier): New class defintion.
4455         (class Output_relaxed_input_section) Change base class to
4456         Output_section_data_build.
4457         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
4458         base class initializer.
4459         (Output_section::add_relaxed_input_section): New method declaration.
4460         (Output_section::Input_section): Change visibility to protected.
4461         (Output_section::Input_section::relobj,
4462         Output_section::Input_section::shndx): Handle relaxed input sections.
4463         Output_section::input_sections) Change visibility to protected.  Also
4464         define overload to return a non-const pointer.
4465         (Output_section::Merge_section_properties): New class defintion.
4466         (Output_section::Merge_section_by_properties_map,
4467         Output_section::Output_section_data_by_input_section_map,
4468         Output_section::Relaxation_map): New types.
4469         (Output_section::relax_input_section): Rename method to
4470         Output_section::convert_input_sections_to_relaxed_sections and change
4471         interface to take a vector of relaxed section pointers.
4472         (Output_section::find_merge_section,
4473         Output_section::find_relaxed_input_section,
4474         Output_section::build_relaxation_map,
4475         Output_section::convert_input_sections_in_list_to_relaxed_sections):
4476         New method declarations.
4477         (Output_section::merge_section_map_
4478         Output_section::merge_section_by_properties_map_,
4479         Output_section::relaxed_input_section_map_,
4480         Output_section::is_relaxed_input_section_map_valid_,
4481         Output_section::generate_code_fills_at_write_): New data members.
4482         * script-sections.cc
4483         (Output_section_element_input::set_section_addresses): Call
4484         current_data_size and addralign methods of relaxed input sections.
4485         (Orphan_output_section::set_section_addresses): Call current_data_size
4486         and addralign methods of relaxed input sections.
4487         * symtab.cc (Symbol_table::compute_final_value): Extract template
4488         from the body of Symbol_table::sized_finalize_symbol.
4489         (Symbol_table::sized_finalized_symbol): Call
4490         Symbol_table::compute_final_value.
4491         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
4492         (Symbol_table::compute_final_value): New templated method declaration.
4493         * target.cc (Target::do_make_output_section): New method defintion.
4494         * target.h (Target::make_output_section): New method declaration.
4495         (Target::relax): Add more parameters for input objects, symbol table
4496         and layout.  Adjust call to do_relax.
4497         (Target::do_make_output_section): New method declaration.
4498         (Target::do_relax): Add parameters for input objects, symbol table
4499         and layout.
4500
4501 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
4502
4503         * pread.c: Include stdio.h.
4504
4505 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
4506
4507         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
4508         defined.
4509
4510 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
4511
4512         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4513         Change read_shndx type to unsigned int.
4514         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
4515         int.
4516         (Sized_dwarf_line_info::read_line_mappings): Likewise.
4517         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
4518         Change read_shndx type to unsigned int.
4519         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
4520         int.
4521         (Sized_dwarf_line_info::read_line_mappings): Likewise.
4522         * layout.cc (Layout::create_symtab_sections): Cast the result of
4523         local_symcount * symsize to off_t in the gold_assert.
4524
4525 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4526
4527         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
4528         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
4529         R_ARM_BASE_ABS.
4530         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
4531         (Arm_relocate_functions::thm_abs5): New function.
4532         (Arm_relocate_functions::abs12): New function.
4533         (Arm_relocate_functions::abs16): New function.
4534         (Arm_relocate_functions::base_abs): New function.
4535         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
4536         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
4537         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
4538         R_ARM_BASE_ABS.
4539         (Scan::global): Likewise.
4540         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
4541         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
4542         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
4543         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
4544         R_ARM_BASE_ABS.
4545
4546 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4547
4548         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
4549         (Arm_relocate_functions::movt_prel): New function.
4550         (Arm_relocate_functions::thm_movw_prel_nc): New function.
4551         (Arm_relocate_functions::thm_movt_prel): New function.
4552         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
4553         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
4554         (Scan::global, Relocate::relocate): Likewise.
4555         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
4556
4557 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
4558
4559         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
4560         Incremental_checker.
4561         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
4562         unsigned int.
4563         (class Incremental_inputs_header): New class.
4564         (Incremental_inputs_header_writer): Edit comment.
4565         (Incremental_inputs_entry): New class.
4566         (Incremental_inputs_entry_writer): Edit comment.
4567         (Sized_incremental_binary::do_find_incremental_inputs_section):
4568         Add *strtab_shndx parameter, fill it.
4569         (Sized_incremental_binary::do_check_inputs): New method.
4570         (Incremental_checker::can_incrementally_link_output_file): Use
4571         Sized_incremental_binary::check_inputs.
4572         (Incremental_inputs::report_command_line): Save command line in
4573         command_line_.
4574         * incremental.h:
4575         (Incremental_binary::find_incremental_inputs_section): New
4576         method.
4577         (Incremental_binary::do_find_incremental_inputs_section): Add
4578         strtab_shndx parameter.
4579         (Incremental_binary::do_check_inputs): New pure virtual method.
4580         (Sized_incremental_binary::do_check_inputs): Declare.
4581         (Incremental_checker::Incremental_checker): Add incremental_inputs
4582         parameter, use it to initialize incremental_inputs_.
4583         (Incremental_checker::incremental_inputs_): New field.
4584         (Incremental_checker::command_line): New method.
4585         (Incremental_checker::inputs): New method.
4586         (Incremental_checker::command_line_): New field.
4587
4588 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
4589
4590         * incremental.cc: Include <cstdarg> and "target-select.h".
4591         (vexplain_no_incremental): New function.
4592         (explain_no_incremental): New function.
4593         (Incremental_binary::error): New method.
4594         (Sized_incremental_binary::do_find_incremental_inputs_section): New
4595         method.
4596         (make_sized_incremental_binary): New function.
4597         (open_incremental_binary): New function.
4598         (can_incrementally_link_file): Add checks if output is ELF and has
4599         inputs section.
4600         * incremental.h: Include "elfcpp_file.h" and "output.h".
4601         (Incremental_binary): New class.
4602         (Sized_incremental_binary): New class.
4603         (open_incremental_binary): Declare.
4604         * object.cc (is_elf_object): Use
4605         elfcpp::Elf_recognizer::is_elf_file.
4606         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
4607         * output.h (Output_file::filesize): New method.
4608
4609 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4610
4611         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
4612         New function.
4613         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
4614         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
4615         function.
4616         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
4617         function.
4618         (Arm_relocate_functions::movw_abs_nc): New function.
4619         (Arm_relocate_functions::movt_abs): New function.
4620         (Arm_relocate_functions::thm_movw_abs_nc): New function.
4621         (Arm_relocate_functions::thm_movt_abs): New function.
4622         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
4623         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
4624         (Scan::global): Likewise.
4625         (Relocate::relocate): Likewise.
4626         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
4627
4628 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4629
4630         * arm.cc (Arm_relocate_functions::got_prel) New function.
4631         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
4632         (Relocate::relocate): Likewise.
4633         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
4634
4635 2009-10-06  Ian Lance Taylor  <iant@google.com>
4636
4637         * options.h (class General_options): Define
4638         split_stack_adjust_size parameter.
4639         * object.h (class Object): Add uses_split_stack_ and
4640         has_no_split_stack_ fields.  Add uses_split_stack and
4641         has_no_split_stack accessor functions.  Declare
4642         handle_split_stack_section.
4643         (class Reloc_symbol_changes): Define.
4644         (class Sized_relobj): Define Function_offsets.  Declare
4645         split_stack_adjust, split_stack_adjust_reltype, and
4646         find_functions.
4647         * object.cc (Object::handle_split_stack_section): New function.
4648         (Sized_relobj::do_layout): Call handle_split_stack_section.
4649         * dynobj.cc (Sized_dynobj::do_layout): Call
4650         handle_split_stack_section.
4651         * reloc.cc (Sized_relobj::relocate_sections): Call
4652         split_stack_adjust for executable sections in split_stack
4653         objects.  Pass reloc_map to relocate_section.
4654         (Sized_relobj::split_stack_adjust): New function.
4655         (Sized_relobj::split_stack_adjust_reltype): New function.
4656         (Sized_relobj::find_functions): New function.
4657         * target-reloc.h: Include "object.h".
4658         (relocate_section): Add reloc_symbol_changes parameter.  Change
4659         all callers.
4660         * target.h (class Target): Add calls_non_split method.  Declare
4661         do_calls_non_split virtual method.  Declare match_view and
4662         set_view_to_nop.
4663         * target.cc: Include "elfcpp.h".
4664         (Target::do_calls_non_split): New function.
4665         (Target::match_view): New function.
4666         (Target::set_view_to_nop): New function.
4667         * gold.cc (queue_middle_tasks): Give an error if mixing
4668         split-stack and non-split-stack objects with -r.
4669         * i386.cc (Target_i386::relocate_section): Add
4670         reloc_symbol_changes parameter.
4671         (Target_i386::do_calls_non_split): New function.
4672         * x86_64.cc (Target_x86_64::relocate_section): Add
4673         reloc_symbol_changes parameter.
4674         (Target_x86_64::do_calls_non_split): New function.
4675         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
4676         parameter.
4677         * powerpc.cc (Target_powerpc::relocate_section): Add
4678         reloc_symbol_changes parameter.
4679         * sparc.cc (Target_sparc::relocate_section): Add
4680         reloc_symbol_changes parameter.
4681         * configure.ac: Call AM_CONDITIONAL for the default target.
4682         * configure: Rebuild.
4683         * testsuite/Makefile.am (TEST_AS): New variable.
4684         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
4685         (check_DATA): Add split_i386 and split_x86_64 files.
4686         (SPLIT_DEFSYMS): Define.
4687         (split_i386_[1234n].o): New targets.
4688         (split_i386_[124]): New targets.
4689         (split_i386_[1234r].stdout): New targets.
4690         (split_x86_64_[1234n].o): New targets.
4691         (split_x86_64_[124]): New targets.
4692         (split_x86_64_[1234r].stdout): New targets.
4693         (MOSTLYCLEANFILES): Add new executables.
4694         * testsuite/split_i386.sh: New file.
4695         * testsuite/split_x86_64.sh: New file.
4696         * testsuite/split_i386_1.s: New file.
4697         * testsuite/split_i386_2.s: New file.
4698         * testsuite/split_i386_3.s: New file.
4699         * testsuite/split_i386_4.s: New file.
4700         * testsuite/split_i386_n.s: New file.
4701         * testsuite/split_x86_64_1.s: New file.
4702         * testsuite/split_x86_64_2.s: New file.
4703         * testsuite/split_x86_64_3.s: New file.
4704         * testsuite/split_x86_64_4.s: New file.
4705         * testsuite/split_x86_64_n.s: New file.
4706         * testsuite/testfile.cc (Target_test): Update relocation_section
4707         function.
4708         * testsuite/Makefile.in: Rebuild.
4709
4710 2009-10-06  Ian Lance Taylor  <iant@google.com>
4711
4712         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
4713         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
4714         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
4715         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
4716         the address on ldo_addrs_.
4717         (Target_i386::Relocate::fix_up_ldo): New function.
4718
4719 2009-10-06   Rafael Espindola  <espindola@google.com>
4720
4721         * plugin.cc (add_input_library): New.
4722         (Plugin::load): Add add_input_library to tv.
4723         (Plugin_manager::add_input_file): Add the is_lib argument.
4724         (add_input_file): Update call to Plugin_manager::add_input_file.
4725         (add_input_library): New.
4726         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
4727
4728 2009-09-30  Doug Kwan  <dougkwan@google.com>
4729
4730         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
4731         symbol and call Symbol::may_need_copy_reloc to determine if
4732         a copy reloc is needed.
4733         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
4734         nocopyreloc is given in command line.
4735         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
4736         given in command line.
4737         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
4738         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
4739         of the removed Target_i386::may_need_copy_reloc.
4740         * options.h (copyreloc): New option with default value false.
4741         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
4742         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
4743         instead of the removed Target_powerpc::may_need_copy_reloc.
4744         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
4745         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
4746         instead of the removed Target_sparc::may_need_copy_reloc.
4747         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
4748         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
4749         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
4750         instead of the removed Target_x86_64::may_need_copy_reloc.
4751
4752 2009-09-30  Ian Lance Taylor  <iant@google.com>
4753
4754         * object.h (class Object): Remove target_ field, and target,
4755         sized_target, and set_target methods.
4756         (Object::sized_target): Remove.
4757         (class Sized_relobj): Update declarations.  Remove sized_target.
4758         * object.cc (Sized_relobj::setup): Remove target parameter.
4759         Change all callers.
4760         (Input_objects::add_object): Don't do anything with the target.
4761         (make_elf_sized_object): Add punconfigured parameter.  Change all
4762         callers.  Set or test parameter target.
4763         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
4764         Change all callers.
4765         * parameters.cc (Parameters::set_target): Change parameter type to
4766         be non-const.
4767         (Parameters::default_target): Remove.
4768         (set_parameters_target): Change parameter type to be non-const.
4769         (parameters_force_valid_target): New function.
4770         (parameters_clear_target): New function.
4771         * parameters.h (class Parameters): Update declarations.  Remove
4772         default_target method.  Add sized_target and clear_target
4773         methods.  Change target_ to be non-const.
4774         (set_parameters_target): Update declaration.
4775         (parameters_force_valid_target): Declare.
4776         (parameters_clear_target): Declare.
4777         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
4778         as NULL if we aren't searching.
4779         (Add_symbols::run): Don't check for compatible target.
4780         * fileread.cc (Input_file::open_binary): Call
4781         parameters_force_valid_target.
4782         * gold.cc (queue_middle_tasks): Likewise.
4783         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
4784         set_target on object.
4785         * dynobj.h (class Sized_dynobj): Update declarations.
4786         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
4787         make_elf_object returns NULL.
4788         (Archive::include_member): Don't check whether object target is
4789         compatible.
4790         * output.cc (Output_section::add_input_section): Get target from
4791         parameters.
4792         (Output_section::relax_input_section): Likewise.
4793         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
4794         parameters.
4795         (Sized_relobj::do_scan_relocs): Likewise.
4796         (Sized_relobj::relocate_sections): Likewise.
4797         * resolve.cc (Symbol_table::resolve): Likewise.
4798         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
4799         parameter.  Change all callers.
4800         (Symbol_table::add_from_object): Get target from parameters.
4801         (Symbol_table::add_from_relobj): Don't check object target.
4802         (Symbol_table::add_from_dynobj): Likewise.
4803         (Symbol_table::define_special_symbol): Get target from
4804         parameters.
4805         * symtab.h (class Symbol_table): Update declaration.
4806         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
4807         parameter.  Change all callers.  Clear parameter target.
4808         (Binary_test): Test target here.
4809         * testsuite/object_unittest.cc (gold_testsuite): Remove
4810         target_test_pointer parameter.  Change all callers.
4811         (Object_test): Test target here.
4812
4813 2009-09-26  Ian Lance Taylor  <iant@google.com>
4814
4815         * testsuite/initpri1.c: Don't try to use constructor priorities if
4816         compiling with gcc before 4.3.
4817
4818 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
4819
4820         * testsuite/retain_symbols_file_test.sh (check_present): Change
4821         output file name to retain_symbols_file_test.stdout.
4822         (check_absent): Likewise.
4823
4824 2009-09-18  Craig Silverstein  <csilvers@google.com>
4825
4826         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
4827         * options.cc: Include <cerrno> and <fstream>.
4828         (General_options::finalize): Parse -retain-symbols-file tag.
4829         * options.h: New flag.
4830         (General_options): New method should_retain_symbol, new
4831         variable symbols_to_retain.
4832         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
4833         should_retain_symbol map.
4834         * testsuite/Makefile.am (retain_symbols_file_test): New test.
4835         * testsuite/Makefile.in: Regenerate.
4836         * testsuite/retain_symbols_file_test.sh: New file.
4837
4838 2009-09-18  Nick Clifton  <nickc@redhat.com>
4839
4840         * po/es.po: Updated Spanish translation.
4841
4842 2009-09-17  Doug Kwan  <dougkwan@google.com>
4843
4844         * debug.h (DEBUG_RELAXATION): New constant.
4845         (DEBUG_ALL): Add DEBUG_RELAXATION.
4846         (debug_string_to_enum): Add relaxation debug option.
4847         * layout.cc
4848         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
4849         Layout::Relaxation_debug_check::read_sections,
4850         Layout::Relaxation_debug_check::read_sections): New method definitions.
4851         (Layout::Layout): Initialize data members
4852         record_output_section_data_from_scrips_,
4853         script_output_section_data_list_ and relaxation_debug_check_.
4854         (Layout::save_segments, Layout::restore_segments,
4855         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
4856         Layout::relaxation_loop_body): New method definitions.
4857         (Layout::finalize): Support relaxation.  Move section layout code to
4858         Layout::relaxation_loop_body.
4859         (Layout::set_asection_address_from_script): Move code for orphan
4860         section placement out.
4861         (Layout::place_orphan_sections_in_script): New method definition.
4862         * layout.h (Output_segment_headers, Output_file_header):
4863         New forward class declarations.
4864         (Layout::~Layout): Define.
4865         (Layout::new_output_section_data_from_script): New method definition.
4866         (Layout::place_orphan_sections_in_script): New method declaration.
4867         (Layout::Segment_states): New type declaration.
4868         (Layout::save_segments, Layout::restore_segments,
4869         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
4870         Layout::relaxation_loop_body): New method declarations.
4871         (Layout::Output_section_data_list): New type declaration.
4872         (Layout::Relaxation_debug_check): New class definition.
4873         (Layout::record_output_section_data_from_script_,
4874         Layout::script_output_section_data_list_, Layout::segment_states_,
4875         Layout::relaxation_debug_check_): New data members.
4876         * output.cc: (Output_section_headers::do_size): New method definition.
4877         (Output_section_headers::Output_section_headers): Move size
4878         computation to Output_section_headers::do_size.
4879         (Output_segment_headers::do_size): New method definition.
4880         (Output_file_header::Output_file_header): Move size computation to
4881         Output_file_header::do_size and call it.
4882         (Output_file_header::do_size): New method definition.
4883         (Output_data_group::Output_data_group): Adjust call to
4884         Output_section_data.
4885         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
4886         (Output_symtab_xindex::do_write): Add array bound check.
4887         (Output_section::Input_section::print_to_mapfile): Handle
4888         RELAXED_INPUT_SECTION_CODE.
4889         (Output_section::Output_section): Initialize data member checkpoint_.
4890         (Output_section::~Output_section): Delete checkpoint object pointed
4891         by checkpoint_.
4892         (Output_section::add_input_section): Always add an Input_section if
4893         relaxing.
4894         (Output_section::add_merge_input_section): Add assert.
4895         (Output_section::relax_input_section): New method definition.
4896         (Output_section::set_final_data_size): Set load address to zero for
4897         an unallocated section.
4898         (Output_section::do_address_and_file_offset_have_reset_values):
4899         New method definition.
4900         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
4901         Handle relaxed input section.
4902         (Output_section::sort_attached_input_sections): Checkpoint input
4903         section list lazily.
4904         (Output_section::get_input_sections): Change type of input_sections to
4905         list of Simple_input_section pointers.  Checkpoint input section list
4906         lazily.  Also handle relaxed input sections.
4907         (Output_section::add_input_section_for_script): Take a reference to
4908         a Simple_input_section object instead of Relobj pointer and section
4909         index as parameter.  Handle relaxed input sections.
4910         (Output_section::save_states, Output_section::restore_states): New
4911         method definitions.
4912         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
4913         (Output_data::is_data_size_fixed): New method definition.
4914         (Output_data::reset_addresss_and_file_offset): Do not reset data size
4915         if it is fixed.
4916         (Output_data::address_and_file_offset_have_reset_values): New method
4917         definition.
4918         (Output_data::do_address_and_file_offset_have_reset_values): New method
4919         definition.
4920         (Output_data::set_data_size): Check that data size is not fixed.
4921         (Output_data::fix_data_size): New method definition.
4922         (Output_data::is_data_size_fixed_): New data member.
4923         (Output_section_headers::set_final_data_size): New method definition.
4924         (Output_section_headers::do_size): New method declaration.
4925         (Output_segment_headers::set_final_data_size): New method definition.
4926         (Output_segment_headers::do_size): New method declaration.
4927         (Output_file_header::set_final_data_size)::New method definition.
4928         (Output_file_header::do_size)::New method declaration.
4929         (Output_section_data::Output_section_data): Add new parameter
4930         is_data_size_fixed and use it to fix data size.
4931         (Output_data_const::Output_data_const): Adjust call to base class
4932         constructor and fix data size.
4933         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
4934         base class constructor and fix data size.
4935         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
4936         base class constructor and fix data size.
4937         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
4938         class constructor and fix data size.
4939         (Output_data_group::set_final_data_size): New method definition.
4940         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
4941         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
4942         class constructor and fix data size.
4943         (Output_relaxed_input_section): New class definition.
4944         (Output_section::Simple_input_section): New class definition.
4945         (Output_section::get_input_sections): Adjust parameter list.
4946         (Output_section::add_input_section_for_script): Same.
4947         (Output_section::save_states, Output_section::restore_states,
4948         Output_section::do_address_and_file_offset_have_reset_values,
4949         (Output_section::Input_section::Input_section): Handle
4950         RELAXED_INPUT_SECTION_CODE.  Add new overload for
4951         Output_relaxed_input_section.
4952         (Output_section::Input_section::is_input_section,
4953         Output_section::Input_section::set_output_section): Handle relaxed
4954         input section.
4955         (Output_section::Input_section::is_relaxed_input_section,
4956         Output_section::Input_section::output_section_data,
4957         Output_section::Input_section::relaxed_input_section): New method
4958         definitions.
4959         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
4960         value.
4961         (Output_section::Input_section::u1_): Update comments.
4962         (Output_section::Input_section::u2_): Add new union member poris.
4963         (Output_section::Checkpoint_output_section): New classs definition.
4964         (Output_section::relax_input_section): New method declaration.
4965         (Output_section::checkpoint_): New data member.
4966         (Output_segment): Update comments.
4967         (Output_segment::Output_segment): Un-privatize copy constructor.
4968         (Output_segment::operator=): Un-privatize.
4969         * script-sections.cc (Output_section_element::Input_section_list):
4970         Change element type to Output_section::Simple_input_section.
4971         (Output_section_element_dot_assignment::set_section_addresses):
4972         Register output section data for relaxation clean up.
4973         (Output_data_exression::Output_data_expression): Adjust call to base
4974         constructor to fix data size.
4975         (Output_section_element_data::set_section_addresses): Register
4976         Output_data_expression object for relaxation clean up.
4977         (struct Input_section_info): Replace Relobj pointer and section index
4978         pair with Output_section::Simple_input_section and Convert struct to a
4979         class.
4980         (Input_section_sorter::operator()): Adjust access to
4981         Input_section_info data member to use accessors.
4982         (Output_section_element_input::set_section_addresses): Use layout
4983         parameter.  Adjust code to use Output_section::Simple_input_section
4984         and Input_secction_info classes.  Register filler for relaxation
4985         clean up.
4986         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
4987         and section index pair with Output_section::Simple_input_section
4988         class.  Adjust code accordingly.
4989         (Phdrs_element::release_segment): New method definition.
4990         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
4991         segment list.
4992         (Script_sections::release_segments): New method definition.
4993         * gold/script-sections.h (Script_sections::release_segments): New
4994         method declaration.
4995         * gold/target.h (Target::may_relax, Target::relax,
4996         Target::do_may_relax, Target::do_relax): New method definitions.
4997
4998 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4999
5000         * arm.cc (has_signed_unsigned_overflow): New function.
5001         (Arm_relocate_functions::abs8): New function.
5002         (Target_arm::Scan::local): Handle R_ARM_ABS8.
5003         (Target_arm::Scan::global): Likewise.
5004         (Target_arm::relocate::relocate): Likewise.
5005         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5006         Likewise.
5007
5008 2009-09-16  Cary Coutant  <ccoutant@google.com>
5009
5010         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
5011         * testsuite/Makefile.in: Regenerate.
5012
5013 2009-09-11  Nick Clifton  <nickc@redhat.com>
5014
5015         * po/gold.pot: Updated by the Translation project.
5016
5017 2009-09-08  Cary Coutant  <ccoutant@google.com>
5018
5019         * output.cc (Output_file::open): Add execute permission to empty file.
5020         * testsuite/Makefile.am (permission_test): New test.
5021         * testsuite/Makefile.in: Regenerate.
5022
5023 2009-09-02  Ian Lance Taylor  <iant@google.com>
5024
5025         * output.cc (Output_file::resize): Call map_no_anonymous rather
5026         than map.
5027
5028 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
5029
5030         * gold.cc: Include "incremental.h".
5031         (queue_initial_tasks): Call Incremental_checker methods.
5032         * incremental.cc: Include "output.h".
5033         (Incremental_checker::can_incrementally_link_output_file): New
5034         method.
5035         * incremental.h (Incremental_checker): New class.
5036
5037         * output.cc (Output_file::open_for_modification): New method.
5038         (Output_file::map_anonymous): Changed return type to bool.  Record
5039         map in base_ field.
5040         (Output_file::map_no_anonymous): New method, broken out of map.
5041         (Output_file::map): Use map_no_anonymous and map_anonymous.
5042         * output.h (class Output_file): Update declarations.
5043
5044 2009-08-24  Cary Coutant  <ccoutant@google.com>
5045
5046         * options.h (Command_line::Pre_options): New class.
5047         (Command_line::pre_options): New member.
5048         * options.cc (gold::options::ready_to_register): New variable.
5049         (One_option::register_option): Do nothing if not registering options.
5050         Assert if same short option registered twice.
5051         (General_options::General_options): Turn off option registration when
5052         done constructing.
5053         (Command_line::Pre_options::Pre_options): New constructor.
5054
5055 2009-08-24  Cary Coutant  <ccoutant@google.com>
5056
5057         * options.h (General_options::no_keep_memory): Remove incorrect
5058         short option.
5059
5060 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5061
5062         * Makefile.am (am__skiplex, am__skipyacc): New.
5063         * Makefile.in: Regenerate.
5064
5065 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5066
5067         * Makefile.am (AM_CPPFLAGS): Renamed from ...
5068         (INCLUDES): ... this.
5069         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
5070         (AM_CPPFLAGS): Renamed from ...
5071         (INCLUDE): ... this.
5072         * Makefile.in, testsuite/Makefile.in: Regenerate.
5073
5074         * Makefile.in: Regenerate.
5075         * aclocal.m4: Likewise.
5076         * config.in: Likewise.
5077         * configure: Likewise.
5078         * testsuite/Makefile.in: Likewise.
5079
5080         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
5081         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
5082         * Makefile.in: Regenerate.
5083         * testsuite/Makefile.in: Regenerate.
5084
5085 2009-08-19  Cary Coutant  <ccoutant@google.com>
5086
5087         * resolve.cc (Symbol_table::resolve): Don't complain about defined
5088         symbols in shared libraries overridden by hidden or internal symbols
5089         in the main program.
5090
5091 2009-08-19  Chris Demetriou  <cgd@google.com>
5092
5093         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
5094         checking source file names in error messages.
5095
5096 2009-08-18  Doug Kwan  <dougkwan@google.com>
5097
5098         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
5099         an elcpp::Ehdr as parameter.  Adjust call to set_target.
5100         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
5101         an elfcpp::Ehdr as parameter.
5102         * object.cc (Object::set_target): Remove the version that looks up
5103         a target and sets it.
5104         (Sized_relobj::setup): Take a Target object instead of
5105         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
5106         (make_elf_sized_object): Find target and ask target to
5107         make an ELF object.
5108         * object.h: (Object::set_target): Remove the version that looks up
5109         a target and sets it.
5110         (Sized_relobj::setup): Take a Target object instead of
5111         an elfcpp:Ehdr as parameter.
5112         * target.cc: Include dynobj.h.
5113         (Target::do_make_elf_object_implementation): New.
5114         (Target::do_make_elf_object): New.
5115         * target.h (Target::make_elf_object): New template declaration.
5116         (Target::do_make_elf_object): New method declarations.
5117         (Target::do_make_elf_object_implementation): New template declaration.
5118
5119 2009-08-14  Ian Lance Taylor  <iant@google.com>
5120
5121         * gold.h (FUNCTION_NAME): Define.
5122         (gold_unreachable): Use FUNCTION_NAME.
5123
5124 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
5125
5126         * icf.cc (Icf::find_identical_sections): Issue a warning when a
5127         symbol in the --keep-unique list is not found.
5128
5129 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
5130
5131         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
5132         been maked as --keep-unique.
5133         (Icf::unfold_section): New function.
5134         * icf.h (Icf::unfold_section): New function.
5135         * options.h (General_options::keep_unique): New option.
5136         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
5137         * testsuite/Makefile.in: Regenerate.
5138         * testsuite/icf_keep_unique_test.sh: New file.
5139         * testsuite/icf_keep_unique_test.cc: New file.
5140
5141 2009-08-12  Cary Coutant  <ccoutant@google.com>
5142
5143         PR 10471
5144         * resolve.cc (Symbol_table::resolve): Check for references from
5145         dynamic objects to hidden and internal symbols.
5146         * testsuite/Makefile.am (hidden_test.sh): New test.
5147         * testsuite/Makefile.in: Regenerate.
5148         * testsuite/hidden_test.sh: New script.
5149         * testsuite/hidden_test_1.c: New test source.
5150         * testsuite/hidden_test_main.c: New test source.
5151
5152 2009-08-11  Doug Kwan  <dougkwan@google.com>
5153
5154         * arm.cc: Update comments.
5155         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
5156         segment to locate the .ARM.exidx section if present.
5157
5158 2009-08-09  Doug Kwan  <dougkwan@google.com>
5159
5160         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
5161         patch.
5162
5163 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
5164         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
5165         compiler warnings.
5166
5167 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
5168
5169         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
5170         valid tls_segment only for non-debug-section relocations.
5171         * testsuite/Makefile.am: Add gc_tls_test.
5172         * testsuite/Makefile.in: Regenerate.
5173         * testsuite/gc_tls_test.cc: New file.
5174         * testsuite/gc_tls_test.sh: New file.
5175
5176 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
5177
5178         * icf.cc: New file.
5179         * icf.h: New file.
5180         * Makefile.am (CCFILES): Add icf.cc.
5181         (HFILES): Add icf.h
5182         * Makefile.in: Regenerate.
5183         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
5184         * gc.h (gc_process_relocs): Populate lists used by icf to contain
5185         section, symbol and addend information for the relocs.
5186         * gold.cc (queue_middle_tasks): Call identical code folding.
5187         * gold.h: Add defines for multimap.
5188         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
5189         to the call of finalize_local_symbols.
5190         * main.cc (main): Create object of class Icf.
5191         * object.cc (Sized_relobj::do_layout): Allow this function to be
5192         called twice during icf.
5193         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
5194         to sections marked as identical by icf.
5195         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
5196         when available.
5197         (Sized_relobj::do_section_entsize): New function.
5198         * object.h (Object::section_entsize): New function.
5199         (Object::do_section_entsize): New pure virtual function.
5200         (Relobj::finalize_local_symbols): Add new parameter.
5201         (Relobj::do_section_entsize): New function.
5202         * options.h (General_options::icf): New option.
5203         (General_options::icf_iterations): New option.
5204         (General_options::print_icf_sections): New option.
5205         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
5206         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
5207         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
5208         icf.
5209         * symtab.cc (Symbol_table::is_section_folded): New function.
5210         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
5211         to sections marked as identical by icf.
5212         * symtab.h (Symbol_table::set_icf): New function.
5213         (Symbol_table::icf): New function.
5214         (Symbol_table::is_section_folded): New function.
5215         (Symbol_table::icf_): New data member.
5216         * target-reloc.h (relocate_section): Ignore sections folded by icf.
5217         * testsuite/Makefile.am: Add commands to build icf_test.
5218         * testsuite/Makefile.in: Regenerate.
5219         * testsuite/icf_test.sh: New file.
5220         * testsuite/icf_test.cc: New file.
5221
5222 2009-07-24  Chris Demetriou  <cgd@google.com>
5223
5224         * layout.cc (is_compressible_debug_section): Fix incorrect
5225         comment about compressed section names.
5226
5227 2009-07-20  Ian Lance Taylor  <ian@airs.com>
5228
5229         PR 10419
5230         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
5231
5232 2009-07-16  Ian Lance Taylor  <iant@google.com>
5233
5234         PR 10400
5235         * layout.h: #include <map>.
5236         (class Kept_section): Change from struct to class.  Add accessors
5237         and setters.  Add section size to Comdat_group mapping.  Change
5238         Comdat_group to std::map.  Add is_comdat_ field.  Add
5239         linkonce_size field in union.
5240         (class Layout): Update declaration of find_or_add_kept_section.
5241         Don't declare find_kept_object.
5242         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
5243         parameter.  Add object, shndx, is_comdat, and is_group_name
5244         parameters.  Change all callers.  Adjust for new Kept_section.
5245         (Layout::find_kept_object): Remove.
5246         * object.cc (Sized_relobj::include_section_group): Update use of
5247         Kept_section.  Rename secnum to shndx.  Only record
5248         Kept_comdat_section if sections are the same size.
5249         (Sized_relobj::include_linkonce_section): Update use of
5250         Kept_section.  Only record Kept_comdat_section if sections are the
5251         same size.  Set size of linkonce section.
5252         (Sized_relobj::map_to_kept_section): Update call to
5253         get_kept_comdat_section.
5254         * object.h (class Sized_relobj): Rename fields in
5255         Kept_comdat_section to drop trailing underscores; change object
5256         field to Relobj*.  Change Kept_comdat_section_table to store
5257         struct rather than pointer.
5258         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
5259         Add kept_object and kept_shndx parameters.  Change all callers.
5260         (Sized_relobj::get_kept_comdat_section): Change return type to
5261         bool.  Add kept_object and kept_shndx parameters.  Change all
5262         callers.
5263         * plugin.cc (Pluginobj::include_comdat_group): Update call to
5264         Layout::find_or_add_kept_section.
5265
5266 2009-07-09  Ian Lance Taylor  <iant@google.com>
5267
5268         * merge.cc (Object_merge_map::initialize_input_to_output_map):
5269         Reserve space in the hash table.
5270
5271 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
5272
5273         * fileread.cc (File_read::get_mtime): New method.
5274         * fileread.h (Timespec): New structure.
5275         (File_read::get_mtime): New method.
5276         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
5277         Renamed from timestamp_nsec.
5278         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
5279         Elf_Xword.
5280         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
5281         timestamp_nsec.
5282         (Incremental_inputs::report_archive): Save mtime; style fix.
5283         (Incremental_inputs::report_obejct): Save mtime; style fix.
5284         (Incremental_inputs::report_script): Save mtime; style fix.
5285         (Incremental_inputs::finalize_inputs): Style fix.
5286         (Incremental_inputs::finalize): Style fix.
5287         (Incremental_inputs::create_input_section_data): Store inputs
5288         mtime.
5289         * incremental.h (Incremental_inputs::report_script): Add mtime
5290         argument.
5291         (Incremental_inputs::Input_info::Input_info): Intialize only one
5292         union member.
5293         (Incremental_inputs::Input_info::archive): Move to nameless
5294         union.
5295         (Incremental_inputs::Input_info::obejct): Move to nameless union.
5296         (Incremental_inputs::Input_info::script): Move to nameless union.
5297         (Incremental_inputs::mtime): New field.
5298         * script.cc (read_input_script): Pass file mtime to
5299         Incremental_input.
5300         * script.h (Script_info::inputs): Style fix.
5301
5302 2009-07-01  Ian Lance Taylor  <ian@airs.com>
5303
5304         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
5305         instead of 32.
5306
5307 2009-06-24  Ian Lance Taylor  <iant@google.com>
5308
5309         PR 10156
5310         * layout.cc (Layout::choose_output_section): If we find an
5311         existing section, update the flags.
5312         (Layout::create_notes): New function, broken out of
5313         Layout::finalize.
5314         (Layout::finalize): Don't create note sections.
5315         (Layout::create_note): Don't crash if linker script discards
5316         section.
5317         (Layout::create_gold_note): Likewise.
5318         (Layout::create_build_id): Likewise.  Don't set
5319         after_input_sections on the section.
5320         (Layout::create_executable_stack_info): Remove target parameter.
5321         Change caller.
5322         * layout.h (class Layout): Declare create_notes.  Update
5323         declaration of create_executable_stack_info.
5324         * gold.cc (queue_middle_tasks): Call create_notes.
5325         * output.cc (Output_section::update_flags_for_input_section): Move
5326         here from output.h.  If SHF_ALLOC flag is newly set, mark address
5327         invalid.
5328         * output.h (Output_data::mark_address_invalid): New function.
5329         (class Output_section): Only declare, not define,
5330         update_flags_for_input_section.  Remove set_flags.
5331
5332 2009-06-24  Ian Lance Taylor  <iant@google.com>
5333
5334         * script-sections.cc (Output_section_definition::
5335         set_section_addresses): Rename shadowing local load_address to
5336         laddr.
5337
5338 2009-06-24  Ian Lance Taylor  <iant@google.com>
5339
5340         PR 10244
5341         * reloc.cc (relocate_sections): Skip empty relocation sections.
5342
5343 2009-06-23  Ian Lance Taylor  <iant@google.com>
5344
5345         PR 10156
5346         * layout.cc (Layout::create_note): Use choose_output_section
5347         rather than make_output_section.
5348
5349 2009-06-23  Ian Lance Taylor  <iant@google.com>
5350
5351         PR 10237
5352         * options.cc (General_options::parse_V): Set printed_version_.
5353         (General_options::General_options): Initialize printed_version_.
5354         * options.h (class General_options): Add printed_version_ field.
5355         * gold.cc (queue_initial_tasks): If there are no input files,
5356         don't give a fatal error if we printed the version information.
5357         (queue_middle_tasks): If using -r with a shared object, give a
5358         fatal error rather than an ordinary error.
5359
5360 2009-06-23  Ian Lance Taylor  <iant@google.com>
5361
5362         PR 10219
5363         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
5364         (Layout::make_output_section): Set have_stabstr_section_ if we see
5365         a .stab*str section.
5366         (Layout::finalize): Call link_stabs_sections.
5367         (Layout::link_stabs_sections): New file.
5368         * layout.h (class Layout): Add have_stabstr_section_ field.
5369         Declare link_stabs_sections.
5370
5371 2009-06-23  Doug Kwan  <dougkwan@google.com>
5372
5373         * Makefile.am (libgold_a_LIBADD): New.
5374         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
5375         * Makefile.in: Regenerate.
5376         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
5377         * configure: Regenerate.
5378         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
5379         * fileread.cc: Include sys/state.h
5380         * gold.h: Declare memmem and strndup if found missing.
5381         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
5382
5383 2009-06-23  Ian Lance Taylor  <iant@google.com>
5384
5385         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
5386         * configure: Rebuild.
5387
5388 2009-06-23  Ian Lance Taylor  <iant@google.com>
5389
5390         PR 10147
5391         * object.cc (Object::section_contents): Don't try to get a view if
5392         the section has length zero.
5393         (Object::handle_gnu_warning_section): If the section is empty, use
5394         the name of the section as the warning.
5395
5396 2009-06-23  Ian Lance Taylor  <iant@google.com>
5397
5398         PR 10133
5399         * stringpool.h (class Stringpool_template): Add optimize_ field.
5400         (Stringpool_template::set_optimize): New function.
5401         * stringpool.cc (Stringpool_template::Stringpool_template):
5402         Initialize optimize_ field.
5403         (Stringpool_template::set_string_offsets): Test local optimize
5404         fild rather than parameter.
5405         * layout.cc (Layout::Layout): Call set_optimize on the section
5406         name stringpool.
5407
5408 2009-06-22  Ian Lance Taylor  <iant@google.com>
5409
5410         PR 10030
5411         * yyscript.y: Parse TARGET.
5412         * script.cc (script_set_target): New function.
5413         * script-c.h (script_set_target): Declare.
5414         * options.cc (General_options::string_to_object_format): Rename
5415         from string_to_object_format in anonymous namespace.  Change
5416         callers.
5417         * options.h (class General_options): Declare
5418         string_to_object_format.
5419
5420 2009-06-22  Ian Lance Taylor  <iant@google.com>
5421
5422         * script-sections.cc (Script_sections::create_segments): Don't put
5423         program headers in a PT_LOAD segment if -n or -N.
5424
5425 2009-06-22  Ian Lance Taylor  <iant@google.com>
5426
5427         PR 10141
5428         * options.h (class General_options): Add -z lazy and -z now.  Sort
5429         -z options into alphabetical order.
5430         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
5431
5432 2009-06-21  Ian Lance Taylor  <iant@google.com>
5433
5434         * layout.cc (Layout::make_output_section): Call
5435         Target::new_output_section.
5436         (Layout::attach_allocated_section_to_segment): Put large section
5437         sections in a separate load segment with the large segment flag
5438         set.
5439         (Layout::segment_precedes): Sort large data segments after other
5440         load segments.
5441         (align_file_offset): New static function.
5442         (Layout::set_segment_offsets): Use align_file_offset.
5443         * output.h (class Output_section): Add is_small_section_ and
5444         is_large_section_ fields.
5445         (Output_section::is_small_section): New function.
5446         (Output_section::set_is_small_section):  New function.
5447         (Output_section::is_large_section): New function.
5448         (Output_section::set_is_large_section): New function.
5449         (Output_section::is_large_data_section): New function.
5450         (class Output_segment): Add is_large_data_segment_ field.
5451         (Output_segment::is_large_data_segment): New function.
5452         (Output_segment::set_is_large_data_segment): New function.
5453         * output.cc (Output_section::Output_section): Initialize new
5454         fields.
5455         (Output_segment::Output_segment): Likewise.
5456         (Output_segment::add_output_section): Add assertion that large
5457         data sections always go in large data segments.  Force small data
5458         sections to the end of the list of data sections.  Force small BSS
5459         sections to the start of the list of BSS sections.  For large BSS
5460         sections to the end of the list of BSS sections.
5461         * symtab.h (class Symbol): Declare is_common_shndx.
5462         (Symbol::is_defined): Check Symbol::is_common_shndx.
5463         (Symbol::is_common): Likewise.
5464         (class Symbol_table): Define enum Commons_section_type.  Update
5465         declarations.  Add small_commons_ and large_commons_ fields.
5466         * symtab.cc (Symbol::is_common_shndx): New function.
5467         (Symbol_table::Symbol_table): Initialize new fields.
5468         (Symbol_table::add_from_object): Put small and large common
5469         symbols in the right list.
5470         (Symbol_table::sized_finalized_symbol): Check
5471         Symbol::is_common_shndx.
5472         (Symbol_table::sized_write_globals): Likewise.
5473         * common.cc (Symbol_table::do_allocate_commons): Allocate new
5474         common symbol lists.  Don't call do_allocate_commons_list if the
5475         list is empty.
5476         (Symbol_table::do_allocate_commons_list): Remove is_tls
5477         parameter.  Add comons_section_type parameter.  Change all
5478         callers.  Handle small and large common symbols.
5479         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
5480         Symbol::is_common_shndx.
5481         * resolve.cc (symbol_to_bits): Likewise.
5482         * target.h (Target::small_common_shndx): New function.
5483         (Target::small_common_section_flags): New function.
5484         (Target::large_common_shndx): New function.
5485         (Target::large_common_section_flags): New function.
5486         (Target::new_output_section): New function.
5487         (Target::Target_info): Add small_common_shndx, large_common_shndx,
5488         small_common_section_flags, and large_common_section_flags
5489         fields.
5490         (Target::do_new_output_section): New virtual function.
5491         * arm.cc (Target_arm::arm_info): Initialize new fields.
5492         * i386.cc (Target_i386::i386_info): Likewise.
5493         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
5494         Likewise.
5495         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
5496         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
5497         (Target_x86_64::do_new_output_section): New function.
5498         * configure.ac: Define conditional MCMODEL_MEDIUM.
5499         * testsuite/Makefile.am (check_PROGRAMS): Add large.
5500         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
5501         (large_LDFLAGS): Define.
5502         * testsuite/large.c: New file.
5503         * testsuite/testfile.cc (Target_test::test_target_info):
5504         Initialize new fields.
5505         * configure, testsuite/Makefile.in: Rebuild.
5506
5507 2009-06-05  Doug Kwan  <dougkwan@google.com>
5508
5509         * Makefile.am (CCFILES): Add target.cc.
5510         * Makefile.in: Regenerate.
5511         * i386.cc (class Target_i386): Define new virtual method to
5512         override do_is_local_label_name in parent.
5513         * object.cc (Sized_relobj::do_count_local_symbols): Discard
5514         local symbols if --discard-locals or -X is given.
5515         * options.h (class General_options): Declare new options
5516         '--discard-locals' and '-X' for discarding locals.
5517         * target.h (class Target): Define new methods is_local_label_name.
5518         Declare new virtual method do_is_local_label_name.
5519         * target.cc: New file.
5520         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
5521         (check_SCRIPTS): Add discard_locals_test.sh.
5522         (check_DATA): Add discard_local_tests.syms.
5523         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
5524         (discard_local_tests.syms, discard_locals_test.o): New make rules.
5525         * testsuite/Makefile.in: Regenerate.
5526         * testsuite/discard_locals_test.c: New file.
5527         * testsuite/discard_locals_test.sh: Same.
5528
5529 2009-06-05  Doug Kwan  <dougkwan@google.com>
5530
5531         * object.cc (Sized_relobj::Sized_relobj): Initialize
5532         discarded_eh_frame_shndx_ to -1U.
5533         (Sized_relobj::do_layout): Record index of a discard .eh_frame
5534         section.
5535         (Sized_relobj::do_count_local_symbols): Skip local symbols in
5536         a discarded .eh_frame section.
5537         (Sized_relobj::do_finalize_local_symbols): Ditto.
5538         * object.h (class Sized_relobj): Declare new member
5539         discarded_eh_frame_shndx_.
5540         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
5541         (local_labels_test.o, local_labels_test): New rules.
5542         * testsuite/Makefile.in: Regenerate.
5543
5544 2009-06-04  Doug Kwan  <dougkwan@google.com>
5545
5546         * layout.cc (Layout::section_name_mapping): Add mapping for
5547         special ARM sections.
5548
5549 2009-06-03  Doug Kwan  <dougkwan@google.com>
5550
5551         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
5552         (utils::has_overflow): Same.
5553
5554 2009-06-03  Ian Lance Taylor  <iant@google.com>
5555
5556         * layout.cc (Layout::section_name_mapping): New array, replacing
5557         Layout::linkonce_mapping.
5558         (Layout::section_name_mapping_count): New variable, replacing
5559         Layout::linkonce_mapping_count.
5560         (Layout::linkonce_output_name): Remove.
5561         (Layout::output_section_name): Rewrite.
5562         * layout.h (class Layout): Rename Linkonce_mapping to
5563         Section_name_mapping, linkonce_mapping to section_name_mapping,
5564         linkonce_mapping_count to section_name_mapping_count.  Don't
5565         declare linkonce_output_name.
5566
5567 2009-06-03  Doug Kwan  <dougkwan@google.com>
5568
5569         * gold/arm.cc (namespace utils): New.
5570         (Target_arm::reloc_is_non_pic): Define new method.
5571         (class Arm_relocate_functions): New.
5572         (Target_arm::Relocate::relocate): Handle relocation types used by
5573         Android.
5574
5575 2009-06-03  Ian Lance Taylor  <iant@google.com>
5576
5577         * arm.cc (Target_arm::scan::global): Use || instead of |.
5578
5579 2009-06-02  Doug Kwan  <dougkwan@google.com>
5580
5581         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
5582         issued_non_pic_error_.
5583         (class Target_arm::Scan): Declare new method check_non_pic.
5584         Define new method symbol_needs_plt_entry.
5585         Declare new data member issued_non_pic_error_.
5586         (class Target_arm::Relocate): Declare new method
5587         should_apply_static_reloc.
5588         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
5589         (Target_arm::Scan::check_non_pic): Define new method.
5590         (Target_arm::Scan::local): Handle a small subset of reloc types used
5591         by Android.
5592         (Target_arm::Scan::local): Same.
5593         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
5594
5595 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
5596
5597         * incremental.cc (Incremental_inputs::report_command_line): Filter
5598         out --incremental-* options.
5599
5600 2009-05-29  Doug Kwan  <dougkwan@google.com>
5601
5602         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
5603         template class.
5604         (class Target_arm): Update comment.
5605         (Target_arm::Target_arm): Initialize new data members GOT_,
5606         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
5607         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
5608         and Target_arm::rel_dyn_section.
5609         Declare new_enum Target_arm::Got_type.
5610         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
5611         and DYNBSS_.
5612         Update commments for member do_dynsym_value.
5613         (Target_arm::got_size, Target_arm::plt_section,
5614         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
5615         new methods inside class defintion.
5616         (Target_arm::got_section): Define new method.
5617         (Target_arm::rel_dyn_section): Same.
5618         (Output_data_plt_arm): New template class.
5619         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
5620         (Output_data_plt_arm:do_adjust_output_section): Define new method.
5621         (Output_data_plt_arm::add_entry): Same.
5622         (Output_data_plt_arm::first_plt_entry): Define new
5623         static data member for PLT instruction template.
5624         (Output_data_plt_arm::plt_entry): Same.
5625         (Output_data_plt_arm::do_write): Define new method.
5626         (Target_arm::make_plt_entry): Same.
5627         (Target_arm::do_finalize_sections): Same.
5628         (Target_arm::do_dynsym_value): Same.
5629
5630 2009-05-28  Doug Kwan  <dougkwan@google.com>
5631
5632         * Makefile.am (TARGETSOURCES): Add arm.cc.
5633         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
5634         * Makefile.in: Regenerate.
5635         * arm.cc: New file.
5636         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
5637
5638 2009-05-26  Doug Kwan  <dougkwan@google.com>
5639
5640         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
5641         (General_options::check_excluded_libs): Strip off directories in
5642         archive name before matching like GNU ld does.
5643         * testsuite/Makefile.am (MOSTLYCLEANFILES,
5644         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
5645         (exclude_libs_test_LDFLAGS): Add linker option
5646         -Wl,--exclude-libs,libexclude_libs_test_3
5647         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
5648         an explicit archive without using -l.
5649         (alt/libexclude_libs_test_3.a): New make rule.
5650         * testsuite/Makefile.in: Regenerate.
5651         * testsuite/exclude_libs_test.c : Declare lib3_default().
5652         (main): Call it.
5653         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
5654         * exclude_libs_test_3.c: New file.
5655
5656 2009-05-26  Nick Clifton  <nickc@redhat.com>
5657
5658         * po/id.po: New Indonesian translation.
5659         * po/gold.pot: Updated template file.
5660
5661 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
5662
5663         * testsuite/Makefile.am: Add -ffunction-sections to compile
5664         gc_comdat_test files.  Add -Wl,--gc-sections to build
5665         gc_comdat_test.
5666         * testsuite/Makefile.in: Regenerate.
5667         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
5668
5669 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
5670
5671         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
5672         kept comdat section was garbage collected.
5673         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
5674         * testsuite/Makefile.in: Regenerate.
5675         * testsuite/gc_comdat_test.sh: New file.
5676         * testsuite/gc_comdat_test_1.cc: New file.
5677         * testsuite/gc_comdat_test_2.cc: New file.
5678
5679 2009-05-19  Doug Kwan  <dougkwan@google.com>
5680
5681         * archive.cc (Archive::Archive): Move constructor from archive.h
5682         to here.  Initialize no_export_.
5683         (Archive::get_elf_object_for_member): Set no_export flag of object.
5684         * archive.h (Archive::Archive): Move constructor body to
5685         archive.cc.
5686         (Archive::no_export): New method.
5687         (Archive::no_export_): New field.
5688         * object.h (Object::Object): Initialize no_export_ to false.
5689         (Object::no_export, Object::set_no_export): New methods.
5690         (Object::no_export_): New field.
5691         * options.cc (General_options::parse_exclude_libs): New method.
5692         (General_options::check_excluded_libs) Same.
5693         * options.h (exclude_libs): New option.
5694         (General_options::check_excluded_libs): New method declaration.
5695         (General_options::excluded_libs_): New field.
5696         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
5697         default or protected visibility if an object has no-export flag set.
5698         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
5699         (check_SCRIPTS): Add exclude_libs_test.sh.
5700         (check_DATA): Add exclude_libs_test.syms.
5701         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
5702         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
5703         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
5704         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
5705         (exclude_libs_test.syms, libexclude_libs_test_1.a,
5706         libexclude_libs_test_2.a): New rules.
5707         * testsuite/Makefile.in: Regenerate.
5708         * testsuite/exclude_libs_test.c: New file.
5709         * testsuite/exclude_libs_test.sh: Ditto.
5710         * testsuite/exclude_libs_test_1.c: Ditto.
5711         * testsuite/exclude_libs_test_2.c: Ditto.
5712
5713 2009-05-15  Ian Lance Taylor  <iant@google.com>
5714
5715         * configure.ac: Check for declarations for cases where libiberty.h
5716         checks HAVE_DECL_xxx.
5717         * configure, config.in: Rebuild.
5718
5719 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
5720
5721         * gold.h (Incremental_argument_list): Remove (invalid) forward
5722         declaration.
5723         * incremental.cc (Incremental_inputs::report_achive): New method.
5724         (Incremental_inputs::report_object): New method.
5725         (Incremental_inputs::report_script): New method.
5726         (Incremental_inputs::finalize_inputs): New method.
5727         (Incremental_inputs::finalize): Call finalize_inputs().
5728         (Incremental_inputs::sized_create_incremental_inputs_section_data):
5729         Create inputs entries.
5730         * incremental.h (Incremental_input_type): New enum.
5731         (Incremental_inputs::Incremental_input): Initialize new fields.
5732         (Incremental_inputs::report_inputs): New method.
5733         (Incremental_inputs::report_achive): New method.
5734         (Incremental_inputs::report_object): New method.
5735         (Incremental_inputs::report_script): New method.
5736         (Incremental_inputs::finalize_inputs): New method.
5737         (Incremental_inputs::Input_info): New struct.
5738         (Incremental_inputs::Input_info_map): New typedef.
5739         (Incremental_inputs::lock_): New field.
5740         (Incremental_inputs::Inputs_): New field.
5741         (Incremental_inputs::Inputs_map): New field.
5742         * main.cc (main): Call Incremental_input::report_inputs.
5743         * options.h (Input_argument_list): Typedef moved from
5744         Input_arguments.
5745         (Input_file_group::Files): Remove, use ::Input_argument_list.
5746         (Input_file_group::Input_argument_list): Remove, use
5747         ::Input_argument_list.
5748         * plugin.cc (Plugin_manager::add_input_file): Add error in
5749         incremental build.
5750         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
5751         functions.
5752         * script.cc (read_input_script): Call
5753         Incremental_input::report_script.
5754         * script.h (Script_info): New class.
5755
5756 2009-04-27  Ian Lance Taylor  <iant@google.com>
5757
5758         * x86_64.cc (do_adjust_output_section): Set entsize to
5759         plt_entry_size.
5760
5761 2009-04-23  Elliott Hughes  <enh@google.com>
5762
5763         * output.cc (Output_file::close): After short writes, continue
5764         writing from the correct offset in the buffer being written.
5765
5766 2009-04-23  Chris Demetriou  <cgd@google.com>
5767
5768         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
5769         * configure: Regenerate.
5770         * config.in: Regenerate.
5771         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
5772         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
5773
5774 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
5775
5776         * incremental.cc (Incremental_inputs_header_data): Renamed from
5777         Incremental_input_header_data.
5778         (Incremental_inputs_header_data::data_size): New field.
5779         (Incremental_inputs_header_data::put_input_file_count): Renamed
5780         from input_file_count.
5781         (Incremental_inputs_header_data::put_command_line_offset): Renamed
5782         from command_line_offset.
5783         (Incremental_inputs_header_data::put_reserved): Renamed from
5784         put_reserved.
5785         (Incremental_inputs_entry_data): Renamed from
5786         Incremental_input_entry_data.
5787         (Incremental_inputs_entry_data::data_size): New field.
5788         (Incremental_inputs::report_command_line): New method.
5789         (Incremental_inputs::finalize): New method.
5790         (Incremental_inputs::create_incremental_inputs_data): New method.
5791         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
5792         * incremental.h: New file.
5793         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
5794        (Layout::finalize): Create incremental inputs section in
5795         incremental builds.
5796        (Layout::create_incremental_info_sections): New method.
5797         * layout.h (Layout::incremental_inputs): New method.
5798        (Layout::create_incremental_info_sections): New method.
5799        (Layout::incremental_inputs_): New field.
5800         * main.cc (main): Notify Incremental_input of the command line.
5801
5802 2009-04-01  Ian Lance Taylor  <iant@google.com>
5803             Mikolaj Zalewski  <mikolajz@google.com>
5804
5805         * gold.h (reserve_unordered_map): Define, three versions, one for
5806         each version of Unordered_map.
5807         * layout.cc (Layout::Layout): Remove options parameter.  Add
5808         number_of_input_files parameter.  Don't initialize options_.
5809         Initialize number_of_input_files_ and resized_signatures_.  Move
5810         sections_are_attached_.
5811         (Layout::layout_group): Reserve space for group_signatures_.
5812         (Layout::find_or_add_kept_section): Change name parameter to be a
5813         reference.  Resize signatures_ map when it gets large enough.
5814         (Layout::layout_eh_frame): Use parameters->options() instead of
5815         this->options_.
5816         (Layout::make_output_section): Likewise.
5817         (Layout::attach_allocated_section_to_segment): Likewise.
5818         (Layout::finalize, Layout::create_executable_stack): Likewise.
5819         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
5820         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
5821         * layout.h (class Layout): Update declarations.  Remove options_
5822         field.  Add number_of_input_files_ and resized_signatures_
5823         fields.  Move sections_are_attached_ field.
5824         * main.cc (main): Pass number of input files to Layout
5825         constructor.  Don't pass options.
5826
5827 2009-03-30  Ian Lance Taylor  <iant@google.com>
5828
5829         * ffsll.c (ffsll): Correct implementation.
5830
5831 2009-03-27  Ian Lance Taylor  <iant@google.com>
5832
5833         * ffsll.c: New file.
5834         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
5835         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
5836         * ftruncate.c (ftruncate): Declare before definition.
5837         * mremap.c (mremap): Likewise.
5838         * pread.c (pread): Likewise.
5839         * configure, Makefile.in, config.in: Rebuild.
5840
5841         * mremap.c: New file.
5842         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
5843         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
5844         (mremap): Declare if HAVE_MREMAP is not defined.
5845         * configure, Makefile.in, config.in: Rebuild.
5846
5847 2009-03-27  Cary Coutant  <ccoutant@google.com>
5848
5849         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
5850         position independent.
5851         * sparc.cc (Target_sparc::check_non_pic): Likewise.
5852         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
5853
5854 2009-03-24  Cary Coutant  <ccoutant@google.com>
5855
5856         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
5857         an executable.
5858         (needs_dynamic_reloc): Likewise.
5859
5860 2009-03-24  Ian Lance Taylor  <iant@google.com>
5861
5862         * yyscript.y (file_cmd): Recognize EXTERN.
5863         (extern_name_list, extern_name_list_body): New nonterminals.
5864         * script.cc (script_add_extern): Define.
5865         * script-c.h (script_add_extern): Declare.
5866
5867 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
5868
5869         * object.cc (is_elf_object): Define.
5870         * object.h (is_elf_object): Declare.
5871         * archive.cc (Archive::get_elf_object_for_member): Call
5872         is_elf_object.
5873         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
5874
5875 2009-03-24  Elliott Hughes  <enh@google.com>
5876
5877         * output.cc (Output_file::map_anonymous): Define.
5878         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
5879         try an anonymous one.  Report the size if the mmap fails.
5880         * output.h (class Output_file): Declare map_anonymous.
5881
5882 2009-03-24  Ian Lance Taylor  <iant@google.com>
5883
5884         * target-select.cc (instantiate_target): Don't acquire the lock if
5885         the instantiated_target_ field has already been set.
5886
5887 2009-03-23  Ian Lance Taylor  <iant@google.com>
5888
5889         * gold-threads.h (class Initialize_lock): Define.
5890         * gold-threads.cc (class Initialize_lock_once): Define.
5891         (initialize_lock_control): New static variable.
5892         (initialize_lock_pointer): New static variable.
5893         (initialize_lock_once): New static function.
5894         (Initialize_lock::Initialize_lock): Define.
5895         (Initialize_lock::initialize): Define.
5896         * target-select.h: Include "gold-threads.h".
5897         (class Target_selector): Add lock_ and initialize_lock_ fields.
5898         Don't define instantiate_target, just declare it.
5899         * target-select.cc (Target_selector::Target_selector): Initialize
5900         new fields.
5901         (Target_selector::instantiate_target): Define.
5902         * descriptors.h: Include "gold-threads.h".
5903         (class Descriptors): Add initialize_lock_ field.
5904         * descriptors.cc (Descriptors::Descriptors): Initialize new
5905         field.
5906         (Descriptors::open): Use initialize_lock_ field
5907         * errors.h (class Errors): Add initialize_lock_ field.
5908         * errors.cc (Errors::Errors): Initialize new field.
5909         (Errors::initialize_lock): Use initialize_lock_ field.
5910         * powerpc.cc (class Target_selector_powerpc): Remove
5911         instantiated_target_ field.  In do_recognize call
5912         instantiate_target rather than do_instantiate_target.  In
5913         do_instantiate_target just allocate a new target.
5914         * sparc.cc (class Target_selector_sparc): Likewise.
5915
5916         * freebsd.h: New file.
5917         * i386.cc: Include "freebsd.h".
5918         (Target_i386): Derive from Target_freebsd rather than
5919         Sized_target.
5920         (Target_selector_i386): Derive from Target_selector_freebsd rather
5921         than Target_selector.
5922         * x86_64.cc: Include "freebsd.h".
5923         (Target_x86_64): Derive from Target_freebsd rather than
5924         Sized_target.
5925         (Target_selector_x86_64): Derive from Target_selector_freebsd
5926         rather than Target_selector.
5927         * target.h (class Target): Add adjust_elf_header and
5928         do_adjust_elf_header.
5929         * output.cc (Output_file_header:: do_sized_write): Call target
5930         adjust_elf_header routine.
5931         * configure.tgt: Set targ_osabi.
5932         * configure.ac: Define GOLD_DEFAULT_OSABI.
5933         * parameters.cc (Parameters::default_target): Pass
5934         GOLD_DEFAULT_OSABI to select_target.
5935         * target-select.h (class Target_selector): Make instantiate_target
5936         protected rather than private.
5937         * Makefile.am (HFILES): Add freebsd.h.
5938         * configure, Makefile.in, config.in: Rebuild.
5939
5940         * merge.cc (do_add_input_section): Correct pend value.  Change
5941         message about last entry not being null terminated from error to
5942         warning.
5943
5944 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
5945
5946         * incremental.cc: New file.
5947         * Makefile.am (CCFILES): Add incremental.cc.
5948         * Makefile.in: Rebuild.
5949
5950 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
5951
5952         * layout.cc (Layout::output_section_name): Preserve names
5953         of '.note.' sections.
5954
5955 2009-03-19  Ian Lance Taylor  <iant@google.com>
5956
5957         * descriptors.cc (Descriptors::open): Check that the options are
5958         valid before using them.
5959
5960 2009-03-18  Ian Lance Taylor  <iant@google.com>
5961
5962         * script-sections.h: Include <list>.
5963         (class Script_sections): Change Sections_elements from std::vector
5964         to std::list.  Typedef public Elements_iterator.  Add
5965         orphan_section_placement_, data_segment_align_start_, and
5966         saw_data_segment_align_ fields.  Remove data_segment_align_index_
5967         field.
5968         * script-sections.cc (class Orphan_section_placement): New class.
5969         (class Sections_element): Add virtual functions is_relro and
5970         orphan_section_init.  Remove virtual function place_orphan_here.
5971         (class Output_section_definition): Add is_relro and
5972         orphan_section_init.  Remove place_orphan_here.
5973         (class Orphan_output_section): Likewise.
5974         (Script_sections::Script_sections): Update for field changes.
5975         (Script_sections::data_segment_align): Set saw_data_segment_align_
5976         and data_segment_align_start_, not data_segment_align_index.
5977         (Script_sections::data_segment_relro_end): Check
5978         saw_data_segment_align_.  Use data_segment_align_start_ rather
5979         than data_segment_align_index_.
5980         (Script_sections::place_orphan): Rewrite to use
5981         Orphan_section_placement.
5982
5983 2009-03-17  Ian Lance Taylor  <iant@google.com>
5984
5985         * archive.cc (Archive::add_symbols): Check for a version attached
5986         to the symbol name in the archive map.
5987         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
5988         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
5989         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
5990         (ver_test_11.a): New target.
5991         * testsuite/Makefile.in: Rebuild.
5992
5993         * configure.ac: Check for chsize and posix_fallocate.  Replace
5994         ftruncate.
5995         * ftruncate.c: New file, from gnulib.
5996         * output.cc (posix_fallocate): Define dummy version if not
5997         HAVE_POSIX_FALLOCATE.
5998         (Output_file::map): Call posix_fallocate rather than lseek and
5999         write.
6000         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
6001         * configure, Makefile.in, config.in: Rebuild.
6002
6003 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
6004
6005         * layout.h (Layout::create_note): Add section_name parameter.
6006         * layout.cc (Layout::create_note): Likewise.
6007         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
6008
6009 2009-03-17  Ian Lance Taylor  <iant@google.com>
6010
6011         * descriptors.cc: Include "options.h".
6012         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
6013         (Descriptors::open): Always use O_CLOEXEC when opening a new
6014         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
6015         then set FD_CLOEXEC.
6016
6017         * sparc.cc (class Target_sparc): Add has_got_section.
6018         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
6019         make sure we have a GOT section.
6020
6021         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
6022         (Target_sparc::Scan::local): Likewise.
6023         (Target_sparc::Scan::global): Likewise.
6024         (Target_sparc::Relocate::relocate): Likewise.
6025         (Target_sparc::Relocate::relocate_tls): Likewise.
6026
6027         * symtab.cc (Symbol_table::define_default_version): New function,
6028         broken out of add_from_object.
6029         (Symbol_table::add_from_object): Call define_default_version.
6030         (Symbol_table::define_special_symbol): Add resolve_oldsym
6031         parameter.  Change all callers.  If the version for a symbol comes
6032         from a version script, resolve it with the symbol with the same
6033         name with no version.  Also add the symbol without a version if
6034         appropriate.
6035         (do_define_in_output_data): If resolving with oldsym, don't delete
6036         sym.
6037         (do_define_in_output_segment): Likewise.
6038         (do_define_as_constant): Likewise.
6039         * symtab.h (class Symbol_table): Update declarations.
6040
6041 2009-03-13  Ian Lance Taylor  <iant@google.com>
6042
6043         * readsyms.cc (Read_symbols::incompatible_warning): New function.
6044         (Read_symbols::requeue): New function.
6045         (Read_symbols::do_read_symbols): If make_elf_object fails because
6046         the target type is not configured, and the file was searched for,
6047         issue a warning and retry with the next directory.
6048         (Add_symbols::run): If the file has an incompatible format, and
6049         it was searched for, requeue the Read_symbols task.  On error,
6050         release the object.
6051         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
6052         dirindex parameter to constructor.  Change all callers.  Declare
6053         incompatible_warning and requeue.
6054         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
6055         input_argument_ and input_group_ fields.  Add them to
6056         constructor.  Change all callers.
6057         (class Read_script): Add dirindex_ field.  Add it to constructor.
6058         Change all callers.
6059         * archive.cc (Archive::setup): Remove input_objects parameter.
6060         Change all callers.
6061         (Archive::get_file_and_offset): Likewise.
6062         (Archive::read_all_symbols): Likewise.
6063         (Archive::read_symbols): Likewise.
6064         (Archive::get_elf_object_for_member): Remove input_objects
6065         parameter.  Add punconfigured parameter.  Change all callers.
6066         (Archive::add_symbols): Change return type to bool.  Check return
6067         value of include_member.
6068         (Archive::include_all_members): Likewise.
6069         (Archive::include_member): Change return type to bool.  Return
6070         false if first included object has incompatible target.  Set
6071         included_member_ field.
6072         (Add_archive_symbols::run): If add_symbols returns false, requeue
6073         Read_symbols task.
6074         * archive.h (class Archive): Add included_member_ field.
6075         Initialize it in constructor.  Add input_file and searched_for
6076         methods.  Update declarations.
6077         (class Add_archive_symbols): Add dirpath_, dirindex_, and
6078         input_argument_ fields.  Add them to constructor.  Change all
6079         callers.
6080         * script.cc: Include "target-select.h".
6081         (class Parser_closure): Add skip_on_incompatible_target_ and
6082         found_incompatible_target_ fields.  Add
6083         skip_on_incompatible_target parameter to constructor.  Change all
6084         callers.  Add methods skip_on_incompatible_target,
6085         clear_skip_on_incompatible_target, found_incompatible_target, and
6086         set_found_incompatible_target.
6087         (read_input_script): Add dirindex parameter.  Change all callers.
6088         If parser finds an incompatible target, requeue Read_symbols
6089         task.
6090         (script_set_symbol): Clear skip_on_incompatible_target in
6091         closure.
6092         (script_add_assertion, script_parse_option): Likewise.
6093         (script_start_sections, script_add_phdr): Likewise.
6094         (script_check_output_format): New function.
6095         * script.h (read_input_script): Update declaration.
6096         * script-c.h (script_check_output_format): Declare.
6097         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
6098         (ignore_cmd): Remove OUTPUT_FORMAT.
6099         * fileread.cc (Input_file::Input_file): Add explicit this.
6100         (Input_file::will_search_for): New function.
6101         (Input_file::open): Add pindex parameter.  Change all callers.
6102         * fileread.h (class Input_file): Add input_file_argument method.
6103         Declare will_search_for.  Update declarations.
6104         * object.cc (make_elf_object): Add punconfigured parameter.
6105         Change all callers.
6106         * object.h (class Object): Make input_file public.  Add
6107         searched_for method.
6108         (make_elf_object): Update declaration.
6109         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
6110         restart search.
6111         * dirsearch.h (class Dirsearch): Update declaration.
6112         * options.h (class General_options): Add --warn-search-mismatch.
6113         * parameters.cc (Parameters::is_compatible_target): New function.
6114         * parameters.h (class Parameters): Declare is_compatible_target.
6115         * workqueue.cc (Workqueue::add_blocker): New function.
6116         * workqueue.h (class Workqueue): Declare add_blocker.
6117
6118         * fileread.cc (Input_file::open): Remove options parameter.
6119         Change all callers.
6120         (Input_file::open_binary): Likewise.
6121         * script.cc (read_input_script): Likewise.
6122         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
6123         options parameter from constructor.  Change all callers.
6124         (class Read_script): Likewise.
6125         * fileread.h (class Input_file): Update declarations.
6126         * script.h (read_input_script): Update declaration.
6127
6128 2009-03-10  Nick Clifton  <nickc@redhat.com>
6129
6130         * po/es.po: New Spanish translation.
6131
6132 2009-03-06  Cary Coutant  <ccoutant@google.com>
6133
6134         * options.cc (parse_short_option): Keep dash_z from registering itself.
6135
6136 2009-03-03  Ian Lance Taylor  <iant@google.com>
6137
6138         PR 9918
6139         * target-reloc.h (relocate_section): Pass output_section to
6140         relocate.
6141         * i386.cc (Target_i386::should_apply_static_reloc): Add
6142         output_section parameter.  Change all callers.
6143         (Target_i386::Relocate::relocate): Add output_section parameter.
6144         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
6145         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
6146         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
6147         * testsuite/two_file_shared.sh: New script.
6148         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
6149         (check_DATA): Add two_file_shared.dbg.
6150         (two_file_shared.dbg): New target.
6151         * testsuite/Makefile.in: Rebuild.
6152
6153 2009-03-01  Ian Lance Taylor  <iant@google.com>
6154
6155         * configure.ac: Check for byteswap.h.
6156         * configure: Rebuild.
6157         * config.in: Rebuild.
6158
6159 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
6160
6161         * layout.cc (Layout::find_or_add_kept_section): New function.
6162         (Layout::add_comdat): Removed.
6163         * layout.h (struct Kept_section): Move out of class Layout.
6164         Remove trailing underscores from field names.  Add group_sections
6165         field.  Rename group_ field to is_group.  Change all uses.
6166         (class Layout): Declare find_or_add_kept_section, not add_comdat.
6167         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
6168         comdat_groups_ field.
6169         (Sized_relobj::include_section_group): Use
6170         find_or_add_kept_section and Kept_section::group_sections.
6171         (Sized_relobj::include_linkonce_section): Likewise.
6172         * object.cc (class Sized_relobj): Don't define Comdat_group or
6173         Comdat_group_table.  Remove find_comdat_group and
6174         add_comdat_group.  Remove comdat_groups_ field.
6175         * plugin.cc (include_comdat_group): Use
6176         Layout::find_or_add_kept_section.
6177
6178 2009-02-28  Ian Lance Taylor  <iant@google.com>
6179
6180         * README: --gc-sections and map files are now supported.  Document
6181         some build requirements.
6182
6183         PR 6992
6184         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
6185         relocatable link set the value of the section symbol to zero.
6186         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
6187         relocatable link don't include the section address in the local
6188         symbol value.
6189
6190 2009-02-27  Ian Lance Taylor  <iant@google.com>
6191
6192         PR 6811
6193         * options.h (class Search_directory): Add is_system_directory.
6194         (class General_options): Declare is_in_system_directory.
6195         * options.cc (get_relative_sysroot): Make static.
6196         (get_default_sysroot): Make static.
6197         (General_optoins::is_in_system_directory): New function.
6198         * fileread.cc (Input_file::is_in_system_directory): New function.
6199         * fileread.h (class Input_file): Declare is_in_system_directory.
6200         * object.h (class Object): Add is_in_system_directory.
6201         (class Input_objects): Remove system_library_directory_ field.
6202         * object.cc (Input_objects::add_object): Don't set
6203         system_library_directory_.
6204         (input_objects::found_in_system_library_directory): Remove.
6205         * symtab.cc (Symbol_table::write_globals): Remove input_objects
6206         parameter.  Change all callers.
6207         (Symbol_table::sized_write_globals): Likewise.
6208         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
6209         Call Object::is_in_system_directory.
6210         * symtab.h (class Symbol_table): Update declarations.
6211
6212         PR 5990
6213         * descriptors.h (Open_descriptor): Add is_on_stack field.
6214         * descriptors.cc (Descriptors::open): If the descriptor is on the
6215         top of the stack, remove it.  Initialize is_on_stack field.
6216         (Descriptors::release): Only add pod to stack if it is not on the
6217         stack already.
6218         (Descriptors::close_some_descriptor): Clear stack_next and
6219         is_on_stack fields.
6220
6221         PR 7091
6222         * output.cc (Output_section::find_starting_output_address): Rename
6223         from starting_output_address; add PADDR parameter; change return
6224         type.
6225         * output.h (class Output_section): Declare
6226         find_starting_output_address instead of starting_output_address.
6227         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
6228         section symbol for which we can't find a merge section.
6229
6230         PR 9836
6231         * symtab.cc (Symbol_table::add_from_object): If the visibility is
6232         hidden or internal, force the symbol to be local.
6233         * resolve.cc (Symbol::override_visibility): Define.
6234         (Symbol::override_base): Use override_visibility.
6235         (Symbol_table::resolve): Likewise.
6236         (Symbol::override_base_with_special): Likewise.
6237         (Symbol_table::override_with_special): If the visibility is hidden
6238         or internal, force the symbol to be local.
6239         * symtab.h (class Symbol): Add set_visibility and
6240         override_visibility.
6241         * testsuite/ver_test_1.sh: New file.
6242         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
6243         (check_DATA): Add ver_test_1.syms.
6244         (ver_test_1.syms): New target.
6245         * testsuite/Makefile.in: Rebuild.
6246
6247 2009-02-25  Cary Coutant  <ccoutant@google.com>
6248
6249         * layout.cc (Layout::choose_output_section): Don't rename sections
6250         when using a linker script that has a SECTIONS clause.
6251         * Makefile.in: Regenerate.
6252
6253         * testsuite/Makefile.am (script_test_5.sh): New test case.
6254         * testsuite/Makefile.in: Regenerate.
6255         * testsuite/script_test_5.cc: New file.
6256         * testsuite/script_test_5.sh: New file.
6257         * testsuite/script_test_5.t: New file.
6258
6259 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
6260
6261         * archive.cc (Archive::include_member): Update calls to add_symbols.
6262         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
6263         the Layout argument.
6264         * dynobj.h (do_add_symbols): Add the Layout argument.
6265         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
6266         Layout argument.
6267         * object.h (Object::add_symbols): Add the Layout argument.
6268         (Object::do_add_symbols): Add the Layout argument.
6269         (Sized_relobj::do_add_symbols): Add the Layout argument.
6270         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
6271         Unify the two versions.
6272         (Add_plugin_symbols): Remove.
6273         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
6274         (Sized_pluginobj::do_add_symbols): Unify the two versions.
6275         (Add_plugin_symbols): Remove.
6276         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
6277         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
6278         (Add_symbols::run): Make it work with Pulginobj.
6279
6280 2009-02-06  Ian Lance Taylor  <iant@google.com>
6281
6282         * object.cc (Sized_relobj::do_layout): Make info message start
6283         with lower case letter.
6284
6285 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
6286
6287         * binary.cc: Fix file comment.
6288
6289         * options.h (enum Incremental_disposition): Define.
6290         (class General_options): Add new options: --incremental,
6291         --incremental_changed, --incremental_unchanged,
6292         --incremental_unknown.  Add incremental_disposition_ and
6293         implicit_incremental_ fields.
6294         (General_options::incremental_disposition): New function.
6295         (class Position_dependent_options): Add incremental_disposition
6296         option.
6297         (Position_dependent_options::copy_from_options): Set incremental
6298         dispositions.
6299         * options.cc (General_options::parse_incremental_changed): New
6300         function.
6301         (General_options::parse_incremental_unchanged): New function.
6302         (General_options::parse_incremental_unknown): New function.
6303         (General_options::General_options): Initialize new fields
6304         incremental_disposition_ and implicit_incremental_.
6305         (General_options::finalize): Check for uasge of --incremental-*
6306         without --incremental.
6307
6308 2009-02-06  Chris Demetriou  <cgd@google.com>
6309
6310         * gold.h (gold_undefined_symbol): Change to take only a Symbol
6311         pointer and to report location as the file name associated with
6312         the symbol.
6313         (gold_undefined_symbol_at_location): New function to replace the
6314         old gold_undefined_symbol functionality.
6315         * target-reloc.h (relocate_section): Update to use
6316         gold_undefined_symbol_at_location.
6317         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
6318         Call gold_undefined_symbol function rather than gold_error.
6319         * errors.h (Errors::undefined_symbol): Take location as a
6320         string, rather than calculating it from a relocation.
6321         * errors.cc (Errors::fatal): Print "fatal error:" before the
6322         formatted message.
6323         (Errors::error, Errors::error_at_location): Print "error: "
6324         before the formatted message.
6325         (Errors::undefined_symbol): Take location as a string, rather
6326         than calculating it from a relocation.
6327         (gold_undefined_symbol_at_location): New function akin to
6328         old gold_undefined_symbol, calculates location from relocation.
6329         (gold_undefined_symbol): Change to take only a Symbol pointer
6330         and to report location as the file name associated with the symbol.
6331         * testsuite/debug_msg.sh: Update for changed error messages.
6332         * testsuite/undef_symbol.sh: Likewise.
6333
6334 2009-02-04  Duncan Sands  <baldrick@free.fr>
6335
6336         PR 9812
6337         * reduced_debug_output.h
6338         (Output_reduced_debug_abbrev_section::failed): Use format for
6339         gold_warning.
6340         (Output_reduced_debug_info_section::faild): Likewise.
6341
6342 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
6343
6344         * script.cc (Lazy_demangler): New class.
6345         (Version_script_info::get_symbol_version_helper): Demangle a
6346         symbol only once.
6347
6348 2009-01-29  Cary Coutant  <ccoutant@google.com>
6349
6350         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
6351         to __tls_get_addr.
6352         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
6353
6354 2009-01-28  Ian Lance Taylor  <iant@google.com>
6355
6356         * version.cc (version_string): Bump to 1.9.
6357
6358         * gold.h: Include <cstring> and <stdint.h>.
6359         * version.cc: Include <cstdio>.
6360         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
6361         warning.
6362         * reduced_debug_output.cc (insert_into_vector): Rename from
6363         Insert_into_vector; change all callers.  Use Swap_unaligned to
6364         avoid aliasing issue; remove union since it is unnecessary.
6365
6366 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
6367
6368         * Makefile.am (CCFILES): Add gc.cc.
6369         (HFILES): Add gc.h.
6370         * Makefile.in: Regenerate.
6371         * gold.cc (Gc_runner): New class.
6372         (queue_initial_tasks): Call garbage collection related tasks
6373         when corresponding options are invoked.
6374         (queue_middle_gc_tasks): New function.
6375         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
6376         processed early before laying out sections during garbage collection.
6377         * gold.h (queue_middle_gc_tasks): New function.
6378         (is_prefix_of): Move from "layout.cc".
6379         * i386.cc (Target_i386::gc_process_relocs): New function.
6380         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
6381         * main.cc (main): Create object of class "Garbage_collection".
6382         * object.cc (Relobj::copy_symbols_data): New function.
6383         (Relobj::is_section_name_included): New function.
6384         (Sized_relobj::do_layout): Allow this function to be called twice
6385         during garbage collection and defer layout of section during the
6386         first call.
6387         * object.h (Relobj::get_symbols_data): New function.
6388         (Relobj::is_section_name_included): New function.
6389         (Relobj::copy_symbols_data): New function.
6390         (Relobj::set_symbols_data): New function.
6391         (Relobj::get_relocs_data): New function.
6392         (Relobj::set_relocs_data): New function.
6393         (Relobj::is_output_section_offset_invalid): New pure virtual function.
6394         (Relobj::gc_process_relocs): New function.
6395         (Relobj::do_gc_process_relocs): New pure virtual function.
6396         (Relobj::sd_): New data member.
6397         (Sized_relobj::is_output_section_offset_invalid): New function.
6398         (Sized_relobj::do_gc_process_relocs): New function.
6399         * options.h (General_options::gc_sections): Modify to not be a no-op.
6400         (General_options::print_gc_sections): New option.
6401         * plugin.cc (Plugin_finish::run): Remove function call to
6402         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
6403         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
6404         * reloc.cc (Read_relocs::run): Add task to process relocs and
6405         determine unreferenced sections when doing garbage collection.
6406         (Gc_process_relocs): New class.
6407         (Sized_relobj::do_gc_process_relocs): New function.
6408         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
6409         sections that are garbage collected.
6410         * reloc.h (Gc_process_relocs): New class.
6411         * sparc.cc (Target_sparc::gc_process_relocs): New function.
6412         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
6413         symbols whose corresponding sections are garbage collected.
6414         (Symbol_table::Symbol_table): Add new parameter for the garbage
6415         collection object.
6416         (Symbol_table::gc_mark_undef_symbols): New function.
6417         (Symbol_table::gc_mark_symbol_for_shlib): New function.
6418         (Symbol_table::gc_mark_dyn_syms): New function.
6419         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
6420         as garbage.
6421         (Symbol_table::add_from_object): Likewise.
6422         (Symbol_table::add_from_relobj): When building shared objects, do not
6423         treat externally visible symbols as garbage.
6424         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
6425         table information for static and relocatable links.
6426         * symtab.h (Symbol_table::set_gc): New function.
6427         (Symbol_table::gc): New function.
6428         (Symbol_table::gc_mark_undef_symbols): New function.
6429         (Symbol_table::gc_mark_symbol_for_shlib): New function.
6430         (Symbol_table::gc_mark_dyn_syms): New function.
6431         (Symbol_table::gc_): New data member.
6432         * target.h (Sized_target::gc_process_relocs): New pure virtual
6433         function.
6434         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
6435         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
6436
6437 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
6438
6439         * options.h (General_options::gc_sections): Define as a no-op for now.
6440         (General_options::no_keep_memory): Ditto.
6441         (General_options::Bshareable): Define.
6442         * options.cc (General_options::finalize): Honor -Bshareable.
6443
6444 2009-01-20  Andreas Schwab  <schwab@suse.de>
6445
6446         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
6447         read the value in the contents, since we don't use it.  Use the
6448         template endianness when writing.
6449         (Relocate::relocate): Use it for R_PPC_REL16_HA.
6450
6451 2009-01-19  Andreas Schwab  <schwab@suse.de>
6452
6453         * configure.tgt (powerpc64-*): Fix targ_obj.
6454
6455 2009-01-15  Ian Lance Taylor  <iant@google.com>
6456
6457         * object.cc (Sized_relobj::write_local_symbols): Don't write out
6458         local symbols when stripping all symbols.
6459
6460 2009-01-14  Cary Coutant  <ccoutant@google.com>
6461
6462         * output.cc (Output_reloc): Add explicit instantiations.
6463
6464 2009-01-14  Cary Coutant  <ccoutant@google.com>
6465
6466         * archive.cc (Archive::get_elf_object_for_member): Remove call
6467         to File_read::claim_for_plugin.
6468         * descriptors.cc (Descriptors::open): Remove reference to
6469         is_claimed.
6470         (Descriptors::claim_for_plugin): Remove.
6471         * descriptors.h (Descriptors::claim_for_plugin): Remove.
6472         (Descriptors::is_claimed): Remove.
6473         (claim_descriptor_for_plugin): Remove.
6474         * fileread.cc (File_read::claim_for_plugin): Remove.
6475         * fileread.h (File_read::claim_for_plugin): Remove.
6476         (File_read::descriptor): Reopen descriptor if necessary.
6477         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
6478         (Plugin_manager::all_symbols_read): Add task parameter. Change
6479         all callers.
6480         (Plugin_manager::get_input_file): New function.
6481         (Plugin_manager::release_input_file): New function.
6482         (Pluginobj::Pluginobj): Add filesize parameter and initialize
6483         corresponding data member.
6484         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
6485         and pass to base constructor. Change all callers.
6486         (get_input_file, release_input_file): New functions.
6487         (make_sized_plugin_object): Add filesize parameter. Change all callers.
6488         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
6489         (Plugin_manager::all_symbols_read): Add task parameter.
6490         (Plugin_manager::get_input_file): New function.
6491         (Plugin_manager::release_input_file): New function.
6492         (Plugin_manager::task_): New data member.
6493         (Pluginobj::Pluginobj): Add filesize parameter.
6494         (Pluginobj::filename): New function.
6495         (Pluginobj::descriptor): New function.
6496         (Pluginobj::filesize): New function.
6497         (Pluginobj::filesize_): New data member.
6498         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
6499         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
6500         File_read::claim_for_plugin; use Object::unlock to unlock the file.
6501
6502         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
6503         with archive libraries.
6504         * testsuite/Makefile.in: Regenerate.
6505         * testsuite/plugin_test.c (struct sym_info): New type.
6506         (get_input_file, release_input_file): New static variables.
6507         (onload): Capture new transfer vector entries.
6508         (claim_file_hook): Stop reading at end of file according to filesize.
6509         Factor out parsing of readelf output into separate function.
6510         (all_symbols_read_hook): Exercise get_input_file and release_input_file
6511         APIs and get the source file name from the symbol table.  Convert
6512         source file name to corresponding object file name.  Print info
6513         message when adding new input files.
6514         (parse_readelf_line): New function.
6515         * testsuite/plugin_test_1.sh: Add checks for new info messages.
6516         * testsuite/plugin_test_2.sh: Likewise.
6517         * testsuite/plugin_test_3.sh: Likewise.
6518         * testsuite/plugin_test_4.sh: New test case.
6519
6520 2009-01-07  Ian Lance Taylor  <iant@google.com>
6521
6522         * version.cc (version_string): Bump to 1.8.
6523
6524 2008-12-23  Cary Coutant  <ccoutant@google.com>
6525
6526         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
6527         * plugin.cc (Plugin_manager::finish): Rename as
6528         layout_deferred_objects.  Move cleanup to separate function.
6529         (Plugin_manager::cleanup): New function.
6530         (Plugin_finish::run): Call layout_deferred_objects and cleanup
6531         separately.
6532         * plugin.h (Plugin_manager::finish): Rename as
6533         layout_deferred_objects.
6534         (Plugin_manager::cleanup): New function.
6535         (Plugin_manager::cleanup_done): New field.
6536
6537 2008-12-23  Cary Coutant  <ccoutant@google.com>
6538
6539         * plugin.cc (is_visible_from_outside): New function.
6540         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
6541         so we don't return "IR only" status for exported symbols or -r links.
6542
6543         * testsuite/Makefile.am (plugin_test_3): New test case.
6544         * testsuite/Makefile.in: Regenerate.
6545         * testsuite/plugin_test_3.sh: New file.
6546
6547 2008-12-22  Cary Coutant  <ccoutant@google.com>
6548
6549         * object.cc (Sized_relobj::layout_section): New function.
6550         (Sized_relobj::do_layout): Defer layout of input sections until after
6551         plugin has provided replacement files.
6552         (Sized_relobj::do_layout_deferred_sections): New function.
6553         * object.h (Relobj::set_section_offset): Remove virtual keyword.
6554         (Relobj::layout_deferred_sections): New function.
6555         (Relobj::do_layout_deferred_sections): New function.
6556         (Sized_relobj::do_layout_deferred_sections): New function.
6557         (Sized_relobj::layout_section): New function.
6558         (Sized_relobj::Deferred_layout): New structure.
6559         (Sized_relobj::deferred_layout_): New field.
6560         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
6561         Change all callers.  Layout deferred sections.
6562         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
6563         references.
6564         (Plugin_hook::run): Move code from do_plugin_hook inline.
6565         (Plugin_hook::do_plugin_hook): Remove.
6566         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
6567         (Plugin_manager::finish): Renamed, was cleanup.
6568         (Plugin_manager::should_defer_layout): New function.
6569         (Plugin_manager::add_deferred_layout_object): New function.
6570         (Plugin_manager::Deferred_layout_list): New type.
6571         (Plugin_manager::deferred_layout_objects_): New field.
6572         (Plugin_hook::do_plugin_hook): Remove.
6573
6574 2008-12-17  Ian Lance Taylor  <iant@google.com>
6575
6576         * options.h (class General_options): Add --no case for
6577         --export-dynamic.
6578
6579 2008-12-16  Cary Coutant  <ccoutant@google.com>
6580
6581         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
6582         vector.
6583         (Plugin_manager::claim_file): Create plugin object even if
6584         plugin did not call the add_symbols callback.
6585         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
6586         asking for more symbols than were added.
6587         * testsuite/Makefile.am (plugin_test_1): Add test case with
6588         no global symbols.
6589         (empty.syms): New target.
6590         * testsuite/Makefile.in: Regenerate.
6591         * testsuite/plugin_test.c (claim_file_hook): Add new debug
6592         message. Don't call add_symbols if no globals.
6593         (all_symbols_read_hook): Don't provide replacement for empty
6594         claimed file.
6595
6596 2008-12-12  Ian Lance Taylor  <iant@google.com>
6597
6598         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
6599         r_type == 0 for a local symbol with r_sym == 0.
6600         (scan_relocatable_relocs): Pass r_sym to
6601         local_non_section_strategy.
6602         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
6603         r_sym parameter.
6604
6605         * configure.ac: Update test for TLS descriptors: they are
6606         supported as of glibc 2.9.
6607         * configure: Rebuild.
6608
6609 2008-12-11  Ian Lance Taylor  <iant@google.com>
6610
6611         PR 7091
6612         * target-reloc.h (Default_scan_relocatable_relocs): For each
6613         function, map r_type == 0 to RELOC_DISCARD.
6614
6615 2008-12-10  Cary Coutant  <ccoutant@google.com>
6616
6617         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
6618         object to override a kept COMDAT group from a plugin object.
6619
6620 2008-12-09  Ian Lance Taylor  <iant@google.com>
6621
6622         PR 7088
6623         * yyscript.y (file_cmd): Handle INPUT.
6624
6625         * testsuite/initpri1.c: Change all declarations to be full
6626         prototypes by adding void, to avoid compiler warnings.
6627
6628 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
6629
6630         * options.cc (General_options::parse_plugin_opt): New.
6631         (General_options::add_plugin): The argument now is just the filename.
6632         (General_options::add_plugin_option): New.
6633         * options.h (plugin_opt): New.
6634         (add_plugin): Change argument name.
6635         (add_plugin_option): New.
6636         * plugin.cc (Plugin::load): Don't parse the plugin option.
6637         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
6638         (Plugin::add_option): New.
6639         (Plugin::args_): Change type.
6640         (Plugin::filename_): New.
6641         (Plugin_manager::add_plugin_option): New.
6642         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
6643         * testsuite/Makefile.in: Regenerate.
6644
6645 2008-12-05  Cary Coutant  <ccoutant@google.com>
6646
6647         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
6648         Handle --strip-lto-sections option.
6649         * options.h (strip_lto_sections): New option.
6650
6651 2008-12-01  Cary Coutant  <ccoutant@google.com>
6652
6653         * plugin.cc (ld_plugin_message): Change format parameter to const.
6654         Fix mismatch between new[] and delete.
6655
6656 2008-11-14  Cary Coutant  <ccoutant@google.com>
6657
6658         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
6659         instead of -1U.
6660
6661 2008-11-05  Craig Silverstein  <csilvers@google.com>
6662
6663         * options.cc (General_options::parse_dynamic_list): New function.
6664         * options.h (General_options): New flags dynamic_list,
6665         dynamic_list_data, dynamic_list_cpp_new, and
6666         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
6667         (General_options::in_dynamic_list): New function.
6668         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
6669         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
6670         (Lex::can_continue_name): Likewise.
6671         (yylex): Likewise.
6672         (read_script_file): New parameter script_options.
6673         (read_dynamic_list): New function.
6674         (Script_options::define_dynamic_list): New function.
6675         (dynamic_list_keyword_parsecodes): New variable.
6676         (dynamic_list_keywords): New variable.
6677         * script.h (Script_options::define_dynamic_list): New function
6678         prototype.
6679         (read_dynamic_list): New function prototype.
6680         * symtab.cc (strprefix): New macro.
6681         (Symbol::should_add_dynsym_entry): Support dynamic_list,
6682         dynamic_list_data, dynamic_list_cpp_new, and
6683         dynamic_list_cpp_typeinfo.
6684         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
6685         (dynamic_list_expr): New rule.
6686         (dynamic_list_nodes): Likewise.
6687         (dynamic_list_node): Likewise.
6688         * testsuite/Makefile.am (dynamic_list): New test.
6689         * testsuite/Makefile.in: Regenerated.
6690         * testsuite/dynamic_list.t: New file.
6691         * testsuite/dynamic_list.sh: New file.
6692
6693 2008-11-05  Craig Silverstein  <csilvers@google.com>
6694
6695         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
6696         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
6697         (t11_last): Likewise.
6698         * testsuite/ver_test_6.c (main): Likewise.
6699
6700 2008-10-07  Cary Coutant  <ccoutant@google.com>
6701
6702         * options.c (General_options::finalize): Add check for -static and
6703         -shared.
6704         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
6705         is not empty.
6706
6707 2008-10-02  Cary Coutant  <ccoutant@google.com>
6708
6709         * plugin.cc (make_sized_plugin_object): Fix conditional
6710         compilation to work when not all targets are enabled.
6711
6712 2008-09-29  Cary Coutant  <ccoutant@google.com>
6713
6714         * archive.cc (Archive::get_file_and_offset): Use filename instead
6715         of name to get library path.
6716         (Archive::include_member): Unlock external member of a thin archive.
6717
6718         * testsuite/Makefile.am (TEST_AR): New variable.
6719         (thin_archive_test_1): New test.
6720         (thin_archive_test_2): New test.
6721         * testsuite/Makefile.in: Regenerate.
6722         * testsuite/thin_archive_main.cc: New file.
6723         * testsuite/thin_archive_test_1.cc: New file.
6724         * testsuite/thin_archive_test_2.cc: New file.
6725         * testsuite/thin_archive_test_3.cc: New file.
6726         * testsuite/thin_archive_test_4.cc: New file.
6727
6728 2008-09-29  Cary Coutant  <ccoutant@google.com>
6729
6730         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
6731         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
6732         instead of -1U.
6733         (Sized_relobj::do_finalize_local_symbols): Likewise.
6734         (Sized_relobj::map_to_kept_section): Likewise.
6735         * object.h (Sized_relobj::invalid_address): New constant.
6736         (Sized_relobj::do_output_section_offset): Check for invalid_address
6737         and return -1ULL.
6738         * output.cc (Output_reloc::local_section_offset): Use constant
6739         invalid_address instead of -1U.
6740         (Output_reloc::get_address): Likewise.
6741         (Output_section::output_address): Change -1U to -1ULL.
6742         * output.h (Output_reloc::invalid_address): New constant.
6743         * reloc.cc (Sized_relobj::write_sections): Use constant
6744         invalid_address instead of -1U.
6745         (Sized_relobj::relocate_sections): Likewise.
6746         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
6747         values for merge sections.
6748         * target-reloc.h (relocate_for_relocatable): Use constant
6749         invalid_address instead of -1U.
6750
6751 2008-09-19  Cary Coutant  <ccoutant@google.com>
6752
6753         Add plugin functionality for link-time optimization (LTO).
6754         * configure.ac (plugins): Add --enable-plugins option.
6755         * configure: Regenerate.
6756         * config.in: Regenerate.
6757         * Makefile.am (LIBDL): New variable.
6758         (CCFILES): Add plugin.cc.
6759         (HFILES): Add plugin.h.
6760         (ldadd_var): Add LIBDL.
6761         * Makefile.in: Regenerate.
6762
6763         * archive.cc: Include "plugin.h".
6764         (Archive::setup): Don't preread archive symbols when using a plugin.
6765         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
6766         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
6767         files.
6768         (Archive::include_member): Add symbols from plugin objects.
6769         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
6770         * descriptors.cc (Descriptors::open): Check for file descriptors
6771         abandoned by plugins.
6772         (Descriptors::claim_for_plugin): New function.
6773         * descriptors.h (Descriptors::claim_for_plugin): New function.
6774         (Open_descriptor::is_claimed): New field.
6775         (claim_descriptor_for_plugin): New function.
6776         * fileread.cc (File_read::claim_for_plugin): New function.
6777         * fileread.h (File_read::claim_for_plugin): New function.
6778         (File_read::descriptor): New function.
6779         * gold.cc: Include "plugin.h".
6780         (queue_initial_tasks): Add task to call plugin hooks for generating
6781         new object files.
6782         * main.cc: Include "plugin.h".
6783         (main): Load plugin libraries.
6784         * object.h (Pluginobj): Declare.
6785         (Object::pluginobj): New function.
6786         (Object::do_pluginobj): New function.
6787         (Object::set_target): New function.
6788         * options.cc: Include "plugin.h".
6789         (General_options::parse_plugin): New function.
6790         (General_options::General_options): Initialize plugins_ field.
6791         (General_options::add_plugin): New function.
6792         * options.h (Plugin_manager): Declare.
6793         (General_options): Add --plugin option.
6794         (General_options::has_plugins): New function.
6795         (General_options::plugins): New function.
6796         (General_options::add_plugin): New function.
6797         (General_options::plugins_): New field.
6798         * plugin.cc: New file.
6799         * plugin.h: New file.
6800         * readsyms.cc: Include "plugin.h".
6801         (Read_symbols::do_read_symbols): Check for archive before checking
6802         for ELF file.  Call plugin hooks to claim files.
6803         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
6804         from a real object file; force override when processing replacement
6805         files.
6806         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
6807         (Symbol::init_base_object): Likewise.
6808         (Symbol::init_base_output_data): Likewise.
6809         (Symbol::init_base_output_segment): Likewise.
6810         (Symbol::init_base_constant): Likewise.
6811         (Symbol::init_base_undefined): Likewise.
6812         (Symbol::output_section): Assert that object is not a plugin.
6813         (Symbol_table::add_from_pluginobj): New function.
6814         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
6815         undefined.
6816         (Symbol_table::sized_write_globals): Likewise.
6817         (Symbol_table::add_from_pluginobj): Instantiate template.
6818         * symtab.h (Sized_pluginobj): Declare.
6819         (Symbol::in_real_elf): New function.
6820         (Symbol::set_in_real_elf): New function.
6821         (Symbol::in_real_elf_): New field.
6822         (Symbol_table::add_from_pluginobj): New function.
6823
6824         * testsuite/Makefile.am (AM_CFLAGS): New variable.
6825         (LIBDL): New variable.
6826         (LDADD): Add LIBDL.
6827         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
6828         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
6829         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
6830         (MOSTLYCLEANFILES): Likewise.
6831         * testsuite/Makefile.in: Regenerate.
6832         * testsuite/plugin_test.c: New file.
6833         * testsuite/plugin_test_1.sh: New file.
6834         * testsuite/plugin_test_2.sh: New file.
6835
6836 2008-09-16  Ian Lance Taylor  <iant@google.com>
6837
6838         * target-reloc.h (relocate_section): Check whether a symbol is
6839         defined by the ABI before reporting an undefined symbol error.
6840         * target.h (Target::is_defined_by_abi): Make parameter const.
6841         (Target::do_is_defined_by_abi): Likewise.
6842         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
6843         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
6844         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
6845         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
6846         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
6847         * testsuite/Makefile.in: Rebuild.
6848
6849         * fileread.cc (make_view): Add casts to avoid warning.
6850
6851 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
6852
6853         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
6854         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
6855
6856 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
6857
6858         * options.h (General_options::output_is_executable): New.
6859         (General_options::output_is_pie): New.
6860         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
6861         for shared libraries.
6862         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
6863
6864 2008-09-11  Chris Demetriou  <cgd@google.com>
6865
6866         * options.h (origin): New -z option.
6867         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
6868         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
6869         in DT_FLAGS_1.
6870
6871 2008-09-05  Cary Coutant  <ccoutant@google.com>
6872
6873         * fileread.cc (File_read::make_view): Add check for attempt to map
6874         beyond end of file.
6875
6876 2008-09-05  Cary Coutant  <ccoutant@google.com>
6877
6878         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
6879         explicit instantiations.
6880
6881 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
6882
6883         PR gold/6858
6884         * options.cc (General_options::finalize): Allow undefined symbols
6885         in shlibs if linking -shared.
6886
6887         PR gold/6859
6888         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
6889         symbols as not needing a dynsym entry.
6890
6891 2008-08-20  Craig Silverstein  <csilvers@google.com>
6892
6893         * fileread.cc (File_read::open): Do not lock the file unless it
6894         was successfully opened.
6895
6896 2008-08-14  Cary Coutant  <ccoutant@google.com>
6897
6898         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
6899         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
6900         * testsuite/tls_test.cc (struct int128): 128-bit struct
6901         for testing TLS relocs with non-zero addend.
6902         (v12): New TLS variable.
6903         (t12): New test.
6904         (t_last): Add check for v12.
6905         * testsuite/tls_test.h (t12): New function.
6906         * testsuite/tls_test_main.cc (thread_routine): Call new test.
6907
6908 2008-08-13  Ian Lance Taylor  <iant@google.com>
6909
6910         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
6911         set tls_segment_ or relro_segment_.
6912         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
6913         when appropriate.
6914         * output.h (Output_section::clear_is_relro): New function.
6915         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
6916         sections specially even when output_data_ is empty.
6917         (Output_segment::maximum_alignment): When first section is relro,
6918         only force alignment for PT_LOAD segments.
6919         * script.cc (script_data_segment_align): New function.
6920         (script_data_segment_relro_end): New function.
6921         * script-c.h (script_data_segment_align): Declare.
6922         (script_data_segment_relro_end): Declare.
6923         * script-sections.h (class Script_sections): Declare
6924         data_segment_align and data_segment_relro_end.  Add fields
6925         segment_align_index_ and saw_relro_end_.
6926         * script-sections.cc (class Sections_element): Add set_is_relro
6927         virtual function.  Add new bool* parameter to place_orphan_here.
6928         Add get_output_section virtual function.
6929         (class Output_section_definition): Add set_is_relro.  Add new
6930         bool* parameter to place_orphan_here.  Add get_output_section.
6931         Add is_relro_ field.
6932         (Output_section_definition::Output_section_definition): Initialize
6933         evaluated_address_, evaluated_load_address, evaluated_addralign_,
6934         and is_relro_ fields.
6935         (Output_section_definition::place_orphan_here): Add is_relro
6936         parameter.
6937         (Output_section_definition::set_section_addresses): Set relro for
6938         output section.
6939         (Output_section_definition::alternate_constraint): Likewise.
6940         (class Orphan_output_section): Add new bool* parameter to
6941         place_orphan_here.  Add get_output_section.
6942         (Orphan_output_section::place_orphan_here): Add is_relro
6943         parameter.
6944         (Script_sections::Script_sections): Initialize
6945         data_segment_align_index_ and saw_relro_end_.
6946         (Script_sections::data_segment_align): New function.
6947         (Script_sections::data_segment_relro_end): New function.
6948         (Script_sections::place_orphan): Set or clear is_relro.
6949         (Script_sections::set_section_addresses): Force alignment of first
6950         TLS section.
6951         * yyscript.y (exp): Call script_data_segment_align and
6952         script_data_segment_relro_end.
6953         * testsuite/relro_script_test.t: New file.
6954         * testsuite/relro_test.cc (using_script): Declare.
6955         (t1, t2): Test using_script.
6956         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
6957         (relro_script_test_SOURCES): Define.
6958         (relro_script_test_DEPENDENCIES): Define.
6959         (relro_script_test_LDFLAGS): Define.
6960         (relro_script_test_LDADD): Define.
6961         (relro_script_test.so): New target.
6962         * testsuite/Makefile.in: Rebuild.
6963
6964 2008-08-06  Cary Coutant <ccoutant@google.com>
6965
6966         * archive.cc (Archive::total_archives, Archive::total_members)
6967         (Archive::total_members_loaded): New variables.
6968         (Archive::setup): Add parameter.  Add option to preread
6969         archive symbols.
6970         (Archive::read_armap): Add counter.
6971         (Archive::get_file_and_offset): New function.
6972         (Archive::get_elf_object_for_member): New function.
6973         (Archive::read_all_symbols): New function.
6974         (Archive::read_symbols): New function.
6975         (Archive::add_symbols): Add counters.
6976         (Archive::include_all_members): Use armap to find members if it's
6977         already built.
6978         (Archive::include_member): Skip reading symbols if already read.
6979         Factored code into Archive::get_file_and_offset and
6980         Archive::get_elf_object_for_member.  Changed call to
6981         Mapfile::report_include_archive_member.
6982         (Archive::print_stats): New function.
6983         * archive.h: Declare Object and Read_symbols_data classes.
6984         (Archive::Archive): Add initializers for new members.
6985         (Archive::setup): Add parameter.
6986         (Archive::print_stats): New function.
6987         (Archive::total_archives, Archive::total_members)
6988         (Archive::total_members_loaded): New variables.
6989         (Archive::get_file_and_offset): New function.
6990         (Archive::get_elf_object_for_member): New function.
6991         (Archive::read_all_symbols): New function.
6992         (Archive::read_symbols): New function.
6993         (Archive::Archive_member): New class.
6994         (Archive::members_): New member.
6995         (Archive::num_members_): New member.
6996         * main.cc: Include archive.h.
6997         (main): Call Archive::print_stats.
6998         * mapfile.cc (Mapfile::report_include_archive_member): Delete
6999         archive parameter; member_name is now the fully-decorated name.
7000         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
7001         * options.h: (General_options): Add --preread-archive-symbols option.
7002         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
7003         Archive::setup.
7004
7005 2008-08-04  Ian Lance Taylor  <iant@google.com>
7006
7007         * symtab.h (Symbol::use_plt_offset): New function.
7008         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
7009         * powerpc.cc (Relocate::relocate): Likewise.
7010         * sparc.cc (Relocate::relocate): Likewise.
7011         * x86_64.cc (Relocate::relocate): Likewise.
7012         * testsuite/weak_plt.sh: New test.
7013         * testsuite/weak_plt_main.cc: New test.
7014         * testsuite/weak_plt_shared.cc: New test.
7015         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
7016         (check_PROGRAMS): Add weak_plt.
7017         (check_DATA): Add weak_plt_shared.so.
7018         (weak_plt_main_pic.o, weak_plt): New targets.
7019         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
7020         * testsuite/Makefile.in: Rebuild.
7021
7022         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
7023         gcctestdir/ld.
7024         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
7025         * testsuite/Makefile.in: Rebuild.
7026
7027 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
7028
7029         * Makefile.am (POTFILES.in): Set LC_ALL=C.
7030         * Makefile.in: Regenerate.
7031         * po/POTFILES.in: Regenerate.
7032
7033 2008-07-29  Ian Lance Taylor  <iant@google.com>
7034
7035         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
7036         symbols before other symbols.
7037         * testsuite/script_test_2.cc (test_addr): Declare.
7038         (test_addr_alias): Declare.
7039         (main): Check that test_addr and test_addr_alias have the right
7040         values.
7041         * testsuite/script_test_2.t: Define test_addr_alias and
7042         test_addr.
7043
7044 2008-07-24  Ian Lance Taylor  <iant@google.com>
7045
7046         PR 5990
7047         * descriptors.cc: New file.
7048         * descriptors.h: New file.
7049         * gold-threads.h (class Hold_optional_lock): New class.
7050         * fileread.cc: Include "descriptors.h".
7051         (File_read::~File_read): Release descriptor rather than closing
7052         it.
7053         (File_read::open) [file]: Call open_descriptor rather than open.
7054         Set is_descriptor_opened_.
7055         (File_read::open) [memory]: Assert that descriptor is not open.
7056         (File_read::reopen_descriptor): New function.
7057         (File_read::release): Release descriptor.
7058         (File_read::do_read): Make non-const.  Reopen descriptor.
7059         (File_read::read): Make non-const.
7060         (File_read::make_view): Reopen descriptor.
7061         (File_read::do_readv): Likewise.
7062         * fileread.h (class File_read): Add is_descriptor_opened_ field.
7063         Update declarations.
7064         * layout.cc: Include "descriptors.h".
7065         (Layout::create_build_id): Use open_descriptor rather than open.
7066         * output.cc: Include "descriptors.h".
7067         (Output_file::open): Use open_descriptor rather than open.
7068         * archive.cc (Archive::const_iterator): Change Archive to be
7069         non-const.
7070         (Archive::begin, Archive::end): Make non-const.
7071         (Archive::count_members): Likewise.
7072         * archive.h (class Archive): Update declarations.
7073         * object.h (Object::read): Make non-const.
7074         * Makefile.am (CCFILES): Add descriptors.cc.
7075         (HFILES): Add descriptors.h.
7076         * Makefile.in: Rebuild.
7077
7078         PR 6716
7079         * gold.h: Always include <clocale>.  Add Solaris workarounds
7080         following code in binutils/sysdep.h.
7081
7082         PR 6048
7083         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
7084         this->eh_frame_hdr_ is NULL before using it.
7085
7086         * dynobj.cc (Versions::Versions): Update comment.
7087
7088         * dynobj.cc (Versions::Versions): If there is an soname, use it as
7089         the base version name.
7090
7091         * stringpool.cc (Stringpool_template::add_with_length): Set key to
7092         array size plus one.
7093         (Stringpool_template::set_string_offsets): Subtract one from key
7094         before using it as an array index.
7095         (Stringpool_template::get_offset_with_length): Likewise.
7096         (Stringpool_template::write_to_buffer): Likewise.
7097         * stringpool.h (Stringpool_template::get_offset_from_key):
7098         Likewise.
7099
7100 2008-07-23  Ian Lance Taylor  <iant@google.com>
7101
7102         PR 6658
7103         * object.h (Merged_symbol_value::value): Do our best to handle a
7104         negative addend.
7105
7106         PR 6647
7107         * script.cc (Version_script_info::get_versions): Don't add empty
7108         version tag to return value.
7109         (Version_script_info::get_symbol_version_helper): Change return
7110         type to bool.  Add pversion parameter.  Change all callers.
7111         (script_register_vers_node): Don't require a non-NULL tag.
7112         * script.h (class Version_script_info): Update declarations.
7113         (Version_script_info::get_symbol_version): Change return type to
7114         bool.  Add version parameter.  Change all callers.
7115         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
7116         handling.  Handle an empty version from a version script.
7117         (Symbol_table::define_special_symbol): Likewise.
7118         * testsuite/ver_test_10.script: New file.
7119         * testsuite/ver_test_10.sh: New file.
7120         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
7121         (check_DATA): Add ver_test_10.syms.
7122         (ver_test_10.syms, ver_test_10.so): New target.
7123         * testsuite/Makefile.in: Rebuild.
7124
7125 2008-07-23  Simon Baldwin  <simonb@google.com>
7126
7127         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
7128         to zero for undefined symbols from dynamic libraries.
7129
7130 2008-07-23  Ian Lance Taylor  <iant@google.com>
7131
7132         * symtab.cc (Symbol_table::resolve): Remove version parameter.
7133         Change all callers.
7134         * symtab.h (class Symbol_table): Update declaration.
7135         * testsuite/ver_test_9.cc: New file.
7136         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
7137         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
7138         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
7139         (ver_test_9.so, ver_test_9.o): New targets.
7140         * testsuite/Makefile.in: Rebuild.
7141
7142 2008-07-22  Ian Lance Taylor  <iant@google.com>
7143
7144         * options.h (class General_options): Define --check-sections.
7145         * layout.cc (Layout::set_segment_offsets): Handle
7146         --check-sections.
7147
7148         * options.h (class General_options): Define -n/--nmagic and
7149         -N/--omagic.
7150         * options.cc (General_options::finalize): For -n/--nmagic or
7151         -N/--omagic, set -static.
7152         * layout.cc (Layout::attach_allocated_section_to_segment): If
7153         -N/--omagic, don't put read-only and read-write sections in
7154         different segments.
7155         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
7156         finding a read-only segment.
7157         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
7158         don't set the minimum segment alignment to the common page size,
7159         and don't set the file offset to the address modulo the page size.
7160         * script-sections.cc (Script_sections::create_segments): If
7161         -n/--omagic, don't put read-only and read-write sections in
7162         different segments.
7163
7164         * cref.cc: New file.
7165         * cref.h: New file.
7166         * options.h (class General_options): Add --print-symbol-counts.
7167         * main.cc (main): Issue defined symbol report if requested.
7168         * archive.cc (Archive::interpret_header): Make into a const member
7169         function.
7170         (Archive::add_symbols): Call Input_objects::archive_start and
7171         archive_stop.
7172         (Archive::const_iterator): Define new class.
7173         (Archive::begin, Archive::end): New functions.
7174         (Archive::include_all_members): Rewrite to use iterator.
7175         (Archive::count_members): New function.
7176         * archive.h (class Archive): Update declarations.
7177         (Archive::filename): New function.
7178         * object.cc: Include "cref.h".
7179         (Sized_relobj::Sized_relobj): Initialize defined_count_.
7180         (Sized_relobj::do_get_global_symbol_counts): New function.
7181         (Input_objects::add_object): Add object to cross-referencer.
7182         (Input_objects::archive_start): New function.
7183         (Input_objects::archive_stop): New function.
7184         (Input_objects::print_symbol_counts): New function.
7185         * object.h: Declare Cref and Archive.
7186         (Object::get_global_symbol_counts): New function.
7187         (Object::do_get_global_symbol_counts): New pure virtual function.
7188         (class Sized_relobj): Add defined_count_ field.  Update
7189         declarations.
7190         (class Input_objects): Add cref_ field.  Update constructor.
7191         Update declarations.
7192         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
7193         defined_count_.
7194         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
7195         symbol counts.
7196         (Sized_dynobj::do_get_global_symbol_counts): New function.
7197         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
7198         defined_count_.  Update declarations.  Define Symbols typedef.
7199         * symtab.cc (Symbol_table::add_from_relobj): Add defined
7200         parameter.  Change all callers.
7201         (Symbol_table::add_from_dynobj): Add sympointers and defined
7202         parameters.  Change all callers.
7203         * symtab.h (class Symbol_table): Update declarations.
7204         * Makefile.am (CCFILES): Add cref.cc.
7205         (HFILES): Add cref.h.
7206         * Makefile.in: Rebuild.
7207
7208 2008-07-22  Simon Baldwin  <simonb@google.com>
7209
7210         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
7211         to zero when writing undefined symbols.
7212
7213 2008-07-22  Ian Lance Taylor  <iant@google.com>
7214
7215         * output.cc (Output_section::add_input_section): Don't try to
7216         merge empty merge sections.
7217
7218 2008-07-21  Craig Silverstein  <csilvers@google.com>
7219
7220         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
7221         Include symbol version in error message.
7222
7223 2008-07-20  Chris Demetriou  <cgd@google.com>
7224
7225         * configure.ac (gold_cv_c_random_seed): New configured variable.
7226         (RANDOM_SEED_CFLAGS): New substituted variable.
7227         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
7228         * configure: Rebuild.
7229         * Makefile.in: Likewise.
7230         * testsuite/Makefile.in: Likewise.
7231
7232 2008-07-18  Ian Lance Taylor  <iant@google.com>
7233
7234         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
7235         where we see NAME/NULL and NAME/VERSION  as separate symbols.
7236         * testsuite/ver_test_main.cc (main): Call t4.
7237         (t4, t4_2a): Define.
7238         * testsuite/ver_test_2.cc (t4_2): Define.
7239         * testsuite/ver_test_2.script: Put t4_2a in VER2.
7240         * testsuite/ver_test_4.cc (t4_2a): Define.
7241         * testsuite/ver_test_4.script: Put t4_2a in VER2.
7242         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
7243
7244 2008-07-17  Ian Lance Taylor  <iant@google.com>
7245
7246         * dynobj.cc (Versions::add_def): If we give an error about a
7247         missing version, go ahead and create the version anyhow.
7248
7249 2008-07-10  Ian Lance Taylor  <iant@google.com>
7250
7251         Handle output sections with more than 0x7fffffff bytes.
7252         * object.h (class Relobj): Change map_to_output_ to
7253         output_sections_, and just keep a section pointer.  Change all
7254         uses.  Move comdat group support to Sized_relobj.
7255         (Relobj::is_section_specially_mapped): Remove.
7256         (Relobj::output_section): Remove poff parameter.  Change all
7257         callers.
7258         (Relobj::output_section_offset): New function.
7259         (Relobj::set_section_offset): Rewrite.
7260         (Relobj::map_to_output): Remove.
7261         (Relobj::output_sections): New function.
7262         (Relobj::do_output_section_offset): New pure virtual function.
7263         (Relobj::do_set_section_offset): Likewise.
7264         (class Sized_relobj): Add section_offsets_ field.  Add comdat
7265         group support from Relobj.  Update declarations.
7266         (Sized_relobj::get_output_section_offset): New function.
7267         (Sized_relobj::do_output_section_offset): New function.
7268         (Sized_relobj::do_set_section_offset): New function.
7269         * object.cc (Relobj::output_section_address): Remove.
7270         (Sized_relobj::Sized_relobj): Initialize new fields.
7271         (Sized_relobj::include_section_group): Cast find_kept_object to
7272         Sized_relobj.
7273         (Sized_relobj::include_linkonce_section): Likewise.
7274         (Sized_relobj::do_layout): Use separate arrays for output section
7275         and output offset.
7276         (Sized_relobj::do_count_local_symbols): Change map_to_output to
7277         output_sections.
7278         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
7279         output_sections and section_offsets.
7280         (Sized_relobj::write_local_symbols): Likewise.
7281         (map_to_kept_section): Compute output address directly.
7282         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
7283         output_sections and section_offsets.
7284         (Sized_relobj::write_sections): Likewise.
7285         (Sized_relobj::relocate_sections): Likewise.
7286         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
7287         * output.h (class Output_reloc): Update declarations.  Change
7288         u2_.relobj to Sized_relobj*.
7289         (class Output_data_reloc): Change add functions to use
7290         Sized_relobj*.
7291         * output.cc (Output_reloc::Output_reloc): Change relobj to
7292         Sized_relobj*.
7293         (Output_reloc::local_section_offset): Change return type to
7294         Elf_Addr.  Use get_output_section_offset.
7295         (Output_reloc::get_address): Likewise.
7296         (Output_section::is_input_address_mapped): Don't call
7297         is_section_specially_mapped.
7298         (Output_section::output_offset): Likewise.
7299         (Output_section::output_address): Likewise.
7300         (Output_section::starting_output_address): Likewise.
7301         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
7302         parameter to Sized_relobj*.
7303         (Copy_relocs::need_copy_reloc): Likewise.
7304         (Copy_relocs::save): Likewise.
7305         * copy-relocs.h (class Copy_relocs): Update declarations.
7306         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
7307         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
7308         * target-reloc.h (relocate_for_relocatable): Change
7309         offset_in_output_section type to Elf_Addr.  Change code that uses
7310         it as well.
7311         * layout.cc (Layout::layout): Always set *off.
7312         * mapfile.cc (Mapfile::print_input_section): Use
7313         output_section_offset.
7314         * i386.cc (Target_i386::copy_reloc): Change object parameter to
7315         Sized_relobj*.
7316         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
7317         * sparc.cc (Target_sparc::copy_reloc): Likewise.
7318         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
7319
7320 2008-07-03  Ian Lance Taylor  <iant@google.com>
7321
7322         * layout.cc (Layout::include_section): Do not discard unrecognized
7323         SHT_STRTAB sections.
7324
7325 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
7326
7327         * script.cc (Lex::can_continue_name): Make '?' allowable in
7328         version-script names.
7329         * testsuite/version_script.map: Change glob pattern to use '?'
7330
7331 2008-06-30  Manish Singh  <yosh@gimp.org>
7332
7333         PR 6585
7334         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
7335         Correct typo.
7336
7337 2008-06-30  Ian Lance Taylor  <iant@google.com>
7338
7339         PR 6660
7340         PR 6682
7341         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
7342         versions]: Don't try to read the value in the contents, since we
7343         don't use it.  Use the template endianness when writing.
7344
7345 2008-06-25  Cary Coutant  <ccoutant@google.com>
7346
7347         * fileread.cc (File_read::make_view): Assert on zero-length view.
7348         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
7349         symbol table when there are no symbols to read.
7350
7351 2008-06-23  Craig Silverstein  <csilvers@google.com>
7352
7353         * version.cc (version_string): Bump to 1.7
7354
7355 2008-06-18  Craig Silverstein  <csilvers@google.com>
7356
7357         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
7358         constant 0xFFFF to type Valtype.
7359         (Powerpc_relocate_functions::rel16_ha): Likewise.
7360
7361 2008-06-17  Ian Lance Taylor  <iant@google.com>
7362
7363         * output.h (Output_section::Input_section): Initialize p2align_ to
7364         zero for Output_section_data constructors.
7365         (Output_section::Input_section::addralign): If not an input
7366         section, return the alignment of the Output_section_data.
7367         * testsuite/copy_test.cc: New file.
7368         * testsuite/copy_test_1.cc: New file.
7369         * testsuite/copy_test_2.cc: New file.
7370         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
7371         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
7372         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
7373         (copy_test_1_pic.o, copy_test_1.so): New targets.
7374         (copy_test_2_pic.o, copy_test_2.so): New targets.
7375         * testsuite/Makefile.in: Rebuild.
7376
7377         * script-sections.cc (Script_sections::place_orphan): Initialize
7378         local variable exact.
7379
7380 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
7381
7382         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
7383
7384 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
7385             David S. Miller  <davem@davemloft.net>
7386
7387         * powerpc.cc: New file.
7388         * Makefile.am (TARGETSOURCES): Add powerpc.cc
7389         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
7390         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
7391         * Makefile.in: Rebuild.
7392
7393 2008-06-09  Ian Lance Taylor  <iant@google.com>
7394
7395         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
7396         <exception>.
7397         (throwing, orig_terminate): New static variables.
7398         (terminate_handler): New static function.
7399         (t2): Set terminate handler.
7400
7401 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
7402
7403         PR 6584
7404         * binary.cc (Binary_to_elf::sized_convert): Fix .data
7405         alignment.
7406
7407 2008-05-30  Cary Coutant  <ccoutant@google.com>
7408
7409         * archive.cc (Archive::include_all_members) Correct to step
7410         over symbol table and extended name table in thin archives.
7411
7412 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
7413
7414         PR 6407
7415         * target-reloc.h (relocate_for_relocatable): Fix new_offset
7416         calculation.
7417
7418 2008-05-28  Caleb Howe  <cshowe@google.com>
7419
7420         * reduced_debug_output.cc: New file.
7421         * reduced_debug_output.h: New file.
7422         * options.h (class General_options): Add --strip-debug-non-line.
7423         * options.cc (General_options::finalize): Add strip_debug_non_line
7424         to the strip heirarchy.
7425         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
7426         fields.
7427         * layout.cc: Include "reduced_debug_output.h".
7428         (Layout::Layout): Initialize new fields.
7429         (line_only_debug_sections): New static array.
7430         (is_lines_only_debug_sections): New static inline function.
7431         (Layout::include_section): Handle --strip-debug-non-line.
7432         (Layout::make_output_section): If --strip-debug-non-line, build
7433         new output sections for .debug_abbrev and .debug_info.
7434         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
7435         gold.  Warn about possible overflow.
7436         (read_signed_LEB_128): Likewise.
7437         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
7438         (read_signed_LEB_128): Declare.
7439         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
7440         (HFILES): Add reduced_debug_output.h.
7441         * Makefile.in: Rebuild.
7442
7443 2008-05-21  Ian Lance Taylor  <iant@google.com>
7444
7445         * mapfile.cc: New file.
7446         * mapfile.h: New file.
7447         * options.h (class General_options): Add -M/--print-map and -Map.
7448         * options.cc (General_options::finalize): Make -M equivalent to
7449         -Map -.
7450         * main.cc: Include <cstdio> and "mapfile.h".
7451         (main): Open mapfile if requested.
7452         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
7453         constructor.  Change caller.
7454         (queue_initial_tasks): Add mapfile parameter.  Change caller.
7455         (queue_middle_tasks): Likewise.
7456         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
7457         declarations.
7458         * archive.cc: Include "mapfile.h".
7459         (Archive::add_symbols): Add mapfile parameter.  Change all
7460         callers.  Pass mapfile, symbol, and reason to include_member.
7461         (Archive::include_all_members): Add mapfile parameter.  Change all
7462         callers.
7463         (Archive::include_member): Add mapfile, sym, and why parameters.
7464         Change all callers.  Report inclusion to map file.
7465         * archive.h: Include "fileread.h".
7466         (class Archive): Update declarations.
7467         (Archive::file): New const method.
7468         (class Add_archive_symbols): Add mapfile_ field.  Update
7469         constructor.  Change all callers.
7470         * readsyms.h (class Read_symbols): Likewise.
7471         (class Finish_group): Likewise.
7472         (class Read_script): Likewise.
7473         * common.cc: Include "mapfile.h".
7474         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
7475         all callers.
7476         (Symbol_table::do_allocate_commons): Likewise.
7477         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
7478         symbol allocation to mapfile.
7479         * common.h (class Allocate_commons_task): Add mapfile_ field.
7480         Update constructor.  Change all callers.
7481         * symtab.h (class Symbol_table): Update declarations.
7482         * layout.cc: Include "mapfile.h".
7483         (Layout_task_runner::run): Print information to mapfile.
7484         (Layout::create_gold_note): Change Output_data_fixed_space to
7485         Output_data_zero_fill.
7486         (Layout::create_build_id): Likewise.
7487         (Layout::print_to_mapfile): New function.
7488         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
7489         constructor.  Change caller.
7490         (class Layout): Declare print_to_mapfile.
7491         * output.cc (Output_section::Input_section::print_to_mapfile): New
7492         function.
7493         (Output_section::add_input_section): If producing a map, always
7494         add to input_sections_ list.
7495         (Output_section::do_print_to_mapfile): New function.
7496         (Output_segment::print_sections_to_mapfile): New function.
7497         (Output_segment::print_section_list_to_mapfile): New function.
7498         * output.h: Include "mapfile.h".
7499         (Output_data::print_to_mapfile): New function.
7500         (Output_data::do_print_to_mapfile): New virtual function.
7501         (Output_segment_headers::do_print_to_mapfile): New function.
7502         (Output_file_header::do_print_to_mapfile): New function.
7503         (Output_data_const::do_print_to_mapfile): New function.
7504         (class Output_data_const_buffer): Add map_name_ field.  Update
7505         constructor.  Change all callers.  Add do_print_to_mapfile
7506         function.
7507         (class Output_data_fixed_space): Likewise.
7508         (class Output_data_space): Likewise.
7509         (class Output_data_zero_fill): New class.
7510         (Output_data_strtab::do_print_to_mapfile): New function.
7511         (Output_data_reloc_base::do_print_to_mapfile): New function.
7512         (Output_relocatable_relocs::do_print_to_mapfile): New function.
7513         (Output_data_group::do_print_to_mapfile): New function.
7514         (Output_data_got::do_print_to_mapfile): New function.
7515         (Output_data_dynamic::do_print_to_mapfile): New function.
7516         (Output_symtab_xindex::do_print_to_mapfile): New function.
7517         (class Output_section): Declare do_print_to_mapflie.  Declare
7518         print_to_mapfile in Input_section.
7519         (class Output_segment): Declare new functions.
7520         * object.h (Sized_relobj::symbol_count): New function.
7521         * script-sections.cc
7522         (Output_section_element_dot_assignment::set_section_addresses):
7523         Change Output_data_fixed_space to Output_data_zero_fill.
7524         (Output_data_expression::do_print_to_mapfile): New function.
7525         * script.cc (read_input_script): Add mapfile parameter.  Change
7526         all callers.
7527         * script.h (read_input_script): Update declaration.
7528         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
7529         (Eh_frame::do_print_to_mapfile): New function.
7530         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
7531         (Output_merge_string::do_print_to_mapfile): New function.
7532         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
7533         function.
7534         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
7535         function.
7536         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
7537         function.
7538         * Makefile.am (CCFILES): Add mapfile.cc.
7539         (HFILES): Add mapfile.h.
7540         * Makefile.in: Rebuild.
7541
7542 2008-05-19  Ian Lance Taylor  <iant@google.com>
7543
7544         * options.h (class General_options): Add -z relro.
7545         * layout.cc (Layout::Layout): Initialize relro_segment_.
7546         (Layout::add_output_section_data): Return the output section.
7547         (Layout::make_output_section): Rcognize relro sections and mark
7548         them appropriately.
7549         (Layout::attach_allocated_section_to_segment): Put relro sections
7550         in a PT_GNU_RELRO segment.
7551         (Layout::create_initial_dynamic_sections): Mark the .dynamic
7552         section as relro.
7553         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
7554         PT_TLS segments.
7555         (Layout::linkonce_mapping): Map d.rel.ro.local to
7556         .data.rel.ro.local.
7557         (Layout::output_section_name): Us .data.rel.ro.local for any
7558         section which begins with that.
7559         * layout.h (class Layout): Update add_output_section_data
7560         declaration.  Add relro_segment_ field.
7561         * output.cc (Output_section::Output_section): Initialize is_relro_
7562         and is_relro_local_ fields.
7563         (Output_segment::add_output_section): Group relro sections.
7564         (Output_segment::is_first_section_relro): New function.
7565         (Output_segment::maximum_alignment): If there is a relro section,
7566         align the segment to the common page size.
7567         (Output_segment::set_section_addresses): Track whether we are
7568         looking at relro sections.  If the last section is a relro
7569         section, align to the common page size.
7570         (Output_segment::set_section_list_addresses): Add in_relro
7571         parameter.  Change all callers.  Align to the page size when
7572         moving from relro to non-relro section.
7573         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
7574         segment.
7575         * output.h (class Output_section): Add is_relro_ and
7576         is_relro_local_ fields.
7577         (Output_section::is_relro): New function.
7578         (Output_section::set_is_relro): New function.
7579         (Output_section::is_relro_local): New function.
7580         (Output_section::set_is_relro_local): New function.
7581         (class Output_segment): Update declarations.
7582         * i386.cc (Target_i386::got_section): Mark .got section as relro.
7583         * sparc.cc (Target_sparc::got_section): Likewise.
7584         * x86_64.cc (Target_x86_64::got_section): Likewise.
7585         * testsuite/relro_test_main.cc: New file.
7586         * testsuite/relro_test.cc: New file.
7587         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
7588         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
7589         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
7590         (relro_test.so, relro_test_pic.o): New targets.
7591         * testsuite/Makefile.in: Rebuild.
7592
7593 2008-05-16  Ian Lance Taylor  <iant@google.com>
7594
7595         * output.cc (Output_segment::add_output_section): Remove front
7596         parameter.
7597         * output.h (class Output_segment): Remove
7598         add_initial_output_section and overloaded add_output_section.
7599         Update declaration of remaining add_output_section.
7600         * layout.cc (Layout::create_interp): Call add_output_section
7601         rather than add_initial_output_section.
7602         (Layout::finish_dynamic_section): Likewise.
7603
7604         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
7605         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
7606         know the dynamic type.
7607         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
7608         field.  Initialize it in constructor.
7609         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
7610         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
7611         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
7612         reloc.
7613
7614         * output.cc (Output_reloc::get_address): Change return type to
7615         Elf_Addr.
7616         * output.h (class Output_reloc): Update get_address declaration.
7617         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
7618         for section addresses.
7619
7620 2008-05-09  Ian Lance Taylor  <iant@google.com>
7621
7622         PR 6493
7623         * gold.cc (gold_nomem): Use return value of write.
7624
7625 2008-05-08  Ian Lance Taylor  <iant@google.com>
7626
7627         * symtab.c (Symbol::init_base_output_data): Add version
7628         parameter.  Change all callers.
7629         (Symbol::init_base_output_segment): Likewise.
7630         (Symbol::init_base_constant): Likewise.
7631         (Symbol::init_base_undefined): Likewise.
7632         (Sized_symbol::init_output_data): Likewise.
7633         (Sized_symbol::init_output_segment): Likewise.
7634         (Sized_symbol::init_constant): Likewise.
7635         (Sized_symbol::init_undefined): Likewise.
7636         (Symbol_table::do_define_in_output_data): If the new symbol has a
7637         version, mark it as the default.
7638         (Symbol_table::do_define_in_output_segment): Likewise.
7639         (Symbol_table::do_define_as_constant): Likewise.
7640         * symtab.h (class Symbol): Update declarations.
7641         (class Sized_symbol): Likewise.
7642         * resolve.cc (Symbol::override_version): New function.
7643         (Symbol::override_base): Call override_version.
7644         (Symbol::override_base_with_special): Likewise.
7645         * testsuite/ver_script_8.script: New file.
7646         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
7647         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
7648         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
7649         (ver_test_8_1.so, ver_test_8_2.so): New targets.
7650
7651 2008-05-06  Ian Lance Taylor  <iant@google.com>
7652
7653         PR 6049
7654         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
7655         functions.
7656         (class General_options): Remove existing --undefined, and add
7657         --no-undefined instead.  Add new --undefined as synonym for -u.
7658         * archive.cc (Archive::add_symbols): Check whether symbol was
7659         named with -u.
7660         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
7661         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
7662         all uses.  Add IS_UNDEFINED.  Update declarations to split
7663         different versions of init_base.  Declare init_base_undefined.
7664         (Symbol::is_defined): Handle IS_UNDEFINED.
7665         (Symbol::is_undefined): Likewise.
7666         (Symbol::is_weak_undefined): Call is_undefined.
7667         (Symbol::is_absolute): Handle IS_CONSTANT.
7668         (class Sized_symbol): Update declarations to split different
7669         versions of init.  Declare init_undefined.
7670         (class Symbol_table): Declare new functions.
7671         * symtab.cc (Symbol::init_base_object): Rename from init_base.
7672         Change all callers.
7673         (Symbol::init_base_output_data): Likewise.
7674         (Symbol::init_base_output_segment): Likewise.
7675         (Symbol::init_base_constant): Likewise.
7676         (Symbol::init_base_undefined): New function.
7677         (Sized_symbol::init_object): Rename from init.  Change all
7678         callers.
7679         (Sized_symbol::init_output_data): Likewise.
7680         (Sized_symbol::init_output_segment): Likewise.
7681         (Sized_symbol::init_constant): Likewise.
7682         (Sized_symbol::init_undefined): New function.
7683         (Symbol_table::add_undefined_symbols_from_command_line): New
7684         function.
7685         (Symbol_table::do_add_undefined_symbols_from_command_line): New
7686         function.
7687         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
7688         (Symbol::output_section): Likewise.
7689         (Symbol::set_output_section): Likewise.
7690         (Symbol_table::sized_finalize_symbol): Likewise.
7691         (Symbol_table::sized_write_globals): Likewise.
7692         * resolve.cc (Symbol_table::should_override): Likewise.
7693         (Symbol::override_base_with_special): Likewise.
7694
7695         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
7696         symbol, change it to have default visibility.
7697         * testsuite/protected_1.cc: New file.
7698         * testsuite/protected_2.cc: New file.
7699         * testsuite/protected_3.cc: New file.
7700         * testsuite/protected_main_1.cc: New file.
7701         * testsuite/protected_main_2.cc: New file.
7702         * testsuite/protected_main_3.cc: New file.
7703         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
7704         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
7705         (protected_1_LDFLAGS, protected_1_LDADD): Define.
7706         (protected_1.so): New target.
7707         (protected_1_pic.o, protected_2_pic.o): New targets.
7708         (protected_3_pic.o): New target.
7709         (check_PROGRAMS): Add protected_2.
7710         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
7711         (protected_2_LDFLAGS, protected_2_LDADD): Define.
7712         * testsuite/Makefile.in: Rebuild.
7713
7714         * options.h (DEFINE_var): Add set_user_set_##varname__.
7715         (DEFINE_bool_alias): New macro.
7716         (class General_options): Define -Bstatic using DEFINE_bool_alias
7717         rather than DEFINE_special.  Add --undefined as an alias for -z
7718         defs.
7719         * options.cc (General_options::parse_Bstatic): Remove.
7720
7721         * options.h (class General_options): Add --fatal-warnings.
7722         * main.cc (main): Implement --fatal-warnings.
7723         * errors.h (Errors::warning_count): New function.
7724
7725         * options.h (class General_options): Add -Bsymbolic-functions.
7726         * symtab.h (Symbol::is_preemptible): Check for
7727         -Bsymbolic-functions.
7728
7729 2008-05-05  Ian Lance Taylor  <iant@google.com>
7730
7731         * options.h (DEFINE_bool): For DASH_Z, create the negative option
7732         as noVARNAME rather than no-VARNAME.
7733         (class General_options): Add option -z combreloc.
7734         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
7735         get_address.
7736         (Output_reloc::sort_before) [SHT_REL]: New function.
7737         (Output_reloc::sort_before) [SHT_RELA]: New function.
7738         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
7739         Sort_relocs_comparison.
7740         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
7741         parameter.  Change all callers.
7742         (Output_data_reloc::Output_data_reloc) [both versions]: Add
7743         sort_relocs parameter.  Change all callers.
7744         * output.cc (Output_reloc::get_address): New function, broken out
7745         of write_rel.
7746         (Output_reloc::write_rel): Call it.
7747         (Output_reloc::compare): New function.
7748         (Output_data_reloc_base::do_write): Optionally sort relocs.
7749
7750         * configure.ac: If targ_extra_obj is set, link it in.
7751         * configure.tgt: Initialize all variables.
7752         (x86_64*): Set targ_extra_obj and targ_extra_size.
7753         * configure: Rebuild.
7754
7755         * object.cc (Sized_relobj::include_section_group): Adjust section
7756         indexes read from group data.  Build vector to pass to
7757         layout_group.
7758         * layout.cc (Layout::layout_group): Add flags and shndxes
7759         parameters.  Remove contents parameter.  Change caller.  Update
7760         explicit instantiations.
7761         * layout.h (class Layout): Update layout_group declaration.
7762         * output.cc (Output_data_group::Output_data_group): Add flags and
7763         input_shndxes parameters.  Remove contents parameter.  Change
7764         caller.
7765         (Output_data_group::do_write): Change input_sections_ to
7766         input_shndxes_.
7767         * output.h (class Output_data_group): Update constructor
7768         declaration.  Rename input_sections_ to input_shndxes_.
7769         * testsuite/many_sections_test.cc: Add template.
7770
7771 2008-04-30  Cary Coutant  <ccoutant@google.com>
7772
7773         * target-reloc.h (relocate_section): Fix dead-pointer bug.
7774
7775         * layout.cc (Layout::include_section): Refactored check for debug
7776         info section.
7777         (Layout::add_comdat): Add new parameters.  Change type
7778         of signature parameter.  Add object and shndx to signatures table.
7779         (Layout::find_kept_object): New function.
7780         * layout.h: Include <cstring>.
7781         (Layout::is_debug_info_section): New function.
7782         (Layout::add_comdat): Add new parameters.
7783         (Layout::find_kept_object): New function.
7784         (Layout::Kept_section): New struct.
7785         (Layout::Signatures): Change type of map range.
7786         * object.cc (Relobj::output_section_address): New function.
7787         (Sized_relobj::include_section_group): Add new parameters.  Change
7788         calls to Layout::add_comdat.  Change to build table of kept comdat
7789         groups and table mapping discarded sections to kept sections.
7790         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
7791         (Sized_relobj::do_layout): Change calls to include_section_group and
7792         include_linkonce_section.
7793         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
7794         value to zero when section is discarded.
7795         (Sized_relobj::map_to_kept_section): New function.
7796         * object.h (Relobj::output_section_address): New function.
7797         (Relobj::Comdat_group): New type.
7798         (Relobj::find_comdat_group): New function.
7799         (Relobj::Comdat_group_table): New type.
7800         (Relobj::Kept_comdat_section): New type.
7801         (Relobj::Kept_comdat_section_table): New type.
7802         (Relobj::add_comdat_group): New function.
7803         (Relobj::set_kept_comdat_section): New function.
7804         (Relobj::get_kept_comdat_section): New function.
7805         (Relobj::comdat_groups_): New field.
7806         (Relobj::kept_comdat_sections_): New field.
7807         (Symbol_value::input_value): Update comment.
7808         (Sized_relobj::map_to_kept_section) New function.
7809         (Sized_relobj::include_linkonce_section): Add new parameter.
7810         * target-reloc.h (Comdat_behavior): New type.
7811         (get_comdat_behavior): New function.
7812         (relocate_section): Add code to map a discarded section to the
7813         corresponding kept section when applying a relocation.
7814
7815 2008-04-30  Craig Silverstein  <csilvers@google.com>
7816
7817         * dwarf_reader.cc (next_generation_count): New static var.
7818         (Addr2line_cache_entry): New struct.
7819         (addr2line_cache): New static var.
7820         (Dwarf_line_info::one_addr2line): Added caching.
7821         (Dwarf_line_info::clear_addr2line_cache): New function.
7822         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
7823         cache-size parameter.
7824         (Dwarf_line_info::one_addr2line_cache): New function.
7825         * symtab.cc (Symbol_table::detect_odr_violations): Pass
7826         new cache-size argument to one_addr2line(), and clear cache.
7827
7828 2008-04-28  Cary Coutant  <ccoutant@google.com>
7829
7830         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
7831         R_386_PC8 relocations.
7832
7833 2008-04-23  Ian Lance Taylor  <iant@google.com>
7834
7835         * object.cc (Sized_relobj::include_section_group): Check for
7836         invalid section group.
7837
7838         * object.cc (make_elf_object): Correct test for 64-bit ELF file
7839         header size.
7840
7841         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
7842         than read for file header.
7843         * archive.cc (Archive::include_member): Likewise.
7844
7845 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
7846
7847         * aclocal.m4: Regenerate.
7848         * configure: Regenerate.
7849
7850 2008-04-19  Ian Lance Taylor  <iant@google.com>
7851
7852         * version.cc (version_string): Bump to 1.6.
7853
7854         * testsuite/Makefile.am (many_sections_r_test): New target.
7855         (many_sections_r_test_SOURCES): Remove.
7856         (many_sections_r_test_DEPENDENCIES): Remove.
7857         (many_sections_r_test_LDFLAGS): Remove.
7858         (many_sections_r_test_LDADD): Remove.
7859
7860         * object.cc (Sized_relobj::do_add_symbols): Always pass
7861         local_symbol_count_ to add_from_relobj.
7862
7863         * testsuite/Makefile.am (many_sections_check.h): Only check one in
7864         every thousand variables.
7865         * testsuite/Makefile.in: Rebuild.
7866
7867         * object.cc (Xindex::initialize_symtab_xindex): New function.
7868         (Xindex::read_symtab_xindex): New function.
7869         (Xindex::sym_xindex_to_shndx): New function.
7870         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
7871         available.
7872         (Sized_relobj::do_initialize_xindex): New function.
7873         (Sized_relobj::do_read_symbols): Adjust section links.
7874         (Sized_relobj::symbol_section_and_value): Add is_ordinary
7875         parameter.  Change all callers.
7876         (Sized_relobj::include_section_group): Adjust section links and
7877         symbol section indexes.
7878         (Sized_relobj::do_layout): Adjust section links.
7879         (Sized_relobj::do_count_local_symbols): Adjust section links and
7880         symbol section indexes.
7881         (Sized_relobj::do_finalize_local_symbols): Distinguish between
7882         ordinary and special symbols.
7883         (Sized_relobj::write_local_symbols): Add symtab_xindex and
7884         dynsym_xindex parameters.  Change all callers.  Adjust section
7885         links.  Use SHN_XINDEX when needed.
7886         (Sized_relobj::get_symbol_location_info): Adjust section links.
7887         Don't get fooled by special symbols.
7888         * object.h (class Xindex): Define.
7889         (class Object): Add xindex_ parameter.  Declare virtual functoin
7890         do_initialize_xindex.
7891         (Object::adjust_sym_shndx): New function.
7892         (Object::set_xindex): New protected function.
7893         (class Symbol_value): Add is_ordinary_shndx_ field.
7894         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
7895         (Symbol_value::value): Assert ordinary section.
7896         (Symbol_value::initialize_input_to_output_map): Likewise.
7897         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
7898         Change all callers.
7899         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
7900         all callers.
7901         (class Sized_relobj): Update declarations.
7902         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
7903         parameter.  Change all callers.
7904         (Sized_relobj::adjust_shndx): New function.
7905         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
7906         field.
7907         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
7908         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
7909         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
7910         (Sized_dynobj::read_dynsym_section): Adjust section links.
7911         (Sized_dynobj::read_dynamic): Likewise.
7912         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
7913         section links.
7914         (Sized_dynobj::do_initialize_xindex): New function.
7915         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
7916         do_initialize_xindex.
7917         (Sized_dynobj::adjust_shndx): New function.
7918         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
7919         dynsym_xindex_ fields.
7920         (Layout::finalize): Add a call to set_section_indexes before
7921         creating the symtab sections.
7922         (Layout::set_section_indexes): Don't do anything if the section
7923         already has a section index.
7924         (Layout::create_symtab_sections): Add shnum parameter.  Change
7925         caller.  Create .symtab_shndx section if needed.
7926         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
7927         caller.
7928         (Layout::allocated_output_section_count): New function.
7929         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
7930         needed.
7931         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
7932         fields.  Update declarations.
7933         (Layout::symtab_xindex): New function.
7934         (Layout::dynsym_xindex): New function.
7935         (class Write_symbols_task): Add layout_ field.
7936         (Write_symbols_task::Write_symbols_task): Add layout parameter.
7937         Change caller.
7938         * output.cc (Output_section_headers::Output_section_headers): Add
7939         shstrtab_section parameter.  Change all callers.
7940         (Output_section_headers::do_sized_write): Store overflow values
7941         for section count and section string table section index in
7942         section header zero.
7943         (Output_file_header::do_sized_write): Check for overflow of
7944         section count and section string table section index.
7945         (Output_symtab_xindex::do_write): New function.
7946         (Output_symtab_xindex::endian_do_write): New function.
7947         * output.h (class Output_section_headers): Add shstrtab_section_.
7948         Update declarations.
7949         (class Output_symtab_xindex): Define.
7950         (Output_section::has_out_shndx): New function.
7951         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
7952         field.
7953         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
7954         Change all callers.
7955         (Sized_symbol::init): Likewise.
7956         (Symbol::output_section): Check for ordinary symbol.
7957         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
7958         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
7959         callers.
7960         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
7961         Change all callers.  Simplify handling of symbols from sections
7962         not included in the link.
7963         (Symbol_table::add_from_dynobj): Handle ordinary symbol
7964         distinction.
7965         (Weak_alias_sorter::operator()): Assert that symbols are
7966         ordinary.
7967         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
7968         distinction.
7969         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
7970         parameters.  Change all callers.
7971         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
7972         symbol distinction.  Use SHN_XINDEX when needed.
7973         (Symbol_table::write_section_symbol): Add symtab_xindex
7974         parameter.  Change all callers.
7975         (Symbol_table::sized_write_section_symbol): Likewise.  Use
7976         SHN_XINDEX when needed.
7977         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
7978         declarations.
7979         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
7980         (Symbol::is_defined): Check is_ordinary.
7981         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
7982         (Symbol::is_absolute, Symbol::is_common): Likewise.
7983         (class Sized_symbol): Update declarations.
7984         (class Symbol_table): Update declarations.
7985         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
7986         parameters.  Change all callers.
7987         (Sized_symbol::override): Likewise.
7988         (Symbol_table::override): Likewise.
7989         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
7990         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
7991         is_ordinary, and orig_st_shndx parameters.  Change all callers.
7992         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
7993         to be in an ordinary section.
7994         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
7995         object and is_ordinary parameters.  Change all callers.
7996         (Sized_dwarf_line_info::read_relocs): Add object parameter.
7997         Change all callers.  Don't add undefined or non-ordinary symbols
7998         to reloc_map_.
7999         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
8000         Change all callers.
8001         * dwarf_reader.h (class Sized_dwarf_line_info): Update
8002         declarations.
8003         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
8004         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
8005         (Sized_relobj::relocate_sections): Likewise.
8006         * target-reloc.h (scan_relocs): Adjust section symbol index.
8007         (scan_relocatable_relocs): Likewise.
8008         * i386.cc (Scan::local): Check for ordinary symbols.
8009         * sparc.cc (Scan::local): Likewise.
8010         * x86_64.cc (Scan::local): Likewise.
8011         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
8012         to symbol_section_and_value.
8013         * testsuite/many_sections_test.cc: New file.
8014         * testsuite/Makefile.am (BUILT_SOURCES): Define.
8015         (check_PROGRAMS): Add many_sections_test.
8016         (many_sections_test_SOURCES): Define.
8017         (many_sections_test_DEPENDENCIES): Define.
8018         (many_sections_test_LDFLAGS): Define.
8019         (BUILT_SOURCES): Add many_sections_define.h.
8020         (many_sections_define.h): New target.
8021         (BUILT_SOURCES): Add many_sections_check.h.
8022         (many_sections_check.h): New target.
8023         (check_PROGRAMS): Add many_sections_r_test.
8024         (many_sections_r_test_SOURCES): Define.
8025         (many_sections_r_test_DEPENDENCIES): Define.
8026         (many_sections_r_test_LDFLAGS): Define.
8027         (many_sections_r_test_LDADD): Define.
8028         (many_sections_r_test.o): New target.
8029         * testsuite/Makefile.in: Rebuild.
8030
8031 2008-04-17  Cary Coutant  <ccoutant@google.com>
8032
8033         * errors.cc (Errors::info): New function.
8034         (gold_info): New function.
8035         * errors.h (Errors::info): New function.
8036         * gold.h (gold_info): New function.
8037         * object.cc (Input_objects::add_object): Print trace output.
8038         * options.cc (options::parse_set): New function.
8039         (General_options::parse_wrap): Deleted.
8040         (General_options::General_options): Deleted initializer.
8041         * options.h (options::String_set): New typedef.
8042         (options::parse_set): New function.
8043         (DEFINE_set): New macro.
8044         (General_options::wrap): Changed to use DEFINE_set. Changed
8045         callers of any_wrap_symbols and is_wrap_symbol.
8046         (General_options::trace, General_options::trace_symbol):
8047         New options.
8048         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
8049         (General_options::wrap_symbols_): Deleted.
8050         * symtab.cc (Symbol_table::add_from_object): Print trace output.
8051
8052 2008-04-17  David S. Miller  <davem@davemloft.net>
8053
8054         * options.cc (General_options::parse_V): New function.
8055         * options.h: Add entries for -V and -Qy.
8056
8057 2008-04-17  Ian Lance Taylor  <iant@google.com>
8058
8059         * common.cc (Symbol_table::allocate_commons): Remove options
8060         parameter.  Change caller.
8061         (Symbol_table::do_allocate_commons): Remove options parameter.
8062         Change caller.  Just call do_allocate_commons_list twice.
8063         (Symbol_table::do_allocate_commons_list): New function, broken out
8064         of do_allocate_commons.
8065         * common.h (class Allocate_commons_task): Remove options_ field.
8066         Update constructor.
8067         * symtab.cc (Symbol_table::Symbol_table): Initialize
8068         tls_commons_.
8069         (Symbol_table::add_from_object): Put TLS common symbols on
8070         tls_commons_ list.
8071         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
8072         which are IN_OUTPUT_DATA.
8073         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
8074         allocate_commons and do_allocate_commons declarations.  Declare
8075         do_allocate_commons_list.
8076         * gold.cc (queue_middle_tasks): Update creation of
8077         Allocate_commons_task to not pass options.
8078         * testsuite/Makefile.am (INCLUDES): Add -I.. .
8079         (TLS_TEST_C_FLAGS): New variable.
8080         (tls_test_c_pic.o): New target.
8081         (tls_test_shared.so): Link in tls_test_c_pic.o.
8082         (tls_test_c_pic_ie.o): New target.
8083         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
8084         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
8085         (tls_test_c.o): New target.
8086         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
8087         (tls_pic_test_LDADD): Likewise.
8088         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
8089         (tls_shared_gd_to_ie_test_LDADD): Likewise.
8090         (tls_test_c_gnu2.o): New target.
8091         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
8092         tls_test_c_gnu2.o.
8093         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
8094         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
8095         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
8096         * testsuite/tls_test.cc: Include "config.h".
8097         (t_last): Call t11_last.
8098         * testsuite/tls_test.h (t11, t11_last): Declare.
8099         * testsuite/tls_test_c.c: New file.
8100         * testsuite/tls_test_main.cc (thread_routine): Call t11.
8101         * configure.ac: Check for OpenMP support.
8102         * configure, config.in, Makefile.in: Rebuild.
8103         * testsuite/Makefile.in: Rebuild.
8104
8105 2008-04-16  Cary Coutant  <ccoutant@google.com>
8106
8107         * i386.cc (Target_i386::define_tls_base_symbol): New function.
8108         (Target_i386::tls_base_symbol_defined_): New field.
8109         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
8110         (Target_i386::Scan::global): Likewise.
8111         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
8112         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
8113         (Target_x86_64::tls_base_symbol_defined_): New field.
8114         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
8115         (Target_x86_64::Scan::global): Likewise.
8116
8117 2008-04-16  Cary Coutant  <ccoutant@google.com>
8118
8119         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
8120         (Symbol::needs_plt_entry): Allow weak undefined symbols.
8121         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
8122         building shared libraries.
8123         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
8124         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
8125         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
8126         * testsuite/Makefile.in: Rebuild.
8127         * testsuite/weak_undef.h: New file.
8128         * testsuite/weak_undef_file1.cc: Add extra test cases.
8129         * testsuite/weak_undef_file2.cc: Likewise.
8130         * testsuite/weak_undef_test.cc: Likewise.
8131
8132 2008-04-16  David S. Miller  <davem@davemloft.net>
8133
8134         * sparc.cc (Target_sparc::Scan): Change from struct to class.
8135         Add issued_non_pic_error_ field.  Declare check_non_pic.
8136         (Target_sparc::Scan::check_non_pic): New function.
8137         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
8138         (Target_sparc::Scan::global): Likewise.
8139
8140         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
8141         * configure: Rebuild.
8142
8143         * options.h (DEFINE_enable): New macro.
8144         (new_dtags): New enable option.
8145         (initfirst, interpose, loadfltr, nodefaultlib,
8146         nodelete, nodlopen, nodump): New -z options.
8147         * layout.cc (Layout:finish_dynamic_section): If new
8148         dtags enabled, emit DT_RUNPATH.  Also, emit a
8149         DT_FLAGS_1 containing any specified -z flags.
8150
8151 2008-04-16  Ian Lance Taylor  <iant@google.com>
8152
8153         * copy-relocs.cc: New file.
8154         * copy-relocs.h: New file.
8155         * reloc.cc: Remove Copy_relocs code.
8156         * reloc.h: Likewise.
8157         * reloc-types.h (struct Reloc_types) [both versions]: Add
8158         get_reloc_addend_noerror.
8159         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
8160         variants of add_global which take an addend which must be zero.
8161         * i386.cc: Include "copy-relocs.h".
8162         (class Target_i386): Change type of copy_relocs_ to variable,
8163         update initializer.
8164         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
8165         Change all callers.
8166         (Target_i386::do_finalize_sections): Change handling of
8167         copy_relocs_.
8168         * sparc.cc: Include "copy-relocs.h".
8169         (class Target_sparc): Change type of copy_relocs_ to variable,
8170         update initializer.
8171         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
8172         Change all callers.
8173         (Target_sparc::do_finalize_sections): Change handling of
8174         copy_relocs_.
8175         * x86_64.cc: Include "copy-relocs.h".
8176         (class Target_x86_64): Change type of copy_relocs_ to variable,
8177         update initializer.
8178         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
8179         class.  Change all callers.
8180         (Target_x86_64::do_finalize_sections): Change handling of
8181         copy_relocs_.
8182         * Makefile.am (CCFILES): Add copy-relocs.cc.
8183         (HFILES): Add copy-relocs.h.
8184
8185         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
8186
8187         * testsuite/script_test_4.sh: Permit leading zeroes.
8188
8189 2008-04-15  Ian Lance Taylor  <iant@google.com>
8190
8191         * script-sections.cc (Script_sections::create_segments): Use
8192         header_size_adjustment even when there is enough room for the
8193         headers.
8194         * testsuite/script_test_4.sh: New file.
8195         * testsuite/script_test_4.t: New file.
8196         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
8197         (check_DATA): Add script_test_4.stdout.
8198         (MOSTLYCLEANFILES): Likewise.
8199         (script_test_4): New target.
8200         (script_test_4.stdout): New target.
8201         * testsuite/Makefile.in: Rebuild.
8202
8203         * sparc.cc: Add definitions for Output_data_plt_sparc class
8204         constants.
8205
8206 2008-04-14  David S. Miller  <davem@davemloft.net>
8207
8208         * sparc.cc: New file.
8209         * Makefile.am (TARGETSOURCES): Add sparc.cc
8210         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
8211         * configure.tgt: Document targ_extra_size and
8212         targ_extra_big_endian.  Add entries for sparc-* and
8213         sparc64-*.
8214         * configure.ac: Handle targ_extra_size and
8215         targ_extra_big_endian.
8216         * Makefile.in: Rebuild.
8217         * configure: Likewise.
8218         * po/POTFILES.in: Likewise.
8219         * po/gold.pot: Likewise.
8220
8221 2008-04-14  Ian Lance Taylor  <iant@google.com>
8222
8223         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
8224         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
8225         in the name/type/flags to section mapping.  Don't call
8226         allocate_output_section.
8227         (Layout::choose_output_section): Change parameter from adjust_name
8228         to is_input_section.  Don't permit input sections after sections
8229         are attached to segments.  Don't call allocate_output_section.
8230         (Layout::layout_eh_frame): Call update_flags_for_input_section,
8231         not write_enable_output_section.
8232         (Layout::make_output_section): Don't push to
8233         unattached_section_list_ nor call attach_to_segment.  Call
8234         attach_section_to_segment if sections are attached.
8235         (Layout::attach_sections_to_segments): New function.
8236         (Layout::attach_section_to_segment): New function.
8237         (Layout::attach_allocated_section_to_segment): Rename from
8238         attach_to_segment.  Remove flags parameter.
8239         (Layout::allocate_output_section): Remove function.
8240         (Layout::write_enable_output_section): Remove function.
8241         * layout.h (class Layout): Update for above changes.  Add new
8242         field sections_are_attached_.
8243         * output.h (Output_section::update_flags_for_input_section): New
8244         function.
8245         * output.cc (Output_section::add_input_section): Call
8246         update_flags_for_input_section.
8247         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
8248
8249 2008-04-11  Cary Coutant  <ccoutant@google.com>
8250
8251         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
8252         thought unnecessary.
8253         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
8254
8255 2008-04-11  Ian Lance Taylor  <iant@google.com>
8256
8257         * output.h (class Output_section_data): Remove inline definition
8258         of set_addralign.
8259         * output.cc (Output_section_data::set_addralign): New function.
8260
8261 2008-04-11  Cary Coutant  <ccoutant@google.com>
8262
8263         Add support for TLS descriptors for i386 and x86_64.
8264         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
8265         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
8266         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
8267         GOT_TYPE_TLS_DESC.
8268         (Target_i386::got_mod_index_entry): Remove unnecessary code.
8269         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
8270         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
8271         relocations.
8272         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
8273         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
8274         Fix problem with initial-exec relocations.
8275         (Target_i386::Relocate::relocate_tls): Likewise.
8276         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
8277         relaxation.
8278         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
8279         support for section-plus-offset dynamic table entries.
8280         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
8281         (Output_data_dynamic::Dynamic_entry): Add support for
8282         section-plus-offset dynamic table entries.
8283         (Output_data_dynamic::Classification): Likewise.
8284         (Output_data_dynamic::classification_): Renamed offset_.
8285         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
8286         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
8287         (Target_x86_64::make_plt_section): New function.
8288         (Target_x86_64::reserve_tlsdesc_entries): New function.
8289         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
8290         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
8291         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
8292         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
8293         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
8294         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
8295         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
8296         add extra PLT entry for TLS descriptors.
8297         (Output_data_plt_x86_64::got_): New field.
8298         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
8299         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
8300         fields.
8301         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
8302         descriptors.
8303         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
8304         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
8305         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
8306         R_386_TLS_DESC_CALL relocations.
8307         (Target_x86_64::Scan::global): Likewise.
8308         (Target_x86_64::do_finalize_sections): Add dynamic table entries
8309         for TLS descriptors.
8310         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
8311         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
8312         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
8313         GD-to-IE relaxation.
8314         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
8315         and TLS_DESCRIPTORS.
8316         * Makefile.in: Rebuild.
8317         * configure: Rebuild.
8318         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
8319         (tls_test_shared2.so): New target.
8320         (tls_shared_gd_to_ie_test_SOURCES): New variable.
8321         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
8322         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
8323         (tls_shared_gd_to_ie_test_LDADD): New variable.
8324         (tls_shared_gnu2_gd_to_ie_test): New target.
8325         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
8326         New targets.
8327         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
8328         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
8329         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
8330         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
8331         (tls_shared_gnu2_test): New target.
8332         (tls_test_gnu2_shared.so): New target.
8333         (tls_shared_gnu2_test_SOURCES): New variable.
8334         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
8335         (tls_shared_gnu2_test_LDFLAGS): New variable.
8336         (tls_shared_gnu2_test_LDADD): New variable.
8337         * testsuite/Makefile.in: Rebuild.
8338         * testsuite/Makefile.
8339
8340 2008-04-11  Ian Lance Taylor  <iant@google.com>
8341
8342         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
8343         justsyms.t.
8344         * testsuite/Makefile.in: Rebuild.
8345
8346         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
8347         long.
8348         * testsuite/script_test_2.cc (main): Adjust test.
8349
8350 2008-04-11  David S. Miller  <davem@davemloft.net>
8351             Ian Lance Taylor  <iant@google.com>
8352
8353         * options.h (General_options): Add entries for '-Y' and
8354         '-relax'.
8355         * options.cc (General_options:finalize): If -Y was used, add those
8356         entries to the library path instead of the default "/lib" and
8357         "/usr/lib".
8358
8359 2008-04-11  David S. Miller  <davem@davemloft.net>
8360
8361         * testsuite/justsyms.t: Start at 0x100.
8362         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
8363         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
8364         long.
8365         * testsuite/script_test_2.cc: Adjust string and section length
8366         checks.
8367
8368 2008-04-09  Ian Lance Taylor  <iant@google.com>
8369
8370         PR gold/5996
8371         * script-sections.cc (Sections_element::allocate_to_segment): Add
8372         orphan parameter.
8373         (Output_section_definition::allocate_to_segment): Likewise.
8374         (Orphan_output_section::allocate_to_segment): Likewise.
8375         (Script_sections::attach_sections_using_phdrs_clause): Don't
8376         propagate non-PT_LOAD segments to orphan sections.
8377         * testsuite/Makefile.am (script_test_3.stdout): Generate using
8378         readelf rather than objdump.
8379         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
8380         .interp section and PT_INTERP segment are the same size.
8381         * testsuite/Makefile.in: Rebuild.
8382
8383         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
8384         aliases for symbols defined in the same object.
8385         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
8386         (weak_alias_test_SOURCES): New variable.
8387         (weak_alias_test_DEPENDENCIES): New variable.
8388         (weak_alias_test_LDFLAGS): New variable.
8389         (weak_alias_test_LDADD): New variable.
8390         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
8391         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
8392         (weak_alias_test_3.o): New target.
8393         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
8394         * testsuite/weak_alias_test_main.cc: New file.
8395         * testsuite/weak_alias_test_1.cc: New file.
8396         * testsuite/weak_alias_test_2.cc: New file.
8397         * testsuite/weak_alias_test_3.cc: New file.
8398
8399 2008-04-08  Ian Lance Taylor  <iant@google.com>
8400
8401         * options.h (class General_options): Add --noinhibit-exec option.
8402         * main.cc (main): Check --noinhibit-exec.
8403
8404         * options.h (class General_options): Define --wrap as a special
8405         option.  Add wrap_symbols_ field.
8406         (General_options::any_wrap_symbols): New function.
8407         (General_options::is_wrap_symbol): New function.
8408         * options.cc (General_options::parse_wrap): New function.
8409         (General_options::General_options): Initialize wrap_symbols_.
8410         * symtab.cc (Symbol_table::wrap_symbol): New function.
8411         (Symbol_table::add_from_object): Handle --wrap.
8412         * symtab.h (class Symbol_table): Declare wrap_symbol.
8413         * target.h (Target::wrap_char): New function.
8414         (Target::Target_info): Add wrap_char field.
8415         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
8416         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
8417         * testsuite/testfile.cc (Target_test::test_target_info):
8418         Likewise.
8419
8420         * errors.cc (Errors::undefined_symbol): Mention symbol version if
8421         there is one.
8422
8423         * layout.h (class Layout): Add added_eh_frame_data_ field.
8424         * layout.cc (Layout::Layout): Initialize new field.
8425         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
8426         output section until we find a section we merged successfully.
8427         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
8428         that the size be non-zero.
8429
8430         * merge.cc (Object_merge_map::get_output_offset): Remove inline
8431         qualifier.
8432
8433 2008-04-08  Craig Silverstein  <csilvers@google.com>
8434
8435         * configure.ac: Export new conditional variable HAVE_ZLIB.
8436         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
8437         on HAVE_ZLIB.
8438         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
8439         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
8440
8441 2008-04-07  Ian Lance Taylor  <iant@google.com>
8442
8443         * version.cc (version_string): Set to "1.5".
8444
8445         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
8446         Add issued_non_pic_error_ field.  Declare check_non_pic.
8447         (Target_x86_64::Scan::check_non_pic): New function.
8448         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
8449         (Target_x86_64::Scan::global): Likewise.
8450
8451         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
8452         addend parameter.  Change caller.  Handle merge sections.
8453         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
8454         Address to Addend.  Don't add in the result of
8455         local_section_offset, pass down the addend and use the returned
8456         value.
8457         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
8458         Update declarations of local_section_offset and symbol_value.
8459         * testsuite/two_file_test_1.cc (t18): New function.
8460         * testsuite/two_file_test_2.cc (f18): New function.
8461         * testsuite/two_file_test_main.cc (main): Call t18.
8462         * testsuite/two_file_test.h (t18, f18): Declare.
8463
8464         * configure.ac: Don't test for objdump, c++filt, or readelf.
8465         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
8466         conditionals.
8467         (TEST_READELF): New variable.
8468         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
8469         (check_PROGRAMS): Add two_file_strip_test.
8470         (two_file_strip_test): New target.
8471         (check_PROGRAMS): Add two_file_same_shared_strip_test.
8472         (two_file_same_shared_strip_test_SOURCES): New variable.
8473         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
8474         (two_file_same_shared_strip_test_LDFLAGS): New variable.
8475         (two_file_same_shared_strip_test_LDADD): New variable.
8476         (two_file_shared_strip.so): New target.
8477         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
8478         (ver_test_5.syms, ver_test_7.syms): Likewise.
8479         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
8480         (strip_test_3.stdout): Use TEST_OBJDUMP.
8481         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
8482
8483 2008-04-04  Cary Coutant  <ccoutant@google.com>
8484
8485         * symtab.h (Symbol::is_weak_undefined): New function.
8486         (Symbol::is_strong_undefined): New function.
8487         (Symbol::is_absolute): New function.
8488         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
8489         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
8490         absolute symbols.
8491         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
8492         (weak_undef_test): New target.
8493         * testsuite/Makefile.in: Rebuild.
8494         * testsuite/weak_undef_file1.cc: New file.
8495         * testsuite/weak_undef_file2.cc: New file.
8496         * testsuite/weak_undef_test.cc: New file.
8497
8498 2008-04-03  Craig Silverstein  <csilvers@google.com>
8499
8500         * compressed_output.h (class Output_compressed_section): Use
8501         unsigned buffer.
8502         * compressed_output.cc (zlib_compress): Use unsigned buffers,
8503         add zlib header.
8504         (zlib_compressed_suffix): Removed.
8505         (Output_compressed_section::set_final_data_size): Use unsigned
8506         buffers.
8507         * testsuite/Makefile.am (flagstest_compress_debug_sections):
8508         Fix linker invocation.
8509         (flagstest_o_specialfile_and_compress_debug_sections):
8510         Likewise.
8511         * testsuite/Makefile.in: Regenerated.
8512
8513 2008-04-02  David S. Miller  <davem@davemloft.net>
8514
8515         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
8516         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
8517
8518 2008-04-02  Craig Silverstein  <csilvers@google.com>
8519
8520         * TODO: New file.
8521
8522 2008-04-02  Ian Lance Taylor  <iant@google.com>
8523
8524         * fileread.cc (File_read::find_view): Add byteshift and vshifted
8525         parameters.  Update for new key type to views_.  Change all
8526         callers.
8527         (File_read::read): Adjust for byteshift in returned view.
8528         (File_read::add_view): New function, broken out of
8529         find_and_make_view.
8530         (File_read::make_view): New function, broken out of
8531         find_and_make_view.
8532         (File_read::find_or_make_view): Add offset and aligned
8533         parameters.  Rewrite accordingly.  Change all callers.
8534         (File_read::get_view): Add offset and aligned parameters.  Adjust
8535         for byteshift in return value.
8536         (File_read::get_lasting_view): Likewise.
8537         * fileread.h (class File_read): Update declarations.
8538         (class File_read::View): Add byteshift_ field.  Add byteshift to
8539         constructor.  Add byteshift method.
8540         * archive.h (Archive::clear_uncached_views): New function.
8541         (Archive::get_view): Add aligned parameter.  Change all callers.
8542         * object.h (Object::get_view): Add aligned parameter.  Change all
8543         callers.
8544         (Object::get_lasting_view): Likewise.
8545
8546         * fileread.cc (File_read::release): Don't call clear_views if
8547         there are multiple objects.
8548         * fileread.h (File_read::clear_uncached_views): New function.
8549         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
8550         on the archive.
8551
8552 2008-03-31  Cary Coutant  <ccoutant@google.com>
8553
8554         Add thin archive support.
8555         * archive.cc (Archive::armagt): New const.
8556         (Archive::setup): Remove task parameter and calls to unlock.
8557         (Archive::unlock_nested_archives): New function.
8558         (Archive::read_header): Add nested_off parameter. Change
8559         all callers.
8560         (Archive::interpret_header): Likewise.
8561         (Archive::include_all_members): Change to handle thin
8562         archives.
8563         (Archive::include_member): Likewise.
8564         * archive.h (Archive::Archive): Add new parameters and
8565         initializers.
8566         (Archive::armagt): New const.
8567         (Archive::setup): Remove task parameter.
8568         (Archive::unlock_nested_archives): New function.
8569         (Archive::read_header): Add nested_off parameter.
8570         (Archive::interpret_header): Likewise.
8571         (Archive::Nested_archive_table): New typedef.
8572         (Archive::is_thin_archive_): New field.
8573         (Archive::nested_archives_): New field.
8574         (Archive::options_): New field.
8575         (Archive::dirpath_): New field.
8576         (Archive::task_): New field.
8577         * readsyms.cc (Read_symbols::do_read_symbols): Add check
8578         for thin archives.  Pass additional parameters to
8579         Archive::Archive.  Unlock the archive file after calling
8580         Archive::setup.
8581
8582 2008-03-29  Ian Lance Taylor  <iant@google.com>
8583
8584         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
8585         version symbol to be local.
8586         * testsuite/ver_test_4.sh: New file.
8587         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
8588         (check_DATA): Add ver_test_4.syms.
8589         (ver_test_4.syms): New target.
8590         * testsuite/Makefile.in: Rebuild.
8591
8592         * output.cc
8593         (Output_section::Input_section_sort_entry::has_priority): New
8594         function.
8595         (Output_section::Input_section_sort_entry::match_file_name): New
8596         function.
8597         (Output_section::Input_section_sort_entry::match_section_name):
8598         Remove.
8599         (Output_section::Input_section_sort_entry::match_section_name_prefix):
8600         Remove.
8601         (Output_section::Input_section_sort_entry::match_section_file):
8602         Remove.
8603         (Output_section::Input_section_sort_compare::operator()): Rewrite
8604         using new Input_section_sort_entry functions.  Sort crtbegin and
8605         crtend first.  Sort sections with no priority before sections with
8606         a priority.
8607         * testsuite/initpri1.c (d3): Check j != 4.
8608         (cd5): New constructor/destructor function.
8609         (main): Check j != 2.
8610
8611         * symtab.cc (Symbol_table::add_from_object): If we don't use the
8612         new symbol when resolving, don't call set_is_default.
8613         * testsuite/ver_test_7.cc: New file.
8614         * testsuite/ver_test_7.sh: New file.
8615         * testsuite/Makefile.am (ver_test_7.so): New target.
8616         (ver_test_7.o): New target.
8617         (check_SCRIPTS): Add ver_test_7.sh.
8618         (check_DATA): Add ver_test_7.syms.
8619         (ver_test_7.syms): New target.
8620
8621 2008-03-28  Ian Lance Taylor  <iant@google.com>
8622
8623         * layout.cc (Layout::layout): If we see an input section with a
8624         name that needs sorting, set the must_sort flag for the output
8625         section.
8626         (Layout::make_output_section): If the name of the output section
8627         indicates that it might require sorting, set the may_sort flag.
8628         * output.h (Output_section::may_sort_attached_input_sections): New
8629         function.
8630         (Output_section::set_may_sort_attached_input_sections): New
8631         function.
8632         (Output_section::must_sort_attached_input_sections): New
8633         function.
8634         (Output_section::set_must_sort_attached_input_sections): New
8635         function.
8636         (class Output_section): Declare Input_section_sort_entry.  Define
8637         Input_section_sort_compare.  Declare
8638         sort_attached_input_sections.  Add new fields:
8639         may_sort_attached_input_sections_,
8640         must_sort_attached_input_sections_,
8641         attached_input_sections_are_sorted_.
8642         * output.cc (Output_section::Output_section): Initialize new
8643         fields.
8644         (Output_section::add_input_section): Add an entry to
8645         input_sections_ if may_sort or must_sort are true.
8646         (Output_section::set_final_data_size): Call
8647         sort_attached_input_sections if necessary.
8648         (Output_section::Input_section_sort_entry): Define new class.
8649         (Output_section::Input_section_sort_compare::operator()): New
8650         function.
8651         (Output_section::sort_attached_input_sections): New function.
8652         * configure.ac: Check whether the compiler supports constructor
8653         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
8654         * testsuite/initpri1.c: New file.
8655         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
8656         CONSTRUCTOR_PRIORITY.
8657         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
8658         (initpri1_LDFLAGS): New variable.
8659         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
8660
8661 2008-03-27  Ian Lance Taylor  <iant@google.com>
8662
8663         * common.cc (Sort_commons::operator): Correct sorting algorithm.
8664         * testsuite/common_test_1.c: New file.
8665         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
8666         (common_test_1_SOURCES): New variable.
8667         (common_test_1_DEPENDENCIES): New variable.
8668         (common_test_1_LDFLAGS): New variable.
8669
8670         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
8671         and commons_ correctly when NAME/VERSION does not override
8672         NAME/NULL.
8673         * testsuite/ver_test_6.c: New file.
8674         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
8675         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
8676         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
8677
8678 2008-03-26  Ian Lance Taylor  <iant@google.com>
8679
8680         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
8681         of an undefined symbol from a version script.
8682         * testsuite/Makefile.am (ver_test_5.so): New target.
8683         (ver_test_5.o): New target.
8684         (check_SCRIPTS): Add ver_test_5.sh.
8685         (check_DATA): Add ver_test_5.syms.
8686         (ver_test_5.syms): New target.
8687         * testsuite/ver_test_5.cc: New file.
8688         * testsuite/ver_test_5.script: New file.
8689         * testsuite/ver_test_5.sh: New file.
8690         * Makefile.in, testsuite/Makefile.in: Rebuild.
8691
8692         PR gold/5986
8693         Fix problems building gold with gcc 4.3.0.
8694         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
8695         (gold_error_at_location, gold_warning_at_location): Use it.
8696         * configure.ac: Check whether we can compile and use a template
8697         function with a printf attribute.
8698         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
8699         when jumping over bytes.
8700         * object.cc: Instantiate Object::read_section_data.
8701         * debug.h: Include <cstring>
8702         * dwarf_reader.cc: Include <algorithm>
8703         * main.cc: Include <cstring>.
8704         * options.cc: Include <cstring>.
8705         * output.cc: Include <cstring>.
8706         * script.cc: Include <cstring>.
8707         * script.h: Include <string>.
8708         * symtab.cc: Include <cstring> and <algorithm>.
8709         * target-select.cc: Include <cstring>.
8710         * version.cc: Include <string>.
8711         * testsuite/testmain.cc: Include <cstdlib>.
8712         * configure, config.in: Rebuild.
8713
8714 2008-03-25  Ian Lance Taylor  <iant@google.com>
8715
8716         * options.cc: Include "../bfd/bfdver.h".
8717         (options::help): Print bug reporting address.
8718
8719         * version.cc (print_version): Adjust output for current value of
8720         BFD_VERSION_STRING.
8721
8722         * NEWS: New file.
8723
8724         * options.cc (options::help): Print list of supported targets.
8725         * target-select.h: Include <vector>.
8726         (class Target_selector): Make machine_, size_, and is_big_endian_
8727         fields const.  Add bfd_name_ and instantiated_target_ fields.
8728         (Target_selector::Target_selector): Add bfd_name parameter.
8729         (Target_selector::recognize): Make non-virtual, call
8730         do_recognize.
8731         (Target_selector::recognize_by_name): Make non-virtual, call
8732         do_recognize_by_name.
8733         (Target_selector::supported_names): New function.
8734         (Target_selector::bfd_name): New function.
8735         (Target_selector::do_instantiate_target): New pure virtual
8736         function.
8737         (Target_selector::do_recognize): New virtual function.
8738         (Target_selector::do_recognize_by_name): New virtual function.
8739         (Target_selector::instantiate_target): New private function.
8740         (supported_target_names): Declare.
8741         * target-select.cc (Target_selector::Target_selector): Update for
8742         new parameter and fields.
8743         (select_target_by_name): Check that the name matches before
8744         calling recognize_by_name.
8745         (supported_target_names): New function.
8746         * i386.cc (class Target_selector_i386): Update Target_selector
8747         constructor call.  Remove recognize and recognize_by_name.  Add
8748         do_instantiate_target.
8749         * x86_64.cc (class Target_selector_x86_64): Likewise.
8750         * testsuite/testfile.cc (class Target_selector_test): Update for
8751         changes to Target_selector.
8752
8753         * README: Rewrite, with some notes on unsupported features.
8754
8755 2008-03-24  Cary Coutant  <ccoutant@google.com>
8756
8757         * i386.cc (Target_i386::Got_type): New enum declaration.
8758         (Target_i386::Scan::local): Updated callers of Output_data_got
8759         member functions.
8760         (Target_i386::Scan::global): Likewise.
8761         (Target_i386::Relocate::relocate): Likewise.
8762         (Target_i386::Relocate::relocate_tls): Likewise.
8763         * object.h (Got_offset_list): New class.
8764         (Sized_relobj::local_has_got_offset): Added got_type parameter.
8765         (Sized_relobj::local_got_offset): Likewise.
8766         (Sized_relobj::set_local_got_offset): Likewise.
8767         (Sized_relobj::local_has_tls_got_offset): Removed.
8768         (Sized_relobj::local_tls_got_offset): Removed.
8769         (Sized_relobj::set_local_tls_got_offset): Removed.
8770         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
8771         * output.cc (Output_data_got::add_global): Added got_type parameter.
8772         (Output_data_got::add_global_with_rel): Likewise.
8773         (Output_data_got::add_global_with_rela): Likewise.
8774         (Output_data_got::add_global_pair_with_rel): New function.
8775         (Output_data_got::add_global_pair_with_rela): New function.
8776         (Output_data_got::add_local): Added got_type parameter.
8777         (Output_data_got::add_local_with_rel): Likewise.
8778         (Output_data_got::add_local_with_rela): Likewise.
8779         (Output_data_got::add_local_pair_with_rel): New function.
8780         (Output_data_got::add_local_pair_with_rela): New function.
8781         (Output_data_got::add_global_tls): Removed.
8782         (Output_data_got::add_global_tls_with_rel): Removed.
8783         (Output_data_got::add_global_tls_with_rela): Removed.
8784         (Output_data_got::add_local_tls): Removed.
8785         (Output_data_got::add_local_tls_with_rel): Removed.
8786         (Output_data_got::add_local_tls_with_rela): Removed.
8787         * output.h (Output_data_got::add_global): Added got_type parameter.
8788         (Output_data_got::add_global_with_rel): Likewise.
8789         (Output_data_got::add_global_with_rela): Likewise.
8790         (Output_data_got::add_global_pair_with_rel): New function.
8791         (Output_data_got::add_global_pair_with_rela): New function.
8792         (Output_data_got::add_local): Added got_type parameter.
8793         (Output_data_got::add_local_with_rel): Likewise.
8794         (Output_data_got::add_local_with_rela): Likewise.
8795         (Output_data_got::add_local_pair_with_rel): New function.
8796         (Output_data_got::add_local_pair_with_rela): New function.
8797         (Output_data_got::add_global_tls): Removed.
8798         (Output_data_got::add_global_tls_with_rel): Removed.
8799         (Output_data_got::add_global_tls_with_rela): Removed.
8800         (Output_data_got::add_local_tls): Removed.
8801         (Output_data_got::add_local_tls_with_rel): Removed.
8802         (Output_data_got::add_local_tls_with_rela): Removed.
8803         * resolve.cc (Symbol::override_base_with_special): Removed
8804         reference to has_got_offset_ field.
8805         * symtab.cc (Symbol::init_fields): Replaced initialization
8806         of got_offset_ with got_offsets_.  Removed initialization
8807         of has_got_offset_
8808         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
8809         (Symbol::got_offset): Likewise.
8810         (Symbol::set_got_offset): Likewise.
8811         (Symbol::has_tls_got_offset): Removed.
8812         (Symbol::tls_got_offset): Removed.
8813         (Symbol::set_tls_got_offset): Removed.
8814         (Symbol::got_offset_): Removed.
8815         (Symbol::tls_mod_got_offset_): Removed.
8816         (Symbol::tls_pair_got_offset_): Removed.
8817         (Symbol::got_offsets_): New field.
8818         (Symbol::has_got_offset): Removed.
8819         (Symbol::has_tls_mod_got_offset): Removed.
8820         (Symbol::has_tls_pair_got_offset): Removed.
8821         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
8822         (Target_x86_64::Scan::local): Updated callers of Output_data_got
8823         member functions.
8824         (Target_x86_64::Scan::global): Likewise.
8825         (Target_x86_64::Relocate::relocate): Likewise.
8826         (Target_x86_64::Relocate::relocate_tls): Likewise.
8827
8828 2008-03-25  Ben Elliston  <bje@au.ibm.com>
8829
8830         * yyscript.y: Fix spelling error in comment.
8831
8832 2008-03-24  Ian Lance Taylor  <iant@google.com>
8833
8834         * options.h (class General_options): Define build_id option.
8835         * layout.h (class Layout): Declare write_build_id, create_note,
8836         create_build_id.  Add build_id_note_ member.
8837         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
8838         "libiberty.h", "md5.h", "sha1.h".
8839         (Layout::Layout): Initialize eh_frame_data_,
8840         eh_frame_hdr_section_, and build_id_note_.
8841         (Layout::finalize): Call create_build_id.
8842         (Layout::create_note): New function, broken out of
8843         Layout::create_gold_note.
8844         (Layout::create_gold_note): Call create_note.
8845         (Layout::create_build_id): New function.
8846         (Layout::write_build_id): New function.
8847         (Close_task_runner::run): Call write_build_id.
8848
8849         * x86_64.cc: Correct license to GPLv3.
8850
8851 2008-03-23  Ian Lance Taylor  <iant@google.com>
8852
8853         * options.cc: Include "demangle.h".
8854         (parse_optional_string): New function.
8855         (parse_long_option): Handle takes_optional_argument.
8856         (parse_short_option): Update dash_z initializer.  Handle
8857         takes_optional_argument.
8858         (General_options::General_options): Initialize do_demangle_.
8859         (General_options::finalize): Set do_demangle_.  Handle demangling
8860         style.
8861         * options.h (parse_optional_string): Declare.
8862         (struct One_option): Add optional_arg field.  Update constructor.
8863         Update call constructor calls.  Add takes_optional_argument
8864         function.
8865         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
8866         (DEFINE_optional_string): Define.
8867         (General_options::demangle): Change from DEFINE_bool to
8868         DEFINE_optional_string.
8869         (General_options::no_demangle): New function.
8870         (General_options::do_demangle): New function.
8871         (General_options::set_do_demangle): New function.
8872         (General_options::execstack_status_): Move definition to end of
8873         class definition.
8874         (General_options::static_): Likewise.
8875         (General_options::do_demangle_): New field.
8876         * object.cc (big_endian>::get_symbol_location_info): Call
8877         Options::do_demangle, not Options::demangle.
8878         * symtab.cc (demangle): Likewise.
8879
8880 2008-03-22  Ian Lance Taylor  <iant@google.com>
8881
8882         * gold.h: Include <cstddef> and <sys/types.h>
8883         * options.h: Include <cstring>.
8884
8885 2008-03-21  Ian Lance Taylor  <iant@google.com>
8886
8887         * Added source code to GNU binutils.