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