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