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