Make Elf_file::section_name() a const function, so that it can be used in
[platform/upstream/binutils.git] / gold / ChangeLog
1 2014-09-02  Cary Coutant  <ccoutant@google.com>
2
3         * dwp.cc (Sized_relobj_dwo::do_section_name): Add const attribute.
4         * dynobj.h (Sized_dynobj::do_section_name): Likewise.
5         * incremental.cc (Sized_relobj_incr::do_section_name): Likewise.
6         (Sized_incr_dynobj::do_section_name): Likewise.
7         * incremental.h (Sized_relobj_incr::do_section_name): Likewise.
8         (Sized_incr_dynobj::do_section_name): Likewise.
9         * object.h (Object::section_name): Likewise.
10         (Object::do_section_name): Likewise.
11         (Sized_relobj_file::do_section_name): Likewise.
12         * plugin.cc (Sized_pluginobj::do_section_name): Likewise.
13         * plugin.h (Sized_pluginobj::do_section_name): Likewise.
14
15 2014-09-02  Cary Coutant  <ccoutant@google.com>
16
17         PR gold/17005
18         * ehframe.cc (Fde::write): Add output_offset parameter.
19         (Cie::write): Likewise.
20         (Eh_frame::set_final_data_size): Account for offset within output
21         section.
22         (Eh_frame::do_sized_write): Likewise.
23         * ehframe.h (Fde::write): Add output_offset parameter.
24         (Cie::write): Likewise.
25         * output.cc (Output_section::Input_section_sort_entry): Remove
26         section_has_name_; add output_section_name parameter. Use
27         output section name for non-input sections.
28         (Output_section::Input_section_sort_entry::section_has_name): Remove.
29         (Output_section::Input_section_sort_entry::section_has_name_): Remove.
30         (Output_section::Input_section_sort_compare): Remove logic for
31         sections without names.
32         (Output_section::Input_section_sort_init_fini_compare): Likewise.
33         (Output_section::Input_section_sort_section_prefix_special_ordering_compare):
34         Likewise.
35         (Output_section::Input_section_sort_section_name_compare): Likewise.
36
37 2014-08-29 Han Shen <shenhan@google.com>
38            Jing Yu <jingyu@google.com>
39
40         * aarch64-reloc-property.cc
41         (AArch64_reloc_property_table::reloc_name_in_error_message): Fix bug in
42         reference reloc property in the table.
43         * aarch64-reloc.def: Add TLSLE reloc types and fix some errors in
44         3 other entries.
45         * aarch64.cc: (Output_data_got_aarch64::add_static_reloc):
46         2 new overloaded methods.
47         (Output_data_got_aarch64::do_write): Add code to write out
48         static relocs.
49         (class Output_data_got_aarch64::Static_reloc): New class to wrap
50         static relocs.
51         (Output_data_got_aarch64::static_relocs): New vector to
52         hold static relocs.
53         (Target_aarch64::TCB_SIZE): New const static memeber.
54         (Target_aarch64::tcb_size): New method.
55         (Target_aarch64::Relocate::relocate): Add code handling new reloc types.
56         (Target_aarch64::Relocate::relocate_tls): New method.
57         (Target_aarch64::Scan::local): Add code handling new reloc types.
58         (Target_aarch64::Scan::global): Add code handling new reloc types.
59
60 2014-08-13  Sriraman Tallam  <tmsriram@google.com>
61
62         * options.h (-no-pie): Add option.
63
64 2014-08-08  Jing Yu  <jingyu@google.com>
65             Han Shen  <shenhan@google.com>
66
67         * Makefile.am (HFILES): Add aarch64-reloc-property.h.
68         (DEFFILES): add aarch64-reloc.def.
69         (TARGETSOURCES): Add aarch64-reloc-property.cc.
70         (ALL_TARGETOBJS): Add aarch64-reloc-property.$(OBJEXT).
71         * Makefile.in: Regenerate.
72         * aarch64-reloc-property.cc: New file.
73         * aarch64-reloc-property.h: New file.
74         * aarch64-reloc.def: New file.
75         * aarch64.cc: Include aarch64-reloc-property.h. Replace spaces
76         with tab to make the format consistent.
77         (Output_data_got_aarch64::symbol_table_): New method.
78         (Target_aarch64::do_plt_address_for_global): New method.
79         (Target_aarch64::do_plt_address_for_local): New method.
80         (Target_aarch64::do_select_as_default_target): New method.
81         (Target_aarch64::do_make_data_plt): New method.
82         (Target_aarch64::make_data_plt): New method.
83         (Output_data_plt_aarch64::has_irelative_section): New method.
84         (Output_data_plt_aarch64::address_for_global): New method.
85         (Output_data_plt_aarch64::address_for_local): New method.
86         (Output_data_plt_aarch64::irelative_rel_): New parameter.
87         (Output_data_plt_aarch64::add_entry): Implement contents.
88         (Output_data_plt_aarch64::set_final_data_size): Fix typo.
89         (Output_data_plt_aarch64::do_write): Remove useless got_base. Set
90         the got_pov entry to plt0.
91         (Output_data_plt_aarch64_standard::do_fill_first_plt_entry):
92         Implement contents.
93         (Output_data_plt_aarch64_standard::do_fill_plt_entry): Implement.
94         (AArch64_howto): New struct.
95         (aarch64_howto[]): New static const array.
96         (AArch64_relocate_functions): New class.
97         (Target_aarch64::Scan::get_reference_flags): Remove method.
98         (Target_aarch64::Scan::local): Implement to support a few relocations.
99         (Target_aarch64::Scan::global): Implement to support a few relocations.
100         (Target_aarch64::make_plt_section): Implement contents.
101         (Target_aarch64::make_plt_entry): Implement contents.
102         (Target_aarch64::do_finalize_sections): Implement contents.
103         (Target_aarch64::Relocate::relocate): Implement a few relocations.
104         (Target_aarch64::relocate_section): Implement contents.
105
106 2014-08-06  Alan Modra  <amodra@gmail.com>
107
108         * testsuite/defsym_test.sh: Allow ppc64le localentry annotation.
109
110 2014-08-06  Alan Modra  <amodra@gmail.com>
111
112         PR 13227
113         * symtab.cc (Symbol_table::add_from_relobj): Warn on __gnu_lto_slim.
114
115 2014-07-21  Sriraman Tallam  <tmsriram@google.com>
116
117         * object.cc (Relobj::is_section_name_included): Add
118         ".rodata.nptl_version" to not garbage collect this section.
119
120 2014-07-08  Cary Coutant  <ccoutant@google.com>
121
122         * expression.cc (struct Expression::Expression_eval_info): Add
123         new fields type_pointer, vis_pointer, and nonvis_pointer.
124         (Expression::eval_maybe_dot): Add type_pointer, vis_pointer, and
125         nonvis_pointer parameters. Adjust all calls.
126         (Symbol_expression::value): Update type, visibility, and nonvis bits
127         in caller.
128         * script.cc (Symbol_assignment::sized_finalize): Update type,
129         visibility, and remaining st_other bits for new symbol.
130         * script.h: (Expression::eval_maybe_dot): Add type_pointer,
131         vis_pointer, and nonvis_pointer parameters.
132         * symtab.h (Symbol::set_type): New method.
133
134         * testsuite/Makefile.am (defsym_test): New test.
135         * testsuite/Makefile.in: Regenerate.
136         * testsuite/defsym_test.c: New file.
137         * testsuite/defsym_test.sh: New file.
138
139 2014-07-08  Cary Coutant  <ccoutant@google.com>
140
141         PR gold/15639
142         * dynobj.h (Sized_dynobj::base_read_symbols): New method.
143         * dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
144         (Sized_dynobj::base_read_symbols): ...new method.
145         * object.h (Sized_relobj_file::base_read_symbols): New method.
146         * object.cc (Sized_relobj_file::do_read_symbols): Move body to...
147         (Sized_relobj_file::base_read_symbols): ...new method.
148         * arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
149         * mips.cc: (Mips_relobj::do_read_symbols): Likewise.
150         * powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.
151
152 2014-07-04  Alan Modra  <amodra@gmail.com>
153
154         * po/POTFILES.in: Regenerate.
155
156 2014-07-02  Jing Yu  <jingyu@google.com>
157
158         * aarch64.cc: New file
159         * Makefile.am (TARGETSOURCES): Add aarch64.cc
160         (ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
161         * Makefile.in: Regenerate.
162         * configure.tgt: Add entries for aarch64*.
163         * configure.ac:  Likewise.
164         * configure: Likewise.
165
166 2014-06-27  Alan Modra  <amodra@gmail.com>
167
168         * symtab.cc (Symbol::should_add_dynsym_entry): Don't make inline.
169
170 2014-06-24  Cary Coutant  <ccoutant@google.com>
171
172         * dwp.cc (Dwo_file::read): Allow files with no .debug_types
173         sections.
174         (Dwo_file::sized_read_unit_index): Likewise.
175
176 2014-06-23  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
177
178         * mips.cc: New file.
179         * Makefile.am (TARGETSOURCES): Add mips.cc
180         (ALL_TARGETOBJS): Add mips.$(OBJEXT)
181         * configure.tgt: Add entries for mips*.
182         * configure.ac: Likewise.
183         * Makefile.in: Regenerate.
184         * configure: Likewise.
185
186 2014-06-09  Cary Coutant  <ccoutant@google.com>
187
188         * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
189         unit_length is within section bounds.
190
191 2014-06-09  Cary Coutant  <ccoutant@google.com>
192
193         PR gold/16980
194         * layout.cc (Layout::print_to_mapfile): Print unattached sections in
195         map.
196
197 2014-06-07  Alan Modra  <amodra@gmail.com>
198
199         * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
200
201 2014-06-06  Cary Coutant  <ccoutant@google.com>
202
203         * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
204         * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
205         (Dwarf_pubnames_table::read_header): Likewise.
206         * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
207         .debug_gnu_pubtypes.
208
209 2014-06-05  Joel Brobecker  <brobecker@adacore.com>
210
211         * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
212         * Makefile.in, configure: Regenerate.
213
214 2014-06-03  Alan Modra  <amodra@gmail.com>
215
216         * powerpc.cc (addis_12_2): Define.
217         (Stub_table::do_write): Support fusion on ELFv2 stubs.
218
219 2014-06-03  Alan Modra  <amodra@gmail.com>
220
221         * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
222         st_other output.
223
224 2014-06-02  Alan Modra  <amodra@gmail.com>
225
226         * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
227         Only ignore relocs on ELFv1.
228         (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
229
230 2014-05-30  Cary Coutant  <ccoutant@google.com>
231
232         * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
233         * testsuite/Makefile.in: Regenerate.
234         * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
235
236 2014-05-27  H.J. Lu  <hongjiu.lu@intel.com>
237
238         PR gold/16945
239         * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
240         for got_offset.  Properly get GOT address for R_X86_64_PLTOFF64.
241
242 2014-05-15  Alan Modra  <amodra@gmail.com>
243
244         * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
245         Compare FDE contents with DW_CFA_nop rather than 0.
246
247 2014-05-13  Sriraman Tallam  <tmsriram@google.com>
248
249         * symtab.h (may_need_copy_reloc): Remove check for position independent
250         code.
251         * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
252         position independence before pc absolute may_need_copy_reloc call.
253         Add check for executable output befor pc relative may_need_copy_reloc
254         call.
255         * i386.cc: Ditto.
256         * arm.cc: Ditto.
257         * sparc.cc: Ditto.
258         * tilegx.cc: Ditto.
259         * powerpc.cc: Add check for no position independence before
260         may_need_copy_reloc calls.
261         * testsuite/pie_copyrelocs_test.cc: New file.
262         * testsuite/pie_copyrelocs_shared_test.cc: New file.
263         * Makefile.am (pie_copyrelocs_test): New test.
264         * Makefile.in: Regenerate.
265
266 2014-05-08  Martin Liška  <mliska@suse.cz>
267
268         * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
269
270 2014-05-06  Cary Coutant  <ccoutant@google.com>
271
272         PR gold/16900
273         * i386.cc (Output_data_got_plt_i386): New class.
274         (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
275         parameter. Change all callers.
276         (Output_data_plt_i386::layout_): Remove.
277         (Output_data_plt_i386::got_plt_): Change type.
278         (Target_i386::got_plt_): Change type. Change all references.
279         (Target_i386::got_section): Create instance of new class.
280         (Output_data_got_plt_i386::do_write): New function.
281         * x86_64.cc (Output_data_got_plt_x86_64): New class.
282         (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
283         parameter. Change all callers.
284         (Output_data_plt_x86_64::layout_): Remove.
285         (Output_data_plt_x86_64::got_plt_): Change type.
286         (Target_x86_64::got_plt_): Change type. Change all references.
287         (Target_x86_64::got_section): Create instance of new class.
288         (Output_data_got_plt_x86_64::do_write): New function.
289         (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
290         (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
291         class.
292
293 2014-05-05  Cary Coutant  <ccoutant@google.com>
294
295         * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
296         if we have pubnames/pubtypes.
297
298 2014-05-02  Cary Coutant  <ccoutant@google.com>
299
300         * defstd.cc (in_segment): Define __ehdr_start here...
301         * layout.cc (Layout::finalize): ...Instead of here.  Set the
302         output segment when known.
303         * resolve.cc (Symbol::override_base_with_special): Remember
304         the original binding.
305         * symtab.cc (Symbol::set_output_segment): New function.
306         (Symbol::set_undefined): New function.
307         * symtab.h (Symbol::is_weak_undefined): Check original undef
308         binding.
309         (Symbol::is_strong_undefined): New function.
310         (Symbol::set_output_segment): New function.
311         (Symbol::set_undefined): New function.
312         * target-reloc.h (is_strong_undefined): Remove.
313         (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
314         Check for hidden undefs.
315         (relocate_section): Call Symbol::is_strong_undefined.
316
317         * testsuite/Makefile.am (ehdr_start_test_1)
318         (ehdr_start_test_2, ehdr_start_test_3)
319         (ehdr_start_test_4, ehdr_start_test_5): New test cases.
320         * testsuite/Makefile.in: Regenerate.
321         * testsuite/ehdr_start_def.cc: New source file.
322         * testsuite/ehdr_start_test.cc: New source file.
323         * testsuite/ehdr_start_test.t: New linker script.
324         * testsuite/ehdr_start_test_4.sh: New shell script.
325
326 2014-04-23  Cary Coutant  <ccoutant@google.com>
327
328         PR gold/16870
329         * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
330
331 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
332
333         * layout.cc (Layout::include_section): Allow a target to decide
334         whether to include a section.
335         * target.h (Target::should_include_section): New function.
336         (Target::do_should_include_section): New function.
337
338 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
339
340         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
341         inline into ...
342         (Copy_relocs::emit): ... here.
343         * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
344         (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
345         (Copy_reloc_entry::entries_): Change from private to protected.
346
347 2014-04-02  Sriraman Tallam  <tmsriram@google.com>
348
349         * icf.cc (get_section_contents): Replace copies of reloc
350         vectors with const references.
351
352 2014-04-02  Cary Coutant  <ccoutant@google.com>
353
354         * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
355         (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
356         * configure: Regenerate.
357         * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
358         -fno-use-linker-plugin.
359         (LINK1, CXXLINK1): Add it to the link command.
360         * testsuite/Makefile.in: Regenerate.
361
362 2014-03-12  Alan Modra  <amodra@gmail.com>
363
364         * Makefile.in: Regenerate.
365
366 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
367
368         * symtab.h (Symbol::set_nonvis): New function.
369
370 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
371
372         * symtab.cc (Sized_symbol<32>::init_output_data):
373         Instantiate the template.
374         (Sized_symbol<64>::init_output_data): Likewise.
375
376 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
377
378         * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
379         adjust dynamic symbol value.
380         * target.h (Target::adjust_dyn_symbol): New function.
381         (Target::do_adjust_dyn_symbol): New function.
382
383 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
384
385         * output.cc (Output_data_dynamic::Dynamic_entry::write):
386         Get the value of DYNAMIC_CUSTOM dynamic entry.
387         * output.h (Output_data_dynamic::add_custom): New function.
388         (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
389         dynamic entry.
390         (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
391         * target.h (Target::dynamic_tag_custom_value): New function.
392         (Target::do_dynamic_tag_custom_value): New function.
393
394 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
395
396         * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
397         dynsym indexes.
398         * target.h (Target::has_custom_set_dynsym_indexes): New function.
399         (Target::do_has_custom_set_dynsym_indexes): New function.
400         (Target::set_dynsym_indexes): New function.
401         (Target::do_set_dynsym_indexes): New function.
402
403 2014-03-07  Alan Modra  <amodra@gmail.com>
404
405         * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
406         CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
407         (Powerpc_relocate_functions::has_overflow_unsigned): New function.
408         (Powerpc_relocate_functions::has_overflow_bitfield,
409         overflowed): Use the above.
410         (Target_powerpc::Relocate::relocate): Correct overflow checking
411         for a number of relocations.  Modify overflow test for 16-bit
412         fields in instructions to signed/unsigned according to whether
413         the field takes a signed or unsigned value.
414
415 2014-03-05  Alan Modra  <amodra@gmail.com>
416
417         Update copyright years.
418
419 2014-03-05  Alan Modra  <amodra@gmail.com>
420
421         * powerpc.cc (Target_powerpc::Scan::local, global): Support
422         R_PPC64_ADDR64_LOCAL.
423         (Target_powerpc::Relocate::relocate): Likewise.
424
425 2014-03-03  Alan Modra  <amodra@gmail.com>
426
427         * dwp.cc (print_version): Update copyright year to current.
428
429 2014-02-10  Alan Modra  <amodra@gmail.com>
430
431         * po/gold.pot: Regenerate.
432
433 2014-02-06  Cary Coutant  <ccoutant@google.com>
434
435         Fix problem where -u is ignored when a weak undef is seen.
436
437         * archive.cc (Library_base::should_include_member): Reorder
438         code to check for -u option if a weak undef has already been seen.
439         * testsuite/Makefile.am (weak_undef_test_2): New test case.
440         * testsuite/Makefile.in: Regenerate.
441         * testsuite/weak_undef_file3.cc: New file.
442         * testsuite/weak_undef_file4.cc: New file.
443         * testsuite/weak_undef_test_2.cc: New file.
444
445 2014-02-05  Cary Coutant  <ccoutant@google.com>
446
447         Fix issues with gold undefined symbol diagnostics.
448
449         PR binutils/15435
450         * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
451         check to here.
452         * target-reloc.h (is_strong_undefined): New function.
453         (relocate_section): Move undef vtable symbol check from here.
454         Check for is_strong_undefined.
455
456 2014-02-05  Cary Coutant  <ccoutant@google.com>
457
458         Fix problems with the --dynamic-list option.
459
460         PR gold/13577
461         * options.cc (General_options::parse_dynamic_list):
462         Set have_dynamic_list_.
463         (General_options::General_options): Initialize have_dynamic_list_.
464         (General_options::finalize): Turn off -Bsymbolic and
465         -Bsymbolic-functions if --dynamic-list provided.
466         * options.h (General_options::have_dynamic_list): New function.
467         (General_options::have_dynamic_list_): New data member.
468         * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
469         correctly.
470
471         PR gold/16530
472         * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
473         in --dynamic-list, mark it.
474
475         * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
476         (dynamic_list_2): New test case.
477         * testsuite/Makefile.in: Regenerate.
478         * testsuite/dynamic_list_2.cc: New file.
479         * testsuite/dynamic_list_2.t: New file.
480         * testsuite/dynamic_list_lib1.cc: New file.
481         * testsuite/dynamic_list_lib2.cc: New file.
482         * testsuite/gc_dynamic_list_test.c: New file.
483         * testsuite/gc_dynamic_list_test.sh: New file.
484         * testsuite/gc_dynamic_list_test.t: New file.
485
486 2014-01-28  Cary Coutant  <ccoutant@google.com>
487
488         Add .gdb_index version 7 support.
489
490         * gold/dwarf_reader.cc: include <utility> (for make_pair).
491         (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
492         debug sections.
493         (Dwarf_ranges_table::read_ranges_table): Likewise.
494         (Dwarf_pubnames_table::read_section): Check for GNU-style
495         sections, and for compressed debug sections.
496         (Dwarf_pubnames_table::read_header): Compute end address of table.
497         (Dwarf_pubnames_table::next_name): Return flag_byte.  Check
498         for end of list by offset, not by offset == 0.
499         (Dwarf_info_reader::do_read_string_table): Check for compressed
500         debug sections.
501         * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
502         Initialize new data members.
503         (Dwarf_pubnames_table::next_name): return flag_byte.
504         (Dwarf_pubnames_table::end_of_table_): New data member.
505         (Dwarf_pubnames_table::is_gnu_style_): New data member.
506         * gold/gdb-index.cc (gdb_index_version): Update to version 7.
507         (Gdb_index_info_reader::read_pubtable): Read flag_byte.
508         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
509         read skeleton type unit DIEs.
510         (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
511         (Gdb_index::do_write): Write flag_byte.
512         * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
513         (Gdb_index::Cu_vector): Store flags along with cu indexes.
514         * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
515         * gold/testsuite/gdb_index_test_comm.sh: Likewise.
516
517 2014-01-08  H.J. Lu  <hongjiu.lu@intel.com>
518
519         * version.cc (print_version): Update copyright year to 2014.
520
521 2013-12-19  Dimitry Andric  <dimitry@andric.com>
522
523         * stringpool.cc (Stringpool_template::reserve): Add
524         HAVE_UNORDERED_MAP case.
525         * stringpool.cc (Stringpool_template::print_stats): Likewise.
526
527 2013-12-18  Cary Coutant  <ccoutant@google.com>
528
529         * configure.ac: Check for <unordered_set> and <unordered_map>.
530         * config.in: Regenerate.
531         * configure: Regenerate.
532         * system.h: Use <unordered_set> and <unordered_map> if available.
533
534 2013-12-10  Roland McGrath  <mcgrathr@google.com>
535
536         * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
537         with $(INSTALL_PROGRAM_ENV).
538         * Makefile.in: Regenerate.
539
540 2013-11-22  Cary Coutant  <ccoutant@google.com>
541
542         * configure.ac: Add check for which library is needed for
543         dlopen.
544         * configure: Regenerate.
545
546 2013-11-22  Cary Coutant  <ccoutant@google.com>
547
548         * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
549         assembler.
550         * testsuite/Makefile.in: Regenerate.
551
552 2013-11-17  H.J. Lu  <hongjiu.lu@intel.com>
553
554         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
555         Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
556         R_X86_64_PC32 and R_X86_64_PLT32, respectively.
557         (Target_x86_64<size>::Scan::local): Likewise.
558         (Target_x86_64<size>::Scan::global): Likewise.
559         (Target_x86_64<size>::Relocate::relocate): Likewise.
560         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
561         Likewise.
562         (Target_x86_64<size>::Scan::check_non_pic(): Handle
563         R_X86_64_PC32_BND.
564
565         * testsuite/Makefile.am (check_PROGRAMS): Add
566         exception_x86_64_bnd_test.
567         (exception_x86_64_bnd_test_SOURCES): New macro.
568         (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
569         (exception_x86_64_bnd_test_LDFLAGS): Likewise.
570         (exception_x86_64_bnd_test_LDADD): Likewise.
571         (exception_x86_64_bnd_1.o): New rule.
572         (exception_x86_64_bnd_2.o): Likewise.
573         * testsuite/Makefile.in: Regenerated.
574
575 2013-11-15  Alan Modra  <amodra@gmail.com>
576
577         * powerpc.cc (Target_powerpc::glink_section): Provide non-const
578         accessor.
579         (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
580         Only call ppc64_local_entry_offset for 64-bit.  Restrict
581         symval_for_branch lookup to ELFv1.
582         (Stub_table::add_plt_call_entry): Use unsigned int off.
583         (Output_data_glink::Address, invalid_address): New.
584         (Output_data_glink::add_eh_frame): Move out of line.  Add
585         support for ELFv2.
586         (Output_data_glink::add_global_entry, find_global_entry,
587         global_entry_address): New functions.
588         (Output_data_glink::global_entry_stubs_, end_branch_table_,
589         ge_size): New variables.
590         (Output_data_glink::set_final_data_size): Add global entry
591         stub sizing.
592         (Output_data_glink::do_write): Write global entry stubs.
593         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
594         parameter.  Return true for ELFv2.  Adjust callers.
595         (Target_powerpc::Scan::local, global): Restrict opd lookup to
596         ELFv1.  Similarly for ifunc and dynamic relocation processing
597         specific to ELFv1.  Recognize that symbols are defined on
598         their plt entries for ELFv2.
599         (Target_powerpc::symval_for_branch): Assert if called for
600         ELFv2 or ppc32.
601         (Target_powerpc::Relocate::relocate): Use global entry plt
602         stub for symbol value if such exists on ELFv2.
603         (Target_powerpc::Relocate::relocate): Don't call
604         symval_for_branch when ELFv2.  Do adjust for local entry
605         offset when ELFv2.
606         (Target_powerpc::do_dynsym_value): Set symbols to global entry
607         plt stub for ELFv2.
608         (Target_powerpc::do_plt_address_for_global): Similarly.
609
610 2013-11-14  Cary Coutant  <ccoutant@google.com>
611
612         Revert patch -- this did not fix the problem, and there is
613         no race there.
614
615         2013-11-14  Cary Coutant  <ccoutant@google.com>
616
617             PR gold/14860
618             * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
619             (Ehframe_hdr::set_final_data_size): Allocate a Lock.
620             * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
621             updating fde_offsets_.
622             (Eh_frame_hdr::lock_): New data member.
623
624 2013-11-14  Cary Coutant  <ccoutant@google.com>
625
626         * dwp.cc (Dwo_file_entry): New type.
627         (File_list): Use Dwo_file_entry.
628         (Dwo_file::verify): New function.
629         (Dwo_file::verify_dwo_list): New function.
630         (Dwo_file::sized_verify_dwo_list): New function.
631         (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
632         list.
633         (Dwp_options): New enum type.
634         (dwp_options): Add --verify-only.
635         (usage): Likewise.
636         (main): Likewise.
637         * dwp.h (gold_info): Add declaration.
638
639 2013-11-14  Cary Coutant  <ccoutant@google.com>
640
641         PR gold/14860
642         * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
643         (Ehframe_hdr::set_final_data_size): Allocate a Lock.
644         * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
645         updating fde_offsets_.
646         (Eh_frame_hdr::lock_): New data member.
647
648 2013-11-06  Cary Coutant  <ccoutant@google.com>
649
650         PR gold/15758
651         * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
652         before reloc sections.
653
654 2013-11-04  Alan Modra  <amodra@gmail.com>
655
656         * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
657         (Symbol::needs_dynamic_reloc): Test new flag.
658         * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
659         (Target_powerpc::Scan::get_reference_flags): Add target param.
660         Return FUNC_DESC_ABI for 64-bit ELFv1.
661         (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
662         call.
663         (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
664         (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
665
666 2013-10-31  Cary Coutant  <ccoutant@google.com>
667
668         Restore support for dwp v2 DWARF package file format.
669
670         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
671         tu_length parameter.  Adjust all callers.
672         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
673         * dwp.cc: Include dwarf.h.
674         (Section_bounds): New struct type.
675         (Unit_set): New struct type.
676         (Dwo_file::Dwo_file): Initialize new data member.
677         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
678         Combine and rename to...
679         (Dwo_file::read_unit_index): ...this.
680         (Dwo_file::sized_read_compunit_index)
681         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
682         (Dwo_file::sized_read_unit_index): ...this.
683         (Dwo_file::copy_section): Remove section_name, is_str_offsets
684         parameters; add section_id parameter.
685         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
686         (Dwo_file::add_unit_set): ...this.
687         (Dwo_file::shndx_map_): Remove.
688         (Dwo_file::sect_offsets_): New data member.
689         (Dwp_output_file::Dwp_output_file): Initialize new data members.
690         (Dwp_output_file::add_section): Rename to...
691         (Dwp_output_file::add_contribution): ...this.
692         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
693         (Dwp_output_file::add_tu_set): Likewise.
694         (Dwp_output_file::Contribution): New type.
695         (Dwp_output_file::Section::contributions): New data member.
696         (Dwp_output_file::Cu_or_tu_set): Remove.
697         (Dwp_output_file::Section::Section): New ctor.
698         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
699         (Dwp_output_file::Dwp_index::Section_table): New type.
700         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
701         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
702         parameter.
703         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
704         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
705         (Dwp_output_file::Dwp_index::section_table): New member function.
706         (Dwp_output_file::Dwp_index::section_table_end): New member function.
707         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
708         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
709         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
710         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
711         (Dwp_output_file::Dwp_index::section_table_): New data member.
712         (Dwp_output_file::Dwp_index::section_mask_): New data member.
713         (Dwp_output_file::add_output_section): New member function.
714         (Dwp_output_file::write_new_section): New member function.
715         (Dwp_output_file::write_contributions): New member function.
716         (Dwp_output_file::section_id_map_): New data member.
717         (class Dwo_id_info_reader): Remove.
718         (class Unit_reader): New class.
719         (get_dwarf_section_name): New function.
720         (Dwo_file::read_executable): Adjust initializations of class data.
721         (Dwo_file::read): Add support for v2 package file format.
722         (Dwo_file::read_unit_index): Likewise.
723         (Dwo_file::sized_read_unit_index): Likewise.
724         (Dwo_file::copy_section): Likewise.
725         (Dwo_file::add_unit_set): Likewise.
726         (Dwp_output_file::add_output_section): Likewise.
727         (Dwp_output_file::add_contribution): Likewise.
728         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
729         for empty slot.
730         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
731         file format.
732         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
733         slot.
734         (Dwp_output_file::initialize): Remove unused function.
735         (Dwp_output_file::finalize): Add support for v2 package file format.
736         (Dwp_output_file::write_index): Likewise.
737         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
738         function prototype.
739
740 2013-10-31  Cary Coutant  <ccoutant@google.com>
741
742         * configure.ac: Fix check for -fmerge-constants.
743         * configure.ac: Regenerate.
744
745 2013-10-30  Roland McGrath  <mcgrathr@google.com>
746
747         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
748         Correct 9-byte nop sequence to match what the assembler generates.
749
750 2013-10-30  Alan Modra  <amodra@gmail.com>
751
752         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
753         ppc64_local_entry_offset, ppc64_local_entry_offset,
754         do_read_symbols): New functions.
755         (Powerpc_relobj::e_flags_, st_other_): New vars.
756         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
757         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
758         (Powerpc_relobj::e_flags_): New var.
759         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
760         and adjust for ELFv2.
761         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
762         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
763         (Powerpc_dynobj::do_find_special_sections): Likewise.
764         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
765         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
766         to ELFv2 local entry.
767         (Target_powerpc::do_relax): No thread safe barriers needed for
768         ELFv2.
769         (Output_data_plt_powerpc::initial_plt_entry_size_,
770         plt_entry_size): Delete.  Replace all uses with
771         first_plt_entry_offset() and plt_entry_size().
772         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
773         reserved_size parm.  Update callers.
774         (Output_data_plt_powerpc::entry_count): Update.
775         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
776         and use Target_powerpc::first_plt_entry_offset().
777         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
778         rename to plt_entry_size.
779         (Output_data_plt_powerpc::add_ifunc_entry,
780         add_local_ifunc_entry): Adjust reloc for ELFv2.
781         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
782         (glink_eh_frame_fde_64v2): New.
783         (Stub_table::plt_call_size): Support ELFv2 sizing.
784         (Output_data_glink::add_eh_frame): Use the new FDE.
785         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
786         (Stub_table::do_write): Write ELFv2 stubs and glink.
787         (Target_powerpc::Relocate::relocate): Replaces nop after call
788         with ld 2,24(1) and adjust local offset destination for ELFv2.
789
790 2013-10-30  Alan Modra  <amodra@gmail.com>
791
792         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
793         (Target_powerpc::Scan::global, local): Likewise.
794         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
795         on all ppc64 @h and @ha relocs.
796
797 2013-10-14  Alan Modra  <amodra@gmail.com>
798
799         * output.h (Output_data_got::add_constant): Tidy.
800         (Output_data_got::add_constant_pair): New function.
801         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
802         methods used so as to first call reserve_ent().
803
804 2013-10-11  Roland McGrath  <mcgrathr@google.com>
805
806         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
807         add_got_entry and add_got_entry_pair.
808
809         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
810         (HAVE_PUBNAMES): Likewise.
811         * configure: Regenerate.
812
813         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
814         * testsuite/Makefile.in: Regenerate.
815
816         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
817         Remove const from declaration.
818         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
819         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
820         * output.h (Output_file_header): Remove const from member target_
821         and corresponding constructor argument.
822         * output.cc (Output_file_header::Output_file_header): Update prototype.
823         (Output_file_header::do_sized_write): Use this->target_ in place
824         of parameters()->target().
825
826         * testsuite/undef_symbol.cc (Foo::get_a): New method.
827
828         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
829         * configure: Regenerate.
830         * Makefile.in: Regenerate.
831         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
832         * testsuite/merge_string_literals_2.c: Likewise.
833         * testsuite/Makefile.am
834         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
835         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
836         literal -fmerge-constants.
837         * testsuite/Makefile.in: Regenerate.
838
839         * i386.cc (Target_i386): Remove unused member dynbss_.
840         * arm.cc (Target_arm): Likewise.
841         * powerpc.cc (Target_powerpc): Likewise.
842         * sparc.cc (Target_sparc): Likewise.
843         * tilegx.cc (Target_tilegx): Likewise.
844         * x86_64.cc (Target_x86_64): Likewise.
845         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
846         type_signature_, type_offset_.
847         * plugin.h (Plugin_hook): Remove unused member layout_.
848         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
849         mapfile_.
850         (Read_member): Remove unused members input_objects_, symtab_,
851         mapfile_, layout_.
852         (Check_library): Remove unused member symtab_.
853         * archive.h (Lib_group): Remove unused member lib_.
854         * archive.cc (Lib_group::Lib_group): Update initializer.
855         * incremental.h (Incremental_binary): Remove unused member target_.
856         (Incremental_script_entry): Removed unused member script_.
857         * layout.h (Write_symbols_task): Remove unused member input_objects_.
858         * icf.h (Icf): Remove unused member num_tracked_relocs.
859
860         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
861         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
862         its only use.
863         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
864
865         * archive.h: Use struct rather than class for forward declaration
866         of Read_symbols_data.
867
868 2013-10-07  Cary Coutant  <ccoutant@google.com>
869
870         PR gold/16010
871         * testsuite/Makefile.am (icf_test): Fix dependencies.
872         (icf_safe_test): Likewise.
873         (icf_safe_so_test): Likewise.
874         (large_symbol_alignment): Add empty _LDADD rule.
875         * testsuite/Makefile.in: Regenerate.
876
877 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
878
879         PR gold/15927
880         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
881         relocation for R_X86_64_32 on x32.
882
883 2013-08-27  Roland McGrath  <mcgrathr@google.com>
884
885         * output.cc (Output_segment::set_section_addresses): Take new
886         Target* argument.  If target->isolate_execinstr() and the segment
887         is executable and starts at a target->abi_pagesize() boundary,
888         pad its end out to a target->abi_pagesize() boundary with code fill.
889         * output.h (Output_segment::set_section_addresses): Update decl.
890         * layout.h (Layout::check_output_data_for_reset_values): Take new
891         argument RELAX_OUTPUTS.
892         (Layout): New member relax_output_list_.
893         (Layout::add_relax_output): New method.
894         * layout.cc (Layout::Layout): Update constructor.
895         (Layout::reset_relax_output): New method.
896         (Layout::clean_up_after_relaxation): Call it.
897         (Layout::prepare_for_relaxation): Update caller.
898         (Layout::set_segment_offsets): Update callers of set_section_addresses.
899         Call reset_relax_output before re-processing segments for
900         isolate_execinstr case.
901         (Layout::write_data): Handle relax_output_list_.
902         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
903         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
904
905 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
906
907         PR binutils/15834
908         * object.h: Fix typos.
909
910 2013-08-16  Roland McGrath  <mcgrathr@google.com>
911
912         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
913         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
914
915 2013-08-07  Cary Coutant  <ccoutant@google.com>
916
917         Revert support for v2 DWP files:
918
919         2013-03-01  Cary Coutant  <ccoutant@google.com>
920
921             Add dwp support for v2 DWARF package file format.
922             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
923             tu_length parameter.  Adjust all callers.
924             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
925             * dwp.cc: Include dwarf.h.
926             (Section_bounds): New struct type.
927             (Unit_set): New struct type.
928             (Dwo_file::Dwo_file): Initialize new data member.
929             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
930             Combine and rename to...
931             (Dwo_file::read_unit_index): ...this.
932             (Dwo_file::sized_read_compunit_index)
933             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
934             (Dwo_file::sized_read_unit_index): ...this.
935             (Dwo_file::copy_section): Remove section_name, is_str_offsets
936             parameters; add section_id parameter.
937             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
938             (Dwo_file::add_unit_set): ...this.
939             (Dwo_file::shndx_map_): Remove.
940             (Dwo_file::sect_offsets_): New data member.
941             (Dwp_output_file::Dwp_output_file): Initialize new data members.
942             (Dwp_output_file::add_section): Rename to...
943             (Dwp_output_file::add_contribution): ...this.
944             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
945             (Dwp_output_file::add_tu_set): Likewise.
946             (Dwp_output_file::Contribution): New type.
947             (Dwp_output_file::Section::contributions): New data member.
948             (Dwp_output_file::Cu_or_tu_set): Remove.
949             (Dwp_output_file::Section::Section): New ctor.
950             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
951             (Dwp_output_file::Dwp_index::Section_table): New type.
952             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
953             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
954             parameter.
955             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
956             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
957             (Dwp_output_file::Dwp_index::section_table): New member function.
958             (Dwp_output_file::Dwp_index::section_table_end): New member function.
959             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
960             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
961             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
962             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
963             (Dwp_output_file::Dwp_index::section_table_): New data member.
964             (Dwp_output_file::Dwp_index::section_mask_): New data member.
965             (Dwp_output_file::add_output_section): New member function.
966             (Dwp_output_file::write_new_section): New member function.
967             (Dwp_output_file::write_contributions): New member function.
968             (Dwp_output_file::section_id_map_): New data member.
969             (class Dwo_id_info_reader): Remove.
970             (class Unit_reader): New class.
971             (get_dwarf_section_name): New function.
972             (Dwo_file::read_executable): Adjust initializations of class data.
973             (Dwo_file::read): Add support for v2 package file format.
974             (Dwo_file::read_unit_index): Likewise.
975             (Dwo_file::sized_read_unit_index): Likewise.
976             (Dwo_file::copy_section): Likewise.
977             (Dwo_file::add_unit_set): Likewise.
978             (Dwp_output_file::add_output_section): Likewise.
979             (Dwp_output_file::add_contribution): Likewise.
980             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
981             for empty slot.
982             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
983             file format.
984             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
985             slot.
986             (Dwp_output_file::initialize): Remove unused function.
987             (Dwp_output_file::finalize): Add support for v2 package file format.
988             (Dwp_output_file::write_index): Likewise.
989             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
990             function prototype.
991
992 2013-07-31  Cary Coutant  <ccoutant@google.com>
993
994         * object.cc (Sized_relobj::do_output_section_address): New function.
995         (Sized_relobj): Instantiate explicitly.
996         * object.h (Object::output_section_address): New function.
997         (Object::do_output_section_address): New function.
998         (Sized_relobj::do_output_section_address): New function.
999         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
1000
1001 2013-07-30  Cary Coutant  <ccoutant@google.com>
1002             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1003
1004         * parameters.cc (Parameters::entry): Return target-specific entry
1005         symbol name.
1006         * target.h (Target::entry_symbol_name): New function.
1007         (Target_info::entry_symbol_name): New data member.
1008
1009         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
1010         * i386.cc (Target_i386::i386_info): Likewise.
1011         (Target_i386_nacl::i386_nacl_info): Likewise.
1012         * sparc.cc (Target_sparc::sparc_info): Likewise.
1013         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
1014         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
1015         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
1016         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1017
1018 2013-07-22  Sterling Augustine  <saugustine@google.com>
1019
1020         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
1021         Convert parameter shndx to local variable. Add parameters symtab
1022         and symtab_size.  Scan over section names.  Find relocation
1023         section corresponding to current section.  Create and initialize
1024         reloc_mapper_ and reloc_type_.
1025         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
1026         unit_length to off_t.  Initialize member unit_length_.  Fill in field
1027         cu_offset_.
1028         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
1029         Initialize new fields unit_length_ and cu_offset_.
1030         (Dwarf_pubnames_table::read_section): Update prototype.
1031         (Dwarf_pubnames_table::cu_offset): New member function.
1032         (Dwarf_pubnames_table::subsection_size): Likewise.
1033         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
1034         New fields.
1035         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
1036         member functions public.
1037         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
1038         Update comment.  Rework logic.  Move repeated parts to...
1039         (Gdb_index_info_reader::read_pubtable): ...here. New function.
1040         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
1041         pubtypes_table_, and stmt_list_offset.
1042         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
1043         Gdb_index::find_pubtype_offset,
1044         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
1045         (Gdb_index::pubnames_read): Update prototype and rework logic.
1046         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
1047         Forward declare.
1048         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
1049         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
1050         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
1051         Gdb_index::map_pubtable_to_dies):
1052         Declare functions.
1053         (Gdb_index::pubnames_read): Update declaration.
1054         (Gdb_index::Pubname_offset_map): New type.
1055         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
1056         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
1057         Gdb_index::stmt_list_offset): Declare.
1058         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
1059         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
1060         Gdb_index::pubtypes_offset_): Remove.
1061
1062 2013-07-19  Roland McGrath  <mcgrathr@google.com>
1063
1064         * options.h (General_options): Add -Trodata-segment option.
1065         * parameters.cc (Parameters::check_rodata_segment): New function.
1066         (Parameters::set_target_once): Call it.
1067         * parameters.h (Parameters): Declare it (private member function).
1068         * layout.cc (load_seg_unusable_for_headers): New function, broken
1069         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
1070         then validate rodata segment rather than text segment.
1071         (relaxation_loop_body): Call that.
1072         (is_text_segment): New function.  Don't admit a non-executable
1073         segment if TARGET->isolate_execinstr().
1074         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
1075
1076 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
1077
1078         PR gold/15070
1079         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
1080         * nacl.h (Sniff_file::View::View): Request aligned view.
1081
1082 2013-07-11  Cary Coutant  <ccoutant@google.com>
1083
1084         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
1085         correct BRLT entry size.
1086
1087 2013-07-03  Alan Modra  <amodra@gmail.com>
1088
1089         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
1090         comment.
1091
1092 2013-07-01  Cary Coutant  <ccoutant@google.com>
1093
1094         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
1095         reloc_type_.
1096         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
1097         (Dwarf_ranges_table::lookup_reloc): New function.
1098         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
1099         reloc_type_.
1100         (Dwarf_ranges_table::lookup_reloc): New function.
1101         (Dwarf_ranges_table::reloc_type_): New data member.
1102
1103 2013-06-27  Jing Yu  <jingyu@google.com>
1104
1105         PR gold/15662
1106         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
1107         function.
1108         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
1109         (Target_powerpc::do_relax): Call the above.
1110
1111 2013-06-27  Cary Coutant  <ccoutant@google.com>
1112
1113         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
1114         on garbage collected .opd section.
1115
1116 2013-06-27  Alan Modra  <amodra@gmail.com>
1117
1118         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
1119         is non-zero.
1120         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
1121         (Target_powerpc::do_function_location): Likewise for loc->shndx.
1122
1123 2013-06-14  Cary Coutant  <ccoutant@google.com>
1124
1125         * resolve.cc (Symbol::override_base): Don't override st_type
1126         from plugin placeholder symbols.
1127         (Symbol_table::resolve): Likewise.
1128         (Symbol_table::should_override): Don't complain about TLS mismatch
1129         if the TO symbol is a plugin placeholder.
1130         * testsuite/Makefile.am (plugin_test_tls): New test.
1131         * testsuite/Makefile.in: Regenerate.
1132         * testsuite/plugin_test_tls.sh: New test script.
1133         * testsuite/two_file_test_2_tls.cc: New test source.
1134         * testsuite/two_file_test_tls.cc: New test source.
1135
1136 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1137
1138         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
1139         the maximum segment alignment is larger than the page size.
1140         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
1141         correctly aligns the symbols with large alignemnt.
1142         * testsuite/Makefile.in: Regenerate.
1143         * testsuite/large_symbol_alignment.cc: New file.
1144
1145 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1146             Sriraman Tallam  <tmsriram@google.com>
1147
1148         * options.h (sort_section): New option.
1149         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
1150         Rename from Input_section_sort_section_name_special_ordering_compare.
1151         (Input_section_sort_section_name_compare): New struct.
1152         * output.cc (Output_section::Input_section_sort_section_name_compare::
1153         operator()): New function.
1154         (Output_section::sort_attached_input_sections): Use new sort function
1155         for .text if --sort-section=name is specified.
1156         * layout.cc (Layout::make_output_section):
1157         Add sorting by name when --sort-section=name is specified.
1158         * testsuite/Makefile.am (text_section_grouping): Test option
1159         --sort-section=name.
1160         * testsuite/Makefile.in: Regenerate.
1161         * testsuite/section_sorting_name.cc: New file.
1162         * testsuite/section_sorting_name.sh: New file.
1163
1164 2013-05-21  Cary Coutant  <ccoutant@google.com>
1165
1166         * symtab.h (Symbol::is_cxx_vtable): New function.
1167         * target-reloc.h (relocate_section): Check for vtable symbol.
1168         * testsuite/Makefile.am (missing_key_func.sh): New test case.
1169         * testsuite/Makefile.in: Regenerate.
1170         * testsuite/missing_key_func.cc: New test source.
1171         * testsuite/missing_key_func.sh: New test script.
1172
1173 2013-05-21  Cary Coutant  <ccoutant@google.com>
1174
1175         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
1176         type of enclosing symbol.
1177         (Relocate_info::location): Check symbol type when describing symbol.
1178         * object.h (Symbol_location_info): Remove unused line_number;
1179         add enclosing_symbol_type.
1180         * testsuite/debug_msg.sh: Adjust expected output.
1181
1182 2013-05-13  Cary Coutant  <ccoutant@google.com>
1183
1184         * configure.ac: Export DEFAULT_TARGET.
1185         * configure: Regenerate.
1186         * Makefile.in: Regenerate.
1187         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
1188         * testsuite/Makefile.in: Regenerate.
1189         * testsuite/debug_msg.sh: Delete duplicate tests.
1190         Don't check undef_int error message match for powerpc where the
1191         source file and line number aren't available.
1192
1193 2013-05-10  Roland McGrath  <mcgrathr@google.com>
1194
1195         * options.h (General_options): Add --rosegment-gap option.
1196         * options.cc (finalize): --rosegment-gap implies --rosegment.
1197         * layout.cc (set_segment_offsets): Let user option override
1198         target->rosegment_gap().
1199
1200 2013-05-10  Roland McGrath  <mcgrathr@google.com>
1201
1202         * options.h (General_options): Remove leading space from help
1203         messages for -nostdlib and --rosegment.
1204
1205 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
1206
1207         PR ld/15365
1208         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
1209
1210 2013-05-03  Alan Modra  <amodra@gmail.com>
1211
1212         * merge.cc (Output_merge_string::do_add_input_section): Correct
1213         scan for number of strings.  Rename vars to avoid shadowing.
1214         Include missing terminator in input_size_.
1215
1216 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
1217
1218         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
1219         Restore empty string handling.
1220
1221 2013-05-01  Cary Coutant  <ccoutant@google.com>
1222
1223         * stringpool.cc (Stringpool_template::new_key_offset): Fix
1224         uninitialized warning.
1225
1226 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1227
1228         * output.cc (Output_section::add_merge_input_section): Allow
1229         to merge sections if the alignment is more than character size.
1230         * merge.h (Output_merge_string::Output_merge_string): Remove
1231         assert.
1232         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
1233         only not-null strings. Check the alignment of strings.
1234         * stringpool.h
1235         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
1236         alignment as the argument.
1237         (Stringpool_template<Stringpool_char>::addralign_): New class member.
1238         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
1239         Align non-zero length strings according to the addralign_.
1240         (Stringpool_template<Stringpool_char>::set_string_offsets):
1241         Updating offsets according to the given alignment.
1242         * testsuite/Makefile.am (text_section_grouping): Test if string
1243         literals are getting merged.
1244         * testsuite/Makefile.in: Regenerate.
1245         * testsuite/merge_string_literals_1.c: New file.
1246         * testsuite/merge_string_literals_2.c: Ditto.
1247         * testsuite/merge_string_literals.sh: Ditto.
1248
1249 2013-04-26  Ian Lance Taylor  <iant@google.com>
1250
1251         * target-reloc.h (relocate_section): If the reloc offset is out of
1252         range, pass VIEW as NULL to relocate.relocate.
1253         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
1254         * i386.cc (Target_i386::Relocate::relocate): Likewise.
1255         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
1256         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
1257         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
1258         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
1259
1260 2013-04-26  Geoff Pike  <gpike@chromium.org>
1261
1262         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
1263         * layout.cc (Hash_task): New class.
1264         (Layout::queue_build_id_tasks): New function.
1265         (Layout::write_build_id): Handle single-thread portion of build ID
1266         computation.  (In some cases, all of it is single-threaded.)  Replace
1267         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
1268         functionality in fewer lines of code.
1269         * layout.h (Layout::queue_build_id_tasks): New function declaration.
1270         * options.h (General_options): make "--build-id" default to tree
1271         rather than sha1.  Add two new options related to --build-id=tree:
1272         --build-id-chunk-size-for-treehash and
1273         --build-id-min-file-size-for-treehash.
1274         * Makefile.am: add testing of --build-id=tree and related new options
1275         (these tests will be invoked by "make check").
1276         * Makefile.in: Regenerate.
1277
1278 2013-04-25  Alan Modra  <amodra@gmail.com>
1279
1280         * configure.tgt: Add powerpcle and powerpc64le.
1281
1282 2013-04-22  Alan Modra  <amodra@gmail.com>
1283
1284         PR gold/15355
1285         * layout.cc (Layout::segment_precedes): Allow more than one
1286         segment with the same type and flags.
1287
1288 2013-04-15  Cary Coutant  <ccoutant@google.com>
1289
1290         * layout.cc (Layout::set_relocatable_section_offsets): Don't
1291         allocate space in file for BSS sections.
1292
1293 2013-04-15  Cary Coutant  <ccoutant@google.com>
1294
1295         * script-sections.cc (Orphan_output_section): Reset address
1296         to zero after each orphaned section for relocatable links.
1297
1298 2013-04-15  Cary Coutant  <ccoutant@google.com>
1299
1300         * symtab.cc (Symbol_table::sized_write_globals): Subtract
1301         section starting address for relocatable link.
1302         * testsuite/Makefile.am (script_test_11): New test.
1303         * testsuite/Makefile.in: Regenerate.
1304         * testsuite/script_test_11.c: New source file.
1305         * testsuite/script_test_11.t: New linker script.
1306
1307 2013-04-13  Alan Modra  <amodra@gmail.com>
1308
1309         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
1310         owner when sections are not adjacent and exceed group size.
1311         (Target_powerpc::group_sections): Handle corner case.
1312         (Target_powerpc::Branch_info::make_stub): Handle case where
1313         stub table doesn't exist due to branches in non-exec sections.
1314         (Target_powerpc::Relocate::relocate): Likewise.
1315
1316 2013-04-11  Alan Modra  <amodra@gmail.com>
1317
1318         PR gold/15354
1319         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
1320         .branch_lt to match bfd ld.  Adjust comments throughout file.
1321
1322 2013-04-04  Ian Lance Taylor  <iant@google.com>
1323
1324         GCC PR c++/56840
1325         * object.cc (do_layout_deferred_sections): Handle .eh_frame
1326         sections before checking whether they are included in the link.
1327
1328 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
1329
1330         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
1331         object before calling the plugin claim_file handler.  Pass the elf
1332         object of the archive to the plugin. Delete the elf object if the
1333         plugin claims the file.
1334
1335 2013-03-21  Alan Modra  <amodra@gmail.com>
1336
1337         * layout.cc (Layout::set_segment_offsets): Accept writable .text
1338         segment when omagic.
1339
1340 2013-03-21  Alan Modra  <amodra@gmail.com>
1341
1342         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
1343         comparison warning.
1344         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
1345         uninitialized" warning.
1346
1347 2013-03-20  Alan Modra  <amodra@gmail.com>
1348
1349         * symtab.h (Symbol::clear_version): New function.
1350         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
1351         is_needed by weak references.  Clear version for symbols defined
1352         in as-needed objects that are not needed.
1353
1354 2013-03-15  Alan Modra  <amodra@gmail.com>
1355
1356         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
1357         static and public.  Add report_err param.  Return false for data refs.
1358         (Target_powerpc::rela_dyn_section): New overloaded function.
1359         (Target_powerpc::plt_, iplt_): Elucidate.
1360         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
1361         (Output_data_plt_powerpc::do_write): Don't write .iplt.
1362         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
1363         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
1364         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
1365         push_branch and make_plt_entry for ifunc syms when
1366         reloc_needs_plt_for_ifunc.
1367         (Target_powerpc::Relocate::relocate): Don't use plt entry value
1368         for ifunc unless reloc_needs_plt_for_ifunc.
1369
1370 2013-03-15  Alan Modra  <amodra@gmail.com>
1371
1372         * gc.h (gc_process_relocs): Don't look through function descriptors.
1373         * icf.cc (get_section_contents): Do so here instead.
1374
1375 2013-03-13  Alan Modra  <amodra@gmail.com>
1376
1377         * powerpc.cc (is_branch_reloc): Forward declare.
1378         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
1379         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
1380         false for 64-bit, true for 32-bit non-branch relocs.
1381         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
1382         * testsuite/Makefile.am (icf_test): Use linker map file instead of
1383         nm output.
1384         (icf_safe_test): Generate linker map file as well as nm output.
1385         (icf_safe_so_test): Likewise.
1386         * testsuite/Makefile.in: Regenerate.
1387         * testsuite/icf_test.sh: Parse linker map file to determine
1388         section folding.
1389         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
1390         * testsuite/icf_safe_so_test.sh: Likewise.
1391         (X86_32_or_ARM_specific_safe_fold): Merge into..
1392         (arch_specific_safe_fold): ..this.
1393         (X86_64_specific_safe_fold): Delete unused function.
1394
1395 2013-03-12  Alan Modra  <amodra@gmail.com>
1396
1397         * gc.h (gc_process_relocs): Look through function descriptors
1398         to determine shndx, symvalue and addend used by ICF.  Tidy
1399         variable duplication.
1400
1401 2013-03-11  Alan Modra  <amodra@gmail.com>
1402
1403         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
1404         * layout.cc (Layout_task_runner::run): ..to here.
1405         * symtab.h (struct Symbol_location): Extract from..
1406         (class Symbol_table): ..here.
1407         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
1408         * target.h (class Target): Add function_location and
1409         do_function_location functions.
1410         (class Sized_target): Add do_function_location.
1411         * object.h (class Sized_relobj_file): Move find_shdr..
1412         (class Object): ..to here.
1413         * object.cc: Likewise.  Update to suit.  Instantiate.
1414         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
1415         * powerpc.cc (class Powerpc_dynobj): New.
1416         (Target_powerpc::do_function_location): New function.
1417         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
1418         (Powerpc_dynobj::do_read_symbols): New function.
1419         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
1420
1421 2013-03-08  Ian Lance Taylor  <iant@google.com>
1422
1423         * options.cc (General_options::string_to_object_format): Accept
1424         "default".
1425
1426 2013-03-08  Alan Modra  <amodra@gmail.com>
1427
1428         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
1429         pointer to Post_fde.
1430         (struct Post_fde): Move definition to here..
1431         * ehframe.cc (struct Post_fde): ..from here.
1432         (Cie::write): Don't alloc Post_fde.
1433         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
1434
1435 2013-03-07  Alan Modra  <amodra@gmail.com>
1436
1437         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
1438         relocation referencing .LC0.
1439         * testsuite/discard_locals_test.sh: Remove FIXMEs.
1440
1441 2013-03-07  Alan Modra  <amodra@gmail.com>
1442
1443         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
1444         always_inline.  Add assembly for powerpc to avoid GOT.
1445
1446 2013-03-07  Alan Modra  <amodra@gmail.com>
1447
1448         * testsuite/script_test_10.sh: Don't test .bss section
1449         header number.
1450
1451 2013-03-06  Alan Modra  <amodra@gmail.com>
1452
1453         * powerpc.cc (class Powerpc_relobj): Move some member functions.
1454         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
1455         all callers.  Handle folded sections.
1456         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
1457         to Powerpc_relobj.
1458         (Global_symbol_visitor_opd::operator()): Likewise.
1459
1460 2013-03-04  Alan Modra  <amodra@gmail.com>
1461
1462         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
1463         * testsuite/Makefile.in: Regenerate.
1464
1465 2013-03-01  Cary Coutant  <ccoutant@google.com>
1466
1467         Add dwp support for v2 DWARF package file format.
1468         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1469         tu_length parameter.  Adjust all callers.
1470         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1471         * dwp.cc: Include dwarf.h.
1472         (Section_bounds): New struct type.
1473         (Unit_set): New struct type.
1474         (Dwo_file::Dwo_file): Initialize new data member.
1475         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1476         Combine and rename to...
1477         (Dwo_file::read_unit_index): ...this.
1478         (Dwo_file::sized_read_compunit_index)
1479         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1480         (Dwo_file::sized_read_unit_index): ...this.
1481         (Dwo_file::copy_section): Remove section_name, is_str_offsets
1482         parameters; add section_id parameter.
1483         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1484         (Dwo_file::add_unit_set): ...this.
1485         (Dwo_file::shndx_map_): Remove.
1486         (Dwo_file::sect_offsets_): New data member.
1487         (Dwp_output_file::Dwp_output_file): Initialize new data members.
1488         (Dwp_output_file::add_section): Rename to...
1489         (Dwp_output_file::add_contribution): ...this.
1490         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1491         (Dwp_output_file::add_tu_set): Likewise.
1492         (Dwp_output_file::Contribution): New type.
1493         (Dwp_output_file::Section::contributions): New data member.
1494         (Dwp_output_file::Cu_or_tu_set): Remove.
1495         (Dwp_output_file::Section::Section): New ctor.
1496         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1497         (Dwp_output_file::Dwp_index::Section_table): New type.
1498         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1499         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1500         parameter.
1501         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1502         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1503         (Dwp_output_file::Dwp_index::section_table): New member function.
1504         (Dwp_output_file::Dwp_index::section_table_end): New member function.
1505         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1506         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1507         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1508         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1509         (Dwp_output_file::Dwp_index::section_table_): New data member.
1510         (Dwp_output_file::Dwp_index::section_mask_): New data member.
1511         (Dwp_output_file::add_output_section): New member function.
1512         (Dwp_output_file::write_new_section): New member function.
1513         (Dwp_output_file::write_contributions): New member function.
1514         (Dwp_output_file::section_id_map_): New data member.
1515         (class Dwo_id_info_reader): Remove.
1516         (class Unit_reader): New class.
1517         (get_dwarf_section_name): New function.
1518         (Dwo_file::read_executable): Adjust initializations of class data.
1519         (Dwo_file::read): Add support for v2 package file format.
1520         (Dwo_file::read_unit_index): Likewise.
1521         (Dwo_file::sized_read_unit_index): Likewise.
1522         (Dwo_file::copy_section): Likewise.
1523         (Dwo_file::add_unit_set): Likewise.
1524         (Dwp_output_file::add_output_section): Likewise.
1525         (Dwp_output_file::add_contribution): Likewise.
1526         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1527         for empty slot.
1528         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1529         file format.
1530         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1531         slot.
1532         (Dwp_output_file::initialize): Remove unused function.
1533         (Dwp_output_file::finalize): Add support for v2 package file format.
1534         (Dwp_output_file::write_index): Likewise.
1535         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1536         function prototype.
1537
1538 2013-03-01  Cary Coutant  <ccoutant@google.com>
1539
1540         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
1541         function into class definition in header file.
1542         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
1543         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
1544         New function.
1545         (Dwarf_info_reader::check_buffer): Move here from .cc file.
1546
1547 2013-02-28  Alan Modra  <amodra@gmail.com>
1548
1549         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
1550         * target.cc (Target::do_plt_fde_location): New function.
1551         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
1552         accessor function, and constructor param.
1553         (struct Post_fde, Post_fdes): Declare.
1554         (Cie::write): Add post_fdes param.
1555         * ehframe.cc (Fde::write): Use plt_fde_location.
1556         (struct Post_fde): Define.
1557         (Cie::write): Stash FDEs added post merge mapping.
1558         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
1559         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
1560         (Eh_frame::do_sized_write): Arrange to write post map FDES after
1561         other FDEs.
1562         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
1563         (Target_powerpc::has_glink): New function.
1564         (Target_powerpc::do_relax): Add eh_frame info for stubs.
1565         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
1566         glink_eh_frame_fde_32, default_fde): New data.
1567         (Stub_table::eh_frame_added_): New var.
1568         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
1569         Make const.
1570         (Stub_table::add_eh_frame): New function.
1571         (Output_data_glink::add_eh_frame): New function.
1572         (Target_powerpc::make_glink_section): Call add_eh_frame.
1573
1574 2013-02-15  Ian Lance Taylor  <iant@google.com>
1575
1576         * options.h (DEFINE_uint64_alias): Define.
1577         (class General_options): Add -Ttext-segment as an alias for
1578         -Ttext.
1579
1580 2013-02-15  Alan Modra  <amodra@gmail.com>
1581
1582         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
1583         (Stub_table::do_write): ..here, two places.
1584         (Stub_table::plt_call_size): Use it here too.
1585
1586 2013-02-11  Ian Lance Taylor  <iant@google.com>
1587
1588         * descriptors.cc (Descriptors::close_all): New function.
1589         * descriptors.h (class Descriptors): Declare close_all.
1590         (close_all_descriptors): New inline function.
1591         * plugin.cc: Include "descriptors.h".
1592         (Plugin_manager::cleanup): Call close_all_descriptors.
1593
1594 2013-02-06  Alan Modra  <amodra@gmail.com>
1595
1596         * README: Update coding style link.
1597
1598 2013-01-28  Cary Coutant  <ccoutant@google.com>
1599
1600         * dwp.cc (File_list): New typedef.
1601         (Dwo_name_info_reader): New class.
1602         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
1603         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
1604         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
1605         (Dwo_file::read_executable): New function.
1606         (Dwo_file::read): Move common setup code to ...
1607         (Dwo_file::make_object): ... here.
1608         (dwp_options): Add --exec/-e.
1609         (usage): Likewise.
1610         (main): Likewise.
1611
1612 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
1613
1614         * layout.cc (Layout::layout): Check for option text_reorder.
1615         (Layout::make_output_section): Ditto.
1616         * options.h (text_reorder): New option.
1617         * output.cc (Input_section_sort_compare): Remove special ordering
1618         of section names.
1619         (Output_section::
1620          Input_section_sort_section_name_special_ordering_compare::
1621          operator()): New function.
1622         (Output_section::sort_attached_input_sections): Use new sort function
1623         for .text.
1624         * output.h (Input_section_sort_section_name_special_ordering_compare):
1625         New struct.
1626         * testsuite/Makefile.am (text_section_grouping): Test option
1627         --no-text-reorder
1628         * testsuite/Makefile.in: Regenerate.
1629         * testsuite/text_section_grouping.sh: Check order of functions without
1630         default text reordering.
1631
1632 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1633
1634         * options.h (General_options): Change default to true for new_dtags.
1635
1636 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1637
1638         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
1639         when enable_new_dtags is false.  Only add DT_RUNPATH when
1640         enable_new_dtags is true.
1641
1642 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
1643
1644         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
1645         used in declaration and definition consistent.
1646         (Target_powerpc::symval_for_branch): Ditto.
1647
1648 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1649
1650         * testsuite/plugin_final_layout.cc: Fix comment.
1651
1652 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1653
1654         * layout.cc (Layout::layout): Do not do default sorting for
1655         text sections when section ordering is specified.
1656         (make_output_section): Ditto.
1657         * testsuite/plugin_final_layout.cc: Name the function sections
1658         to catch reordering issues.
1659
1660 2013-01-15  Alan Modra  <amodra@gmail.com>
1661
1662         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
1663         plt-thread-safe.
1664
1665 2013-01-15  Alan Modra  <amodra@gmail.com>
1666
1667         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
1668         * testsuite/Makefile.in: Regenerate.
1669
1670 2013-01-14  Alan Modra  <amodra@gmail.com>
1671
1672         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
1673         * testsuite/Makefile.in: Regenerate.
1674
1675 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
1676
1677         PR bfd/14430
1678         Fix mingw gold build with plugins enabled
1679         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
1680         * configure.ac: Export DLOPEN_LIBS and add headers check.
1681         * plugin.cc: Handle non-dlfcn case.
1682         * Makefile.in: Regenerate.
1683         * config.in: Regenerate.
1684         * configure: Regenerate.
1685         * testsuite/Makefile.in: Regenerate.
1686
1687 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
1688
1689         * output.h (sort_attached_input_sections): Change to be public.
1690         * script-sections.cc
1691         (Output_section_definition::set_section_addresses): Sort
1692         attached input sections according to section order before linker
1693         script assigns section addresses.
1694         (Orphan_output_section::set_section_addresses): Sort
1695         attached input sections according to section order before linker
1696         script assigns section addresses.
1697         * Makefile.am (final_layout.sh): Use a simple linker script to
1698         check if section ordering still works.
1699         * Makefile.in: Regenerate.
1700
1701 2013-01-09  Ben Cheng  <bccheng@google.com>
1702
1703         * arm.cc (Target_arm::attributes_accept_div): New function.
1704         (Target_arm::attributes_forbid_div): New function.
1705         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
1706         attribute using the same new functions as what bfd/elf32_arm.c
1707         does.
1708
1709 2013-01-07  Cary Coutant  <ccoutant@google.com>
1710
1711         PR gold/14993
1712         * output.cc (Output_section::add_input_section): For incremental
1713         updates, don't track input sections that are allocated from patch
1714         space.
1715
1716 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1717             Ian Lance Taylor  <iant@google.com>
1718
1719         PR gold/14897
1720         * configure.ac (--enable-ld): Removed.
1721         (install_as_default): Set to yes only for --enable-gold=default
1722         or --disable-ld.
1723         * configure: Regenerated.
1724
1725 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1726
1727         * options.h (General_options): Add -fuse-ld= for GCC linker
1728         option compatibility.
1729
1730 2013-01-04  Cary Coutant  <ccoutant@google.com>
1731
1732         * configure.ac: Fix typo restoring CXXFLAGS.
1733         * configure: Regenerate.
1734
1735 2013-01-04  Cary Coutant  <ccoutant@google.com>
1736
1737         * testsuite/Makefile.am (CXXLINK_S): New macro.
1738         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
1739         * testsuite/Makefile.in: Regenerate.
1740
1741 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
1742
1743         * version.cc (print_version): Update copyright year to 2013.
1744
1745 2012-12-20  Ian Lance Taylor  <iant@google.com>
1746
1747         * layout.cc (Layout::special_ordering_of_input_section): New
1748         function.
1749         (Layout::layout): If input section requires special ordering, must
1750         sort input sections.
1751         (Layout::make_output_section): May sort .text input sections.
1752         (Layout::is_section_name_prefix_grouped): Remove.
1753         * layout.h (class Layout): Declare
1754         special_ordering_of_input_section.  Don't declare
1755         is_section_name_prefix_grouped.
1756         * output.cc (Output_section::add_input_section): Revert last
1757         change.
1758         (Output_section::Input_section_sort::match_file_name): Don't crash
1759         if called on output section data.
1760         (Output_section::Input_section_sort_compare): Sort based on
1761         special ordering.
1762         (Output_section::Input_section_sort_section_order_index_compare):
1763         Revert last patch.
1764         (Output_section::sort_attached_input_sections): Likewise.
1765
1766 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
1767
1768         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
1769         * layout.h (Layout::is_section_name_prefix_grouped): New function.
1770         * output.cc (Output_section::add_input_section): Check if section
1771         name contains special prefix.  Keep input sections to sort such
1772         sections.
1773         (Output_section::Input_section_sort_section_order_index_compare
1774          ::operator()): Group sections according to prefixes.
1775         (Output_section::sort_attached_input_sections): Add condition to
1776         Input_section_entry constructor call.
1777         * testsuite/Makefile.am (text_section_grouping): New test.
1778         * testsuite/Makefile.in: Regenerate.
1779         * testsuite/text_section_grouping.cc: New file.
1780         * testsuite/text_section_grouping.sh: New file.
1781
1782 2012-12-17  Nick Clifton  <nickc@redhat.com>
1783
1784         * Makefile.am: Add copyright notice.
1785         * NEWS: Likewise.
1786         * README: Likewise.
1787         * configure.ac: Likewise.
1788         * ftruncate.c: Likewise.
1789         * Makefile.in: Regenerate.
1790
1791 2012-12-14  Cary Coutant  <ccoutant@google.com>
1792
1793         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
1794         --no-as-needed flag.
1795         (exception_separate_shared_12_test): Likewise.
1796         (incremental_copy_test): Likewise.
1797         * testsuite/Makefile.in: Regenerate.
1798
1799 2012-12-14  Cary Coutant  <ccoutant@google.com>
1800
1801         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
1802         (Dwp_output_file::Dwp_index::enter_set): Add assert.
1803
1804 2012-12-12  Alan Modra  <amodra@gmail.com>
1805
1806         * powerpc.cc (class Track_tls): New.
1807         (class Relocate, class Scan): Inherit Track_tls.
1808         (Target_powerpc::Scan::local, global): Track tls optimization
1809         and avoid creating plt entry for __tls_get_addr if all uses
1810         are optimized away.
1811         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
1812
1813 2012-12-12  Alan Modra  <amodra@gmail.com>
1814
1815         * options.h (General_options): Add --toc-sort/--no-toc-sort.
1816         Replace no_toc_optimize with toc_optimize.
1817         * output.h (Output_section::input_sections): Provide non-const variant.
1818         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
1819         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
1820         accessors.
1821         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
1822         (class Sort_toc_sections): New.
1823         (Target_powerpc::do_finalize_sections): Sort toc sections.
1824         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
1825
1826 2012-12-10  Roland McGrath  <mcgrathr@google.com>
1827
1828         * testsuite/binary_unittest.cc (read_all): New function.
1829         (Sized_binary_test): Use it instead of ::read.
1830         * fileread.cc (do_read): Don't assume pread always reads the whole
1831         amount in a single call.
1832
1833 2012-12-10  Alan Modra  <amodra@gmail.com>
1834
1835         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
1836         Set EM_PPC64 or EM_PPC here.
1837         (Target_selector_powerpc::do_recognize): Delete.
1838
1839 2012-12-10  Alan Modra  <amodra@gmail.com>
1840
1841         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
1842         stub_table_.
1843         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
1844
1845 2012-12-07  Roland McGrath  <mcgrathr@google.com>
1846
1847         * testsuite/binary_unittest.cc (Sized_binary_test):
1848         Use open_descriptor rather than ::open.
1849
1850 2012-12-07  Alan Modra  <amodra@gmail.com>
1851
1852         * powerpc.cc (Stub_table::do_write): Delete redundant Address
1853         typedef and invalid_address constant.
1854         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
1855         instantiate constants.
1856
1857 2012-12-06  Roland McGrath  <mcgrathr@google.com>
1858
1859         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
1860         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
1861         * aclocal.m4: Regenerate.
1862         * configure: Regenerate.
1863         * Makefile.in: Regenerate.
1864         * testsuite/Makefile.in: Regenerate.
1865
1866 2012-12-07  Alan Modra  <amodra@gmail.com>
1867
1868         * options.h (General_options): Add no_toc_optimize.
1869         * powerpc.cc (ok_lo_toc_insn): New function.
1870         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
1871
1872 2012-12-06  Alan Modra  <amodra@gmail.com>
1873
1874         * options.h (General_options): Add plt_align, plt_static_chain,
1875         plt_thread_safe.  Update stub_group_size help text.
1876         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
1877         for new plt_thread_safe_ var.
1878         (use_plt_offset): Correct comments.
1879         (Target_powerpc::do_relax): Look for thread creation symbols to
1880         determine default plt_thread_safe value.  Clear plt call stubs
1881         as well as branch stubs each iteration.
1882         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
1883         insn constants.
1884         (l, hi, ha, write_insn): Move earlier.
1885         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
1886         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
1887         plt stubs too.
1888         (Stub_table::update_size): Adjust.
1889         (Stub_table::prev_size, set_prev_size): Delete.
1890         (Stub_table::stub_align): Let --plt-align affect result.
1891         (Stub_table::plt_call_size): Calculate sizes for various stubs.
1892         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
1893         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
1894         (Stub_table::do_write): Support more stub variants.
1895
1896 2012-12-04  Alan Modra  <amodra@gmail.com>
1897
1898         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
1899         (Target_powerpc::do_define_standard_symbols): New function.
1900
1901 2012-12-03  Alan Modra  <amodra@gmail.com>
1902
1903         * output.h: Formatting, whitespace.
1904
1905 2012-12-03  Alan Modra  <amodra@gmail.com>
1906
1907         * layout.h (Layout::get_executable_sections): Declare.
1908         * layout.cc (Layout::get_executable_sections): New function.
1909         * arm.cc (Target_arm::group_sections): Use it.
1910         (Arm_output_section::group_sections): Delete now redundant test.
1911         * output.cc (Output_reloc::Output_reloc): Add is_relative.
1912         param to handle relative relocs.
1913         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
1914         (Output_data_reloc::add_absolute): Adjust.
1915         (Output_data_reloc::add_relative): New function.
1916         (Output_data::reset_data_size): New function.
1917         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
1918         (Output_section::set_addralign): New function.
1919         (Output_section::checkpoint_set_addralign): New function.
1920         (Output_section::clear_section_offsets_need_adjustment): New function.
1921         (Output_section::input_sections): Make public.
1922         * powerpc.cc (class Output_data_brlt_powerpc): New.
1923         (class Stub_table, class Stub_control): New.
1924         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
1925         stub_table_, set_stub_table, stub_table): New vectors and accessor
1926         functions.
1927         (Target_powerpc::do_may_relax, do_relax, push_branch,
1928         new_stub_table, stub_tables, brlt_section, group_sections,
1929         add_branch_lookup_table, find_branch_lookup_table,
1930         write_branch_lookup_table, make_brlt_section): New functions.
1931         (Target_powerpc::struct Sort_sections, class Branch_info): New.
1932         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
1933         branch_info_): New vars.
1934         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
1935         make call stubs here.
1936         (Output_data_glink): Remove all call stub handling from this class.
1937         (Target_powerpc::Scan::local, global): Save interesting branch
1938         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
1939         (Target_powerpc::do_finalize_sections): Only make reg save/restore
1940         functions on final link.
1941         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
1942         Handle long branch destinations too.
1943         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
1944         do_plt_address_for_local): Adjust lookup of plt call stubs.
1945
1946 2012-11-30  Alan Modra  <amodra@gmail.com>
1947
1948         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
1949         relocs against protected symbols when building 32-bit shared libs.
1950
1951 2012-11-30  Alan Modra  <amodra@gmail.com>
1952
1953         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
1954         param.  Call got_section() to make .got.  Update all callers
1955         and their callers and so on.
1956
1957 2012-11-30  Alan Modra  <amodra@gmail.com>
1958
1959         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
1960         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
1961         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
1962         value if it already exists.
1963
1964 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
1965
1966         PR gold/14858
1967         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
1968
1969 2012-11-14  Roland McGrath  <mcgrathr@google.com>
1970
1971         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
1972         than bfc instruction for data sandboxing.
1973
1974 2012-11-08  Alan Modra  <amodra@gmail.com>
1975
1976         * po/POTFILES.in: Regenerate.
1977
1978 2012-11-05  Alan Modra  <amodra@gmail.com>
1979
1980         * configure.ac: Apply 2012-09-10 change to config.in here.
1981         * configure: Regenerate.
1982
1983 2012-11-05  Alan Modra  <amodra@gmail.com>
1984
1985         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
1986         (struct Opd_ent): Use "Address" rather than "Offset".
1987         (Output_data_got_powerpc::got_base_offset): Return Valtype.
1988         (Target_powerpc::got_section): Make public.
1989         (Target_powerpc::scan_relocs): Move code setting symbols..
1990         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
1991         Create _SDA_BASE_ only when referenced.
1992
1993 2012-11-02  Roland McGrath  <mcgrathr@google.com>
1994
1995         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
1996         from last change.
1997
1998 2012-11-01  Roland McGrath  <mcgrathr@google.com>
1999
2000         * target.h (Sized_target::relocate_relocs): Use Elf_Off
2001         for offset_in_output_section parameter.
2002         (Sized_target::relocate_special_relocatable): Likewise.
2003         * arm.cc (Target_arm::relocate_relocs): Likewise.
2004         (Target_arm::relocate_special_relocatable): Likewise.
2005         * i386.cc (Target_i386::relocate_relocs): Likewise.
2006         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
2007         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
2008         * target-reloc.h (relocate_relocs): Likewise.
2009         * testsuite/testfile.cc (Target_test): Likewise.
2010         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
2011         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
2012
2013         * system.h: Move inclusion of <clocale> to after <libintl.h> in
2014         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
2015
2016         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
2017         parameter, which is unused in the [!F_SETFD] case.
2018
2019         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
2020         SYMNDX to off_t before comparing it to this->data_size().
2021         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
2022         * incremental.cc (Output_section_incremental_inputs::do_write):
2023         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
2024
2025         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
2026
2027 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
2028
2029         * gold.cc (Target_arm::do_adjust_elf_header): Add the
2030         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
2031         in EABI_VER5.
2032
2033 2012-10-29  Cary Coutant  <ccoutant@google.com>
2034
2035         * dwp.cc (usage): Add file and exit status parameters;
2036         add --help and --version options.
2037         (print_version): New function.
2038         (main): Add --help and --version options.
2039
2040 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2041
2042         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
2043         final_layout_sequence.txt.
2044         * testsuite/Makefile.in: Regenerated.
2045
2046 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2047
2048         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
2049         COMPILE generated by automake.
2050         (LINK1): Likewise.
2051         (CXXCOMPILE1): Likewise.
2052         (CXXLINK1): Likewise.
2053         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
2054         (LINK): Likewise.
2055         (CXXCOMPILE): Likewise.
2056         (CXXLINK): Likewise.
2057         * testsuite/Makefile.in: Regenerated.
2058
2059 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2060
2061         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
2062         on bad fwrite return.
2063
2064 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2065
2066         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
2067         on val.
2068
2069 2012-10-23  Cary Coutant  <ccoutant@google.com>
2070
2071         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
2072         * testsuite/Makefile.in: Regenerate.
2073         * testsuite/dwp_test.h: New source file.
2074         * testsuite/dwp_test_1.cc: New source file.
2075         * testsuite/dwp_test_1.s: New source file.
2076         * testsuite/dwp_test_1.sh: New source file.
2077         * testsuite/dwp_test_1b.cc: New source file.
2078         * testsuite/dwp_test_1b.s: New source file.
2079         * testsuite/dwp_test_2.cc: New source file.
2080         * testsuite/dwp_test_2.s: New source file.
2081         * testsuite/dwp_test_2.sh: New source file.
2082         * testsuite/dwp_test_main.cc: New source file.
2083         * testsuite/dwp_test_main.s: New source file.
2084
2085 2012-10-23  Cary Coutant  <ccoutant@google.com>
2086
2087         * dwp.h: New header file.
2088         * dwp.cc: New source file.
2089         * gold.h: Move shared declarations to system.h.
2090         * system.h: New header file.
2091         * Makefile.am: Add dwp.
2092         * Makefile.in: Regenerate.
2093
2094 2012-10-23  Cary Coutant  <ccoutant@google.com>
2095
2096         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
2097         Dwarf_info_reader::read_from_pointer.
2098         (Dwarf_pubnames_table::read_header): Likewise.
2099         (Dwarf_pubnames_table::next_name): Likewise.
2100         (Dwarf_die::read_attributes): Likewise.
2101         (Dwarf_die::skip_attributes): Likewise.
2102         (Dwarf_info_reader::read_from_pointer): New function template.
2103         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
2104         (Dwarf_pubnames_table): Likewise.
2105         (Dwarf_info_reader::read_from_pointer): New function template.
2106         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
2107         Dwarf_pubnames_table ctor.
2108
2109 2012-10-23  Cary Coutant  <ccoutant@google.com>
2110
2111         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
2112         abbrev_shndx.
2113         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
2114         abbrev_shndx_.
2115         (Dwarf_info_reader::set_abbrev_shndx): New method.
2116         (Dwarf_info_reader::abbrev_shndx_): New data member.
2117
2118 2012-10-23  Cary Coutant  <ccoutant@google.com>
2119
2120         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
2121         from object, not parameters.
2122         (Dwarf_info_reader::parse): Likewise.
2123         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
2124         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
2125         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
2126         methods.
2127
2128 2012-10-23  Cary Coutant  <ccoutant@google.com>
2129
2130         * fileread.cc (Input_file::Input_file): New constructor.
2131         * fileread.h (class Input_file): Add new constructor.
2132
2133 2012-10-18  Alan Modra  <amodra@gmail.com>
2134
2135         PR gold/14727
2136         * object.cc (Relobj::is_section_name_included): Also match
2137         .sdata personality section.
2138
2139 2012-10-18  Alan Modra  <amodra@gmail.com>
2140
2141         * target-reloc.h (class Default_comdat_behavior): New, package up..
2142         (get_comdat_behaviour): ..this.
2143         (relocate_section): Add Relocate_comdat_behavior template arg,
2144         adjust code to suit.
2145         * arm.cc (Target_arm::relocate_section): Adjust to suit.
2146         (Target_arm::scan_reloc_section): Likewise.
2147         * i386.cc (Target_i386::relocate_section): Likewise.
2148         * sparc.cc (Target_sparc::relocate_section): Likewise.
2149         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
2150         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
2151         * powerpc.cc (class Relocate_comdat_behavior): New.
2152         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
2153         gold::relocate_section with new template arg.
2154
2155 2012-10-18  Alan Modra  <amodra@gmail.com>
2156
2157         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
2158         dynamic relocs for GOT_TPREL got entries, without symbol if
2159         resolving locally.
2160         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
2161         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
2162         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
2163
2164 2012-10-17  Alan Modra  <amodra@gmail.com>
2165
2166         PR gold/14726
2167         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
2168
2169 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
2170
2171         * layout.cc (Layout::include_section): Keep sections marked
2172         SHF_EXCLUDE when doing relocatable links.
2173
2174 2012-10-16  Alan Modra  <amodra@gmail.com>
2175
2176         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
2177         (Target_powerpc::do_finalize_sections): Call it.
2178         (Output_data_save_res): New class and supporting functions.
2179         (Target_powerpc::symval_for_branch): Only look up .opd entry for
2180         normal symbols defined in object files.
2181
2182 2012-10-12  Alan Modra  <amodra@gmail.com>
2183
2184         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
2185         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
2186         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
2187         section if scan_opd_relocs not yet called.
2188         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
2189
2190 2012-10-12  Alan Modra  <amodra@gmail.com>
2191
2192         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2193         add_local_ifunc_entry): Revert last change.
2194         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
2195
2196 2012-10-05  Alan Modra  <amodra@gmail.com>
2197
2198         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
2199         do_plt_address_for_global): New functions.
2200         (Output_data_got_powerpc::do_write): Don't segfault when linking
2201         statically.
2202         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2203         add_local_ifunc_entry): Return true on adding entry..
2204         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
2205         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
2206         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
2207         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
2208         set up symbols here.
2209         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
2210         syms here.  Do so even when no .iplt.  Don't segfault when linking
2211         statically.
2212         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
2213         new variants without reloc param.
2214         (Glink_sym_ent::Glink_sym_ent): Likewise.
2215         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
2216         reloc when refs will resolve to plt call stub.
2217         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
2218         R_PPC_PLTREL24 to resolve locally.
2219         (Target_powerpc::Scan::global): Correct ifunc handling.
2220         (Target_powerpc::Relocate::relocate): Correct local sym glink
2221         lookup.  Don't destroy "value" when we have a plt call stub,
2222         and when checking plt call validity.
2223         (Target_powerpc::do_dynsym_value): Simplify.
2224
2225 2012-10-05  Alan Modra  <amodra@gmail.com>
2226
2227         * i386.cc (Output_data_plt_i386::address_for_global,
2228         address_for_local): Add plt offset to returned value.  Adjust uses.
2229         * sparc.cc (Output_data_plt_sparc::address_for_global,
2230         address_for_local): Likewise.
2231         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
2232         address_for_local): Likewise.
2233         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
2234         address_for_local): Likewise.
2235         * target.h (Target::plt_address_for_global, plt_address_for_local):
2236         Update comment.
2237         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
2238         (Output_data_got::Got_entry::write): Nor here.
2239         * output.h: Comment fix.
2240
2241 2012-10-02  Jiong Wang  <jiwang@tilera.com>
2242
2243         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
2244         global_offset_table_ value for larget got.
2245         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
2246
2247 2012-09-29  Alan Modra  <amodra@gmail.com>
2248
2249         * powerpc.cc (Target_powerpc::iplt_): New output section.
2250         (Target_powerpc::iplt_section, make_iplt_section,
2251         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
2252         (Target_powerpc::make_plt_entry): Handle ifunc syms.
2253         Target_powerpc::plt_entry_count): Count iplt entries too.
2254         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
2255         reloc section in constructor.  New params.
2256         (Target_powerpc::make_plt_section): Create reloc section here instead.
2257         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
2258         functions.
2259         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
2260         (Output_data_glink::add_entry, find_entry): New functions to
2261         deal with local syms.
2262         (Glink_sym_ent): Add support for local syms.
2263         (Output_data_glink::do_write): Handle ifunc plt entries.
2264         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2265         (Target_powerpc::Scan::local, global): Handle ifunc syms.
2266         (Target_powerpc::Relocate::relocate): Likewise.
2267         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
2268
2269 2012-09-25  Alan Modra  <amodra@gmail.com>
2270
2271         * object.h (Sized_relobj_file::adjust_local_symbol,
2272         do_adjust_local_symbol): New functions.
2273         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
2274         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
2275         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
2276         and irregular opd entry spacing.
2277         (Powerpc_relobj::do_read_relocs): Add opd size checks.
2278         (Global_symbol_visitor_opd): New functor.
2279         (Target_powerpc::do_finalize_sections): Omit global symbols defined
2280         on deleted opd entries.
2281
2282 2012-09-15  Jiong Wang  <jiwang@tilera.com>
2283
2284         * tilegx.cc: New file.
2285         * Makefile.am (TARGETSOURCES): Add tilegx.cc
2286         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
2287         * configure.tgt: Add entries for tilegx*.
2288         * configure.ac: Likewise.
2289         * Makefile.in: Rebuild.
2290         * configure: Likewise.
2291         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
2292         tilegx.
2293
2294 2012-09-13  Alan Modra  <amodra@gmail.com>
2295
2296         * target-reloc.h (scan_relocs): Call scan.local for relocs
2297         against symbols in discarded sections.  Pass is_discarded
2298         param.
2299         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
2300         Add is_discarded param.
2301         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
2302         is_discarded to flag opd entry as discarded.  Don't emit dyn
2303         relocs on such entries.
2304         (Target_powerpc::Scan::global): Similarly detect and handle
2305         such opd entries.
2306         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
2307         opd_ent_.  Update all uses.
2308         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
2309         (Target_powerpc::relocate_section): Zero out discarded opd
2310         entry relocs.
2311
2312 2012-09-12  Ian Lance Taylor  <iant@google.com>
2313
2314         PR gold/14570
2315         * output.cc: Rename Output_data_got template parameter from size
2316         to got_size for all functions.  Compile all variants of
2317         Output_data_got.
2318         (Output_data_got::Got_entry::write): Correct use of size for
2319         symbol value.  Use local_is_tls rather than casting to
2320         Sized_relobj_file.
2321         * object.h (class Object): Add local_is_tls and do_local_is_tls.
2322         (class Sized_relobj_file): Add do_local_is_tls.
2323         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
2324
2325 2012-09-11  Alan Modra  <amodra@gmail.com>
2326
2327         PR gold/14566
2328         * layout.cc (Layout::set_segment_offsets): When using
2329         common-page-size alignment, ensure we are on a new max-page-size
2330         page.
2331         * output.cc (Output_segment::set_section_addresses): Use
2332         abi_pagesize, not common_pagesize for relro boundary.
2333         (Output_segment::set_offset): Likewise.
2334
2335 2012-09-11  Alan Modra  <amodra@gmail.com>
2336
2337         * output.h (Output_data_got::add_global_tls, add_local_tls,
2338         add_local_tls_pair): New functions.
2339         (Output_data_got::add_local_pair_with_rel): Remove second
2340         reloc param.  Expand comment.
2341         (Output_data_got::Got_entry): Rename use_plt_offset_ to
2342         use_plt_or_tls_offset_, similarly for constructor param.
2343         (Output_data_got::Got_entry::write): Add got_index param.
2344         * output.cc (Output_data_got::add_global_tls, add_local_tls,
2345         add_local_tls_pair): New functions.
2346         (Output_data_got::Got_entry::write): Handle tls symbols
2347         with use_plt_or_tls_offset_ set specially.
2348         (Output_data_got::add_local_pair_with_rel): Only one reloc.
2349         (Output_data_got::do_write): Replace iterator with index, pass
2350         index to entry write function.
2351         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
2352         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
2353         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
2354         call.
2355         * i386.cc (Target_i386::Scan::local): Likewise.
2356         * sparc.cc (Target_sparc::Scan::local): Likewise.
2357         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
2358         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
2359         do_tls_offset_for_global): New functions.
2360         (Target_powerpc::Scan::local): Correct TLS relocations and got
2361         entry values.
2362         (Target_powerpc::Scan::global): Don't emit unnecessary
2363         dynamic relocations on TLS GOT entries.
2364
2365 2012-09-10  Matthias Klose  <doko@ubuntu.com>
2366
2367         * config.in: Disable sanity check for kfreebsd.
2368
2369 2012-09-10  Sterling Augustine  <saugustine@google.com>
2370
2371         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
2372         (Gdb_index::pubtypes_read): New parameter.
2373         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
2374         to calls.
2375         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
2376         pubtypes_object_.
2377
2378 2012-09-09  Alan Modra  <amodra@gmail.com>
2379
2380         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
2381         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
2382         * gc.h (gc_process_relocs): Call target gc_add_reference.
2383         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
2384         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
2385         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
2386         unnecessary cast.
2387         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
2388         to cater for when we don't need code offset.  Update use.
2389         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
2390         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
2391         set_opd_valid): New functions.
2392         (Target_powerpc::do_gc_add_reference): New function.
2393         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
2394         stashed refs.
2395         (Target_powerpc::do_gc_mark_symbol): New function.
2396
2397 2012-09-06  Cary Coutant  <ccoutant@google.com>
2398
2399         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
2400         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
2401         (Dwarf_die::skip_attributes): Likewise.
2402         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
2403         * testsuite/gdb_index_test.cc (inline_func_1): New function.
2404         (main): Call it.
2405         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
2406
2407 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
2408
2409         * testsuite/script_test_3.t: Add .got.plt output section
2410         statement.
2411         * testsuite/script_test_4.t: Likewise.
2412
2413 2012-09-05  Alan Modra  <amodra@gmail.com>
2414
2415         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
2416         update all uses and lose "enum" when using type.
2417
2418 2012-09-05  Alan Modra  <amodra@gmail.com>
2419
2420         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
2421         * configure: Regenerate.
2422         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
2423         (plugin_final_layout.stdout): Likewise.
2424         (memory_test): Set page sizes to 0x1000.
2425         * testsuite/Makefile.in: Regenerate.
2426         * testsuite/discard_locals_test.sh: Add FIXME comment.
2427         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
2428         * testsuite/pr14265.t: Add .got output section statement.
2429         * testsuite/script_test_2.t: Likewise.
2430         * testsuite/script_test_3.t: Likewise.
2431         * testsuite/script_test_4.t: Likewise.
2432         * testsuite/script_test_5.t: Likewise.
2433         * testsuite/script_test_6.t: Likewise.
2434         * testsuite/script_test_7.t: Likewise.
2435         * testsuite/script_test_9.t: Likewise.
2436
2437 2012-09-05  Alan Modra  <amodra@gmail.com>
2438
2439         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
2440         (Powerpc_relocate_functions::Status): New typedef.
2441         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2442         (Target_powerpc::Scan::local): Handle REL64.
2443         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
2444         for REL32 and REL64.
2445         (Target_powerpc::symval_for_branch): New function, extracted from..
2446         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
2447         checks.  Report overflow errors.
2448
2449 2012-09-05  Alan Modra  <amodra@gmail.com>
2450
2451         * object.h (Sized_relobj_file::emit_relocs): Delete.
2452         (Sized_relobj_file::emit_relocs_reltype): Delete.
2453         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
2454         relocate_relocs for --emit-relocs.
2455         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
2456         * output.h: Update comment.
2457         (Output_segment::first_section): New function.
2458         (Output_segment::first_section_load_address): Use first_section.
2459         * output.cc (Output_segment::first_section): New function extracted..
2460         (Output_segment::first_section_load_address): ..from here.  Delete.
2461         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
2462         * target.h (Sized_target::relocate_for_relocatable): Likewise.
2463         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
2464         adjust call to target.h function.
2465         * i386.cc (Target_i386): Likewise.
2466         * sparc.cc (Target_sparc): Likewise.
2467         * x86_64.cc (Target_x86_64): Likewise.
2468         * powerpc.cc (Target_powerpc): Likewise.
2469         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
2470         first tls section has section symbol for optimised local dynamic
2471         output relocs.
2472         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
2473         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
2474         optimised tls code.
2475         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
2476         Rename to relocate_relocs.  Update error message.
2477
2478 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
2479
2480         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
2481         --just-symbols.
2482
2483 2012-08-31  Alan Modra  <amodra@gmail.com>
2484
2485         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
2486         (Powerpc_relobj::toc_base_offset): New stub function.
2487         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
2488         got_mod_index_offset to tlsld_got_offset.  Update all refs.
2489         (Target_powerpc::Relocate::enum skip_tls): New.
2490         (Target_powerpc::call_tls_get_addr_): New var.
2491         (Target_powerpc::is_branch_reloc): Move to file scope.
2492         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
2493         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
2494         New functions.
2495         (Target_powerpc::enum Got_type): Delete old values, add new ones.
2496         (powerpc_info): Correct common_pagesize for ppc64.
2497         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
2498         (Powerpc_relocate_functions): Add overflow check enums and functions.
2499         Add non-shift version of rela, rela_ua.  Delete all rel public
2500         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
2501         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
2502         addr16_ha3, addr14 functions.
2503         (Output_data_got_powerpc::add_constant_pair): New function.
2504         (Output_data_got_powerpc::got_base_offset): Likewise.
2505         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
2506         (instruction constants): Sort, add some more.
2507         (Output_data_glink::do_write): Add and use Address typedef.  Use
2508         object->toc_base_offset() stub for 64-bit.
2509         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
2510         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2511         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
2512         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
2513         Always treat .opd relocs as against locally defined symbol.
2514         Correct condition for RELATIVE relocs.
2515         (Target_powerpc::do_finalize_sections): Test for NULL sections.
2516         (Target_powerpc::Relocate::relocate): Use plt call stub as value
2517         for 32-bit syms with a plt entry.  Correct ppc64 toc base
2518         calculations.  Handle TLS relocs, and more.  Add overflow
2519         checking and adjust for Powerpc_relocate_functions changes.
2520         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
2521         Reinstate --emit-relocs code with FIXME.
2522
2523 2012-08-30  Alan Modra  <amodra@gmail.com>
2524
2525         * layout.cc (Layout::set_segment_offsets): Set p_align to
2526         abi_pagesize, not common_pagesize.
2527         (Layout::relaxation_loop_body): Similarly use abi_pagesize
2528         to determine whether file header can go in segment.
2529
2530 2012-08-30  Alan Modra  <amodra@gmail.com>
2531
2532         * output.h (Output_reloc::Output_reloc <output section>): Add
2533         is_relative param.  Adjust calls.
2534         (Output_reloc::add_output_section_relative): New functions.
2535         * output.cc (Output_reloc::Output_reloc <output section>): Handle
2536         is_relative.
2537         (Output_reloc::symbol_value): Handle SECTION_CODE.
2538
2539 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
2540
2541         * gold.cc (queue_middle_tasks): Call layout again when unique
2542         segments for sections is desired.
2543         * layout.cc (Layout::Layout): Initialize new members.
2544         (Layout::get_output_section_flags): New function.
2545         (Layout::choose_output_section): Call get_output_section_flags.
2546         (Layout::layout): Make output section for mapping to a unique segment.
2547         (Layout::insert_section_segment_map): New function.
2548         (Layout::attach_allocated_section_to_segment): Make unique segment for
2549         output sections marked so.
2550         (Layout::segment_precedes): Check for unique segments when sorting.
2551         * layout.h (Layout::Unique_segment_info): New struct.
2552         (Layout::Section_segment_map): New typedef.
2553         (Layout::insert_section_segment_map): New function.
2554         (Layout::get_output_section_flags): New function.
2555         (Layout::is_unique_segment_for_sections_specified): New function.
2556         (Layout::set_unique_segment_for_sections_specified): New function.
2557         (Layout::unique_segment_for_sections_specified_): New member.
2558         (Layout::section_segment_map_): New member.
2559         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
2560         Rename is_gc_pass_one to is_pass_one.
2561         Rename is_gc_pass_two to is_pass_two.
2562         Rename is_gc_or_icf to is_two_pass.
2563         Check for which pass based on whether symbols data is present.
2564         Make it two pass when unique segments for sections is desired.
2565         * output.cc (Output_section::Output_section): Initialize new
2566         members.
2567         * output.h (Output_section::is_unique_segment): New function.
2568         (Output_section::set_is_unique_segment): New function.
2569         (Output_section::is_unique_segment_): New member.
2570         (Output_section::extra_segment_flags): New function.
2571         (Output_section::set_extra_segment_flags): New function.
2572         (Output_section::extra_segment_flags_): New member.
2573         (Output_section::segment_alignment): New function.
2574         (Output_section::set_segment_alignment): New function.
2575         (Output_section::segment_alignment_): New member.
2576         (Output_segment::Output_segment): Initialize is_unique_segment_.
2577         (Output_segment::is_unique_segment): New function.
2578         (Output_segment::set_is_unique_segment): New function.
2579         (Output_segment::is_unique_segment_): New member.
2580         * plugin.cc (allow_unique_segment_for_sections): New function.
2581         (unique_segment_for_sections): New function.
2582         (Plugin::load): Add new functions to transfer vector.
2583         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
2584         * Makefile.in: Regenerate.
2585         * testsuite/plugin_final_layout.sh: Check if unique segment
2586         functionality works.
2587         * testsuite/plugin_section_order.c (onload): Check if new interfaces
2588         are available.
2589         (allow_unique_segment_for_sections): New global.
2590         (unique_segment_for_sections): New global.
2591         (claim_file_hook): Call allow_unique_segment_for_sections.
2592         (all_symbols_read_hook): Call unique_segment_for_sections.
2593
2594 2012-08-22  Cary Coutant  <ccoutant@google.com>
2595
2596         * layout.cc (Layout::include_section): Don't assert on GROUP
2597         sections with --emit-relocs.
2598
2599 2012-08-21  Cary Coutant  <ccoutant@google.com>
2600
2601         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
2602         if --export-dynamic-symbol names an undef symbol.
2603
2604 2012-08-18  Alan Modra  <amodra@gmail.com>
2605
2606         * powerpc.cc: Formatting and white space.
2607         (Powerpc_relobj): Rename got2_section_ to special_.
2608         Add opd_ent_shndx_ and opd_ent_off_ vectors.
2609         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
2610         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
2611         (Target_powerpc): Add Address typedef and invalid_address.  Use
2612         throughout.
2613         (Target_powerpc::is_branch_reloc): New function.
2614         (Powerpc_relocate_functions): Add Address typedef, use throughout.
2615         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
2616         for dst_mask, value and addend.
2617         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
2618         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
2619         (Output_data_glink::do_write): Correct toc base.  Don't try to use
2620         uint16_t for 24-bit offset.  Use get_output_section_offset and
2621         check return.
2622         (Target_powerpc::Scan::local): Handle more relocs.
2623         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
2624         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
2625         Plug in toc restoring insn after plt calls.  Translate branches
2626         to function descriptor symbols to corresponding entry point.
2627         (Target_powerpc::relocate_for_relocatable): Check return from
2628         get_output_section_offset.
2629         * symtab.h: Comment typo.
2630
2631 2012-08-14  Ian Lance Taylor  <iant@google.com>
2632
2633         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
2634         unsupported_relocal_local to call unsupported_reloc_global.
2635
2636 2012-08-14  Nick Clifton  <nickc@redhat.com>
2637
2638         PR ld/14265
2639         * script-sections.cc (Sections_element::output_section_name): Add
2640         keep return parameter.
2641         (Output_section_element::match_name): Add keep return parameter.
2642         Return the value of the keep_ member.
2643         * script-sections.h (class Output_section): Update
2644         output_section_name prototype.
2645         * layout.cc (Layout::keep_input_section): New public member
2646         function.
2647         (Layout::choose_output_section): Pass keep parameter to
2648         output_section_name.
2649         * layout.h (class Layout): Add keep_input_section.
2650         * object.cc (Sized_relobj_file::do_layout): Check for kept input
2651         sections.
2652         * testsuite/Makefile.am: Add a test.
2653         * testsuite/Makefile.in: Regenerate.
2654         * testsuite/pr14265.c: Source file for the test.
2655         * testsuite/pr14265.t: Linker script for the test.
2656         * testsuite/pr14265.sh: Shell script for the test.
2657
2658 2012-08-14  Alan Modra  <amodra@gmail.com>
2659
2660         * target.h (Target::output_section_name): New function.
2661         (Target::do_output_section_name): New function.
2662         * layout.cc (Layout::choose_output_section): Call the above.
2663         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
2664
2665 2012-08-14  Alan Modra  <amodra@gmail.com>
2666
2667         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
2668         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
2669         for replace_constant call.
2670         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
2671         (Output_data_glink::do_print_to_mapfile): New function.
2672         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
2673         (Target_powerpc::Relocate::relocate): Likewise.
2674
2675 2012-08-14  Alan Modra  <amodra@gmail.com>
2676
2677         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
2678         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
2679         (Output_data_glink::add_entry,find_entry): Remove shndx param.
2680         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
2681         all references to shndx_.  Handle special case for R_PPC_PLTREL24
2682         here.
2683         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
2684         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
2685         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
2686         here.
2687         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
2688         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
2689
2690 2012-08-12  Alan Modra  <amodra@gmail.com>
2691
2692         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
2693         (glink insn constants): Use uint32_t.
2694         (Output_data_glink::add_entry): Use insert, not [] operator.
2695
2696 2012-08-11  Alan Modra  <amodra@gmail.com>
2697
2698         * object.h (Sized_relobj_file::find_shdr): New function.
2699         (Sized_relobj_file::find_special_sections): New function.
2700         * object.cc (Sized_relobj_file::find_shdr): New function.
2701         (Sized_relobj_file::find_eh_frame): Use find_shdr.
2702         (Sized_relobj_file::find_special_sections): New function, split out..
2703         (Sized_relobj_file::do_read_symbols): ..from here.
2704         * output.h (Output_data_got::replace_constant): New function.
2705         (Output_data_got::num_entries): New function.
2706         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
2707         (Output_data_got::got_offset): Protected rather than private.
2708         (Output_data_got::replace_got_entry): New function.
2709         * output.cc (Output_data_got::replace_got_entry): New function.
2710         * powerpc.cc (class Powerpc_relobj): New.
2711         (class Powerpc_relocate_functions): Delete all psymval variants or
2712         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
2713         Implement _ha functions using corresponding _hi function.
2714         (Powerpc_relobj::find_special_sections): New function.
2715         (Target_powerpc::do_make_elf_object): New function.
2716         (class Output_data_got_powerpc): New.
2717         (class Output_data_glink): New.
2718         (class Powerpc_scan_relocatable_reloc): New.
2719         Many more changes througout file.
2720
2721 2012-08-09  Nick Clifton  <nickc@redhat.com>
2722
2723         * po/vi.po: Updated Vietnamese translation.
2724
2725 2012-08-07  Ian Lance Taylor  <iant@google.com>
2726
2727         * layout.cc (Layout::add_target_dynamic_tags): If
2728         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
2729         plt_rel.
2730
2731 2012-07-30  Nick Clifton  <nickc@redhat.com>
2732
2733         * po/gold.pot: Updated template.
2734         * po/es.po: Updated Spanish translation.
2735
2736 2012-07-18  Cary Coutant  <ccoutant@google.com>
2737
2738         PR gold/14344
2739         * configure.ac: Add check for -gpubnames support.
2740         * configure: Regenerate.
2741         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
2742         support; force -gno-pubnames.
2743         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
2744         support.
2745         (gdb_index_test_4): New test.
2746         * testsuite/Makefile.in: Regenerate.
2747         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
2748         * testsuite/gdb_index_test_2.sh: Likewise.
2749         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
2750         * testsuite/gdb_index_test_4.sh: New script.
2751         * testsuite/gdb_index_test_comm.sh: New script with common code;
2752         don't look for space after colon.
2753
2754 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
2755
2756         * gold.cc (queue_middle_tasks): Update function order only after
2757         deferred objects due to plugins are processed.
2758
2759 2012-07-11  Ian Lance Taylor  <iant@google.com>
2760
2761         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
2762         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
2763         (Target_arm::scan_reloc_for_stub): Likewise.
2764         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
2765         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
2766         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
2767         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
2768         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
2769
2770 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
2771             Ian Lance Taylor  <iant@google.com>
2772
2773         PR gold/14309
2774         * configure.ac: Test whether std::tr1::hash<off_t> works.
2775         * gold.h: Add a specialization for std::tr1::hash<off_t> if
2776         needed.
2777         * output.h (class Output_fill): Add virtual destructor.
2778         * configure, config.in: Rebuild.
2779
2780 2012-06-22  Roland McGrath  <mcgrathr@google.com>
2781
2782         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
2783
2784 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
2785
2786         * plugin.cc (Plugin::load): Handle position independent executables.
2787
2788 2012-06-06  Cary Coutant  <ccoutant@google.com>
2789
2790         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
2791         add .debug_macro.
2792         (lines_only_debug_sections): Likewise.
2793         (gdb_fast_lookup_sections): New static array.
2794         (is_gdb_debug_section): Rename formal parameter.
2795         (is_lines_only_debug_section): Likewise.
2796         (is_gdb_fast_lookup_section): New function.
2797         (Layout::include_section): Check for ".zdebug_" prefix; pass
2798         section name suffix to is_gdb_debug_section, et al.; check for
2799         fast-lookup sections when building .gdb_index.
2800         * options.h (--strip-debug-gdb): Update GDB version number.
2801
2802 2012-06-06  Cary Coutant  <ccoutant@google.com>
2803
2804         * configure.ac: Add check for fallocate.
2805         * configure: Regenerate.
2806         * config.in: Regenerate.
2807
2808         * options.h (class General_options): Add --mmap-output-file and
2809         --posix-fallocate options.
2810         * output.cc: (posix_fallocate): Remove; replace with...
2811         (gold_fallocate): New function.
2812         (Output_file::map_no_anonymous): Call gold_fallocate.
2813         (Output_file::map): Check --mmap-output-file option.
2814
2815 2012-06-05  Jing Yu  <jingyu@google.com>
2816
2817         * gold.h (textdomain): Add do {} to empty while(0).
2818         (bindtextdomain): Likewise.
2819
2820 2012-06-04  Cary Coutant  <ccoutant@google.com>
2821
2822         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
2823         has_dynsym_index.
2824
2825 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
2826
2827         * symtab.cc (Symbol_table::define_special_symbol):
2828         Initialize *poldsym to prevent uninitialized variable errors.
2829
2830 2012-05-23  Cary Coutant  <ccoutant@google.com>
2831
2832         * layout.cc (Layout::section_name_mapping): Add rules to handle
2833         exact match on .data.rel.ro.local or .data.rel.ro.
2834         (Layout::output_section_name): Check for exact matches.
2835
2836 2012-05-23  Cary Coutant  <ccoutant@google.com>
2837
2838         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
2839         more carefully.
2840
2841 2012-05-22  Cary Coutant  <ccoutant@google.com>
2842
2843         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
2844         object before exporting symbol.
2845
2846 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
2847
2848         * testsuite/tls_test.cc: Include "config.h" first.
2849         * testsuite/tls_test_c.c: Likewise.
2850
2851 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
2852             Nick Clifton  <nickc@redhat.com>
2853
2854         PR 14072
2855         * configure.in: Add check that sysdep.h has been included before
2856         any system header files.
2857         * configure: Regenerate.
2858         * config.in: Regenerate.
2859
2860 2012-05-14  Cary Coutant  <ccoutant@google.com>
2861
2862         * layout.cc (Layout::make_output_section): Mark .tdata section
2863         as RELRO.
2864         * testsuite/relro_test.cc: Add a TLS variable.
2865
2866 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
2867
2868         PR gold/14091
2869         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
2870         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
2871         R_X86_64_64.
2872
2873 2012-05-08  Cary Coutant  <ccoutant@google.com>
2874
2875         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
2876         (lines_only_debug_sections): Likewise.
2877
2878 2012-05-02  Roland McGrath  <mcgrathr@google.com>
2879
2880         * nacl.cc: New file.
2881         * nacl.h: New file.
2882         * Makefile.am (CCFILES, HFILES): Add them.
2883         * Makefile.in: Regenerate.
2884         * i386.cc (Output_data_plt_i386_nacl): New class.
2885         (Output_data_plt_i386_nacl_exec): New class.
2886         (Output_data_plt_i386_nacl_dyn): New class.
2887         (Target_i386_nacl): New class.
2888         (Target_selector_i386_nacl): New class.
2889         (target_selector_i386): Use it instead of Target_selector_i386.
2890         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
2891         (Target_x86_64_nacl): New class.
2892         (Target_selector_x86_64_nacl): New class.
2893         (target_selector_x86_64, target_selector_x32): Use it instead of
2894         Target_selector_x86_64.
2895         * arm.cc (Output_data_plt_arm_nacl): New class.
2896         (Target_arm_nacl): New class.
2897         (Target_selector_arm_nacl): New class.
2898         (target_selector_arm, target_selector_armbe): Use it instead of
2899         Target_selector_arm.
2900
2901         * target-select.cc (select_target): Take new Input_file* and off_t
2902         arguments, pass them on to recognize method of selector.
2903         * object.cc (make_elf_sized_object): Update caller.
2904         * parameters.cc (parameters_force_valid_target): Likewise.
2905         * incremental.cc (make_sized_incremental_binary): Likewise.
2906         * target-select.h: Update decl.
2907         (Target_selector::recognize): Take new Input_file* argument,
2908         pass it on to do_recognize.
2909         (Target_selector::do_recognize): Take new Input_file* argument.
2910         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
2911         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
2912         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
2913         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
2914
2915         * target.h (Target::Target_info): New members isolate_execinstr
2916         and rosegment_gap.
2917         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
2918         * arm.cc (Target_arm::arm_info): Update initializer.
2919         * i386.cc (Target_i386::i386_info): Likewise.
2920         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
2921         * sparc.cc (Target_sparc::sparc_info): Likewise.
2922         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2923         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2924         * layout.cc (Layout::attach_allocated_section_to_segment):
2925         Take new const Target* argument.  If target->isolate_execinstr(), act
2926         like --rosegment.
2927         (Layout::find_first_load_seg): Take new const Target* argument;
2928         if target->isolate_execinstr(), reject PF_X segments.
2929         (Layout::relaxation_loop_body): Update caller.
2930         (Layout::set_segment_offsets): If target->isolate_execinstr(),
2931         reset file offset to zero when we hit LOAD_SEG, and then do a second
2932         loop over the segments before LOAD_SEG to reassign offsets after
2933         addresses have been determined.  Handle target->rosegment_gap().
2934         (Layout::attach_section_to_segment): Take new const Target* argument;
2935         pass it to attach_allocated_section_to_segment.
2936         (Layout::make_output_section): Update caller.
2937         (Layout::attach_sections_to_segments): Take new const Target* argument;
2938         pass it to attach_section_to_segment.
2939         * gold.cc (queue_middle_tasks): Update caller.
2940         * layout.h (Layout): Update method decls with new arguments.
2941
2942         * arm.cc (Target_arm::Target_arm): Take optional argument for the
2943         Target_info pointer to use.
2944         (Target_arm::do_make_data_plt): New virtual method.
2945         (Target_arm::make_data_plt): New method that calls it.
2946         (Target_arm::make_plt_entry): Use it.
2947         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
2948         for the section alignment.
2949         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
2950         method.
2951         (Output_data_plt_arm::first_plt_entry_offset): Call it.
2952         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
2953         method.
2954         (Output_data_plt_arm::get_plt_entry_size): Call it.
2955         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
2956         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
2957         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
2958         method.
2959         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
2960         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
2961         method instead of sizeof(plt_entry).
2962         (Output_data_plt_arm::add_entry): Likewise.
2963         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
2964         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
2965         than static method.
2966         (Target_arm::plt_entry_size): Likewise.
2967         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
2968         Move to ...
2969         (Output_data_plt_arm_standard): ... here, new class.
2970         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
2971         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
2972         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
2973
2974         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2975         Take additional argument for the PLT entry size.
2976         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
2977         Use get_plt_entry_size method rather than plt_entry_size variable.
2978         (Output_data_plt_x86_64::reserve_slot): Likewise.
2979         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
2980         (Output_data_plt_x86_64::add_entry): Likewise.
2981         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
2982         (Output_data_plt_x86_64::address_for_global): Likewise.
2983         (Output_data_plt_x86_64::address_for_local): Likewise.
2984         (Output_data_plt_x86_64::set_final_data_size): Likewise.
2985         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
2986         Make method non-static.
2987         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
2988         method.
2989         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
2990         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
2991         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
2992         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
2993         virtual method.
2994         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
2995         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
2996         virtual method.
2997         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
2998         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
2999         virtual method.
3000         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
3001         (Output_data_plt_x86_64::plt_entry_size)
3002         (Output_data_plt_x86_64::first_plt_entry)
3003         (Output_data_plt_x86_64::plt_entry)
3004         (Output_data_plt_x86_64::tlsdesc_plt_entry)
3005         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
3006         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
3007         (Output_data_plt_x86_64_standard): ... here, new class.
3008         (Target_x86_64::Target_x86_64): Take optional argument for the
3009         Target_info pointer to use.
3010         (Target_x86_64::do_make_data_plt): New virtual method.
3011         (Target_x86_64::make_data_plt): New method to call it.
3012         (Target_x86_64::init_got_plt_for_update): Use that.
3013         Call this->plt_->add_eh_frame method here.
3014         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
3015         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
3016         rather than static method.
3017         (Target_x86_64::plt_entry_size): Likewise.
3018         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
3019         rather than plt_entry_size variable.  Move guts of PLT filling to...
3020         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
3021         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
3022         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
3023
3024         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
3025         additional argument for the section alignment.
3026         Don't do add_eh_frame_for_plt here.
3027         (Output_data_plt_i386::first_plt_entry_offset): Make the method
3028         non-static.  Use get_plt_entry_size method rather than plt_entry_size
3029         variable.
3030         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
3031         method.
3032         (Output_data_plt_i386::get_plt_entry_size): Call it.
3033         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
3034         (Output_data_plt_i386::add_eh_frame): New method to call it.
3035         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
3036         method.
3037         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
3038         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
3039         method.
3040         (Output_data_plt_i386::fill_plt_entry): New method to call it.
3041         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
3042         method instead of plt_entry_size.
3043         (Output_data_plt_i386::plt_entry_size)
3044         (Output_data_plt_i386::plt_eh_frame_fde_size)
3045         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
3046         (Output_data_plt_i386_standard): ... here, new class.
3047         (Output_data_plt_i386_exec): New class.
3048         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
3049         (Output_data_plt_i386_exec::first_plt_entry): ... here.
3050         (Output_data_plt_i386::exec_plt_entry): Move to ...
3051         (Output_data_plt_i386_exec::plt_entry): ... here.
3052         (Output_data_plt_i386_dyn): New class.
3053         (Output_data_plt_i386::first_plt_entry): Move to ...
3054         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
3055         (Output_data_plt_i386::dyn_plt_entry): Move to ...
3056         (Output_data_plt_i386_dyn::plt_entry): ... here.
3057         (Target_i386::Target_i386): Take optional argument for the Target_info
3058         pointer to use.
3059         (Target_i386::do_make_data_plt): New virtual method.
3060         (Target_i386::make_data_plt): New method to call it.
3061         (Target_i386::make_plt_section): Use that.
3062         Call this->plt_->add_eh_frame method here.
3063         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
3064         rather than plt_entry_size variable.
3065         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
3066         (Output_data_plt_i386::address_for_local): Likewise.
3067         (Output_data_plt_i386::do_write): Likewise.
3068         Move guts of PLT filling to...
3069         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
3070         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
3071         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
3072         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
3073
3074 2012-05-01  Cary Coutant  <ccoutant@google.com>
3075
3076         * dwarf_reader.cc (Dwarf_die::read_attributes)
3077         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
3078         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
3079         * reduced_debug_output.cc
3080         (Output_reduced_debug_info_section::get_die_end): Remove
3081         DW_FORM_GNU_ref_index.  Add default case.
3082
3083 2012-04-26  Mark Wielaard  <mjw@redhat.com>
3084
3085         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
3086         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
3087         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
3088         DW_AT_high_pc as offset from DW_AT_low_pc.
3089
3090         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
3091         * testsuite/Makefile.in: Regenerate.
3092         * testsuite/gdb_index_test_3.c: New test source file.
3093         * testsuite/gdb_index_test_3.sh: New test source file.
3094
3095 2012-04-25  Ian Lance Taylor  <iant@google.com>
3096
3097         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
3098         pointer.
3099         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
3100         as a class, not a struct.
3101         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
3102         (Target_arm::apply_cortex_a8_workaround): Likewise.
3103         * gc.h: Declare Reloc_types as a struct, not a class.
3104         * object.h: Declare Symbols_data as a struct.
3105         * reloc.h: Declare Read_relocs_data as a struct.
3106         * target.h: Declare Relocate_info as a struct.
3107
3108 2012-04-24  David S. Miller  <davem@davemloft.net>
3109
3110         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
3111         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
3112         and R_SPARC_WPLT30.
3113
3114 2012-04-24  Cary Coutant  <ccoutant@google.com>
3115
3116         * incremental-dump.cc (find_input_containing_global): Replace
3117         magic number with symbolic constant.
3118         (dump_incremental_inputs): Update version number.
3119         * incremental.cc (Output_section_incremental_inputs): Update version
3120         number; import symbolic constants from Incremental_inputs_reader.
3121         (Incremental_inputs::create_data_sections): Align relocations
3122         section correctly for 64-bit targets.
3123         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
3124         constants; add padding.
3125         (Output_section_incremental_inputs::write_header): Add assert for
3126         header_size.
3127         (Output_section_incremental_inputs::write_input_files): Add assert
3128         for input_entry_size.
3129         (Output_section_incremental_inputs::write_info_blocks): Add padding;
3130         add assert for object_info_size, input_section_entry_size,
3131         global_sym_entry_size.
3132         * incremental.h (Incremental_inputs_reader): Add symbolic constants
3133         for data structure sizes; use them.
3134         (Incremental_input_entry_reader): Import symbolic constants from
3135         Incremental_inputs_reader; use them.
3136
3137 2012-04-23  David S. Miller  <davem@davemloft.net>
3138
3139         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
3140         and elf_flags_set_.
3141         (Target_sparc::Target_sparc): Initialize new fields.
3142         (Target_sparc::do_make_elf_object): New function.
3143         (Target_sparc::do_adjust_elf_header): New function.
3144
3145 2012-04-23  Cary Coutant  <ccoutant@google.com>
3146
3147         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
3148         CU range table of gdb index.
3149
3150 2012-04-20  David S. Miller  <davem@davemloft.net>
3151
3152         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
3153         instead of false.
3154
3155 2012-04-16  David S. Miller  <davem@davemloft.net>
3156
3157         * sparc.cc (Target_sparc::got_address): New function.
3158         (Sparc_relocate_functions::gdop_hix22): New function.
3159         (Sparc_relocate_functions::gdop_lox10): New function.
3160         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
3161         relocs.
3162         (Target_sparc::Scan::local): Likewise if the global symbol is not
3163         preemptible and is not IFUNC.
3164         (Target_sparc::Relocate::relocate): Perform GOTDATA code
3165         transformations for local and non-preemptible non-IFUNC global
3166         symbols.
3167
3168         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
3169         writing out 64-bit part of ranges.
3170
3171         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
3172         -fpic and -fpie respectively.
3173         * Makefile.in: Regenerate.
3174
3175         * sparc.cc (class Target_sparc): Add rela_ifunc_.
3176         (Target_sparc::Target_sparc): Initialize new field.
3177         (Target_sparc::do_plt_section_for_global): New function.
3178         (Target_sparc::do_plt_section_for_local): New function.
3179         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
3180         (Target_sparc::make_plt_section): New function, broken out of
3181         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
3182         (Target_sparc::make_plt_entry): Call make_plt_section.
3183         (Target_sparc::make_local_ifunc_plt_entry): New function.
3184         (Target_sparc::rela_ifunc_section): New function.
3185         (Target_sparc::plt_section): Remove const.
3186         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
3187         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
3188         and ifunc_count_ fields.
3189         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
3190         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
3191         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
3192         (Output_data_plt_sparc::rela_ifunc): New function.
3193         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
3194         (Output_data_plt_sparc::has_ifunc_section): New function.
3195         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
3196         (Output_data_plt_sparc::address_for_global): New function.
3197         (Output_data_plt_sparc::address_for_local): New function.
3198         (Output_data_plt_sparc::plt_index_to_offset): New function.
3199         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
3200         and entry_count.
3201         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
3202         entry_count.
3203         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
3204         R_SPARC_JMP_IREL to switch.
3205         (Target_sparc::Scan::check_non_pic): Likewise.
3206         (Target_sparc::Scan::local): Handle IFUNC symbols.
3207         (Target_sparc::Scan::local): Likewise.
3208         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
3209         and plt_address_for_local.
3210         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
3211         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
3212
3213         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
3214         (class Output_data_reloc): Adjust calls to Output_reloc_type.
3215         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
3216         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
3217         global relocs too.
3218         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
3219         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
3220         calls.
3221         * sparc.cc (Target_sparc::Scan::global): Likewise.
3222         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3223
3224 2012-04-16  Cary Coutant  <ccoutant@google.com>
3225
3226         * archive.cc (Library_base::should_include_member): Check for
3227         --export-dynamic-symbol.
3228         * options.h (class General_options): Add --export-dynamic-symbol.
3229         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
3230         --export-dynamic-symbol.
3231         (Symbol_table::gc_mark_undef_symbols): Likewise.
3232         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
3233
3234 2012-04-12  David S. Miller  <davem@davemloft.net>
3235
3236         * sparc.cc (Reloc::wdisp10): New relocation method.
3237         (Reloc::h34): Likewise.
3238         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
3239         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
3240         R_SPARC_WDISP10.
3241         (Target_sparc::Scan::local): Likewise.
3242         (Target_sparc::Scan::global): Likewise.
3243         (Target_sparc::Relocate::relocate): Likewise.
3244
3245 2012-04-09  Cary Coutant  <ccoutant@google.com>
3246
3247         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
3248         low_pc == 0.
3249
3250 2012-04-06  Ian Lance Taylor  <iant@google.com>
3251
3252         * timer.cc: #include <unistd.h>.
3253
3254 2012-04-06  Roland McGrath  <mcgrathr@google.com>
3255
3256         * configure.in (AC_CHECK_HEADERS): Add locale.h.
3257         * config.in: Regenerate.
3258         * configure: Regenerate.
3259
3260 2012-04-05  Nick Clifton  <nickc@redhat.com>
3261
3262         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
3263         (AM_LC_MESSAGES): Add.
3264         * aclocal.m4: Regenerate.
3265         * config.in: Regenerate.
3266         * configure: Regenerate.
3267
3268 2012-03-21  Cary Coutant  <ccoutant@google.com>
3269
3270         * Makefile.am: Add gdb-index.cc, gdb-index.h.
3271         * Makefile.in: Regenerate.
3272         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
3273         (Sized_elf_reloc_mapper::symbol_section): New function.
3274         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
3275         (make_elf_reloc_mapper): New function.
3276         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
3277         (Dwarf_abbrev_table::do_read_abbrevs): New function.
3278         (Dwarf_abbrev_table::do_get_abbrev): New function.
3279         (Dwarf_ranges_table::read_ranges_table): New function.
3280         (Dwarf_ranges_table::read_range_list): New function.
3281         (Dwarf_pubnames_table::read_section): New function.
3282         (Dwarf_pubnames_table::read_header): New function.
3283         (Dwarf_pubnames_table::next_name): New function.
3284         (Dwarf_die::Dwarf_die): New function.
3285         (Dwarf_die::read_attributes): New function.
3286         (Dwarf_die::skip_attributes): New function.
3287         (Dwarf_die::set_name): New function.
3288         (Dwarf_die::set_linkage_name): New function.
3289         (Dwarf_die::attribute): New function.
3290         (Dwarf_die::string_attribute): New function.
3291         (Dwarf_die::int_attribute): New function.
3292         (Dwarf_die::uint_attribute): New function.
3293         (Dwarf_die::ref_attribute): New function.
3294         (Dwarf_die::child_offset): New function.
3295         (Dwarf_die::sibling_offset): New function.
3296         (Dwarf_info_reader::check_buffer): New function.
3297         (Dwarf_info_reader::parse): New function.
3298         (Dwarf_info_reader::do_parse): New function.
3299         (Dwarf_info_reader::do_read_string_table): New function.
3300         (Dwarf_info_reader::lookup_reloc): New function.
3301         (Dwarf_info_reader::get_string): New function.
3302         (Dwarf_info_reader::visit_compilation_unit): New function.
3303         (Dwarf_info_reader::visit_type_unit): New function.
3304         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
3305         Sized_elf_reloc_mapper.
3306         (Sized_dwarf_line_info::symbol_section): Remove function.
3307         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
3308         (Sized_dwarf_line_info::read_line_mappings): Remove object
3309         parameter, adjust callers.
3310         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
3311         * dwarf_reader.h: Include <sys/types.h>.
3312         (class Track_relocs): Remove forward declaration.
3313         (class Elf_reloc_mapper): New class.
3314         (class Sized_elf_reloc_mapper): New class.
3315         (class Dwarf_abbrev_table): New class.
3316         (class Dwarf_range_list): New class.
3317         (class Dwarf_ranges_table): New class.
3318         (class Dwarf_pubnames_table): New class.
3319         (class Dwarf_die): New class.
3320         (class Dwarf_info_reader): New class.
3321         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
3322         (Sized_dwarf_line_info::symbol_section): Remove member function.
3323         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
3324         base class.
3325         * gdb-index.cc: New source file.
3326         * gdb-index.h: New source file.
3327         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
3328         and .debug_types sections, call Layout::add_to_gdb_index.
3329         (Sized_relobj_incr::do_section_name): Implement.
3330         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
3331         return type; Implement.
3332         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
3333         return type.
3334         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
3335         parameter list and return type.
3336         (Sized_incr_dynobj::do_section_contents): Likewise.
3337         * layout.cc: Include gdb-index.h.
3338         (Layout::Layout): Initialize gdb_index_data_.
3339         (Layout::init_fixed_output_section): Check for .gdb_index section.
3340         (Layout::add_to_gdb_index): New function. Instantiate.
3341         * layout.h: Add forward declaration for class Gdb_index.
3342         (Layout::add_to_gdb_index): New member function.
3343         (Layout::gdb_index_data_): New data member.
3344         * main.cc: Include gdb-index.h.
3345         (main): Print statistics for gdb index.
3346         * object.cc (Object::section_contents): Move code into
3347         do_section_contents.
3348         (need_decompressed_section): Check for sections needed when building
3349         gdb index.
3350         (build_compressed_section_map): Likewise.
3351         (Sized_relobj_file::do_read_symbols): Need local symbols when building
3352         gdb index.
3353         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
3354         sections; call Layout::add_to_gdb_index.
3355         (Sized_relobj_file::do_decompressed_section_contents): Call
3356         do_section_contents directly.
3357         * object.h (Object::do_section_contents): Adjust parameter list and
3358         return type.
3359         (Object::do_decompressed_section_contents): Call do_section_contents
3360         directly.
3361         (Sized_relobj_file::do_section_contents): Adjust parameter list and
3362         return type.
3363         * options.h (class General_options): Add --gdb-index option.
3364         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
3365         list and return type.
3366         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
3367         * reloc.h (Track_relocs::checkpoint): New function.
3368         (Track_relocs::reset): New function.
3369
3370         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
3371         New test cases.
3372         * testsuite/Makefile.in: Regenerate.
3373         * testsuite/gdb_index_test.cc: New test source file.
3374         * testsuite/gdb_index_test_1.sh: New test source file.
3375         * testsuite/gdb_index_test_2.sh: New test source file.
3376
3377 2012-03-19  Doug Kwan  <dougkwan@google.com>
3378
3379         * arm.cc (Target_arm::do_define_standard_symbols): New method.
3380         (Target_arm::do_finalize_sections): Remove code which defines
3381         __exidx_start and __exidx_end.  Make symbol table parameter
3382         anonymous as it is not used.
3383         * gold.cc (queue_middle_tasks): Call target hook to define any
3384         target-specific symbols.
3385         * target.h (Target::define_standard_symbols): New method.
3386         (Target::do_define_standard_symbols): Same.
3387         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
3388         * testsuite/Makefile.in: Regenerate.
3389         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
3390         and __exidx_end.
3391         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
3392         relocations are generated for __exidx_start and __exidx_end.
3393
3394 2012-03-16  Doug Kwan  <dougkwan@google.com>
3395
3396         * testsuite/Makefile.am: Disable test initpri3b.
3397         * testsuite/Makefile.in: Regenerate.
3398
3399 2012-03-15  Doug Kwan  <dougkwan@google.com>
3400
3401         * arm.cc (Target_arm::got_section): Make .got section read-only
3402         if -z now is given.
3403
3404 2012-03-15  Ian Lance Taylor  <iant@google.com>
3405
3406         PR gold/13850
3407         * layout.cc (Layout::make_output_section): Correctly mark
3408         SHT_INIT_ARRAY, et. al., as relro.
3409
3410 2012-03-14  Doug Kwan  <dougkwan@google.com>
3411
3412         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
3413         dynamic relocations for protected symbols in shared objects.
3414
3415 2012-03-13  Ian Lance Taylor  <iant@google.com>
3416
3417         * resolve.cc (Symbol_table::resolve): When merging common symbols,
3418         keep the larger alignment.
3419
3420 2012-03-12  Cary Coutant  <ccoutant@google.com>
3421
3422         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
3423         handling of DW_LNE_define_file.
3424
3425 2012-03-12  Cary Coutant  <ccoutant@google.com>
3426
3427         * reduced_debug_output.cc
3428         (Output_reduced_debug_info_section::get_die_end): Add new FORM
3429         codes to switch.
3430
3431 2012-02-29  Cary Coutant  <ccoutant@google.com>
3432
3433         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
3434
3435 2012-02-29  Cary Coutant  <ccoutant@google.com>
3436
3437         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3438         Call Object::decompressed_section_contents.
3439         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
3440         New dtor.
3441         (Sized_dwarf_line_info::buffer_start_): New data member.
3442         * merge.cc (Output_merge_data::do_add_input_section): Call
3443         Object::decompressed_section_contents.
3444         (Output_merge_string::do_add_input_section): Likewise.
3445         * object.cc (need_decompressed_section): New function.
3446         (build_compressed_section_map): Decompress sections needed later.
3447         (Sized_relobj_file::do_decompressed_section_contents): New function.
3448         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3449         * object.h (Object::decompressed_section_contents): New function.
3450         (Object::discard_decompressed_sections): New function.
3451         (Object::do_decompressed_section_contents): New function.
3452         (Object::do_discard_decompressed_sections): New function.
3453         (Compressed_section_info): New type.
3454         (Compressed_section_map): Include decompressed section contents.
3455         (Sized_relobj_file::do_decompressed_section_contents): New function.
3456         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3457
3458 2012-02-16  Cary Coutant  <ccoutant@google.com>
3459
3460         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
3461         * testsuite/Makefile.in: Regenerate.
3462
3463 2012-02-14  Cary Coutant  <ccoutant@google.com>
3464
3465         * options.cc (General_options::finalize): Disallow -pie and -static.
3466
3467 2012-02-03  Doug Kwan  <dougkwan@google.com>
3468
3469         * arm.cc (Arm_relocate_functions::abs8,
3470         Arm_relocate_functions::abs16): Use
3471         Bits::has_signed_unsigned_overflow32.
3472         (Arm_relocate_functions::thm_abs8): Correct range of
3473         overflow check.
3474         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
3475         in assertions.
3476
3477 2012-02-02  Doug Kwan  <dougkwan@google.com>
3478
3479         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
3480         position independent outputs, not just shared objects.
3481
3482 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
3483
3484         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
3485         * configure: Regenerated.
3486
3487 2012-01-27  Ian Lance Taylor  <iant@google.com>
3488
3489         * reloc.h (Bits): New class with static functions, copied from
3490         namespace utils in arm.cc.
3491         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
3492         instead.
3493
3494 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3495
3496         * incremental.cc (write_info_blocks): Correct relocation offset.
3497
3498 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3499
3500         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
3501         (Relocate::tls_gd_to_le): Likewise.
3502
3503 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3504
3505         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
3506
3507 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3508
3509         * configure.ac: Check if -mcmodel=medium works.
3510         * configure: Regenerated.
3511
3512 2012-01-24  Cary Coutant  <ccoutant@google.com>
3513
3514         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
3515         definition and ...
3516         (read_unsigned_LEB_128_x): ... this new function.
3517         (read_signed_LEB_128): Replaced with inline definition and ...
3518         (read_signed_LEB_128_x): ... this new function.
3519         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
3520         (read_unsigned_LEB_128): Add inline definition.
3521         (read_signed_LEB_128_x): New function.
3522         (read_signed_LEB_128): Add inline definition.
3523         * testsuite/Makefile.am (leb128_unittest): New unit test.
3524         * testsuite/Makefile.in: Regenerate.
3525         * testsuite/leb128_unittest.cc: New unit test.
3526
3527 2012-01-23  Ian Lance Taylor  <iant@google.com>
3528
3529         PR gold/13617
3530         * i386.cc (Target_i386::do_code_fill): When using a jmp
3531         instruction, pad with nop instructions.
3532         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3533
3534 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
3535
3536         * x86_64.cc (gc_process_relocs): Add typename on types used in
3537         template.
3538         (scan_relocs): Likewise.
3539         (relocate_section): Likewise.
3540         (apply_relocation): Likewise.
3541
3542 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
3543
3544         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
3545         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
3546         under x32.
3547
3548 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
3549
3550         * x86_64.cc: Initial support for x32.
3551
3552 2012-01-03  Cary Coutant  <ccoutant@google.com>
3553
3554         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
3555         Use abstract base class for GOT.
3556         * gold/output.h (class Output_data_got_base): New abstract base class.
3557         (class Output_data_got): Derive from new base class, adjust ctors.
3558         (Output_data_got::reserve_slot): Make virtual; rename to
3559         do_reserve_slot; Adjust callers.
3560         * gold/target.h (Sized_target::init_got_plt_for_update): Return
3561         pointer to abstract base class.
3562         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
3563
3564 2011-12-18  Ian Lance Taylor  <iant@google.com>
3565
3566         * object.h (Relobj::local_symbol_value): New function.
3567         (Relobj::local_plt_offset): New function.
3568         (Relobj::local_has_got_offset): New function.
3569         (Relobj::local_got_offset): New function.
3570         (Relobj::set_local_got_offset): New function.
3571         (Relobj::do_local_symbol_value): New pure virtual function.
3572         (Relobj::do_local_plt_offset): Likewise.
3573         (Relobj::do_local_has_got_offset): Likewise.
3574         (Relobj::do_local_got_offset): Likewise.
3575         (Relobj::do_set_local_got_offset): Likewise.
3576         (Sized_relobj::do_local_has_got_offset): Rename from
3577         local_has_got_offset.
3578         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
3579         (Sized_relobj::do_set_local_got_offset): Rename from
3580         set_local_got_offset.
3581         (Sized_relobj_file::do_local_plt_offset): Rename from
3582         local_plt_offset.
3583         (Sized_relobj_file::do_local_symbol_value): New function.
3584         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
3585         local_plt_offset.
3586         * output.cc (Output_data_got::Got_entry::write): Change object to
3587         Relobj.  Use local_symbol_value.
3588         (Output_data_got::add_global_with_rel): Change rel_dyn to
3589         Output_data_reloc_generic*.  Use add_global_generic.
3590         (Output_data_got::add_global_with_rela): Remove.  Change all
3591         callers to use add_global_with_rel.
3592         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
3593         Output_data_reloc_generic*.  Use add_global_generic.
3594         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
3595         callers to use add_global_pair_with_rel.
3596         (Output_data_got::add_local): Change object to Relobj*.
3597         (Output_data_got::add_local_plt): Likewise.
3598         (Output_data_got::add_local_with_rel): Change object to Relobj*,
3599         change rel_dyn to Output_data_reloc_generic*.  Use
3600         add_local_generic.
3601         (Output_data_got::add_local_with_rela): Remove.  Change all
3602         callers to use all_local_with_rel.
3603         (Output_data_got::add_local_pair_with_rel): Change object to
3604         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
3605         add_output_section_generic.
3606         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
3607         callers to use add_local_pair_with_rel.
3608         (Output_data_got::reserve_local): Change object to Relobj*.
3609         * output.h: (class Output_data_reloc_generic): Add pure virtual
3610         declarations for add_global_generic, add_local_generic,
3611         add_output_section_generic.
3612         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
3613         functions for Output_data_reloc_generic.  Update declarations for
3614         changes listed in output.cc.
3615         (class Output_data_got): Change template parameter to got_size.
3616         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
3617         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
3618         function.
3619         (Sized_relobj_incr::do_local_plt_offset): New function.
3620         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
3621         add_global_generic.
3622
3623 2011-12-17  Cary Coutant  <ccoutant@google.com>
3624
3625         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
3626         * resolve.cc (Symbol_table::resolve): Likewise.
3627         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
3628         arrays.
3629         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3630
3631 2011-12-16  Ian Lance Taylor  <iant@google.com>
3632
3633         * output.h (Output_data_reloc_generic::add): Only call
3634         add_dynamic_reloc if this is a dynamic reloc section.
3635
3636 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
3637
3638         PR gold/13505
3639         * target-reloc.h (apply_relocation): Replace <64, false> with
3640         <size, big_endian>.
3641
3642 2011-11-25  Nick Clifton  <nickc@redhat.com>
3643
3644         * po/it.po: New Italian translation.
3645
3646 2011-11-17  Sterling Augustine  <saugustine@google.com>
3647
3648         * script.cc (script_include_directive): Implement.
3649         (read_script_file): New local variables name and search_path. Update
3650         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
3651         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
3652         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
3653
3654 2011-11-11  Sterling Augustine  <saugustine@google.com>
3655
3656         * yyscript.y (section_cmd): Add support for INCLUDE directive.
3657         (file_or_sections_cmd): Likewise.
3658
3659 2011-11-11  Doug Kwan  <dougkwan@google.com>
3660
3661         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
3662         if --just-symbols is given.
3663
3664 2011-11-10  Doug Kwan  <dougkwan@google.com>
3665
3666         PR gold/13362
3667         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
3668         when processing data relocs.
3669         * reloc.h (Relocate_functions::rel_unaligned): New method.
3670         (Relocate_functions::pcrel_unaligned): Ditto.
3671         (Relocate_functions::rel32_unaligned): Ditto.
3672         (Relocate_functions::pcrel32_unaligned): Ditto.
3673
3674 2011-11-09  Doug Kwan  <dougkwan@google.com>
3675
3676         PR gold/13362
3677         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
3678         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
3679         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
3680         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3681         (Relocate_functions::rel_unaligned): New.
3682         (Relocate_functions::rel32_unaligned): New.
3683         * target-reloc.h (relocate_for_relocatable): Add code to handle
3684         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3685         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
3686         arm_unaligned_reloc_r): New targets.
3687         * testsuite/Makefile.in: Regenerate.
3688         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
3689         linking.
3690
3691 2011-11-02  Ian Lance Taylor  <iant@google.com>
3692
3693         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
3694         NATIVE_LINKER.
3695         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
3696         * options.cc (General_options::finalize): Use library search path
3697         from configure script if specified.  If not native and no sysroot,
3698         only search TOOLLIBDIR.
3699         * options.h (Search_directory::Search_directory): Change name to
3700         const std::string&.
3701         (General_options::add_to_library_path_with_sysroot): Change arg to
3702         const std::string&.
3703         * configure, Makefile.in, config.in: Rebuild.
3704
3705 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3706
3707         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
3708         we are working around the ARM1176 Erratum.
3709         * options.h (General_options::fix_arm1176): Add option.
3710         * testsuite/Makefile.am: Add testcases, and keep current ones
3711         working.
3712         * testsuite/Makefile.in: Regenerate.
3713         * testsuite/arm_fix_1176.s: New file.
3714         * testsuite/arm_fix_1176.sh: Likewise.
3715
3716 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3717
3718         * arm.cc (Target_arm::Target_arm): Remove initialisation of
3719         may_use_blx_.
3720         (Target_arm::may_use_blx): Remove method.
3721         (Target_arm::set_may_use_blx): Likewise.
3722         (Target_arm::may_use_v4t_interworking): New method.
3723         (Target_arm::may_use_v5t_interworking): Likewise.
3724         (Target_arm::may_use_blx_): Remove member variable.
3725         (Arm_relocate_functions::arm_branch_common): Check for v5T
3726         interworking.
3727         (Arm_relocate_functions::thumb_branch_common): Likewise.
3728         (Reloc_stub::stub_type_for_reloc): Likewise.
3729         (Target_arm::do_finalize_sections): Correct interworking checks.
3730         * testsuite/Makefile.am: Add new tests.
3731         * testsuite/Makefile.in: Regenerate.
3732         * testsuite/arm_farcall_arm_arm.s: New test.
3733         * testsuite/arm_farcall_arm_arm.sh: Likewise.
3734         * testsuite/arm_farcall_arm_thumb.s: Likewise.
3735         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
3736         * testsuite/arm_farcall_thumb_arm.s: Likewise.
3737         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
3738         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
3739         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
3740
3741 2011-10-31  Cary Coutant  <ccoutant@google.com>
3742
3743         PR gold/13023
3744         * expression.cc (Expression::eval_with_dot): Add
3745         is_section_dot_assignment parameter.
3746         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
3747         absolute and assigning to dot within a section.
3748         * script-sections.cc
3749         (Output_section_element_assignment::set_section_addresses): Pass
3750         dot_section to set_if_absolute.
3751         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
3752         as is_section_dot_assignment flag to eval_with_dot.
3753         (Output_section_element_dot_assignment::set_section_addresses):
3754         Likewise.
3755         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
3756         parameter.  Also set value if relative to dot_section; set the
3757         symbol's output_section.
3758         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
3759         parameter.  Adjust all callers.
3760         (Expression::eval_maybe_dot): Likewise.
3761         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
3762         Adjust all callers.
3763         * testsuite/script_test_2.t: Test assignment of an absolute value
3764         to dot within an output section element.
3765
3766 2011-10-31  Cary Coutant  <ccoutant@google.com>
3767
3768         * options.h (class General_options): Add --[no-]gnu-unique options.
3769         * symtab.cc (Symbol_table::sized_write_globals): Convert
3770         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
3771
3772 2011-10-31  Cary Coutant  <ccoutant@google.com>
3773
3774         PR gold/13359
3775         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
3776         unnecessary assertion.
3777         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
3778
3779 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
3780
3781         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3782         gc_mark_symbol.
3783         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3784         gc_mark_symbol.
3785         Change to just keep the section associated with symbol.
3786         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
3787         they are externally visible and --export-dynamic is turned on.
3788         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
3789
3790 2011-10-19  Ian Lance Taylor  <iant@google.com>
3791
3792         PR gold/13163
3793         * script-sections.cc
3794         (Output_section_element_dot_assignment::needs_output_section): New
3795         function.
3796
3797 2011-10-19  Ian Lance Taylor  <iant@google.com>
3798
3799         PR gold/13204
3800         * layout.cc (Layout::segment_precedes): Don't assert failure if a
3801         --section-start option was seen.
3802         * options.h (General_options::any_section_start): New function.
3803
3804 2011-10-18  David S. Miller  <davem@davemloft.net>
3805
3806         PR binutils/13301
3807         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
3808         member to track relocation locations that have moved during TLS
3809         reloc optimizations.
3810         (Target_sparc::Relocate::Relocate): Initialize to NULL.
3811         (Target_sparc::Relocate::relocate): Adjust view down by 4
3812         bytes if it matches reloc_adjust_addr_.
3813         (Target_sparc::Relocate::relocate_tls): Always move the
3814         __tls_get_addr call delay slot instruction forward 4 bytes when
3815         performing relaxation.
3816
3817 2011-10-18  Cary Coutant  <ccoutant@google.com>
3818
3819         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
3820         (Output_file::map_no_anonymous): Check for non-zero
3821         return code from posix_fallocate.
3822
3823 2011-10-17  Cary Coutant  <ccoutant@google.com>
3824
3825         PR gold/13245
3826         * plugin.cc (is_visible_from_outside): Check for symbols
3827         referenced from dynamic objects.
3828         * resolve.cc (Symbol_table::resolve): Don't count references
3829         from dynamic objects as references from real ELF files.
3830         * testsuite/plugin_test_2.sh: Adjust expected result.
3831
3832 2011-10-17  Cary Coutant  <ccoutant@google.com>
3833
3834         * gold.cc: Include timer.h.
3835         (queue_middle_tasks): Stamp time.
3836         (queue_final_tasks): Likewise.
3837         * main.cc (main): Store timer in parameters.  Print timers
3838         for each pass.
3839         * parameters.cc (Parameters::Parameters): Initialize timer_.
3840         (Parameters::set_timer): New function.
3841         (set_parameters_timer): New function.
3842         * parameters.h (Parameters::set_timer): New function.
3843         (Parameters::timer): New function.
3844         (Parameters::timer_): New data member.
3845         (set_parameters_timer): New function.
3846         * timer.cc (Timer::stamp): New function.
3847         (Timer::get_pass_time): New function.
3848         * timer.h (Timer::stamp): New function.
3849         (Timer::get_pass_time): New function.
3850         (Timer::pass_times_): New data member.
3851
3852 2011-10-17  Cary Coutant  <ccoutant@google.com>
3853
3854         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
3855         task for members of lib groups.
3856
3857 2011-10-17  Cary Coutant  <ccoutant@google.com>
3858
3859         PR gold/13288
3860         * fileread.cc (File_read::find_view): Add assert.
3861         (File_read::make_view): Move bounds check (replace with assert)...
3862         (File_read::find_or_make_view): ... to here.
3863
3864 2011-10-12  Cary Coutant  <ccoutant@google.com>
3865
3866         * output.cc (Output_file::open_base_file): Handle case where
3867         ::read returns less than requested size.
3868
3869 2011-10-10  Cary Coutant  <ccoutant@google.com>
3870
3871         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
3872         Initialize defined_count_.
3873         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
3874         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
3875         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
3876         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
3877         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
3878         * incremental.h (Sized_relobj_incr::defined_count_): New data
3879         member.
3880         (Sized_incr_dynobj::defined_count_): New data member.
3881         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
3882         Return zeroes instead of internal error.
3883
3884 2011-10-10  Cary Coutant  <ccoutant@google.com>
3885
3886         PR gold/13249
3887         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
3888         (Output_reloc::symbol_value): Return PLT offset if flag is set.
3889         * output.h (class Output_reloc): Add use_plt_offset flag.
3890         (Output_reloc::type_): Adjust size of bit field.
3891         (Output_reloc::use_plt_offset_): New bit field.
3892         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
3893         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
3894         flag.  Adjust all callers.
3895         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
3896         creating RELATIVE relocations.
3897
3898 2011-10-10  Nick Clifton  <nickc@redhat.com>
3899
3900         * po/es.po: Updated Spanish translation.
3901         * po/fi.po: Updated Finnish translation.
3902
3903 2011-10-03   Diego Novillo  <dnovillo@google.com>
3904
3905         * options.cc (parse_uint): Fix dereference of RETVAL.
3906
3907 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
3908
3909         * layout.h (section_order_map_): New member.
3910         (get_section_order_map): New member function.
3911         * output.cc (Output_section::add_input_section): Check for patterns
3912         only when --section-ordering-file is specified.
3913         * gold.cc (queue_middle_tasks): Delay updating order of sections till
3914         output_sections have been formed.
3915         * layout.cc (Layout_Layout): Initialize section_order_map_.
3916         * plugin.cc (update_section_order): Store order in order_map. Do not
3917         update the order.
3918         * testsuite/Makefile.am: Add test case for plugin_final_layout.
3919         * testsuite/Makefile.in: Regenerate.
3920         * testsuite/plugin_section_order.c: New file.
3921         * testsuite/plugin_final_layout.cc: New file.
3922         * testsuite/plugin_final_layout.sh: New file.
3923
3924 2011-09-29  Cary Coutant  <ccoutant@google.com>
3925
3926         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3927         Check for NULL.
3928         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
3929         symbols during incremental update.
3930         (Symbol_table::add_from_dynobj): Likewise.
3931
3932 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3933             Ian Lance Taylor  <iant@google.com>
3934
3935         * symtab.cc (Symbol_table::define_special_symbol): Always
3936         canonicalize version string.
3937
3938 2011-09-26  Cary Coutant  <ccoutant@google.com>
3939
3940         * gold.cc (queue_initial_tasks): Move option checks ...
3941         * options.cc (General_options::finalize): ... to here. Disable
3942         some options; make others fatal.
3943
3944 2011-09-26  Cary Coutant  <ccoutant@google.com>
3945
3946         gcc PR lto/47247
3947         * plugin.cc (get_symbols_v2): New function.
3948         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
3949         (is_referenced_from_outside): New function.
3950         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
3951         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
3952         (get_symbols): Pass version parameter.
3953         (get_symbols_v2): New function.
3954         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
3955         parameter.
3956         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
3957         (onload): Add LDPT_GET_SYMBOLS_V2.
3958         (all_symbols_read_hook): Use get_symbols_v2; check for
3959         LDPR_PREVAILING_DEF_IRONLY_EXP.
3960         * testsuite/plugin_test_3.sh: Update expected results.
3961
3962 2011-09-23  Simon Baldwin  <simonb@google.com>
3963
3964         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
3965         configuration options.
3966         * configure: Regenerate.
3967         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
3968         * Makefile.in: Regenerate.
3969         * testsuite/Makefile.in: Regenerate.
3970
3971 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
3972
3973         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
3974
3975 2011-09-19  Cary Coutant  <ccoutant@google.com>
3976
3977         * incremental.cc (can_incremental_update): Fix typo in comment.
3978         * incremental.h (can_incremental_update): Likewise.
3979
3980 2011-09-18  Cary Coutant  <ccoutant@google.com>
3981
3982         * incremental.cc (can_incremental_update): New function.
3983         * incremental.h (can_incremental_update): New function.
3984         * layout.cc (Layout::init_fixed_output_section): Call it.
3985         (Layout::make_output_section): Don't allow patch space in .eh_frame.
3986         * object.cc (Sized_relobj_file::do_layout): Call
3987         can_incremental_update.
3988
3989 2011-09-13  Cary Coutant  <ccoutant@google.com>
3990
3991         * configure.ac: Check for glibc support for gnu_indirect_function
3992         support with static linking, setting automake conditional
3993         IFUNC_STATIC.
3994         * Makefile.in: Regenerate.
3995         * configure: Regenerate.
3996
3997         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
3998         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
3999         for IFUNC_STATIC.
4000         * testsuite/Makefile.in: Regenerate.
4001
4002 2011-09-13  Cary Coutant  <ccoutant@google.com>
4003
4004         * incremental.cc (Sized_relobj_incr::do_layout): Call
4005         report_comdat_group for kept comdat sections.
4006         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
4007         * testsuite/Makefile.in: Regenerate.
4008         * testsuite/incr_comdat_test_1.cc: New source file.
4009         * testsuite/incr_comdat_test_2_v1.cc: New source file.
4010         * testsuite/incr_comdat_test_2_v2.cc: New source file.
4011         * testsuite/incr_comdat_test_2_v3.cc: New source file.
4012
4013 2011-09-13  Ian Lance Taylor  <iant@google.com>
4014
4015         * object.cc (Sized_relobj_file::do_layout): Remove unused local
4016         variable external_symbols_offset.
4017
4018 2011-09-12  Ian Lance Taylor  <iant@google.com>
4019
4020         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
4021         triggered if object has no symbols.
4022
4023 2011-09-09  David S. Miller  <davem@davemloft.net>
4024
4025         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
4026         (Output_fill_debug_line::do_write): Likewise.
4027
4028 2011-08-29  Cary Coutant  <ccoutant@google.com>
4029
4030         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
4031         casts to match formatting specs.
4032         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
4033
4034 2011-08-26  Cary Coutant  <ccoutant@google.com>
4035
4036         * layout.cc (Free_list::allocate): Provide guarantee of minimum
4037         remaining hole size when allocating.
4038         (Layout::make_output_section): Set fill methods for debug sections.
4039         * layout.h (Free_list::Free_list_node): Move from private to
4040         public.
4041         (Free_list::set_min_hole_size): New function.
4042         (Free_list::begin, Free_list::end): New functions.
4043         (Free_list::min_hole_): New data member.
4044         * output.cc: Include dwarf.h.
4045         (Output_fill_debug_info::do_minimum_hole_size): New function.
4046         (Output_fill_debug_info::do_write): New function.
4047         (Output_fill_debug_line::do_minimum_hole_size): New function.
4048         (Output_fill_debug_line::do_write): New function.
4049         (Output_section::Output_section): Initialize new data member.
4050         (Output_section::set_final_data_size): Ensure patch space is larger
4051         than minimum hole size.
4052         (Output_section::do_write): Fill holes in debug sections.
4053         * output.h (Output_fill): New class.
4054         (Output_fill_debug_info): New class.
4055         (Output_fill_debug_line): New class.
4056         (Output_section::set_free_space_fill): New function.
4057         (Output_section::free_space_fill_): New data member.
4058         * testsuite/Makefile.am (incremental_test_3): Add
4059         --incremental-patch option.
4060         (incremental_test_4): Likewise.
4061         (incremental_test_5): Likewise.
4062         (incremental_test_6): Likewise.
4063         (incremental_copy_test): Likewise.
4064         (incremental_common_test_1): Likewise.
4065         * testsuite/Makefile.in: Regenerate.
4066
4067 2011-08-26  Nick Clifton  <nickc@redhat.com>
4068
4069         * po/es.po: Updated Spanish translation.
4070
4071 2011-08-01  Cary Coutant  <ccoutant@google.com>
4072
4073         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
4074         * gold/testsuite/Makefile.in: Regenerate.
4075         * gold/testsuite/justsyms_exec.c: New source file.
4076         * gold/testsuite/justsyms_lib.c: New source file.
4077
4078 2011-08-01  Cary Coutant  <ccoutant@google.com>
4079
4080         * layout.cc (Layout::set_segment_offsets): Don't realign text
4081         segment if -Ttext was specified.
4082         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
4083         file type.
4084         * object.h (Sized_relobj_file::e_type): New function.
4085         (Sized_relobj_file::e_type_): New data member.
4086         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
4087         base address for ET_EXEC files.
4088         * target.cc (Target::do_make_elf_object_implementation): Allow
4089         ET_EXEC files with --just-symbols option.
4090
4091 2011-07-28  Cary Coutant  <ccoutant@google.com>
4092
4093         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
4094         Add thread_number parameter.
4095         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
4096         * workqueue-threads.cc
4097         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
4098         current thread if its thread number is greater than desired thread
4099         count.
4100         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
4101         Add thread_number parameter.
4102         (Workqueue::should_cancel_thread): Likewise.
4103         (Workqueue::find_runnable_or_wait): Pass thread_number to
4104         should_cancel_thread.
4105         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
4106         parameter.
4107
4108 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
4109
4110         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
4111         only after checking if it cannot be forced local.
4112         * symtab.h (is_externally_visible): Check if the symbol is not forced
4113         local.
4114
4115 2011-07-15  Ian Lance Taylor  <iant@google.com>
4116
4117         * options.h (class General_options): Add --print-output-format.
4118         Move -EL next to -EB, for  better --help output.
4119         * target-select.cc: Include <cstdio>, "options.h", and
4120         "parameters.h".
4121         (Target_selector::do_target_bfd_name): New function.
4122         (print_output_format): New function.
4123         * target-select.h (class Target_selector): Update declarations.
4124         (Target_selector::target_bfd_name): New function.
4125         (print_output_format): Declare.
4126         * main.cc: Include "target-select.h".
4127         (main): Handle --print-output-format.
4128         * gold.cc: Include "target-select.h".
4129         (queue_initial_tasks): Handle --print-output-format when there are
4130         no input files.
4131         * parameters.cc (parameters_force_valid_target): Give a better
4132         error message if -EB/-EL does not match target.
4133         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
4134         function.
4135
4136 2011-07-15  Ian Lance Taylor  <iant@google.com>
4137
4138         * i386.cc (class Output_data_plt_i386): Add layout_ field.
4139         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
4140         (Output_data_plt_i386::do_write): Write address of .dynamic
4141         section to first entry in .got.plt section.
4142         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
4143         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4144         Initialize layout_.
4145         (Output_data_plt_x86_64::do_write): Write address of .dynamic
4146         section to first entry in .got.plt section.
4147         * layout.h (Layout::dynamic_section): New function.
4148
4149 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
4150
4151         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
4152         to claim_file call.
4153         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
4154         input_section_position_, and input_section_glob_.
4155         (read_layout_from_file): Call function section_ordering_specified.
4156         * layout.h (is_section_ordering_specified): New function.
4157         (section_ordering_specified): New function.
4158         (section_ordering_specified_): New boolean member.
4159         * main.cc(main): Call load_plugins after layout object is defined.
4160         * output.cc (Output_section::add_input_section): Use
4161         function section_ordering_specified to check if section ordering is
4162         needed.
4163         * output.cc (Output_section::add_relaxed_input_section): Use
4164         function section_ordering_specified to check if section ordering is
4165         needed.
4166         (Output_section::update_section_layout): New function.
4167         (Output_section::sort_attached_input_sections): Check if input section
4168         must be reordered.
4169         * output.h (Output_section::update_section_layout): New function.
4170         * plugin.cc (get_section_count): New function.
4171         (get_section_type): New function.
4172         (get_section_name): New function.
4173         (get_section_contents): New function.
4174         (update_section_order): New function.
4175         (allow_section_ordering): New function.
4176         (Plugin::load): Add the new interfaces to the transfer vector.
4177         (Plugin_manager::load_plugins): New parameter.
4178         (Plugin_manager::all_symbols_read): New parameter.
4179         (Plugin_manager::claim_file): New parameter. Save the elf object for
4180         unclaimed objects.
4181         (Plugin_manager::get_elf_object): New function.
4182         (Plugin_manager::get_view): Change to directly use the bool to check
4183         if get_view is called from claim_file_hook.
4184         * plugin.h (input_objects): New function
4185         (Plugin__manager::load_plugins): New parameter.
4186         (Plugin_manager::claim_file): New parameter.
4187         (Plugin_manager::get_elf_object): New function.
4188         (Plugin_manager::in_claim_file_handler): New function.
4189         (Plugin_manager::in_claim_file_handler_): New member.
4190         (layout): New function.
4191         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
4192         handler with an extra parameter. Make the elf object before calling
4193         claim_file handler.
4194         * testsuite/plugin_test.c (get_section_count): New function pointer.
4195         (get_section_type): New function pointer.
4196         (get_section_name): New function pointer.
4197         (get_section_contents): New function pointer.
4198         (update_section_order): New function pointer.
4199         (allow_section_ordering): New function pointer.
4200         (onload): Check if the new interfaces exist.
4201
4202 2011-07-13  Ian Lance Taylor  <iant@google.com>
4203
4204         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
4205         relro section.
4206         * x86_64.cc (Target_x86_64::got_section): Likewise.
4207         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
4208         (relro_now_test_SOURCES): New variable.
4209         (relro_now_test_DEPENDENCIES): New variable.
4210         (relro_now_test_LDFLAGS): New variable.
4211         (relro_now_test_LDADD): New variable.
4212         (relro_now_test.so): New target.
4213         * testsuite/Makefile.in: Rebuild.
4214
4215 2011-07-12  Ian Lance Taylor  <iant@google.com>
4216
4217         PR gold/12980
4218         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
4219         GLOB_DAT relocation rather than a RELATIVE relocation for a
4220         protected symbol when creating a shared library.
4221         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
4222         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
4223         * testsuite/protected_main_1.cc (main): Test that protected
4224         function has same address.
4225
4226 2011-07-11  Ian Lance Taylor  <iant@google.com>
4227
4228         PR gold/12979
4229         * options.h (class General_options): Add -Bgroup.
4230         * options.cc (General_options::finalize): If -Bgroup is set,
4231         default to --unresolved-symbols=report-all.
4232         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
4233         * target-reloc.h (issue_undefined_symbol_error): Handle
4234         --unresolved-symbols=report-all.
4235
4236 2011-07-08  Ian Lance Taylor  <iant@google.com>
4237
4238         PR gold/11985
4239         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
4240         if linker script discards key sections.
4241         (Layout::create_dynamic_symtab): Likewise.
4242         (Layout::assign_local_dynsym_offsets): Likewise.
4243         (Layout::sized_create_version_sections): Likewise.
4244         (Layout::create_interp): Likewise.
4245         (Layout::finish_dynamic_section): Likewise.
4246         (Layout::set_dynamic_symbol_size): Likewise.
4247
4248 2011-07-08  Ian Lance Taylor  <iant@google.com>
4249
4250         PR gold/12386
4251         * options.h (class General_options): Add --unresolved-symbols.
4252         * target-reloc.h (issue_undefined_symbol_error): Check
4253         --unresolved-symbols.  Add comments.
4254
4255 2011-07-08  Ian Lance Taylor  <iant@google.com>
4256
4257         * testsuite/odr_violation2.cc (Ordering::operator()): Make
4258         expression more complex.
4259
4260 2011-07-08  Ian Lance Taylor  <iant@google.com>
4261
4262         PR gold/11317
4263         * target-reloc.h (issue_undefined_symbol_error): New inline
4264         function, broken out of relocate_section.
4265         (relocate_section): Call issue_undefined_symbol_error.
4266         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4267         there is no TLS segment if we are about to issue an undefined
4268         symbol error.
4269         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4270
4271 2011-07-08  Ian Lance Taylor  <iant@google.com>
4272
4273         PR gold/12279
4274         * resolve.cc (Symbol_table::should_override): Add fromtype
4275         parameter.  Change all callers.  Give error when linking together
4276         TLS and non-TLS symbol.
4277         (Symbol_table::should_override_with_special): Add fromtype
4278         parameter.  Change all callers.
4279         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4280         there is no TLS segment if we have reported some errors.
4281         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4282
4283 2011-07-08  Ian Lance Taylor  <iant@google.com>
4284
4285         PR gold/12372
4286         * target.h (Target::plt_address_for_global): New function.
4287         (Target::plt_address_for_local): New function.
4288         (Target::plt_section_for_global): Remove.
4289         (Target::plt_section_for_local): Remove.
4290         (Target::do_plt_address_for_global): New virtual function.
4291         (Target::do_plt_address_for_local): New virtual function.
4292         (Target::do_plt_section_for_global): Remove.
4293         (Target::do_plt_section_for_local): Remove.
4294         (Target::register_global_plt_entry): Add Symbol_table and Layout
4295         parameters.
4296         * output.cc (Output_data_got::Got_entry::write): Use
4297         plt_address_for_global and plt_address_for_local.
4298         * layout.cc (Layout::add_target_dynamic_tags): Use size and
4299         address of output section.
4300         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
4301         got_irelative_, and irelative_count_ fields.  Update
4302         declarations.
4303         (Output_data_plt_i386::has_irelative_section): New function.
4304         (Output_data_plt_i386::entry_count): Add irelative_count_.
4305         (Output_data_plt_i386::set_final_data_size): Likewise.
4306         (class Target_i386): Add got_irelative_ and rel_irelative_
4307         fields.  Update declarations.
4308         (Target_i386::Target_i386): Initialize new fields.
4309         (Target_i386::do_plt_address_for_global): New function replacing
4310         do_plt_section_for_global.
4311         (Target_i386::do_plt_address_for_local): New function replacing
4312         do_plt_section_for_local.
4313         (Target_i386::got_section): Create got_irelative_.
4314         (Target_i386::rel_irelative_section): New function.
4315         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
4316         fields.  Don't define __rel_iplt_{start,end}.
4317         (Output_data_plt_i386::add_entry): Add symtab and layout
4318         parameters.  Change all callers.  Use different PLT and GOT for
4319         IFUNC symbols.
4320         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
4321         layout parameters.  Change all callers.  Use different PLT and
4322         GOT.
4323         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
4324         (Output_data_plt_i386::rel_irelative): New function.
4325         (Output_data_plt_i386::address_for_global): New function.
4326         (Output_data_plt_i386::address_for_local): New function.
4327         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
4328         IRELATIVE GOT when changing IFUNC GOT entries.
4329         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
4330         reloc.
4331         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
4332         if we didn't create an IRELATIVE GOT.
4333         (Target_i386::Relocate::relocate): Use plt_address_for_global and
4334         plt_address_for_local.
4335         (Target_i386::do_dynsym_value): Use plt_address_for_global.
4336         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
4337         got_irelative_, and irelative_count_ fields.  Update
4338         declarations.
4339         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4340         Initialize new fields.  Remove symtab parameter.  Change all
4341         callers.
4342         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
4343         irelative_count_.
4344         (Output_data_plt_x86_64::has_irelative_section): New function.
4345         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
4346         (class Target_x86_64): Add got_irelative_ and rel_irelative_
4347         fields.  Update declarations.
4348         (Target_x86_64::Target_x86_64): Initialize new fields.
4349         (Target_x86_64::do_plt_address_for_global): New function replacing
4350         do_plt_section_for_global.
4351         (Target_x86_64::do_plt_address_for_local): New function replacing
4352         do_plt_section_for_local.
4353         (Target_x86_64::got_section): Create got_irelative_.
4354         (Target_x86_64::rela_irelative_section): New function.
4355         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
4356         all callers.  Don't create __rel_iplt_{start,end}.
4357         (Output_data_plt_x86_64::add_entry): Add symtab and layout
4358         parameters.  Change all callers.  Use different PLT and GOT for
4359         IFUNC symbols.
4360         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
4361         layout parameters.  Change all callers.  Use different PLT and
4362         GOT.
4363         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
4364         parameters.  Change all callers.  Use different PLT and GOT for
4365         IFUNC symbols.
4366         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
4367         (Output_data_plt_x86_64::rela_irelative): New function.
4368         (Output_data_plt_x86_64::address_for_global): New function.
4369         (Output_data_plt_x86_64::address_for_local): New function.
4370         (Output_data_plt_x86_64::set_final_data_size): Likewise.
4371         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
4372         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
4373         (Target_x86_64::register_global_plt_entry): Add symtab and layout
4374         parameters.
4375         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
4376         reloc.
4377         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
4378         symbols if we didn't create an IRELATIVE GOT.
4379         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
4380         plt_address_for_local.
4381         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
4382         * testsuite/ifuncvar1.c: New test file.
4383         * testsuite/ifuncvar2.c: New test file.
4384         * testsuite/ifuncvar3.c: New test file.
4385         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
4386         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
4387         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
4388         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
4389         * testsuite/Makefile.in: Rebuild.
4390
4391 2011-07-07  Cary Coutant  <ccoutant@google.com>
4392
4393         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
4394         (two_file_test_1_ndebug.o): Likewise.
4395         (two_file_test_1b_ndebug.o): Likewise.
4396         (two_file_test_2_ndebug.o): Likewise.
4397         (two_file_test_main_ndebug.o): Likewise.
4398         (incremental_test_2): Link with no-debug versions.
4399
4400 2011-07-06  Cary Coutant  <ccoutant@google.com>
4401
4402         * gold/incremental.cc
4403         (Output_section_incremental_inputs::write_info_blocks): Check for
4404         hidden and internal symbols.
4405
4406 2011-07-06  Cary Coutant  <ccoutant@google.com>
4407
4408         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
4409         Check disposition for startup file.
4410         (Incremental_inputs::report_command_line): Ignore
4411         --incremental-startup-unchanged option.
4412         * options.cc (General_options::parse_incremental_startup_unchanged):
4413         New function.
4414         (General_options::General_options): Initialize new data member.
4415         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
4416         (General_options): Add --incremental-startup-unchanged option.
4417         (General_options::incremental_startup_disposition): New function.
4418         (General_options::incremental_startup_disposition_): New data member.
4419
4420 2011-07-06  Cary Coutant  <ccoutant@google.com>
4421
4422         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
4423         input file index to Script_info ctor.
4424         (Sized_incremental_binary::do_file_has_changed): Find the
4425         command-line argument for files named in scripts.
4426         * incremental.h (Script_info::Script_info): New ctor
4427         with input file index.
4428         (Script_info::input_file_index): New function.
4429         (Script_info::input_file_index_): New data member.
4430         (Incremental_binary::get_library): Add const.
4431         (Incremental_binary::get_script_info): Add const.
4432         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
4433         * testsuite/Makefile.am (incremental_test_5): New test case.
4434         (incremental_test_6): New test case.
4435         * testsuite/Makefile.in: Regenerate.
4436
4437 2011-07-06  Cary Coutant  <ccoutant@google.com>
4438
4439         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
4440         debug output when command lines differ.
4441
4442 2011-07-06  Cary Coutant  <ccoutant@google.com>
4443
4444         * incremental.cc (Incremental_inputs::report_command_line): Ignore
4445         --incremental-patch option.
4446         * layout.cc (Free_list::allocate): Extend allocation beyond original
4447         end if enabled.
4448         (Layout::make_output_section): Mark sections that should get
4449         patch space.
4450         * options.cc (parse_percent): New function.
4451         * options.h (parse_percent): New function.
4452         (DEFINE_percent): New macro.
4453         (General_options): Add --incremental-patch option.
4454         * output.cc (Output_section::Output_section): Initialize new data
4455         members.
4456         (Output_section::add_input_section): Print section name when out
4457         of patch space.
4458         (Output_section::add_output_section_data): Likewise.
4459         (Output_section::set_final_data_size): Add patch space when
4460         doing --incremental-full.
4461         (Output_section::do_reset_address_and_file_offset): Remove patch
4462         space.
4463         (Output_segment::set_section_list_addresses): Print debug output
4464         only if --incremental-update.
4465         * output.h (Output_section::set_is_patch_space_allowed): New function.
4466         (Output_section::is_patch_space_allowed_): New data member.
4467         (Output_section::patch_space_): New data member.
4468         * parameters.cc (Parameters::incremental_full): New function.
4469         * parameters.h (Parameters::incremental_full): New function
4470         * testsuite/Makefile.am (incremental_test_2): Add test for
4471         --incremental-patch option.
4472         * testsuite/Makefile.in: Regenerate.
4473         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
4474         (t18): Remove function body.
4475
4476 2011-07-05  Doug Kwan  <dougkwan@google.com>
4477
4478         PR gold/12771
4479         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
4480         Arm_Address type for relocation result.
4481         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
4482         overflow check.
4483         (Arm_relocate_functions::abs32): Use unaligned access.
4484         (Arm_relocate_functions::rel32): Ditto.
4485         (Arm_relocate_functions::prel31): Ditto.
4486         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
4487         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
4488         static data relocations.
4489         * testsuite/Makefile.in: Regnerate.
4490         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
4491
4492 2011-07-05  Ian Lance Taylor  <iant@google.com>
4493
4494         PR gold/12392
4495         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
4496         symbols if necessary.
4497         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4498
4499 2011-07-05  Ian Lance Taylor  <iant@google.com>
4500
4501         PR gold/12952
4502         * resolve.cc (Symbol::override_base_with_special): Simply override
4503         version with special symbol version, ignoring previous version.
4504
4505 2011-07-05  Ian Lance Taylor  <iant@google.com>
4506
4507         * object.cc (Sized_relobj_file::include_section_group): Add
4508         information to comment about signature location.
4509
4510 2011-07-02  Ian Lance Taylor  <iant@google.com>
4511
4512         PR gold/12957
4513         * options.h (class General_options): Add -f and -F.
4514         * options.cc (General_options::finalize): Fatal error if -f/-F
4515         are used without -shared.
4516         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
4517
4518 2011-07-02  Ian Lance Taylor  <iant@google.com>
4519
4520         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
4521
4522 2011-07-01  Ian Lance Taylor  <iant@google.com>
4523
4524         PR gold/12525
4525         PR gold/12952
4526         * resolve.cc (Symbol::override_base_with_special): Don't override
4527         the version if the overriding symbol has a different name.
4528         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
4529         all callers.  If we give an error about an undefined version,
4530         define the base version if necessary.
4531         * dynobj.h (class Versions): Update declaration.
4532         * testsuite/weak_alias_test_5.cc: New file.
4533         * testsuite/weak_alias_test.script: New file.
4534         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
4535         and versioned_alias have the right value, and call t2.
4536         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
4537         weak_alias_test_5.so.
4538         (weak_alias_test_LDADD): Likewise.
4539         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
4540         * testsuite/Makefile.in: Rebuild.
4541
4542 2011-07-01  Ian Lance Taylor  <iant@google.com>
4543
4544         PR gold/12525
4545         * options.h (class General_options): Support -z notext.
4546         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
4547         -Wl,-z,notext.
4548         (two_file_shared_nonpic.so): Likewise.
4549         (two_file_shared_mixed.so): Likewise.
4550         (two_file_shared_mixed_1.so): Likewise.
4551         (weak_undef_lib_nonpic.so): Likewise.
4552         (alt/weak_undef_lib_nonpic.so): Likewise.
4553         (tls_test_shared_nonpic.so): Likewise.
4554         * testsuite/Makefile.in: Rebuild.
4555
4556 2011-07-01  Ian Lance Taylor  <iant@google.com>
4557
4558         PR gold/12525
4559         * configure.ac: Test whether static linking works, setting
4560         the automake conditional HAVE_STATIC.
4561         * testsuite/Makefile.am: Disable tests using -static if
4562         HAVE_STATIC is not true.
4563         * configure, testsuite/Makefile.in: Rebuild.
4564
4565 2011-07-01  Ian Lance Taylor  <iant@google.com>
4566
4567         PR gold/12525
4568         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
4569         Assert if we see DW_EH_PE_indirect.
4570         * target.h (Target::ehframe_datarel_base): New function.
4571         (Target::do_ehframe_datarel_base): New target function.
4572         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
4573         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
4574         function.
4575
4576 2011-07-01  Ian Lance Taylor  <iant@google.com>
4577
4578         PR gold/12571
4579         * options.h (class General_options): Add
4580         --ld-generated-unwind-info.
4581         * ehframe.cc (Fde::write): Add address parameter.  Change all
4582         callers.  If associated with PLT, fill in address and size.
4583         (Cie::set_output_offset): Only add merge mapping if there is an
4584         object.
4585         (Cie::write): Add address parameter.  Change all callers.
4586         (Eh_frame::add_ehframe_for_plt): New function.
4587         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
4588         input_offset_ fields into union u_, with new plt field.
4589         (Fde::Fde): Adjust for new union field.
4590         (Fde::Fde) [Output_data version]: New constructor.
4591         (Fde::add_mapping): Only add merge mapping if there is an object.
4592         (class Cie): Update declarations.
4593         (class Eh_frame): Declare add_ehframe_for_plt.
4594         * layout.cc (Layout::layout_eh_frame): Break out code into
4595         make_eh_frame_section, and call it.
4596         (Layout::make_eh_frame_section): New function.
4597         (Layout::add_eh_frame_for_plt): New function.
4598         * layout.h (class Layout): Update declarations.
4599         * merge.cc (Merge_map::add_mapping): Add assertion.
4600         * i386.cc: Include "dwarf.h".
4601         (class Output_data_plt_i386): Make first_plt_entry,
4602         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
4603         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4604         and plt_eh_frame_fde.
4605         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
4606         boundary.  Call add_eh_frame_for_plt if appropriate.
4607         * x86_64.cc: Include "dwarf.h".
4608         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
4609         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
4610         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4611         and plt_eh_frame_fde.
4612         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
4613         appropriate.
4614
4615 2011-06-29  Ian Lance Taylor  <iant@google.com>
4616
4617         PR gold/12629
4618         * object.cc (Sized_relobj_file::layout_section): Change shdr
4619         parameter to be const.
4620         (Sized_relobj_file::layout_eh_frame_section): New function, broken
4621         out of do_layout.
4622         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
4623         appropriate.  Call layout_eh_frame_section.
4624         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
4625         sections.
4626         * object.h (class Sized_relobj_file): Update declarations.
4627
4628 2011-06-29  Ian Lance Taylor  <iant@google.com>
4629
4630         PR gold/12652
4631         * script.cc (Token::integer_value): Accept trailing M/m/K/k
4632         modifier.
4633         (Lex::gather_token): Accept trailing M/m/K/k for integers.
4634
4635 2011-06-29  Ian Lance Taylor  <iant@google.com>
4636
4637         PR gold/12675
4638         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
4639         SHT_X86_64_UNWIND.
4640         * layout.cc (Layout::layout_eh_frame): Likewise.
4641
4642 2011-06-29  Ian Lance Taylor  <iant@google.com>
4643
4644         PR gold/12695
4645         * layout.cc (Layout::symtab_section_shndx): New function.
4646         * layout.h (class Layout): Declare symtab_section_shndx.
4647         * output.cc (Output_section::write_header): Call it.
4648
4649 2011-06-29  Ian Lance Taylor  <iant@google.com>
4650
4651         PR gold/12818
4652         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
4653         symbols which are not used in a relocation.
4654
4655 2011-06-28  Ian Lance Taylor  <iant@google.com>
4656
4657         PR gold/12898
4658         * layout.cc (Layout::segment_precedes): Don't crash if a linker
4659         script create indistinguishable segments.
4660         (Layout::set_segment_offsets): Use stable_sort when sorting
4661         segments.  Pass this to Compare_segments constructor.
4662         * layout.h (class Layout): Make segment_precedes non-static.
4663         (class Compare_segments): Change from struct to class.  Add
4664         layout_ field.  Add constructor.
4665         * script-sections.cc
4666         (Script_sections::attach_sections_using_phdrs_clause): Rename
4667         local orphan to is_orphan.  Don't report failure to put empty
4668         section in segment.  On attachment failure, report name of
4669         section, and attach to first PT_LOAD segment.
4670
4671 2011-06-28  Ian Lance Taylor  <iant@google.com>
4672
4673         PR gold/12934
4674         * target-select.cc (Target_selector::Target_selector): Add
4675         emulation parameter.  Change all callers.
4676         (select_target_by_bfd_name): Rename from select_target_by_name.
4677         Change all callers.
4678         (select_target_by_emulation): New function.
4679         (supported_emulation_names): New function.
4680         * target-select.h (class Target_selector): Add emulation_ field.
4681         Update declarations.
4682         (Target_selector::recognize_by_bfd_name): Rename from
4683         recognize_by_name.  Change all callers.
4684         (Target_selector::supported_bfd_names): Rename from
4685         supported_names.  Change all callers.
4686         (Target_selector::recognize_by_emulation): New function.
4687         (Target_selector::supported_emulations): New function.
4688         (Target_selector::emulation): New function.
4689         (Target_selector::do_recognize_by_bfd_name): Rename from
4690         do_recognize_by_name.  Change all callers.
4691         (Target_selector::do_supported_bfd_names): Rename from
4692         do_supported_names.  Change all callers.
4693         (Target_selector::do_recognize_by_emulation): New function.
4694         (Target_selector::do_supported_emulations): New function.
4695         (select_target_by_bfd_name): Change name in declaration.
4696         (select_target_by_emulation): Declare.
4697         (supported_emulation_names): Declare.
4698         * parameters.cc (parameters_force_valid_target): Try to find
4699         target based on emulation from -m option.
4700         * options.h (class General_options): Change doc string for -m.
4701         * options.cc (help): Print emulations.
4702         (General_options::parse_V): Likewise.
4703         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
4704         Add emulation parameter.  Change all callers.
4705
4706 2011-06-28  Ian Lance Taylor  <iant@google.com>
4707
4708         * target.h (class Target): Add osabi_ field.
4709         (Target::osabi): New function.
4710         (Target::set_osabi): New function.
4711         (Target::Target): Initialize osabi_.
4712         (Target::do_adjust_elf_header): Make pure virtual.
4713         (Sized_target::do_adjust_elf_header): Declare.
4714         * target.cc (Sized_target::do_adjust_elf_header): New function.
4715         (class Sized_target): Instantiate all versions.
4716         * freebsd.h (class Target_freebsd): Remove.
4717         (Target_selector_freebsd::do_recognize): Call set_osabi on
4718         Target.
4719         (Target_selector_freebsd::do_recognize_by_name): Likewise.
4720         (Target_selector_freebsd::set_osabi): Remove.
4721         * i386.cc (class Target_i386): Inherit from Sized_target rather
4722         than Target_freebsd.
4723         * x86_64.cc (class Target_x86_64): Likewise.
4724
4725 2011-06-28  Ian Lance Taylor  <iant@google.com>
4726
4727         * target.h (Target::can_check_for_function_pointers): Rewrite.
4728         Make non-virtual.
4729         (Target::can_icf_inline_merge_sections): Likewise.
4730         (Target::section_may_have_icf_unsafe_poineters): Likewise.
4731         (Target::Target_info): Add can_icf_inline_merge_sections field.
4732         (Target::do_can_check_for_function_pointers): New virtual
4733         function.
4734         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
4735         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
4736         from can_check_for_function_pointers, move in file.
4737         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
4738         section_may_have_icf_unsafe_poineters, move in file.
4739         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
4740         * i386.cc (Target_i386::do_can_check_for_function_pointers):
4741         Rename from can_check_for_function_pointers, move in file.
4742         (Target_i386::can_icf_inline_merge_sections): Remove.
4743         (Target_i386::i386_info): Initialize
4744         can_icf_inline_merge_sections.
4745         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
4746         Initialize can_icf_inline_merge_sections.
4747         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
4748         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
4749         Rename from can_check_for_function_pointers, move in file.
4750         (Target_x86_64::can_icf_inline_merge_sections): Remove.
4751         (Target_x86_64::x86_64_info): Initialize
4752         can_icf_inline_merge_sections.
4753         * testsuite/testfile.cc (Target_test::test_target_info):
4754         Likewise.
4755         * icf.cc (get_section_contents): Correct formatting.
4756
4757 2011-06-27  Ian Lance Taylor  <iant@google.com>
4758
4759         * symtab.cc (Symbol::versioned_name): New function.
4760         (Symbol_table::add_to_final_symtab): Use versioned_name when
4761         appropriate.
4762         (Symbol_table::sized_write_symbol): Likewise.
4763         * symtab.h (class Symbol): Declare versioned_name.
4764         * stringpool.h (class Stringpool_template): Add variant of add
4765         which takes a std::basic_string.
4766         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
4767         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
4768         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
4769         (ver_test_12.o): New target.
4770         * testsuite/Makefile.in: Rebuild.
4771
4772 2011-06-27  Doug Kwan  <dougkwan@google.com>
4773
4774         * arm.cc (Arm_relocate_functions::thm_jump8,
4775         Arm_relocate_functions::thm_jump11): Use a wider signed
4776         type to compute offset.
4777         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
4778         arm_thm_jump8.
4779         * testsuite/Makefile.in: Regenerate.
4780         * testsuite/arm_branch_in_range.sh: Check test results of
4781         arm_thm_jump11 and arm_thm_jump8.
4782         * testsuite/arm_thm_jump11.s: New test source file.
4783         * testsuite/arm_thm_jump11.t: New linker script.
4784         * testsuite/arm_thm_jump8.s: New test source file.
4785         * testsuite/arm_thm_jump8.t: New linker script.
4786
4787 2011-06-24  Ian Lance Taylor  <iant@google.com>
4788
4789         * layout.cc: Include "object.h".
4790         (ctors_sections_in_init_array): New static variable.
4791         (Layout::is_ctors_in_init_array): New function.
4792         (Layout::layout): Add entry to ctors_sections_in_init_array if
4793         appropriate.
4794         * layout.h (class Layout): Declare is_ctors_in_init_array.
4795         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
4796         is_ctors_reverse_view is set.
4797         (Sized_relobj_file::write_sections): Add layout parameter.  Change
4798         all callers.  Set is_ctors_reverse_view field of View_size.
4799         (Sized_relobj_file::reverse_words): New function.
4800         * object.h (Sized_relobj_file::View_size): Add
4801         is_ctors_reverse_view field.
4802         (class Sized_relobj_file): Update declarations.
4803         * testsuite/initpri3.c: New test.
4804         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
4805         initpri3b.
4806         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
4807         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
4808         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
4809         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
4810         * testsuite/Makefile.in: Rebuild.
4811
4812 2011-06-24  Cary Coutant  <ccoutant@google.com>
4813
4814         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
4815         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
4816         (debug_msg_cdebug.err): New targets.
4817         * testsuite/Makefile.in: Regenerate.
4818         * testsuite/debug_msg.sh: Check output of link with compressed debug.
4819         Fix checks for link with shared library.
4820
4821 2011-06-24  Doug Kwan  <dougkwan@google.com>
4822
4823         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
4824         skip empty text sections.
4825         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
4826
4827 2011-06-22  Ian Lance Taylor  <iant@google.com>
4828
4829         PR gold/12910
4830         * options.h (class General_options): Add --ctors-in-init-array.
4831         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
4832         friends as SHT_PROGBITS for merging sections.
4833         (Layout::layout): Remove special handling of .init_array and
4834         friends.  Don't sort if doing relocatable link.  Sort for .ctors
4835         and .dtors if ctors_in_init_array.
4836         (Layout::make_output_section): Force correct section types for
4837         .init_array and friends.  Don't sort if doing relocatable link,
4838         Don't sort .ctors and .dtors if ctors_in_init_array.
4839         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
4840         (Layout::output_section_name): Add relobj parameter.  Change all
4841         callers.  Handle .ctors. and .dtors. in code rather than table.
4842         Handle .ctors and .dtors if ctors_in_init_array.
4843         (Layout::match_file_name): New function, moved from output.cc.
4844         * layout.h (class Layout): Update declarations.
4845         * output.cc: Include "layout.h".
4846         (Input_section_sort_entry::get_priority): New function.
4847         (Input_section_sort_entry::match_file_name): Just call
4848         Layout::match_file_name.
4849         (Output_section::Input_section_sort_init_fini_compare::operator()):
4850         Handle .ctors and .dtors.  Sort by explicit priority rather than
4851         by name.
4852         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
4853         * testsuite/initpri2.c: New test.
4854         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
4855         (check_PROGRAMS): Add initpri2.
4856         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
4857         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
4858         * configure, testsuite/Makefile.in: Rebuild.
4859
4860 2011-06-19  Ian Lance Taylor  <iant@google.com>
4861
4862         PR gold/12880
4863         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
4864         .interp section to a PT_INTERP segment even if we have seen a
4865         --dynamic-linker option.  Don't do it if we have seen a PHDRS
4866         clause in a linker script.
4867         (Layout::finalize): Don't create a .interp section if we've
4868         already create a PT_INTERP segment.
4869         (Layout::create_interp): Always call choose_output_section (revert
4870         patch of 2011-06-17).  Don't create PT_INTERP segment.
4871         * script-sections.cc
4872         (Script_sections::create_note_and_tls_segments): Add a .interp
4873         section to a PT_INTERP segment even if we have seen a
4874         --dynamic-linker option.
4875
4876 2011-06-18  Ian Lance Taylor  <iant@google.com>
4877
4878         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
4879         merely because a non-PT_LOAD segment has a dynamic reloc.
4880
4881 2011-06-18  Ian Lance Taylor  <iant@google.com>
4882
4883         * layout.cc (Layout::finish_dynamic_section): Don't create
4884         DT_FLAGS entry if not needed.
4885
4886 2011-06-18  Ian Lance Taylor  <iant@google.com>
4887
4888         PR gold/12745
4889         * layout.cc (Layout::layout_eh_frame): Correct handling of
4890         writable .eh_frame section.
4891
4892 2011-06-17  Ian Lance Taylor  <iant@google.com>
4893
4894         PR gold/12893
4895         * resolve.cc (Symbol_table::resolve): Don't give an error if a
4896         symbol is redefined with the exact same object and value.
4897
4898 2011-06-17  Ian Lance Taylor  <iant@google.com>
4899
4900         PR gold/12880
4901         * layout.h (class Layout): Add interp_segment_ field.
4902         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
4903         (Layout::attach_allocated_section_to_segment): If making shared
4904         library, put .interp section in PT_INTERP segment.
4905         (Layout::finalize): Also call create_interp if -dynamic-linker
4906         option was used.
4907         (Layout::create_interp): Assert that there is no PT_INTERP
4908         segment.  If not using a SECTIONS clause, use make_output_section.
4909         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
4910         * script-sections.cc
4911         (Script_sections::create_note_and_tls_segments): If making shared
4912         library, put .interp section in PT_INTERP segment.
4913
4914 2011-06-17  Ian Lance Taylor  <iant@google.com>
4915
4916         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
4917         when making a shared library.
4918
4919 2011-06-17  Ian Lance Taylor  <iant@google.com>
4920
4921         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
4922         parameter.  Change all callers.  Don't issue warning about PC32
4923         against locally defined symbol.
4924
4925 2011-06-16  Ian Lance Taylor  <iant@google.com>
4926
4927         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
4928         occurs in same object.
4929
4930 2011-06-14  Alan Modra  <amodra@gmail.com>
4931
4932         * po/POTFILES.in: Regenerate.
4933
4934 2011-06-09  Ian Lance Taylor  <iant@google.com>
4935
4936         * script-sections.cc
4937         (Orphan_output_section::set_section_addresses): For a relocatable
4938         link set address to 0.
4939
4940 2011-06-09  Cary Coutant  <ccoutant@google.com>
4941
4942         PR gold/12804
4943         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
4944         used with --compress-debug-sections.
4945         * gold/object.cc (Sized_relobj_file::do_layout): Report
4946         uncompressed size of compressed input sections.
4947
4948 2011-06-08  Cary Coutant  <ccoutant@google.com>
4949
4950         PR gold/12804
4951         * testsuite/two_file_test_2_v1.cc: Change initialization of
4952         v2 to keep it in .data.
4953
4954 2011-06-07  Cary Coutant  <ccoutant@google.com>
4955
4956         * common.cc (Symbol_table::do_allocate_commons_list): Call
4957         gold_fallback.
4958         * errors.cc (Errors::fatal): Adjust call to gold_exit.
4959         (Errors::fallback): New function.
4960         (gold_fallback): New function.
4961         * errors.h (Errors::fallback): New function.
4962         * gold.cc (gold_exit): Change status parameter to enum; adjust
4963         all callers.
4964         (queue_initial_tasks): Call gold_fallback.
4965         * gold.h: Include cstdlib.
4966         (Exit_status): New enum type.
4967         (gold_exit): Change status parameter to enum.
4968         (gold_fallback): New function.
4969         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
4970         (Layout::create_symtab_sections): Likewise.
4971         (Layout::create_shdrs): Likewise.
4972         * main.cc (main): Adjust call to gold_exit.
4973         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
4974         (Output_data_got::add_got_entry_pair): Likewise.
4975         (Output_section::add_input_section): Likewise.
4976         (Output_section::add_output_section_data): Likewise.
4977         (Output_segment::set_section_list_addresses): Likewise.
4978         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
4979
4980 2011-06-07  Cary Coutant  <ccoutant@google.com>
4981
4982         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
4983         for incremental links.
4984         * output.cc (Output_segment::set_section_list_addresses): Remove
4985         FIXME and test for TLS or BSS.
4986
4987 2011-06-07  Cary Coutant  <ccoutant@google.com>
4988
4989         * testsuite/Makefile.am: Add incremental_copy_test,
4990         incremental_common_test_1.
4991         * testsuite/Makefile.in: Regenerate.
4992         * testsuite/common_test_1_v1.c: New source file.
4993         * testsuite/common_test_1_v2.c: New source file.
4994         * testsuite/copy_test_v1.cc: New source file.
4995
4996 2011-06-07  Cary Coutant  <ccoutant@google.com>
4997
4998         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
4999         update, allocate common from bss section's free list.
5000         * incremental-dump.cc (dump_incremental_inputs): Print flag for
5001         linker-defined symbols.
5002         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
5003         Skip GOT and PLT entries that are no longer referenced.
5004         (Output_section_incremental_inputs::write_info_blocks): Mark
5005         linker-defined symbols.
5006         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
5007         * output.cc (Output_section::allocate): New function.
5008         * output.h (Output_section::allocate): New function.
5009         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
5010         linker-defined symbols.
5011         (Symbol::override_base_with_special): Copy is_predefined_ flag.
5012         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
5013         (Symbol::init_base_output_data): Likewise.
5014         (Symbol::init_base_output_segment): Likewise.
5015         (Symbol::init_base_constant): Likewise.
5016         (Sized_symbol::init_output_data): Likewise.
5017         (Sized_symbol::init_output_segment): Likewise.
5018         (Sized_symbol::init_constant): Likewise.
5019         (Symbol_table::do_define_in_output_data): Likewise.
5020         (Symbol_table::do_define_in_output_segment): Likewise.
5021         (Symbol_table::do_define_as_constant): Likewise.
5022         * symtab.h (Symbol::is_predefined): New function.
5023         (Symbol::init_base_output_data): Add is_predefined parameter.
5024         (Symbol::init_base_output_segment): Likewise.
5025         (Symbol::init_base_constant): Likewise.
5026         (Symbol::is_predefined_): New data member.
5027         (Sized_symbol::init_output_data): Add is_predefined parameter.
5028         (Sized_symbol::init_output_segment): Likewise.
5029         (Sized_symbol::init_constant): Likewise.
5030         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
5031
5032 2011-06-07  Cary Coutant  <ccoutant@google.com>
5033
5034         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
5035         instead of emit_copy_reloc.
5036         (Copy_relocs::emit_copy_reloc): Refactor.
5037         (Copy_relocs::make_copy_reloc): New function.
5038         (Copy_relocs::add_copy_reloc): Remove.
5039         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
5040         section.
5041         (Copy_relocs::make_copy_reloc): New function.
5042         (Copy_relocs::add_copy_reloc): Remove.
5043         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
5044         unchanged input files.
5045         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
5046         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
5047         Reserve BSS space for COPY relocations.
5048         (Sized_incremental_binary::do_emit_copy_relocs): New function.
5049         (Output_section_incremental_inputs::write_info_blocks): Record
5050         whether a symbol is copied from a shared object.
5051         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
5052         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
5053         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
5054         (Incremental_input_entry_reader::get_output_symbol_index): Add
5055         is_copy parameter.
5056         (Incremental_binary::emit_copy_relocs): New function.
5057         (Incremental_binary::do_emit_copy_relocs): New function.
5058         (Sized_incremental_binary::Sized_incremental_binary): Initialize
5059         new data member.
5060         (Sized_incremental_binary::add_copy_reloc): New function.
5061         (Sized_incremental_binary::do_emit_copy_relocs): New function.
5062         (Sized_incremental_binary::Copy_reloc): New struct.
5063         (Sized_incremental_binary::Copy_relocs): New typedef.
5064         (Sized_incremental_binary::copy_relocs_): New data member.
5065         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
5066         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
5067         * target.h (Sized_target::emit_copy_reloc): New function.
5068         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
5069
5070 2011-06-02  Cary Coutant  <ccoutant@google.com>
5071
5072         PR gold/12163
5073         * gold/archive.cc (Archive::Archive): Initialize new data member.
5074         (Archive::include_all_members): Return if archive has already been
5075         included.
5076         * gold/archive.h (Archive::include_all_members_): New data member.
5077
5078 2011-06-02  Nick Clifton  <nickc@redhat.com>
5079
5080         * dynobj.h: Fix spelling mistake in comment.
5081         * output.cc: Likewise.
5082
5083 2011-05-31  Doug Kwan  <dougkwan@google.com>
5084             Asier Llano
5085
5086         PR gold/12826
5087         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
5088         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
5089         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
5090         redundant arm_exidx_test.so.
5091         * testsuite/Makefile.in: Regenerate.
5092         (check_SCRIPTS): Add pr12826.sh
5093         (check_DATA): Add pr12826.stdout
5094         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
5095         * testsuite/pr12826.sh: New file.
5096         * testsuite/pr12826_1.s: Ditto.
5097         * testsuite/pr12826_1.s: Ditto.
5098
5099 2011-05-30  Ian Lance Taylor  <iant@google.com>
5100
5101         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
5102         sections.
5103
5104 2011-05-29  Ian Lance Taylor  <iant@google.com>
5105
5106         PR gold/12804
5107         * testsuite/Makefile.am: Use different file name for two_file_test
5108         temporary file for each incremental test.
5109         * testsuite/Makefile.in: Rebuild.
5110
5111 2011-05-29  Ian Lance Taylor  <iant@google.com>
5112
5113         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
5114         binary input file is empty.
5115
5116 2011-05-27  Ian Lance Taylor  <iant@google.com>
5117
5118         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
5119         (ver_test_9.so): Likewise.
5120         * testsuite/Makefile.in: Rebuild.
5121
5122 2011-05-26 Cary Coutant  <ccoutant@google.com>
5123
5124         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
5125         * incremental.cc (Incremental_inputs::report_input_section): Fix
5126         comment, indentation.
5127         (Incremental_inputs::report_comdat_group): New function.
5128         (Output_section_incremental_inputs::set_final_data_size): Adjust size
5129         of data for incremental input file entry.
5130         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
5131         group count, COMDAT group signatures.
5132         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
5133         an unchanged input file.
5134         * incremental.h (Incremental_object_entry::Incremental_object_entry):
5135         Initialize new data member.
5136         (Incremental_object_entry::add_comdat_group): New function.
5137         (Incremental_object_entry::get_comdat_group_count): New function.
5138         (Incremental_object_entry::get_comdat_signature_key): New function.
5139         (Incremental_object_entry::groups_): New data member.
5140         (Incremental_inputs::report_comdat_group): New function.
5141         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
5142         data for incremental input file entry.
5143         (Incremental_input_entry_reader::get_comdat_group_count): New function.
5144         (Incremental_input_entry_reader::get_input_section): Adjust size of
5145         data for incremental input file entry.
5146         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
5147         (Incremental_input_entry_reader::get_comdat_group_signature): New
5148         function.
5149         * object.cc (Sized_relobj::include_section_group): Report kept
5150         COMDAT groups for incremental links.
5151
5152 2011-05-24  David Meyer  <pdox@google.com>
5153
5154         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
5155         with name parameter.  Add found_name parameter.
5156         * fileread.cc (Input_file::find_file): Adjust code accordingly.
5157         * dirsearch.h (class Dirsearch): Update declaration.
5158
5159 2011-05-24  Ian Lance Taylor  <iant@google.com>
5160
5161         * archive.cc (Library_base::should_include_member): Pull in object
5162         from archive if it defines the entry symbol.
5163         * parameters.cc (Parameters::entry): New function.
5164         * parameters.h (class Parameters): Declare entry.
5165         * output.h (class Output_file_header): Remove entry_ field.
5166         * output.cc (Output_file_header::Output_file_header): Remove entry
5167         parameter.  Change all callers.
5168         (Output_file_header::entry): Use parameters->entry.
5169         * gold.cc (queue_middle_tasks): Likewise.
5170         * plugin.cc (Plugin_hook::run): Likewise.
5171
5172 2011-05-24 Cary Coutant  <ccoutant@google.com>
5173
5174         * gold.cc (queue_initial_tasks): Pass incremental base filename
5175         to Output_file::open_base_file; don't print error message.
5176         * incremental-dump.cc (main): Adjust call to
5177         Output_file::open_for_modification.
5178         * incremental-dump.cc (main): Likewise.
5179         * incremental.cc (Incremental_inputs::report_command_line):
5180         Ignore --incremental-base option when comparing command lines.
5181         Ignore parameter when given as separate argument.
5182         * options.h (class General_options): Add --incremental-base.
5183         * output.cc (Output_file::Output_file):
5184         (Output_file::open_base_file): Add base_name and writable parameters;
5185         read base file into new file; print error message here.
5186         (Output_file::map_no_anonymous): Add writable parameter; adjust all
5187         callers.
5188         * output.h (Output_file::open_for_modification): Rename to...
5189         (Output_file::open_base_file): ...this; add base_name and
5190         writable parameters; adjust all callers.
5191         (Output_file::map_no_anonymous): Add writable parameter; adjust all
5192         callers.
5193         * testsuite/Makefile.am (incremental_test_4): Test
5194         --incremental-base.
5195         * testsuite/Makefile.in: Regenerate.
5196
5197 2011-05-24 Cary Coutant  <ccoutant@google.com>
5198
5199         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
5200         incremental_test_4.
5201         * testsuite/Makefile.in: Regenerate.
5202         * testsuite/two_file_test_1_v1.cc: New test source file.
5203         * testsuite/two_file_test_1b_v1.cc: New test source file.
5204         * testsuite/two_file_test_2_v1.cc: New test source file.
5205
5206 2011-05-24 Cary Coutant  <ccoutant@google.com>
5207
5208         * dynobj.h (Dynobj::do_dynobj): New function.
5209         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
5210         flag and soname for shared objects.
5211         * incremental.cc (Incremental_inputs::report_object): Make
5212         either Incremental_object_entry or Incremental_dynobj_entry; add
5213         soname to string table.
5214         (Incremental_inputs::report_input_section): Add assertion.
5215         (Output_section_incremental_inputs::set_final_data_size): Adjust
5216         type of input file entry for shared libraries; adjust size of
5217         shared library info entry.
5218         (Output_section_incremental_inputs::write_input_files): Write
5219         as_needed flag for shared libraries.
5220         (Output_section_incremental_inputs::write_info_blocks): Adjust type
5221         of input file entry for shared libraries; write soname.
5222         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
5223         soname from incremental info.
5224         * incremental.h (enum Incremental_input_flags): Add
5225         INCREMENTAL_INPUT_AS_NEEDED.
5226         (Incremental_input_entry::Incremental_input_entry): Initialize new
5227         data member.
5228         (Incremental_input_entry::set_as_needed): New function.
5229         (Incremental_input_entry::as_needed): New function.
5230         (Incremental_input_entry::do_dynobj_entry): New function.
5231         (Incremental_input_entry::as_needed_): New data member.
5232         (Incremental_object_entry::Incremental_object_entry): Don't check
5233         for shared library.
5234         (Incremental_object_entry::do_type): Likewise.
5235         (class Incremental_dynobj_entry): New class.
5236         (Incremental_input_entry_reader::as_needed): New function.
5237         (Incremental_input_entry_reader::get_soname): New function.
5238         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
5239         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
5240         size of shared library info entry.
5241         * layout.cc (Layout::finish_dynamic_section): Don't test for
5242         incremental link when adding DT_NEEDED entries.
5243         * object.h (Object::Object): Initialize new data member.
5244         (Object::dynobj): New function.
5245         (Object::set_as_needed): New function.
5246         (Object::as_needed): New function.
5247         (Object::do_dynobj): New function.
5248         (Object::as_needed_): New data member.
5249
5250 2011-05-24 Cary Coutant  <ccoutant@google.com>
5251
5252         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
5253         info; adjust display of GOT entries.
5254         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5255         vector of input objects; remove file_status_.
5256         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
5257         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
5258         got_plt reader; call target hooks to reserve GOT entries.
5259         (Output_section_incremental_inputs::set_final_data_size): Adjust size
5260         of input file info header and GOT info entry.
5261         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
5262         relocation info.
5263         (Got_plt_view_info::got_descriptor): Remove.
5264         (Got_plt_view_info::sym_index): New data member.
5265         (Got_plt_view_info::input_index): New data member.
5266         (Local_got_offset_visitor::visit): Write input file index.
5267         (Global_got_offset_visitor::visit): Write 0 for input file index.
5268         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
5269         with sym_index and input_index.
5270         (Output_section_incremental_inputs::write_got_plt): Adjust size of
5271         incremental info GOT entry; replace got_descriptor with input_index.
5272         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
5273         map from input file index to object.
5274         (Sized_relobj_incr::do_layout): Replace direct data member reference
5275         with accessor function.
5276         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
5277         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
5278         Adjust size of input file info header.
5279         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
5280         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
5281         (Incremental_input_entry_reader::get_input_section): Adjust size of
5282         input file info header.
5283         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
5284         of incremental info GOT entry.
5285         (Incremental_got_plt_reader::get_got_desc): Remove.
5286         (Incremental_got_plt_reader::get_got_symndx): New function.
5287         (Incremental_got_plt_reader::get_got_input_index): New function.
5288         (Sized_incremental_binary::Sized_incremental_binary): Remove
5289         file_status_; add input_objects_.
5290         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
5291         (Sized_incremental_binary::set_file_is_unchanged): Remove.
5292         (Sized_incremental_binary::file_is_unchanged): Remove.
5293         (Sized_incremental_binary::set_input_object): New function.
5294         (Sized_incremental_binary::input_object): New function.
5295         (Sized_incremental_binary::file_status_): Remove.
5296         (Sized_incremental_binary::input_objects_): New data member.
5297         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
5298         references.
5299         (Sized_relobj_incr::invalid_address): Move to base class.
5300         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
5301         class.
5302         (Sized_relobj_incr::do_output_section_offset): Likewise.
5303         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
5304         (Sized_relobj_incr::section_offsets_): Likewise.
5305         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
5306         function.
5307         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
5308         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
5309         with accessor function.
5310         (Sized_relobj_file::do_layout): Likewise.
5311         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
5312         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
5313         (Sized_relobj_file::compute_final_local_value): Replace refs to
5314         section_offsets_ with accessor function.
5315         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
5316         * object.h (Relobj::Relobj): Initialize new data members.
5317         (Relobj::add_dyn_reloc): New function.
5318         (Relobj::first_dyn_reloc): New function.
5319         (Relobj::dyn_reloc_count): New function.
5320         (Relobj::first_dyn_reloc_): New data member.
5321         (Relobj::dyn_reloc_count_): New data member.
5322         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
5323         references.
5324         (Sized_relobj::Address): New typedef.
5325         (Sized_relobj::invalid_address): Move here from child class.
5326         (Sized_relobj::Sized_relobj): Initialize new data members.
5327         (Sized_relobj::sized_relobj): New function.
5328         (Sized_relobj::is_output_section_offset_invalid): Move here from
5329         child class.
5330         (Sized_relobj::get_output_section_offset): Likewise.
5331         (Sized_relobj::local_has_got_offset): Likewise.
5332         (Sized_relobj::local_got_offset): Likewise.
5333         (Sized_relobj::set_local_got_offset): Likewise.
5334         (Sized_relobj::do_for_all_local_got_entries): Likewise.
5335         (Sized_relobj::clear_got_offsets): New function.
5336         (Sized_relobj::section_offsets): Move here from child class.
5337         (Sized_relobj::do_output_section_offset): Likewise.
5338         (Sized_relobj::do_set_section_offset): Likewise.
5339         (Sized_relobj::Local_got_offsets): Likewise.
5340         (Sized_relobj::local_got_offsets_): Likewise.
5341         (Sized_relobj::section_offsets_): Likewise.
5342         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
5343         references.
5344         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
5345         class.
5346         (Sized_relobj_file::sized_relobj): New function
5347         (Sized_relobj_file::local_has_got_offset): Move to base class.
5348         (Sized_relobj_file::local_got_offset): Likewise.
5349         (Sized_relobj_file::set_local_got_offset): Likewise.
5350         (Sized_relobj_file::get_output_section_offset): Likewise.
5351         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
5352         (Sized_relobj_file::do_output_section_offset): Likewise.
5353         (Sized_relobj_file::do_set_section_offset): Likewise.
5354         (Sized_relobj_file::Local_got_offsets): Likewise.
5355         (Sized_relobj_file::local_got_offsets_): Likewise.
5356         (Sized_relobj_file::section_offsets_): Likewise.
5357         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
5358         (all constructors).
5359         (set_needs_dynsym_index): Convert relobj to derived class pointer.
5360         (Output_reloc::get_symbol_index): Likewise.
5361         (Output_reloc::local_section_offset): Likewise.
5362         (Output_reloc::get_address): Likewise.
5363         (Output_reloc::symbol_value): Likewise.
5364         (Output_data_got::reserve_slot): Move to class definition.
5365         (Output_data_got::reserve_local): New function.
5366         (Output_data_got::reserve_slot_for_global): Remove.
5367         (Output_data_got::reserve_global): New function.
5368         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
5369         (all constructors, two instantiations).
5370         (Output_reloc::get_relobj): New function (two instantiations).
5371         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
5372         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
5373         (Output_data_reloc::add_global): Adjust type of relobj.
5374         (Output_data_reloc::add_global_relative): Likewise.
5375         (Output_data_reloc::add_symbolless_global_addend): Likewise.
5376         (Output_data_reloc::add_local): Likewise.
5377         (Output_data_reloc::add_local_relative): Likewise.
5378         (Output_data_reloc::add_symbolless_local_addend): Likewise.
5379         (Output_data_reloc::add_local_section): Likewise.
5380         (Output_data_reloc::add_output_section): Likewise.
5381         (Output_data_reloc::add_absolute): Likewise.
5382         (Output_data_reloc::add_target_specific): Likewise.
5383         (Output_data_got::reserve_slot): Move definition here.
5384         (Output_data_got::reserve_local): New function.
5385         (Output_data_got::reserve_global): New function.
5386         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
5387         section_offsets_ with accessor function.
5388         (Sized_relobj_file::write_sections): Likewise.
5389         (Sized_relobj_file::do_relocate_sections): Likewise.
5390         * target.h (Sized_target::reserve_local_got_entry): New function.
5391         (Sized_target::reserve_global_got_entry): New function.
5392         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
5393         (Target_x86_64::reserve_global_got_entry): New function.
5394         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
5395
5396 2011-05-23 Cary Coutant  <ccoutant@google.com>
5397
5398         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
5399         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
5400         bit when checking got_type.
5401         * incremental.cc (Sized_incremental_binary::setup_readers):
5402         Store symbol table and string table locations; initialize bit vector
5403         of file status flags.
5404         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
5405         unchanged files.
5406         (Sized_incremental_binary::do_process_got_plt): New function.
5407         (Sized_incremental_binary::get_symtab_view): Use stored locations.
5408         (Output_section_incremental_inputs::set_final_data_size): Record
5409         file index for each input file.
5410         (Output_section_incremental_inputs::write_got_plt): Store file index
5411         instead of input entry offset for each GOT entry.
5412         * incremental.h
5413         (Incremental_input_entry::Incremental_input_entry): Initialize new
5414         data member.
5415         (Incremental_input_entry::set_offset): Store file index.
5416         (Incremental_input_entry::get_file_index): New function.
5417         (Incremental_input_entry::file_index_): New data member.
5418         (Incremental_binary::process_got_plt): New function.
5419         (Incremental_binary::do_process_got_plt): New function.
5420         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5421         data members.
5422         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
5423         (Sized_incremental_binary::set_file_is_unchanged): New function.
5424         (Sized_incremental_binary::file_is_unchanged): New function.
5425         (Sized_incremental_binary::do_process_got_plt): New function.
5426         (Sized_incremental_binary::file_status_): New data member.
5427         (Sized_incremental_binary::main_symtab_loc_): New data member.
5428         (Sized_incremental_binary::main_strtab_loc_): New data member.
5429         * output.cc (Output_data_got::Got_entry::write): Add case
5430         RESERVED_CODE.
5431         (Output_data_got::add_global): Call add_got_entry.
5432         (Output_data_got::add_global_plt): Likewise.
5433         (Output_data_got::add_global_with_rel): Likewise.
5434         (Output_data_got::add_global_with_rela): Likewise.
5435         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
5436         (Output_data_got::add_global_pair_with_rela): Likewise.
5437         (Output_data_got::add_local): Call add_got_entry.
5438         (Output_data_got::add_local_plt): Likewise.
5439         (Output_data_got::add_local_with_rel): Likewise.
5440         (Output_data_got::add_local_with_rela): Likewise.
5441         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
5442         (Output_data_got::add_local_pair_with_rela): Likewise.
5443         (Output_data_got::reserve_slot): New function.
5444         (Output_data_got::reserve_slot_for_global): New function.
5445         (Output_data_got::add_got_entry): New function.
5446         (Output_data_got::add_got_entry_pair): New function.
5447         (Output_section::add_output_section_data): Edit FIXME.
5448         * output.h
5449         (Output_section_data_build::Output_section_data_build): New
5450         constructor with size parameter.
5451         (Output_data_space::Output_data_space): Likewise.
5452         (Output_data_got::Output_data_got): Initialize new data member; new
5453         constructor with size parameter.
5454         (Output_data_got::add_constant): Call add_got_entry.
5455         (Output_data_got::reserve_slot): New function.
5456         (Output_data_got::reserve_slot_for_global): New function.
5457         (class Output_data_got::Got_entry): Add RESERVED_CODE.
5458         (Output_data_got::add_got_entry): New function.
5459         (Output_data_got::add_got_entry_pair): New function.
5460         (Output_data_got::free_list_): New data member.
5461         * target.h (Sized_target::init_got_plt_for_update): New function.
5462         (Sized_target::register_global_plt_entry): New function.
5463         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
5464         Initialize new data member; call init; add constructor with PLT count.
5465         (Output_data_plt_x86_64::init): New function.
5466         (Output_data_plt_x86_64::add_relocation): New function.
5467         (Output_data_plt_x86_64::reserve_slot): New function.
5468         (Output_data_plt_x86_64::free_list_): New data member.
5469         (Target_x86_64::init_got_plt_for_update): New function.
5470         (Target_x86_64::register_global_plt_entry): New function.
5471         (Output_data_plt_x86_64::add_entry): Allocate from free list for
5472         incremental updates.
5473         (Output_data_plt_x86_64::add_relocation): New function.
5474         * testsuite/object_unittest.cc (Object_test): Set default options.
5475
5476 2011-05-16  Ian Lance Taylor  <iant@google.com>
5477
5478         * options.h (class General_options): Make -i a synonym for -r.
5479
5480 2011-05-16  Ian Lance Taylor  <iant@google.com>
5481
5482         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
5483
5484 2011-05-10 Cary Coutant  <ccoutant@google.com>
5485
5486         * object.cc (Sized_relobj::do_count_local_symbols): Check for
5487         strip_all (-s).
5488
5489 2011-05-06  Ian Lance Taylor  <iant@google.com>
5490
5491         * layout.cc (Layout::layout): If the output section flags change,
5492         update the ordering.
5493
5494 2011-04-25 Cary Coutant  <ccoutant@google.com>
5495
5496         * incremental-dump.cc (dump_incremental_inputs): Print local
5497         symbol info for each input file.
5498         * incremental.cc
5499         (Output_section_incremental_inputs::set_final_data_size): Add local
5500         symbol info to input file entries in incremental info.
5501         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5502         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
5503         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
5504         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
5505         implementation.
5506         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
5507         (Sized_incr_relobj::do_relocate): Write the local symbols.
5508         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
5509         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
5510         Adjust size of input file header.
5511         (Incremental_inputs_reader::get_local_symbol_offset): New function.
5512         (Incremental_inputs_reader::get_local_symbol_count): New function.
5513         (Incremental_inputs_reader::get_input_section): Adjust size of input
5514         file header.
5515         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
5516         (Sized_incr_relobj::This): New typedef.
5517         (Sized_incr_relobj::sym_size): New const data member.
5518         (Sized_incr_relobj::Local_symbol): New struct.
5519         (Sized_incr_relobj::do_output_local_symbol_count): New function.
5520         (Sized_incr_relobj::do_local_symbol_offset): New function.
5521         (Sized_incr_relobj::local_symbol_count_): New data member.
5522         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
5523         (Sized_incr_relobj::local_symbol_index_): New data member.
5524         (Sized_incr_relobj::local_symbol_offset_): New data member.
5525         (Sized_incr_relobj::local_dynsym_offset_): New data member.
5526         (Sized_incr_relobj::local_symbols_): New data member.
5527         * object.h (Relobj::output_local_symbol_count): New function.
5528         (Relobj::local_symbol_offset): New function.
5529         (Relobj::do_output_local_symbol_count): New function.
5530         (Relobj::do_local_symbol_offset): New function.
5531         (Sized_relobj::do_output_local_symbol_count): New function.
5532         (Sized_relobj::do_local_symbol_offset): New function.
5533
5534 2011-04-22  Vladimir Simonov  <sv@sw.ru>
5535
5536         * descriptors.cc (set_close_on_exec): New function.
5537         (Descriptors::open): Use set_close_on_exec.
5538         * output.cc (S_ISLNK): Define if not defined.
5539
5540 2011-04-22 Cary Coutant  <ccoutant@google.com>
5541
5542         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5543         global symbol map.
5544         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5545         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
5546         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
5547         relocations.
5548         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
5549         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
5550         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
5551         * incremental.h
5552         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
5553         function.
5554         (Incremental_binary::apply_incremental_relocs): New function.
5555         (Incremental_binary::do_apply_incremental_relocs): New function.
5556         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5557         data member.
5558         (Sized_incremental_binary::add_global_symbol): New function.
5559         (Sized_incremental_binary::global_symbol): New function.
5560         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5561         (Sized_incremental_binary::symbol_map_): New data member.
5562         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
5563         * target.h (Sized_target::apply_relocation): New function.
5564         * target-reloc.h (apply_relocation): New function.
5565         * x86_64.cc (Target_x86_64::apply_relocation): New function.
5566
5567 2011-04-22  Doug Kwan  <dougkwan@google.com>
5568
5569         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
5570         flag of a SHT_ARM_EXIDX section.
5571         * testsuite/Makefile.am (arm_exidx_test): New test rules.
5572         * testsuite/Makefile.in: Regenerate.
5573         * testsuite/arm_exidx_test.s: New file.
5574         * testsuite/arm_exidx_test.sh: Same.
5575
5576 2011-04-20 Cary Coutant  <ccoutant@google.com>
5577
5578         PR gold/12689
5579         * archive.h (Incremental_archive_entry::Archive_member):
5580         Initialize arg_serial_ (second constructor).
5581
5582 2011-04-17  Ian Lance Taylor  <iant@google.com>
5583
5584         * object.cc (Relocate_info::location): Simplify location string.
5585         * errors.cc (Errors::error_at_location): Don't print program
5586         name.
5587         (Errors::warning_at_location): Likewise.
5588         (Errors::undefined_symbol): Likewise.
5589         * testsuite/debug_msg.sh: Update accordingly.
5590
5591 2011-04-14 Cary Coutant  <ccoutant@google.com>
5592
5593         * gold/layout.cc (Layout::symtab_section_offset): New function.
5594         * gold/layout.h (Layout::symtab_section_offset): New function.
5595         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
5596
5597 2011-04-12  Ian Lance Taylor  <iant@google.com>
5598
5599         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
5600         with MREMAP_MAYMOVE.
5601         * output.h (class Output_file): Add map_is_allocated_ field.
5602         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
5603         not available, provide stubs.  If mremap is not available, #define
5604         it to gold_mremap.
5605         (MREMAP_MAYMOVE): Define if not defined.
5606         (Output_file::Output_file): Initialize map_is_allocated_.
5607         (Output_file::resize): Check map_is_allocated_.
5608         (Output_file::map_anonymous): If mmap fails, use malloc.
5609         (Output_file::unmap): Don't do anything for an anonymous map.
5610         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
5611         is not available, provide stubs.
5612         (File_read::View::~View): Use free rather than delete[].
5613         (File_read::make_view): Use malloc rather than new[].  If mmap
5614         fails, use malloc.
5615         (File_read::find_or_make_view): Use malloc rather than new[].
5616         * gold.h: Remove HAVE_REMAP code.
5617         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
5618         exists.  Rename mremap to gold_mremap.  If mmap is not available
5619         don't do anything.
5620         * configure, config.in: Rebuild.
5621
5622 2011-04-11  Ian Lance Taylor  <iant@google.com>
5623
5624         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
5625         initialize local variable v.
5626
5627 2011-04-11  Cary Coutant  <ccoutant@google.com>
5628
5629         * archive.cc (Archive::include_member): Adjust call to
5630         report_object.
5631         (Add_archive_symbols::run): Track argument serial numbers.
5632         (Lib_group::include_member): Likewise.
5633         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
5634         * archive.h (Incremental_archive_entry::Archive_member):
5635         Initialize arg_serial_.
5636         (Archive_member::arg_serial_): New data member.
5637         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
5638         (Sized_dynobj::do_add_symbols): Track symbols when doing an
5639         incremental link.
5640         (Sized_dynobj::do_for_all_local_got_entries): New function.
5641         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
5642         function.
5643         * fileread.cc (get_mtime): New function.
5644         * fileread.h (get_mtime): New function.
5645         * gold.cc (queue_initial_tasks): Check for incremental update.
5646         (process_incremental_input): New function.
5647         (queue_middle_tasks): Don't force valid target for incremental
5648         update.
5649         * incremental-dump.cc (find_input_containing_global): Adjust
5650         size of symbol info entry.
5651         (dump_incremental_inputs): Dump argument serial number and
5652         in_system_directory flag; bias shndx by 1; print symbol names
5653         when dumping per-file symbol lists; use new symbol info readers.
5654         * incremental.cc
5655         (Output_section_incremental_inputs:update_data_size): New function.
5656         (Sized_incremental_binary::setup_readers): Setup input readers
5657         for each input file; build maps for files added from libraries
5658         and scripts.
5659         (Sized_incremental_binary::check_input_args): New function.
5660         (Sized_incremental_binary::do_check_inputs): Build map of argument
5661         serial numbers to input arguments.
5662         (Sized_incremental_binary::do_file_has_changed): Rename
5663         do_file_is_unchanged to this; compare file modification times.
5664         (Sized_incremental_binary::do_init_layout): New function.
5665         (Sized_incremental_binary::do_reserve_layout): New function.
5666         (Sized_incremental_binary::do_get_input_reader): Remove.
5667         (Sized_incremental_binary::get_symtab_view): New function.
5668         (Incremental_checker::can_incrementally_link_output_file): Remove.
5669         (Incremental_inputs::report_command_line): Exclude --debug options.
5670         (Incremental_inputs::report_archive_begin): Add parameter; track
5671         argument serial numbers; don't put input file entry for archive
5672         before archive members.
5673         (Incremental_inputs::report_archive_end): Put input file entry
5674         for archive after archive members.
5675         (Incremental_inputs::report_object): Add parameter; track argument
5676         serial numbers and in_system_directory flag.
5677         (Incremental_inputs::report_script): Add parameter; track argument
5678         serial numbers.
5679         (Output_section_incremental_inputs::set_final_data_size): Adjust
5680         size of symbol info entry; check for forwarding symbols.
5681         (Output_section_incremental_inputs::write_input_files): Write
5682         in_system_directory flag and argument serial number.
5683         (Output_section_incremental_inputs::write_info_blocks): Map section
5684         indices between incremental info and original input file; store
5685         input section index for each symbol.
5686         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
5687         change operator() to visit().
5688         (class Global_got_offset_visitor): Likewise.
5689         (class Global_symbol_visitor_got_plt):
5690         (Output_section_incremental_inputs::write_got_plt): Use new visitor
5691         classes.
5692         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
5693         (Sized_incr_relobj::do_read_symbols): New function.
5694         (Sized_incr_relobj::do_layout): New function.
5695         (Sized_incr_relobj::do_layout_deferred_sections): New function.
5696         (Sized_incr_relobj::do_add_symbols): New function.
5697         (Sized_incr_relobj::do_should_include_member): New function.
5698         (Sized_incr_relobj::do_for_all_global_symbols): New function.
5699         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
5700         (Sized_incr_relobj::do_section_size): New function.
5701         (Sized_incr_relobj::do_section_name): New function.
5702         (Sized_incr_relobj::do_section_contents): New function.
5703         (Sized_incr_relobj::do_section_flags): New function.
5704         (Sized_incr_relobj::do_section_entsize): New function.
5705         (Sized_incr_relobj::do_section_address): New function.
5706         (Sized_incr_relobj::do_section_type): New function.
5707         (Sized_incr_relobj::do_section_link): New function.
5708         (Sized_incr_relobj::do_section_info): New function.
5709         (Sized_incr_relobj::do_section_addralign): New function.
5710         (Sized_incr_relobj::do_initialize_xindex): New function.
5711         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
5712         (Sized_incr_relobj::do_read_relocs): New function.
5713         (Sized_incr_relobj::do_gc_process_relocs): New function.
5714         (Sized_incr_relobj::do_scan_relocs): New function.
5715         (Sized_incr_relobj::do_count_local_symbols): New function.
5716         (Sized_incr_relobj::do_finalize_local_symbols): New function.
5717         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
5718         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
5719         (Sized_incr_relobj::do_relocate): New function.
5720         (Sized_incr_relobj::do_set_section_offset): New function.
5721         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
5722         (Sized_incr_dynobj::do_read_symbols): New function.
5723         (Sized_incr_dynobj::do_layout): New function.
5724         (Sized_incr_dynobj::do_add_symbols): New function.
5725         (Sized_incr_dynobj::do_should_include_member): New function.
5726         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
5727         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
5728         (Sized_incr_dynobj::do_section_size): New function.
5729         (Sized_incr_dynobj::do_section_name): New function.
5730         (Sized_incr_dynobj::do_section_contents): New function.
5731         (Sized_incr_dynobj::do_section_flags): New function.
5732         (Sized_incr_dynobj::do_section_entsize): New function.
5733         (Sized_incr_dynobj::do_section_address): New function.
5734         (Sized_incr_dynobj::do_section_type): New function.
5735         (Sized_incr_dynobj::do_section_link): New function.
5736         (Sized_incr_dynobj::do_section_info): New function.
5737         (Sized_incr_dynobj::do_section_addralign): New function.
5738         (Sized_incr_dynobj::do_initialize_xindex): New function.
5739         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
5740         (make_sized_incremental_object): New function.
5741         (Incremental_library::copy_unused_symbols): New function.
5742         (Incremental_library::do_for_all_unused_symbols): New function.
5743         * incremental.h (enum Incremental_input_flags): New type.
5744         (class Incremental_checker): Remove.
5745         (Incremental_input_entry::Incremental_input_entry): Add argument
5746         serial number.
5747         (Incremental_input_entry::arg_serial): New function.
5748         (Incremental_input_entry::set_is_in_system_directory): New function.
5749         (Incremental_input_entry::is_in_system_directory): New function.
5750         (Incremental_input_entry::arg_serial_): New data member.
5751         (Incremental_input_entry::is_in_system_directory_): New data member.
5752         (class Script_info): Move here from script.h.
5753         (Script_info::Script_info): Add filename parameter.
5754         (Script_info::filename): New function.
5755         (Script_info::filename_): New data member.
5756         (Incremental_script_entry::Incremental_script_entry): Add argument
5757         serial number.
5758         (Incremental_object_entry::Incremental_object_entry): Likewise.
5759         (Incremental_object_entry::add_input_section): Build list of input
5760         sections with map to original shndx.
5761         (Incremental_object_entry::get_input_section_index): New function.
5762         (Incremental_object_entry::shndx_): New data member.
5763         (Incremental_object_entry::name_key_): Rename; adjust all refs.
5764         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
5765         (Incremental_archive_entry::Incremental_archive_entry): Add argument
5766         serial number.
5767         (Incremental_inputs::report_archive_begin): Likewise.
5768         (Incremental_inputs::report_object): Likewise.
5769         (Incremental_inputs::report_script): Likewise.
5770         (class Incremental_global_symbol_reader): New class.
5771         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
5772         and store flags and input file type.
5773         (Incremental_input_entry_reader::arg_serial): New function.
5774         (Incremental_input_entry_reader::type): Extract type from flags.
5775         (Incremental_input_entry_reader::is_in_system_directory): New function.
5776         (Incremental_input_entry_reader::get_input_section_count): Call
5777         accessor function for type.
5778         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
5779         function for type; adjust size of global symbol entry.
5780         (Incremental_input_entry_reader::get_global_symbol_count): Call
5781         accessor function for type.
5782         (Incremental_input_entry_reader::get_object_count): Likewise.
5783         (Incremental_input_entry_reader::get_object_offset): Likewise.
5784         (Incremental_input_entry_reader::get_member_count): Likewise.
5785         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
5786         (Incremental_input_entry_reader::get_member_offset): Likewise.
5787         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
5788         (Incremental_input_entry_reader::Global_symbol_info): Remove.
5789         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
5790         (Incremental_input_entry_reader::get_global_symbol_reader): New
5791         function.
5792         (Incremental_input_entry_reader::get_output_symbol_index): New
5793         function.
5794         (Incremental_input_entry_reader::type_): Remove.
5795         (Incremental_input_entry_reader::flags_): New data member.
5796         (Incremental_inputs_reader::input_file_offset): New function.
5797         (Incremental_inputs_reader::input_file_index): New function.
5798         (Incremental_inputs_reader::input_file): Call input_file_offset.
5799         (Incremental_inputs_reader::input_file_at_offset): New function.
5800         (Incremental_relocs_reader::get_r_type): Reformat.
5801         (Incremental_relocs_reader::get_r_shndx): Reformat.
5802         (Incremental_relocs_reader::get_r_offset): Reformat.
5803         (Incremental_relocs_reader::data): New function.
5804         (Incremental_binary::Incremental_binary): Initialize new data members.
5805         (Incremental_binary::check_inputs): Add cmdline parameter.
5806         (Incremental_binary::file_is_unchanged): Remove.
5807         (Input_reader::arg_serial): New function.
5808         (Input_reader::get_unused_symbol_count): New function.
5809         (Input_reader::get_unused_symbol): New function.
5810         (Input_reader::do_arg_serial): New function.
5811         (Input_reader::do_get_unused_symbol_count): New function.
5812         (Input_reader::do_get_unused_symbol): New function.
5813         (Incremental_binary::input_file_count): New function.
5814         (Incremental_binary::get_input_reader): Change signature to use
5815         index instead of filename.
5816         (Incremental_binary::file_has_changed): New function.
5817         (Incremental_binary::get_input_argument): New function.
5818         (Incremental_binary::get_library): New function.
5819         (Incremental_binary::get_script_info): New function.
5820         (Incremental_binary::init_layout): New function.
5821         (Incremental_binary::reserve_layout): New function.
5822         (Incremental_binary::output_file): New function.
5823         (Incremental_binary::do_check_inputs): New function.
5824         (Incremental_binary::do_file_is_unchanged): Remove.
5825         (Incremental_binary::do_file_has_changed): New function.
5826         (Incremental_binary::do_init_layout): New function.
5827         (Incremental_binary::do_reserve_layout): New function.
5828         (Incremental_binary::do_input_file_count): New function.
5829         (Incremental_binary::do_get_input_reader): Change signature.
5830         (Incremental_binary::input_args_map_): New data member.
5831         (Incremental_binary::library_map_): New data member.
5832         (Incremental_binary::script_map_): New data member.
5833         (Sized_incremental_binary::Sized_incremental_binary): Initialize
5834         new data members.
5835         (Sized_incremental_binary::output_section): New function.
5836         (Sized_incremental_binary::inputs_reader): Add const.
5837         (Sized_incremental_binary::symtab_reader): Add const.
5838         (Sized_incremental_binary::relocs_reader): Add const.
5839         (Sized_incremental_binary::got_plt_reader): Add const.
5840         (Sized_incremental_binary::get_symtab_view): New function.
5841         (Sized_incremental_binary::Inputs_reader): New typedef.
5842         (Sized_incremental_binary::Input_entry_reader): New typedef.
5843         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
5844         (Sized_incremental_binary::do_file_is_unchanged): Remove.
5845         (Sized_incremental_binary::do_file_has_changed): New function.
5846         (Sized_incremental_binary::do_init_layout): New function.
5847         (Sized_incremental_binary::do_reserve_layout): New function.
5848         (Sized_input_reader::Inputs_reader): Remove.
5849         (Sized_input_reader::Input_entry_reader): Remove.
5850         (Sized_input_reader::do_arg_serial): New function.
5851         (Sized_input_reader::do_get_unused_symbol_count): New function.
5852         (Sized_input_reader::do_get_unused_symbol): New function.
5853         (Sized_incremental_binary::do_input_file_count): New function.
5854         (Sized_incremental_binary::do_get_input_reader): Change signature;
5855         use index instead of filename.
5856         (Sized_incremental_binary::section_map_): New data member.
5857         (Sized_incremental_binary::input_entry_readers_): New data member.
5858         (class Sized_incr_relobj): New class.
5859         (class Sized_incr_dynobj): New class.
5860         (make_sized_incremental_object): New function.
5861         (class Incremental_library): New class.
5862         * layout.cc (Free_list::num_lists): New static data member.
5863         (Free_list::num_nodes): New static data member.
5864         (Free_list::num_removes): New static data member.
5865         (Free_list::num_remove_visits): New static data member.
5866         (Free_list::num_allocates): New static data member.
5867         (Free_list::num_allocate_visits): New static data member.
5868         (Free_list::init): New function.
5869         (Free_list::remove): New function.
5870         (Free_list::allocate): New function.
5871         (Free_list::dump): New function.
5872         (Free_list::print_stats): New function.
5873         (Layout_task_runner::run): Resize output file for incremental updates.
5874         (Layout::Layout): Initialize new data members.
5875         (Layout::set_incremental_base): New function.
5876         (Layout::init_fixed_output_section): New function.
5877         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
5878         incremental updates.
5879         (Layout::create_gold_note): Do not create gold note section for
5880         incremental updates.
5881         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
5882         for incremental updates.
5883         (Layout::set_section_offsets): For incremental updates, allocate space
5884         from free list.
5885         (Layout::create_symtab_sections): Layout with offsets relative to
5886         start of section; for incremental updates, allocate space from free
5887         list.
5888         (Layout::create_shdrs): For incremental updates, allocate space from
5889         free list.
5890         (Layout::finish_dynamic_section): For incremental updates, do not
5891         check --as-needed (fixed in subsequent patch).
5892         * layout.h (class Free_list): New class.
5893         (Layout::set_incremental_base): New function.
5894         (Layout::incremental_base): New function.
5895         (Layout::init_fixed_output_section): New function.
5896         (Layout::allocate): New function.
5897         (Layout::incremental_base_): New data member.
5898         (Layout::free_list_): New data member.
5899         * main.cc (main): Print Free_list statistics.
5900         * object.cc (Relobj::finalize_incremental_relocs): Add
5901         clear_counts parameter; clear counts only when clear_counts is set.
5902         (Sized_relobj::Sized_relobj): Initialize new base class.
5903         (Sized_relobj::do_layout): Don't report special sections.
5904         (Sized_relobj::do_for_all_local_got_entries): New function.
5905         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
5906         symtab_off to all symbol table offsets.
5907         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
5908         * object.h (class Got_offset_list): Move to top of file.
5909         (Object::Object): Allow case where input_file == NULL.
5910         (Object::~Object): Likewise.
5911         (Object::input_file): Assert that input_file != NULL.
5912         (Object::lock): Allow case where input_file == NULL.
5913         (Object::unlock): Likewise.
5914         (Object::is_locked): Likewise.
5915         (Object::token): Likewise.
5916         (Object::release): Likewise.
5917         (Object::is_incremental): New function.
5918         (Object::get_mtime): New function.
5919         (Object::for_all_local_got_entries): New function.
5920         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
5921         (Object::set_is_in_system_directory): New function.
5922         (Object::is_in_system_directory): New function.
5923         (Object::do_is_incremental): New function.
5924         (Object::do_get_mtime): New function.
5925         (Object::do_for_all_local_got_entries): New function.
5926         (Object::is_in_system_directory_): New data member.
5927         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
5928         (class Sized_relobj_base): New class.
5929         (class Sized_relobj): Derive from Sized_relobj_base.
5930         (class Sized_relobj::Symbols): Redeclare from base class.
5931         (class Sized_relobj::local_got_offset_list): Remove.
5932         (class Sized_relobj::Output_sections): Redeclare from base class.
5933         (class Sized_relobj::do_for_all_local_got_entries): New function.
5934         (class Sized_relobj::write_local_symbols): Add offset parameter.
5935         (class Sized_relobj::local_symbol_offset_): Update comment.
5936         (class Sized_relobj::local_dynsym_offset_): Update comment.
5937         * options.cc (Input_arguments::add_file): Remove const.
5938         * options.h (Input_file_argument::Input_file_argument):
5939         Initialize arg_serial_ (all constructors).
5940         (Input_file_argument::set_arg_serial): New function.
5941         (Input_file_argument::arg_serial): New function.
5942         (Input_file_argument::arg_serial_): New data member.
5943         (Input_arguments::Input_arguments): Initialize file_count_.
5944         (Input_arguments::add_file): Remove const.
5945         (Input_arguments::number_of_input_files): New function.
5946         (Input_arguments::file_count_): New data member.
5947         (Command_line::number_of_input_files): Call
5948         Input_arguments::number_of_input_files.
5949         * output.cc (Output_segment_headers::Output_segment_headers):
5950         Set current size.
5951         (Output_section::Input_section::current_data_size): New function.
5952         (Output_section::Output_section): Initialize new data members.
5953         (Output_section::add_input_section): Don't do merge sections for
5954         an incremental link; allocate space from free list for an
5955         incremental update.
5956         (Output_section::add_output_section_data): Allocate space from
5957         free list for an incremental update.
5958         (Output_section::update_data_size): New function.
5959         (Output_section::set_fixed_layout): New function.
5960         (Output_section::reserve): New function.
5961         (Output_segment::set_section_addresses): Remove const.
5962         (Output_segment::set_section_list_addresses): Remove const; allocate
5963         space from free list for an incremental update.
5964         (Output_segment::set_offset): Adjust size of RELRO segment for an
5965         incremental update.
5966         * output.h (Output_data::current_data_size): Move here from
5967         child classes.
5968         (Output_data::pre_finalize_data_size): New function.
5969         (Output_data::update_data_size): New function.
5970         (Output_section_headers::update_data_size): new function.
5971         (Output_section_data_build::current_data_size): Move to Output_data.
5972         (Output_data_strtab::update_data_size): New function.
5973         (Output_section::current_data_size): Move to Output_data.
5974         (Output_section::set_fixed_layout): New function.
5975         (Output_section::has_fixed_layout): New function.
5976         (Output_section::reserve): New function.
5977         (Output_section::update_data_size): New function.
5978         (Output_section::has_fixed_layout_): New data member.
5979         (Output_section::free_list_): New data member.
5980         (Output_segment::set_section_addresses): Remove const.
5981         (Output_segment::set_section_list_addresses): Remove const.
5982         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
5983         New function.
5984         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
5985         New function.
5986         * readsyms.cc (Read_symbols::do_read_symbols): Add library
5987         parameter when calling Add_symbols constructor; store argument
5988         serial number for members of a lib group.
5989         (Add_symbols::locks): Allow case where token == NULL.
5990         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
5991         (Read_member::~Read_member): New function.
5992         (Read_member::is_runnable): New function.
5993         (Read_member::locks): New function.
5994         (Read_member::run): New function.
5995         (Check_script::~Check_script): New function.
5996         (Check_script::is_runnable): New function.
5997         (Check_script::locks): New function.
5998         (Check_script::run): New function.
5999         (Check_library::~Check_library): New function.
6000         (Check_library::is_runnable): New function.
6001         (Check_library::locks): New function.
6002         (Check_library::run): New function.
6003         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
6004         (Add_symbols::library_): New data member.
6005         (class Read_member): New class.
6006         (class Check_script): New class.
6007         (class Check_library): New class.
6008         * reloc.cc (Read_relocs::is_runnable): Allow case where
6009         token == NULL.
6010         (Read_relocs::locks): Likewise.
6011         (Scan_relocs::locks): Likewise.
6012         (Relocate_task::locks): Likewise.
6013         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
6014         to clear counters.
6015         (Sized_relobj::incremental_relocs_scan): Fix comment.
6016         (Sized_relobj::do_relocate): Pass output file offset to
6017         write_local_symbols.
6018         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
6019         from class declaration.
6020         * script.cc (read_input_script): Allocate Script_info; pass
6021         argument serial number to report_script.
6022         * script.h (class Script_info): Move to incremental.h.
6023         * symtab.cc (Symbol_table::add_from_incrobj): New function.
6024         * symtab.h (Symbol_table::add_from_incrobj): New function.
6025         (Symbol_table::set_file_offset): New function.
6026
6027 2011-04-05  Cary Coutant  <ccoutant@google.com>
6028
6029         * incremental-dump.cc (dump_incremental_inputs): Change signature
6030         to take a Sized_incremental_binary; change caller.  Use readers
6031         in Sized_incremental_binary.
6032         * incremental.cc
6033         (Sized_incremental_binary::find_incremental_inputs_sections):
6034         Rename do_find_incremental_inputs_sections to this.
6035         (Sized_incremental_binary::setup_readers): New function.
6036         (Sized_incremental_binary::do_check_inputs): Check
6037         has_incremental_info_ flag; move setup code to setup_readers;
6038         use input readers.
6039         (Sized_incremental_binary::do_file_is_unchanged): New function.
6040         (Sized_incremental_binary::do_get_input_reader): New function.
6041         * incremental.h (class Incremental_binary): Move to end of file.
6042         (Incremental_binary::file_is_unchanged): New function.
6043         (Incremental_binary::do_file_is_unchanged): New function.
6044         (Incremental_binary::Input_reader): New class.
6045         (Incremental_binary::get_input_reader): New function.
6046         (class Sized_incremental_binary): Move to end of file.
6047         (Sized_incremental_binary::Sized_incremental_binary): Setup the
6048         input section reader classes.
6049         (Sized_incremental_binary::has_incremental_info): New function.
6050         (Sized_incremental_binary::inputs_reader): New function.
6051         (Sized_incremental_binary::symtab_reader): New function.
6052         (Sized_incremental_binary::relocs_reader): New function.
6053         (Sized_incremental_binary::got_plt_reader): New function.
6054         (Sized_incremental_binary::do_file_is_unchanged): New function.
6055         (Sized_incremental_binary::Sized_input_reader): New class.
6056         (Sized_incremental_binary::get_input_reader): New function.
6057         (Sized_incremental_binary::find_incremental_inputs_sections):
6058         Rename do_find_incremental_inputs_sections to this.
6059         (Sized_incremental_binary::setup_readers): New function.
6060         (Sized_incremental_binary::has_incremental_info_): New data member.
6061         (Sized_incremental_binary::inputs_reader_): New data member.
6062         (Sized_incremental_binary::symtab_reader_): New data member.
6063         (Sized_incremental_binary::relocs_reader_): New data member.
6064         (Sized_incremental_binary::got_plt_reader_): New data member.
6065         (Sized_incremental_binary::current_input_file_): New data member.
6066
6067 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
6068
6069         PR gold/12640
6070         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
6071         violation.
6072
6073 2011-03-30  Cary Coutant  <ccoutant@google.com>
6074
6075         * archive.cc (Archive::include_member): Adjust call to report_object.
6076         (Add_archive_symbols::run): Add script_info to call to
6077         report_archive_begin.
6078         (Lib_group::include_member): Adjust call to report_object.
6079         (Add_lib_group_symbols::run): Adjust call to report_object.
6080         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
6081         blocks.  Add object count for script input files.
6082         * incremental.cc (Incremental_inputs::report_archive_begin): Add
6083         script_info parameter; change all callers.
6084         (Incremental_inputs::report_object): Add script_info parameter;
6085         change all callers.
6086         (Incremental_inputs::report_script): Store backpointer to
6087         incremental info entry.
6088         (Output_section_incremental_inputs::set_final_data_size): Record
6089         additional information for scripts.
6090         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6091         * incremental.h (Incremental_script_entry::add_object): New function.
6092         (Incremental_script_entry::get_object_count): New function.
6093         (Incremental_script_entry::get_object): New function.
6094         (Incremental_script_entry::objects_): New data member; adjust
6095         constructor.
6096         (Incremental_inputs::report_archive_begin): Add script_info parameter.
6097         (Incremental_inputs::report_object): Add script_info parameter.
6098         (Incremental_inputs_reader::get_object_count): New function.
6099         (Incremental_inputs_reader::get_object_offset): New function.
6100         * options.cc (Input_arguments::add_file): Return reference to
6101         new input argument.
6102         * options.h (Input_argument::set_script_info): New function.
6103         (Input_argument::script_info): New function.
6104         (Input_argument::script_info_): New data member; adjust all
6105         constructors.
6106         (Input_file_group::add_file): Return reference to new input argument.
6107         (Input_file_lib::add_file): Likewise.
6108         (Input_arguments::add_file): Likewise.
6109         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
6110         * script.cc (Parser_closure::Parser_closure): Add script_info
6111         parameter; adjust all callers.
6112         (Parser_closure::script_info): New function.
6113         (Parser_closure::script_info_): New data member.
6114         (read_input_script): Report scripts earlier to incremental info.
6115         (script_add_file): Set script_info in Input_argument.
6116         (script_add_library): Likewise.
6117         * script.h (Script_options::Script_info): Rewrite class.
6118
6119 2011-03-29  Cary Coutant  <ccoutant@google.com>
6120
6121         * archive.cc (Library_base::should_include_member): Move
6122         method here from class Archive.
6123         (Archive::Archive): Initialize base class.
6124         (Archive::should_include_member): Move to base class.
6125         (Archive::do_for_all_unused_symbols): New function.
6126         (Add_archive_symbols::run): Remove redundant access to
6127         incremental_inputs.
6128         (Lib_group::Lib_group): Initialize base class.
6129         (Lib_group::do_filename): New function.
6130         (Lib_group::include_member): Pass pointer to Lib_group to
6131         report_object.
6132         (Lib_group::do_for_all_unused_symbols): New function.
6133         (Add_lib_group_symbols::run): Report archive information for
6134         incremental links.
6135         * archive.h (class Library_base): New base class.
6136         (class Archive): Derive from Library_base.
6137         (Archive::filename): Move to base class.
6138         (Archive::set_incremental_info): Likewise.
6139         (Archive::incremental_info): Likewise.
6140         (Archive::Should_include): Likewise.
6141         (Archive::should_include_member): Likewise.
6142         (Archive::Armap_entry): Remove.
6143         (Archive::Unused_symbol_iterator): Remove.
6144         (Archive::unused_symbols_begin): Remove.
6145         (Archive::unused_symbols_end): Remove.
6146         (Archive::do_filename): New function.
6147         (Archive::do_get_mtime): New function.
6148         (Archive::do_for_all_unused_symbols): New function.
6149         (Archive::task_): Move to base class.
6150         (Archive::incremental_info_): Likewise.
6151         (class Lib_group): Derive from Library_base.
6152         (Lib_group::do_filename): New function.
6153         (Lib_group::do_get_mtime): New function.
6154         (Lib_group::do_for_all_unused_symbols): New function.
6155         (Lib_group::task_): Move to base class.
6156         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
6157         function.
6158         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
6159         function.
6160         * incremental.cc (Incremental_inputs::report_archive_begin):
6161         Use Library_base; call library's get_mtime; add incremental inputs
6162         entry before members.
6163         (class Unused_symbol_visitor): New class.
6164         (Incremental_inputs::report_archive_end): Use Library_base; use
6165         visitor class to record unused symbols; don't add incremental inputs
6166         entry after members.
6167         (Incremental_inputs::report_object): Use Library_base.
6168         * incremental.h
6169         (Incremental_archive_entry::Incremental_archive_entry): Remove
6170         unused Archive parameter.
6171         (Incremental_inputs::report_archive_begin): Use Library_base.
6172         (Incremental_inputs::report_archive_end): Likewise.
6173         (Incremental_inputs::report_object): Likewise.
6174         * object.cc (Sized_relobj::do_for_all_global_symbols): New
6175         function.
6176         * object.h (Object::for_all_global_symbols): New function.
6177         (Object::do_for_all_global_symbols): New function.
6178         (Sized_relobj::do_for_all_global_symbols): New function.
6179         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
6180         function.
6181         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
6182         function.
6183
6184 2011-03-27  Ian Lance Taylor  <iant@google.com>
6185
6186         * archive.cc (Archive::interpret_header): Return -1 if something
6187         goes wrong.  Change callers accordingly.
6188
6189 2011-03-25  Cary Coutant  <ccoutant@google.com>
6190
6191         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
6192         * testsuite/Makefile.in: Regenerate.
6193
6194 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
6195
6196         * plugin.cc (get_view): New.
6197         (Plugin::load): Pass get_view to the plugin.
6198         (Plugin_manager::get_view): New.
6199
6200 2011-03-21  Ian Lance Taylor  <iant@google.com>
6201
6202         * testsuite/final_layout.sh: Rewrite to not use dc.
6203         * testsuite/relro_test.sh: Fail if dc is not present.
6204
6205 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
6206
6207         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
6208         Change == to -eq.
6209         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
6210         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
6211         Change == to -eq.
6212         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
6213         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
6214
6215 2011-03-14  Ian Lance Taylor  <iant@google.com>
6216
6217         * script-sections.cc (Sort_output_sections::script_compare):
6218         Rename from is_before, change return type.
6219         (Sort_output_sections::operator()): Adjust accordingly.
6220
6221 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
6222
6223         PR gold/12572
6224         * testsuite/odr_violation2.cc: Add comment to make all error line
6225         numbers double digits.
6226         * testsuite/debug_msg.sh: Adjust expected errors.
6227
6228 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
6229
6230         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
6231         but mark earlier ones as non-canonical
6232         (offset_to_iterator): Update search target and example
6233         (do_addr2line): Return extra lines in a vector*
6234         (format_file_lineno): Extract from do_addr2line
6235         (one_addr2line): Add vector* out-param
6236         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
6237         when a lineno entry appeared last for its instruction
6238         (Dwarf_line_info): Add vector* out-param
6239         * object.cc (Relocate_info): Pass NULL for the vector* out-param
6240         * symtab.cc (Odr_violation_compare): Include the lineno in the
6241         comparison again.
6242         (linenos_from_loc): New. Combine the canonical line for an
6243         address with its other lines.
6244         (True_if_intersect): New. Helper functor to make
6245         std::set_intersection a query.
6246         (detect_odr_violations): Compare sets of lines instead of just
6247         one line for each function. This became less deterministic, but
6248         has fewer false positives.
6249         * symtab.h: Declarations.
6250         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
6251         mix an optimized and non-optimized object in the same binary
6252         (odr_violation2.so): Same.
6253         * testsuite/Makefile.in: Regenerate from Makefile.am.
6254         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
6255         * testsuite/debug_msg.sh: Update line numbers and add
6256         assertions.
6257         * testsuite/odr_violation1.cc: Use OdrDerived, in a
6258         non-optimized context.
6259         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
6260         isn't inlined, and use OdrDerived in an optimized context.
6261         * testsuite/odr_header1.h: Defines OdrDerived, where
6262         optimization will change the
6263         first-instruction-in-the-destructor's file and line number.
6264         * testsuite/odr_header2.h: Defines OdrBase.
6265
6266 2011-03-09  Ian Lance Taylor  <iant@google.com>
6267
6268         * fileread.cc (File_read::clear_views): Don't delete the whole
6269         file view.
6270
6271 2011-03-08  Ian Lance Taylor  <iant@google.com>
6272
6273         PR gold/12525
6274         * fileread.cc: #include <climits>.
6275         (GOLD_IOV_MAX): Define.
6276         (File_read::read_multiple): Limit number of entries by iov_max.
6277         * fileread.h (class File_read): Always set max_readv_entries to
6278         128.
6279
6280 2011-03-07  Ian Lance Taylor  <iant@google.com>
6281
6282         PR gold/12525
6283         * options.h (class General_options): Add -dy and -dn.
6284
6285 2011-03-02  Cary Coutant  <ccoutant@google.com>
6286
6287         * testsuite/script_test_9.t: Add TLS segment.
6288
6289 2011-03-02  Simon Baldwin  <simonb@google.com>
6290
6291         * configure.ac: Add check for gnu_indirect_function support in
6292         the toolchain building binutils.
6293         * configure: Rebuild.
6294
6295 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
6296
6297         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
6298         plugin only symbols.
6299         (Symbol_table::sized_finalize_symbol) Mark symbol only present
6300         in plugin files as not needed in the symbol table.
6301
6302 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
6303
6304         * output.cc (Output_section::add_input_section): Delay fill
6305         generation for section ordering.
6306
6307 2011-02-09  Ian Lance Taylor  <iant@google.com>
6308
6309         PR gold/12316
6310         * object.h (class Sized_relobj): Remove clear_local_symbols.
6311         * reloc.cc (Sized_relobj::do_relocate): Don't call
6312         clear_local_symbols.
6313
6314 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
6315
6316         * plugin.cc (is_visible_from_outside): Return true for symbols
6317         in the -u option.
6318
6319 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
6320
6321         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
6322         filename.
6323
6324 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
6325
6326         * icf.h (is_section_foldable_candidate): Change type of parameter
6327         to std::string.
6328         * icf.cc (Icf::find_identical_sections): Change type of local variable
6329         section_name to be std::string.
6330         (is_function_ctor_or_dtor): Change type of parameter to std::string.
6331
6332 2011-01-25  Ian Lance Taylor  <iant@google.com>
6333
6334         * script.cc (script_add_extern): Rewrite to use
6335         add_symbol_reference.
6336
6337 2011-01-25  Doug Kwan  <dougkwan@google.com>
6338
6339         * icf.cc (get_section_contents): Always lock section's object.
6340
6341 2011-01-24  Ian Lance Taylor  <iant@google.com>
6342
6343         * options.h (class General_options): Accept
6344         --no-detect-odr-violations.
6345
6346 2011-01-24  Ian Lance Taylor  <iant@google.com>
6347
6348         * version.cc (version_string): Bump to 1.11.
6349
6350 2011-01-24  Ian Lance Taylor  <iant@google.com>
6351
6352         * plugin.cc (class Plugin_rescan): Define new class.
6353         (Plugin_manager::claim_file): Set any_claimed_.
6354         (Plugin_manager::save_archive): New function.
6355         (Plugin_manager::save_input_group): New function.
6356         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
6357         necessary.
6358         (Plugin_manager::new_undefined_symbol): New function.
6359         (Plugin_manager::rescan): New function.
6360         (Plugin_manager::rescannable_defines): New function.
6361         (Plugin_manager::add_input_file): Set any_added_.
6362         * plugin.h (class Plugin_manager): define new fields rescannable_,
6363         undefined_symbols_, any_claimed_, and any_added_.  Declare
6364         Plugin_rescan as friend.  Declare new functions.
6365         (Plugin_manager::Rescannable): Define type.
6366         (Plugin_manager::Rescannable_list): Define type.
6367         (Plugin_manager::Undefined_symbol_list): Define type.
6368         (Plugin_manager::Plugin_manager): Initialize new fields.
6369         * archive.cc (Archive::defines_symbol): New function.
6370         (Add_archive_symbols::run): Pass archive to plugins if any.
6371         * archive.h (class Archive): Declare defines_symbol.
6372         * readsyms.cc (Input_group::~Input_group): New function.
6373         (Finish_group::run): Pass input_group to plugins if any.
6374         * readsyms.h (class Input_group): Declare destructor.
6375         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
6376         any.
6377
6378 2011-01-10  Ian Lance Taylor  <iant@google.com>
6379
6380         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
6381         section as relro.
6382         (Layout::set_segment_offsets): Reset increase_relro before calling
6383         set_section_addresses a second time.
6384
6385 2011-01-04  Cary Coutant  <ccoutant@google.com>
6386
6387         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
6388         sections before NOBITS sections.
6389
6390 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
6391
6392         * version.cc (print_version): Update copyright to 2011.
6393
6394 2010-12-23  Cary Coutant  <ccoutant@google.com>
6395
6396         * output.h (Output_data_reloc::add_output_section): Pass OD instead
6397         of OS to this->add.  Add OD parameter to second form of the function.
6398
6399 2010-12-20  Ian Lance Taylor  <iant@google.com>
6400
6401         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
6402         second of two consecutive entries with same offset.
6403
6404 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6405
6406         * testsuite/Makefile.am (ifuncmain2static_LDADD)
6407         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
6408         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
6409         to avoid unneeded links against $(LDADD).
6410         * testsuite/Makefile.in: Regenerate.
6411
6412 2010-12-15  Ian Lance Taylor  <iant@google.com>
6413
6414         PR gold/12324
6415         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
6416         for R_X86_64_32 and R_X86_64_PC32.
6417         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
6418         ver_matching_def_pic.o.
6419         (ver_matching_def_pic.o): New target.
6420
6421 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6422
6423         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
6424         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
6425         Move definition before File_read::View member definitions.
6426         (File_read::View::~View): Initialize and hold lock before
6427         updating current_mapped_bytes.
6428
6429 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6430
6431         * dwarf_reader.cc: Remove outdated comment.
6432         * gold-threads.cc: Fix typo in error message.
6433         * archive.cc: Fix typos in comments.
6434         * archive.h: Likewise.
6435         * arm-reloc-property.cc: Likewise.
6436         * arm-reloc-property.h: Likewise.
6437         * arm-reloc.def: Likewise.
6438         * arm.cc: Likewise.
6439         * attributes.h: Likewise.
6440         * cref.cc: Likewise.
6441         * ehframe.cc: Likewise.
6442         * fileread.h: Likewise.
6443         * gold.h: Likewise.
6444         * i386.cc: Likewise.
6445         * icf.cc: Likewise.
6446         * incremental.h: Likewise.
6447         * int_encoding.cc: Likewise.
6448         * layout.h: Likewise.
6449         * main.cc: Likewise.
6450         * merge.h: Likewise.
6451         * object.cc: Likewise.
6452         * object.h: Likewise.
6453         * options.cc: Likewise.
6454         * readsyms.cc: Likewise.
6455         * reduced_debug_output.cc: Likewise.
6456         * reloc.cc: Likewise.
6457         * script-sections.cc: Likewise.
6458         * sparc.cc: Likewise.
6459         * symtab.h: Likewise.
6460         * target-reloc.h: Likewise.
6461         * target.cc: Likewise.
6462         * target.h: Likewise.
6463         * timer.cc: Likewise.
6464         * timer.h: Likewise.
6465         * x86_64.cc: Likewise.
6466
6467 2010-12-09  Cary Coutant  <ccoutant@google.com>
6468
6469         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
6470         stack.
6471         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
6472         parameter; change all callers.
6473         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
6474         * options.h (warn_execstack): New option.
6475
6476 2010-12-07  Doug Kwan  <dougkwan@google.com>
6477
6478         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
6479         like function call relocations.
6480
6481 2010-12-07  Ian Lance Taylor  <iant@google.com>
6482
6483         * archive.cc (Archive::get_elf_object_for_member): Permit
6484         punconfigured to be NULL.
6485         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
6486         (Archive::include_member): Pass NULL to get_elf_object_for_member
6487         if we searched for the archive and this is the first included
6488         object.
6489
6490 2010-12-01  Ian Lance Taylor  <iant@google.com>
6491
6492         * dwarf_reader.h (class Sized_dwarf_line_info): Add
6493         track_relocs_type_ field.
6494         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6495         Set track_relocs_type_.
6496         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
6497         contents when using RELA relocs.
6498         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
6499         reloc_map_.
6500         * reloc.cc (Track_relocs::next_addend): New function.
6501         * reloc.h (class Track_relocs): Declare next_addend.
6502
6503 2010-12-01  Ian Lance Taylor  <iant@google.com>
6504
6505         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
6506         virtual destructor.
6507
6508 2010-12-01  Ian Lance Taylor  <iant@google.com>
6509
6510         * README: Update compilers known to work and fail.
6511
6512 2010-11-23  Matthias Klose  <doko@ubuntu.com>
6513
6514         * configure.in: For --enable-gold, handle value `default' instead of
6515         `both*'.  Always install ld as ld.bfd, install as ld if gold is
6516         not the default.
6517         * configure: Regenerate.
6518
6519 2010-11-18  Doug Kwan  <dougkwan@google.com>
6520
6521         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
6522         and right_alignment to be zero.  Store result alignment only if it is
6523         greater than existing alignment.
6524
6525 2010-11-16  Cary Coutant  <ccoutant@google.com>
6526
6527         PR gold/12220
6528         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6529         Check for ".zdebug_line".
6530
6531 2010-11-16  Doug Kwan  <dougkwan@google.com>
6532             Cary Coutant  <ccoutant@google.com>
6533
6534         * output.h (Output_segment::set_section_addresses): Pass increase_relro
6535         by reference; adjust all callers.
6536         * output.cc (Output_segment::set_section_addresses): Adjust references
6537         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
6538         list is empty.
6539         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
6540         end at page boundary.
6541
6542 2010-11-16  Cary Coutant  <ccoutant@google.com>
6543
6544         PR gold/12220
6545         * layout.cc (Layout::choose_output_section): Transform names of
6546         compressed sections even when using a script with a SECTIONS clause.
6547         (Layout::output_section_name): Remove code to transform
6548         compressed debug section names.
6549         * output.cc (Output_section::add_input_section): Use uncompressed
6550         section size when tracking input sections.
6551
6552 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
6553
6554         * symtab.h (Symbol::NON_PIC_REF): Remove.
6555         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
6556         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
6557         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
6558         (Symbol::use_plt_offset): Take a flags argument and pass it
6559         directly to needs_dynamic_reloc.  Restrict check for undefined
6560         weak symbols to function calls.
6561         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
6562         (Target_arm::Scan::global): Use it.
6563         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
6564         (Target_arm::Relocate::relocate): Likewise.
6565         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
6566         parameter with an r_type parameter.  Use get_reference_flags
6567         to get the flags.
6568         (Target_arm::Relocate::relocate): Update accordingly.
6569         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
6570         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
6571         (Target_i386::Scan::global): Likewise.
6572         (Target_i386::Relocate::relocate): Likewise.
6573         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
6574         parameter with an r_type parameter.  Use get_reference_flags
6575         to get the flags.
6576         (Target_i386::Relocate::relocate): Update accordingly.
6577         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
6578         (Target_powerpc::Scan::global): Use it.
6579         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
6580         (Target_powerpc::Relocate::relocate): Likewise.
6581         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
6582         (Target_sparc::Scan::global): Use it.
6583         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
6584         (Target_sparc::Relocate::relocate): Likewise.
6585         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
6586         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
6587         (Target_x86_64::Scan::global): Likewise.
6588         (Target_x86_64::Relocate::relocate): Likewise.
6589
6590 2010-11-08  Doug Kwan  <dougkwan@google.com>
6591             Cary Coutant  <ccoutant@google.com>
6592
6593         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
6594         (Arm_exidx_merge_section::section_contents_): New data member.
6595         (Arm_input_section::Arm_input_section): Initialize original_contents_.
6596         (Arm_input_section::~Arm_input_section): De-allocate memory.
6597         (Arm_input_section::original_contents_): New data member.
6598         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
6599         in parameters instead of calling Object::section_contents without
6600         locking.
6601         (Arm_output_section::group_section): New parameter TASK.  Pass it
6602         to callees that need locking objects.
6603         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
6604         to lock EXIDX input sections.  Fix a formatting issue.  Call
6605         Arm_exidx_merged_section::build_contents to create merged section
6606         contents.
6607         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
6608         to lock object of stub table owner.
6609         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
6610         TEXT_SIZE to initialize data member TEXT_SIZE_.
6611         (Arm_exidx_input_section::addralign): Fix typo in comment.
6612         (Arm_exidx_input_section::text_size): New method.
6613         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
6614         that require locking objects.  Lock objects before scanning for stubs
6615         and updating local symbols.
6616         (Arm_input_section<big_endian>::init): Copy contents of original
6617         input section.
6618         (Arm_input_section<big_endian>::do_write): Use saved contents of
6619         original input section instead of calling Object::section_contents
6620         without locking.
6621         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
6622         size without calling Object::section_size().
6623         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
6624         for size.  Allocate a buffer for merged EXIDX entries.
6625         (Arm_exidx_merged_section::build_contents): New method.
6626         (Arm_exidx_merged_section::do_write): Move merge section contents
6627         building code to Arm_exidx_merged_section::build_contetns.  Write
6628         out contetns in buffer instead of building it on the fly.
6629         (Arm_relobj::make_exidx_input_section): Also pass text section size
6630         to Arm_exidx_input_section constructor.
6631         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
6632         (Arm_dynobj::do_read_symbols): Fix memory leak.
6633         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
6634         * target.h: (class Task): Add forward declaration.
6635         (Target::relax): Add new parameter TASK and pass it to
6636         Target::do_relax().
6637         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
6638
6639 2010-11-05  Cary Coutant  <ccoutant@google.com>
6640
6641         PR gold/10708
6642         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
6643         object when reading from the file.
6644         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
6645         second layout pass.
6646         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
6647         when reading section contents.
6648         (get_section_contents): Likewise.
6649         (icf::find_identical_sections): Likewise.
6650         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
6651         object when reading from the file.
6652         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
6653         the object when doing deferred section layout.
6654
6655 2010-11-03  Nick Clifton  <nickc@redhat.com>
6656
6657         PR gold/12001
6658         * script.h (class Symbol_assignment: name): New member.  Returns
6659         the name of the symbol.
6660         * scrfipt.cc (Script_options::is_pending_assignment): New member.
6661         Returns true if the given symbol name is on the list of
6662         assignments wating to be processed.
6663         * archive.cc (should_incldue_member): If the symbol is undefined,
6664         check to see if it is on the list of symbols pending assignment.
6665
6666 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
6667
6668         * script-sections.cc (Script_sections::find_memory_region): Check
6669         for a NULL output section pointer.
6670
6671 2010-10-29  Doug Kwan  <dougkwan@google.com>
6672
6673         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
6674         Output_section::add_relaxed_input_section.
6675         * output.cc (Output_section::add_relaxed_input_section): Add new
6676         arguments LAYOUT and NAME.  Set section order index.
6677         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6678         Copy section order index.
6679         * output.h (Output_section::add_relaxed_input_section): Add new
6680         arguments LAYOUT and NAME.
6681
6682 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6683
6684         * testsuite/Makefile.am: Move gcctestdir/ld rule to
6685         NATIVE_OR_CROSS_LINKER.
6686         * testsuite/Makefile.in: Regenerate.
6687
6688 2010-10-20  Doug Kwan  <dougkwan@google.com>
6689
6690         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
6691         without SHF_LINK_ORDER flags.
6692         * layout.cc (Layout::choose_output_section): Do not filter
6693         SHF_LINK_ORDER flag in a relocatable link.
6694
6695 2010-10-17  Cary Coutant  <ccoutant@google.com>
6696
6697         * output.h (Output_segment::set_section_addresses): Change function
6698         signature.  Update all callers.
6699         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
6700         sections.
6701         (Output_segment::set_section_addresses): Align after last TLS
6702         section.  Add padding before last relro section instead of after.
6703
6704 2010-10-17  Doug Kwan  <dougkwan@google.com>
6705
6706         * gold/arm.cc (Target_arm::got_section): Use correct order and set
6707         GOT output section to be writable.
6708
6709 2010-10-14  Cary Coutant  <ccoutant@google.com>
6710
6711         * debug.h (DEBUG_INCREMENTAL): New flag.
6712         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
6713         * gold.cc (queue_initial_tasks): Check parameters for incremental link
6714         mode.
6715         * incremental.cc (report_command_line): Ignore all forms of
6716         --incremental.
6717         * layout.cc (Layout::Layout): Check parameters for incremental link
6718         mode.
6719         * options.cc (General_options::parse_incremental): New function.
6720         (General_options::parse_no_incremental): New function.
6721         (General_options::parse_incremental_full): New function.
6722         (General_options::parse_incremental_update): New function.
6723         (General_options::incremental_mode_): New data member.
6724         (General_options::finalize): Check incremental_mode_.
6725         * options.h (General_options): Update help text for --incremental.
6726         Add --no-incremental, --incremental-full, --incremental-update.
6727         (General_options::Incremental_mode): New enum type.
6728         (General_options::incremental_mode): New function.
6729         (General_options::incremental_mode_): New data member.
6730         * parameters.cc (Parameters::incremental_mode_): New data member.
6731         (Parameters::set_options): Set incremental_mode_.
6732         (Parameters::set_incremental_full): New function.
6733         (Parameters::incremental): New function.
6734         (Parameters::incremental_update): New function.
6735         (set_parameters_incremental_full): New function.
6736         * parameters.h (Parameters::set_incremental_full): New function.
6737         (Parameters::incremental): New function.
6738         (Parameters::incremental_update): New function.
6739         (Parameters::incremental_mode_): New data member.
6740         (set_parameters_incremental_full): New function.
6741         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
6742         incremental link mode.
6743         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
6744         (Sized_relobj::do_relocate_sections): Likewise.
6745         * testsuite/Makefile.am (incremental_test): Use --incremental-full
6746         option.
6747         * testsuite/Makefile.in: Regenerate.
6748         * testsuite/incremental_test.sh: Filter all forms of --incremental.
6749
6750 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6751
6752         * script-sections.h (class Script_sections): Make
6753         Sections_elements typedef public.
6754         * script-sections.cc (class Sort_output_sections): Add elements_
6755         field.  Add constructor which sets it; change all callers.
6756         (Sort_output_sections::is_before): New function.
6757         (Sort_output_sections::operator()): Call is_before.
6758         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
6759         conditional.
6760         * testsuite/script_test_10.sh: New test. Test script section
6761         order.
6762         * testsuite/script_test_10.t: Likewise.
6763         * testsuite/script_test_10.s: Likewise.
6764         * testsuite/Makefile.am: Wrap the cross linker tests and the
6765         common tests into NATIVE_OR_CROSS_LINKER.
6766         (check_SCRIPTS): Add script_test_10.sh.
6767         (check_DATA): Add script_test_10.stdout.
6768         (script_test_10.o, script_test_10): New targets.
6769         (script_test_10.stdout): New target.
6770         * configure, testsuite/Makefile.in: Regenerate.
6771
6772 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6773
6774         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
6775         error for the deprecated relocations.
6776         (Target_arm::Scan::global): Likewise.
6777         (Target_arm::Relocate::relocate): Likewise.
6778
6779 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
6780
6781         * fileread.cc (Input_file::find_file): Initialize *found_name
6782         and *namep when using the fallback search for case 4.
6783
6784 2010-10-11  Cary Coutant  <ccoutant@google.com>
6785
6786         * options.h (class General_options): Redefine -z lazy as an alias for
6787         the negation of -z now.
6788
6789 2010-10-11  Ian Lance Taylor  <iant@google.com>
6790
6791         * resolve.cc (symbol_to_bits): Report the value of the unsupported
6792         binding.
6793
6794 2010-10-06  Nick Clifton  <nickc@redhat.com>
6795
6796         * script-sections.cc(class Memory_region): Remove
6797         current_lma_offset_ field.  Rename current_vma_offset_ to
6798         current_offset_.  Add last_section_ field.
6799         (Memory_region::get_current_vma_address): Rename to
6800         get_current_address.
6801         (Memory_region::get_current_lma_address): Delete.
6802         (Memory_region::increment_vma_offset): Rename to
6803         increment_offset.
6804         (Memory_region::increment_lma_offset): Delete.
6805         (Memory_region::attributes_compatible): New method.  Returns
6806         true if the provided section is compatible with the region.
6807         (Memory_region::get_last_section): New method.  Returns the last
6808         section to use the region.
6809         (Memory_region::set_last_section): New method.  Stores the last
6810         section to use the region.
6811         (Script_sections::block_in_region): New method.  Returns true if
6812         a block of memory is contained within a region.
6813         (Script_sections::find_memory_region): New method.  Locates a
6814         memory region to be used to set a VMA or LMA address.
6815         (Output_section_definition::set_section_addresses): Add code to
6816         check for addresses set by memory regions.
6817         (Output_segment::set_section_addresses): Remove memory region
6818         walking code.
6819         (Script_sections::create_segment): Add a warning if a header
6820         segment is created outside of any region.
6821         * script-sections.h (class Script_sections): Add prototypes for
6822         find_memory_region and block_in_region methods.
6823         * testsuite/memory_test.s: Use .long instead of .word.
6824         * testsuite/memory_test.t: Add some more output sections.
6825         * testsuite/memory_test.sh: Update expected output.
6826
6827 2010-10-02  Doug Kwan  <dougkwan@google.com>
6828
6829         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
6830         defintion to symtab.h
6831         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
6832         declaration to defintion.
6833
6834 2010-10-01  Nick Clifton  <nickc@redhat.com>
6835
6836         * expression.cc (eval): Replace dummy argument with NULL.
6837         (eval_maybe_dot): Check for a NULL result section pointer.
6838         (Symbol_expression::value): Likewise.
6839         (Dot_expression::value): Likewise.
6840         (BINARY_EXPRESSION): Likewise.
6841         (Max_expression::value): Likewise.
6842         (Min_expression::value): Likewise.
6843         (Absolute_expression::value): Likewise.
6844         (Addr_expression::value_from_output_section): Likewise.
6845         (Loaddddr_expression::value_from_output_section): Likewise.
6846         (Segment_start_expression::value): Likewise.
6847         * script-sections.cc
6848         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
6849         argument with NULL.
6850         (Sections_elememt_dot_assignment::set_section_addresses):
6851         Likewise.
6852         (Output_data_expression::do_write_to_buffer): Likewise.
6853         (Output_section_definition::finalize_symbols): Likewise.
6854         (Output_section_definition::set_section_addresses): Likewise.
6855
6856 2010-09-30  Doug Kwan  <dougkwan@google.com>
6857
6858         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
6859
6860 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
6861
6862         * target.h (Target::can_icf_inline_merge_sections): New virtual
6863         function.
6864         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
6865         virtual function.
6866         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
6867         virtual function.
6868         * icf.cc (get_section_contents): Inline merge sections only when
6869         target allows it.
6870
6871 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6872
6873         * configure: Regenerate.
6874
6875 2010-09-17  Ian Lance Taylor  <iant@google.com>
6876
6877         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
6878         * testsuite/Makefile.am (memory_test.o): New target.
6879         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
6880         memory_test.t.
6881         * testsuite/Makefile.in: Rebuild.
6882
6883 2010-09-17  Doug Kwan  <dougkwan@google.com>
6884
6885         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
6886         defintion if relocation uses GOT entries of the symbol.
6887         * testsuite/icf_safe_test.sh: Fix test.
6888         * testsuite/icf_safe_so_test.sh: Fix test.
6889
6890 2010-09-16  Cary Coutant  <ccoutant@google.com>
6891
6892         * script_sections.cc (class Memory_region): Remove "NULL" from
6893         vector initializations.
6894
6895 2010-09-15  Cary Coutant  <ccoutant@google.com>
6896
6897         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
6898         Resolve forwarding symbols.
6899
6900 2010-09-15  Doug Kwan  <dougkwan@google.com>
6901
6902         * gold/testsuite/script_test_3.t: Add ARM special sections.
6903         * gold/testsuite/script_test_4.t: Same.
6904         * gold/testsuite/script_test_5.t: Same.
6905         * gold/testsuite/script_test_6.t: Same.
6906         * gold/testsuite/script_test_7.t: Same.
6907         * gold/testsuite/script_test_7.t: Same.
6908         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
6909
6910 2010-09-14  Cary Coutant  <ccoutant@google.com>
6911
6912         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
6913         (Target_x86_64::Relocate::relocate_tls): Replace check for
6914         saw_tls_block_reloc_ with test for executable section.
6915
6916 2010-09-12  Cary Coutant  <ccoutant@google.com>
6917
6918         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
6919         position-independent executables to shared libraries need dynamic
6920         relocations.
6921         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
6922         position-independent executables.
6923         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
6924         * testsuite/Makefile.in: Regenerate.
6925
6926 2010-09-10  Nick Clifton  <nickc@redhat.com>
6927
6928         PR gold/11997
6929         * testsuite/memory_test.t: Discard any sections that are not
6930         needed.
6931
6932 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
6933
6934         PR gold/11996
6935         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
6936         "This::" to work around a bug in gcc 4.2.
6937
6938         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
6939
6940 2010-09-09  Rafael Espindola  <espindola@google.com>
6941
6942         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
6943         sections with different PF_X flags in the same segment.
6944         (Layout::find_first_load_seg): Search all segments to find the first
6945         one.
6946         * options.h (rosegment): New.
6947
6948 2010-09-08  Rafael Espindola  <espindola@google.com>
6949
6950         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
6951
6952 2010-09-08  Doug Kwan  <dougkwan@google.com>
6953
6954         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
6955         (Arm_relobj::do_relocate_sections): Add new parameter for output
6956         file to match the parent.
6957         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
6958         of local symbols instead of input values.  Update code to track
6959         changes in gold::relocate_section.
6960         * object.cc (Sized_relobj::compute_final_local_value): New methods.
6961         (Sized_relobj::compute_final_local_value_internal): New methods.
6962         (Sized_relobj::do_finalize_local_symbols): Move code from loop
6963         body into private version of Sized_relobj::compute_final_local_value.
6964         Call the inline method.
6965         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
6966         merged symbol value if there is one.
6967         (Symbol_value::has_output_value): New method defintiion.
6968         (Sized_relobj::Compute_final_local_value_status): New enum type.
6969         (Sized_relobj::compute_final_local_value): New methods.
6970         (Sized_relobj::compute_final_local_value_internal): New methods.
6971         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
6972         and arm_cortex_a8.sh.
6973         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
6974         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
6975         New tests.
6976         * Makefile.in: Regenerate.
6977         * testsuite/arm_bl_out_of_range.s: Update test.
6978         * testsuite/thumb_bl_out_of_range.s: Ditto.
6979         * testsuite/thumb_blx_out_of_range.s: Ditto.
6980         * testsuite/arm_branch_out_of_range.sh: New file.
6981         * testsuite/arm_cortex_a8.sh: Ditto.
6982         * testsuite/arm_cortex_a8_b.s: Ditto.
6983         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
6984         * testsuite/arm_cortex_a8_b_local.s: Ditto.
6985         * testsuite/arm_cortex_a8_bl.s: Ditto.
6986         * testsuite/arm_cortex_a8_blx.s: Ditto.
6987         * testsuite/arm_cortex_a8_local.s: Ditto.
6988         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
6989         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
6990
6991 2010-09-08  Rafael Espindola  <espindola@google.com>
6992
6993         * Makefile.am (memory_test.stdout): Run readelf with -W.
6994         * Makefile.in: Regenerate.
6995         * testsuite/memory_test.sh: Make the regexps accept both 32 and
6996         64 bit output.
6997
6998 2010-09-08  Rafael Espindola  <espindola@google.com>
6999
7000         * script-sections.cc (Script_sections::add_memory_region): Convert
7001         field precision to int.
7002         * script.cc (script_set_section_region, script_set_section_region):
7003         Convert field precision to int.
7004
7005 2010-09-08  Rafael Espindola  <espindola@google.com>
7006
7007         * arm.cc (do_finalize_sections): Create the __exidx_start and
7008         __exdix_end symbols even when the section is missing.
7009
7010 2010-09-08  Nick Clifton  <nickc@redhat.com>
7011
7012         * README: Remove claim that MEMORY is not supported.
7013         * expression.cc (script_exp_function_origin)
7014         (script_exp_function_length): Move from here to ...
7015         * script.cc: ... here.
7016         (script_set_section_region, script_add_memory)
7017         (script_parse_memory_attr, script_include_directive): New
7018         functions.
7019         * script-sections.cc
7020         (class Memory_region): New class.
7021         (class Output_section_definition): Add set_memory_region,
7022         set_section_vma, set_section_lma and get_section_name methods.
7023         (class Script_Sections): Add add_memory_region,
7024         find_memory_region, find_memory_region_origin,
7025         find_memory_region_length and set_memory_region methods.
7026         Have set_section_addresses method walk the list of set memory
7027         regions.
7028         Extend the print methos to display memory regions.
7029         * script-sections.h: Add prototypes for new methods.
7030         Add enum for MEMORY region attributes.
7031         * yyscript.y: Add support for parsing MEMORY regions.
7032         * script-c.h: Add prototypes for new functions.
7033         * testsuite/Makefile.am: Add test of MEMORY region functionality.
7034         * testsuite/Makefile.in: Regenerate.
7035         * testsuite/memory_test.sh: New script.
7036         * testsuite/memory_test.s: New assembler source file.
7037         * testsuite/memory_test.t: New linker script.
7038
7039 2010-08-27  Doug Kwan  <dougkwan@google.com>
7040
7041         * gold/resolve.cc (Symbol_table::should_override): Let a weak
7042         reference override an existing dynamic weak reference.
7043         * testsuite/Makefile.am: Add new test dyn_weak_ref.
7044         * testsuite/Makefile.in: Regenerate.
7045         * testsuite/dyn_weak_ref.sh: New file.
7046         * testsuite/dyn_weak_ref_1.c: Ditto.
7047         * testsuite/dyn_weak_ref_2.c: Ditto.
7048
7049 2010-08-27  Ian Lance Taylor  <iant@google.com>
7050
7051         * incremental.h (class Incremental_input_entry): Add virtual
7052         destructor.
7053
7054 2010-08-27  Ian Lance Taylor  <iant@google.com>
7055
7056         * testsuite/start_lib_test_3.c: Mark t3 as used.
7057
7058 2010-08-27  Nick Clifton  <nickc@redhat.com>
7059
7060         * options.cc (version_script): Fix small typo in previous
7061         whitespace tidyup.
7062
7063 2010-08-25  Nick Clifton  <nickc@redhat.com>
7064
7065         * archive.cc: Formatting fixes: Remove whitespace between
7066         typename and following asterisk.  Remove whitespace between
7067         function name and opening parenthesis.
7068         * archive.h: Likewise.
7069         * arm.cc: Likewise.
7070         * attributes.cc: Likewise.
7071         * attributes.h: Likewise.
7072         * common.cc: Likewise.
7073         * copy-relocs.cc: Likewise.
7074         * dirsearch.h: Likewise.
7075         * dynobj.cc: Likewise.
7076         * ehframe.cc: Likewise.
7077         * ehframe.h: Likewise.
7078         * expression.cc: Likewise.
7079         * fileread.cc: Likewise.
7080         * fileread.h: Likewise.
7081         * gc.h: Likewise.
7082         * gold-threads.cc: Likewise.
7083         * gold.cc: Likewise.
7084         * i386.cc: Likewise.
7085         * icf.h: Likewise.
7086         * incremental-dump.cc: Likewise.
7087         * incremental.cc: Likewise.
7088         * layout.cc: Likewise.
7089         * layout.h: Likewise.
7090         * main.cc: Likewise.
7091         * merge.cc: Likewise.
7092         * merge.h: Likewise.
7093         * object.cc: Likewise.
7094         * object.h: Likewise.
7095         * options.cc: Likewise.
7096         * options.h: Likewise.
7097         * output.cc: Likewise.
7098         * output.h: Likewise.
7099         * plugin.cc: Likewise.
7100         * plugin.h: Likewise.
7101         * powerpc.cc: Likewise.
7102         * reloc.cc: Likewise.
7103         * script-c.h: Likewise.
7104         * script-sections.cc: Likewise.
7105         * script.cc: Likewise.
7106         * stringpool.cc: Likewise.
7107         * symtab.cc: Likewise.
7108         * symtab.h: Likewise.
7109         * target.cc: Likewise.
7110         * timer.cc: Likewise.
7111         * timer.h: Likewise.
7112         * version.cc: Likewise.
7113         * x86_64.cc: Likewise.
7114
7115 2010-08-24  Nick Clifton  <nickc@redhat.com>
7116
7117         PR 11899
7118         * layout.cc (segment_precedes): Sort segments by their physical
7119         addresses, if they have been set.
7120
7121 2010-08-23  Cary Coutant  <ccoutant@google.com>
7122
7123         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
7124         symbols data.
7125         (Lib_group::include_member): Unlock object after deleting its
7126         symbols data.
7127         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
7128         the bug fixed here.
7129
7130 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
7131             Cary Coutant  <ccoutant@google.com>
7132
7133         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
7134         constructor, and set_blocker.
7135         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
7136         readsyms_blocker_.
7137         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
7138         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
7139         * testsuite/Makefile.am (start_lib_test): New test case.
7140         * testsuite/Makefile.in: Regenerate.
7141         * testsuite/start_lib_test_main.c: New file.
7142         * testsuite/start_lib_test_1.c: New file.
7143         * testsuite/start_lib_test_2.c: New file.
7144         * testsuite/start_lib_test_3.c: New file.
7145
7146 2010-08-19  Ian Lance Taylor  <iant@google.com>
7147
7148         * Makefile.in: Rebuild with automake 1.11.1.
7149         * aclocal.m4: Likewise.
7150         * testsuite/Makefile.in: Likewise.
7151
7152 2010-08-19  Ian Lance Taylor  <iant@google.com>
7153
7154         PR 10893
7155         * i386.cc (class Output_data_plt_i386): Update declarations.
7156         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
7157         local_ifuncs_ fields.
7158         (Target_i386::do_plt_section_for_global): New function.
7159         (Target_i386::do_plt_section_for_local): New function.
7160         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
7161         parameter; change all callers.  Initialize global_ifuncs_ and
7162         local_ifuncs_.  If doing a static link define __rel_iplt_start and
7163         __rel_iplt_end.
7164         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
7165         (Output_data_plt_i386::add_local_ifunc_entry): New function.
7166         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
7167         symbols.
7168         (Target_i386::make_plt_section): New function, broken out of
7169         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
7170         (Target_i386::make_plt_entry): Call make_plt_section.
7171         (Target_i386::make_local_ifunc_plt_entry): New function.
7172         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
7173         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
7174         R_386_IRELATIVE to switch.
7175         (Target_i386::Scan::global): Likewise.
7176         (Target_i386::Relocate::relocate): Likewise.
7177         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
7178         switch.
7179         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
7180         (Target_x86_64::do_plt_section_for_global): New function.
7181         (Target_x86_64::do_plt_section_for_local): New function.
7182         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
7183         parameter; change all callers.  If doing a static link define
7184         __rela_iplt_start and __rela_iplt_end.
7185         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
7186         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
7187         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
7188         to point to .plt.
7189         (Target_x86_64::make_local_ifunc_plt_entry): New function.
7190         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
7191         switch.
7192         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
7193         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
7194         R_X86_64_IRELATIVE to switch.
7195         (Target_x86_64::Scan::global): Likewise.
7196         (Target_x86_64::Relocate::relocate): Likewise.
7197         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
7198         switch.
7199         * target.h (class Target): Add plt_section_for_global and
7200         plt_section_for_local functions.  Add do_plt_section_for_global
7201         and do_plt_section_for_local virtual functions.
7202         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
7203         clarifying comments.
7204         (Symbol::use_plt_offset): Handle IFUNC symbol.
7205         * object.cc (Sized_relobj::Sized_relobj): Initialize
7206         local_plt_offsets_.
7207         (Sized_relobj::local_has_plt_offset): New function.
7208         (Sized_relobj::local_plt_offset): New function.
7209         (Sized_relobj::set_local_plt_offset): New function.
7210         (Sized_relobj::do_count): Handle IFUNC symbol.
7211         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
7212         a bit away from input_shndx_ field.  Add set_is_func_symbol and
7213         is_ifunc_symbol functions.
7214         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
7215         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
7216         local_plt_offsets_ field.
7217         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
7218         * output.h (class Output_section_data): Add non-const
7219         output_section function.
7220         (class Output_data_got): Update declarations.
7221         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
7222         Add use_plt_offset parameter to global and local constructors.
7223         Change all callers.  Change local_sym_index_ field to 31 bits.
7224         Change GSYM_CODE and CONSTANT_CODE accordingly.
7225         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
7226         doing a static link don't set sh_link field.
7227         (Output_data_got::Got_entry::write): Use PLT offset if
7228         appropriate.
7229         (Output_data_got::add_global_plt): New function.
7230         (Output_data_got::add_local_plt): New function.
7231         * target-reloc.h (relocate_section): Handle IFUNC symbol.
7232         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
7233         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
7234         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
7235         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
7236         IFUNC conditional.
7237         * testsuite/ifunc-sel.h: New file.
7238         * testsuite/ifuncmain1.c: New file.
7239         * testsuite/ifuncmain1vis.c: New file.
7240         * testsuite/ifuncmod1.c: New file.
7241         * testsuite/ifuncdep2.c: New file.
7242         * testsuite/ifuncmain2.c: New file.
7243         * testsuite/ifuncmain3.c: New file.
7244         * testsuite/ifuncmod3.c: New file.
7245         * testsuite/ifuncmain4.c: New file.
7246         * testsuite/ifuncmain5.c: New file.
7247         * testsuite/ifuncmod5.c: New file.
7248         * testsuite/ifuncmain6pie.c: New file.
7249         * testsuite/ifuncmod6.c: New file.
7250         * testsuite/ifuncmain7.c: New file.
7251         * configure, testsuite/Makefile.in: Rebuild.
7252
7253 2010-08-18  Ian Lance Taylor  <iant@google.com>
7254
7255         * incremental.cc
7256         (Output_section_incremental_inputs::write_input_files): Add cast
7257         to avoid signed/unsigned comparison warning.
7258         (Output_section_incremental_inputs::write_info_blocks): Likewise.
7259
7260 2010-08-12  Cary Coutant  <ccoutant@google.com>
7261
7262         * common.cc (Sort_commons::operator()): Remove unnecessary code.
7263
7264 2010-08-13  Ian Lance Taylor  <iant@google.com>
7265
7266         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
7267
7268 2010-08-12  Cary Coutant  <ccoutant@google.com>
7269             Doug Kwan  <dougkwan@google.com>
7270
7271         * resolve.cc (Symbol_table::should_override): When a weak dynamic
7272         defintion overrides non-weak undef, remember that the original undef
7273         is not weak.
7274         * symtab.cc (Symbol_table::sized_write_global): For undef without
7275         an original weak binding, set binding to global in output.
7276         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
7277         * testsuite/Makefile.in: Regenerate.
7278         * testsuite/strong_ref_weak_def.sh: New file.
7279         * testsuite/strong_ref_weak_def_1.c: Ditto.
7280         * testsuite/strong_ref_weak_def_2.c: Ditto.
7281
7282 2010-08-12  Cary Coutant  <ccoutant@google.com>
7283
7284         * testsuite/incremental_test.sh: Rewrite.
7285         * testsuite/incremental_test_1.c: Rewrite.
7286         * testsuite/incremental_test_2.c: Rewrite.
7287
7288 2010-08-12  Cary Coutant  <ccoutant@google.com>
7289
7290         * arm.cc (Target_arm::got_size): Add const.
7291         (Target_arm::got_entry_count): New function.
7292         (Target_arm::plt_entry_count): New function.
7293         (Target_arm::first_plt_entry_offset): New function.
7294         (Target_arm::plt_entry_size): New function.
7295         (Output_data_plt_arm::entry_count): New function.
7296         (Output_data_plt_arm::first_plt_entry_offset): New function.
7297         (Output_data_plt_arm::get_plt_entry_size): New function.
7298         * i386.cc (Target_i386::got_size): Add const.
7299         (Target_i386::got_entry_count): New function.
7300         (Target_i386::plt_entry_count): New function.
7301         (Target_i386::first_plt_entry_offset): New function.
7302         (Target_i386::plt_entry_size): New function.
7303         (Output_data_plt_i386::entry_count): New function.
7304         (Output_data_plt_i386::first_plt_entry_offset): New function.
7305         (Output_data_plt_i386::get_plt_entry_size): New function.
7306         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
7307         find_incremental_inputs_sections.  Dump incremental_got_plt section.
7308         * incremental.cc: Include target.h.
7309         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
7310         parameter.  Adjust all callers.  Find incremental_got_plt section.
7311         (Incremental_inputs::create_data_sections): Create incremental_got_plt
7312         section.
7313         (Output_section_incremental_inputs::set_final_data_size): Calculate
7314         size of incremental_got_plt section.
7315         (Output_section_incremental_inputs::do_write): Write the
7316         incremental_got_plt section.
7317         (Got_plt_view_info): New struct.
7318         (Local_got_offset_visitor): New class.
7319         (Global_got_offset_visitor): New class.
7320         (Global_symbol_visitor_got_plt): New class.
7321         (Output_section_incremental_inputs::write_got_plt): New function.
7322         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
7323         Add parameter.  Adjust all callers.
7324         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7325         (Incremental_inputs::got_plt_section): New function.
7326         (Incremental_inputs::got_plt_section_): New data member.
7327         (Incremental_got_plt_reader): New class.
7328         * layout.cc (Layout::create_incremental_info_sections): Add the
7329         incremental_got_plt section.
7330         * object.h (Got_offset_list::get_list): New function.
7331         (Got offset_list::for_all_got_offsets): New function.
7332         (Sized_relobj::local_got_offset_list): New function.
7333         * powerpc.cc (Target_powerpc::got_size): Add const.
7334         (Target_powerpc::got_entry_count): New function.
7335         (Target_powerpc::plt_entry_count): New function.
7336         (Target_powerpc::first_plt_entry_offset): New function.
7337         (Target_powerpc::plt_entry_size): New function.
7338         (Output_data_plt_powerpc::entry_count): New function.
7339         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
7340         (Output_data_plt_powerpc::get_plt_entry_size): New function.
7341         * sparc.cc (Target_sparc::got_size): Add const.
7342         (Target_sparc::got_entry_count): New function.
7343         (Target_sparc::plt_entry_count): New function.
7344         (Target_sparc::first_plt_entry_offset): New function.
7345         (Target_sparc::plt_entry_size): New function.
7346         (Output_data_plt_sparc::entry_count): New function.
7347         (Output_data_plt_sparc::first_plt_entry_offset): New function.
7348         (Output_data_plt_sparc::get_plt_entry_size): New function.
7349         * symtab.h (Symbol::got_offset_list): New function.
7350         (Symbol_table::for_all_symbols): New function.
7351         * target.h (Sized_target::got_entry_count): New function.
7352         (Sized_target::plt_entry_count): New function.
7353         (Sized_target::plt_entry_size): New function.
7354         * x86_64.cc (Target_x86_64::got_size): Add const.
7355         (Target_x86_64::got_entry_count): New function.
7356         (Target_x86_64::plt_entry_count): New function.
7357         (Target_x86_64::first_plt_entry_offset): New function.
7358         (Target_x86_64::plt_entry_size): New function.
7359         (Output_data_plt_x86_64::entry_count): New function.
7360         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
7361         (Output_data_plt_x86_64::get_plt_entry_size): New function.
7362
7363 2010-08-12  Cary Coutant  <ccoutant@google.com>
7364
7365         * archive.cc: Include incremental.h.
7366         (Archive::Archive): Initialize incremental_info_.
7367         (Archive::include_member): Record archive members in incremental info.
7368         (Add_archive_symbols::run): Record begin and end of an archive in
7369         incremental info.
7370         (Lib_group::include_member): Record objects in incremental info.
7371         * archive.h (Incremental_archive_entry): Forward declaration.
7372         (Archive::set_incremental_info): New member function.
7373         (Archive::incremental_info): New member function.
7374         (Archive::Unused_symbol_iterator): New class.
7375         (Archive::unused_symbols_begin): New member function.
7376         (Archive::unused_symbols_end): New member function.
7377         (Archive::incremental_info_): New data member.
7378         * incremental-dump.cc (find_input_containing_global): New function.
7379         (dump_incremental_inputs): Dump new incremental info sections.
7380         * incremental.cc: Include symtab.h.
7381         (Output_section_incremental_inputs): New class.
7382         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
7383         new incremental info sections.
7384         (Sized_incremental_binary::do_check_inputs): Likewise.
7385         (Incremental_inputs::report_archive): Remove.
7386         (Incremental_inputs::report_archive_begin): New function.
7387         (Incremental_inputs::report_archive_end): New function.
7388         (Incremental_inputs::report_object): New function.
7389         (Incremental_inputs::finalize_inputs): Remove.
7390         (Incremental_inputs::report_input_section): New function.
7391         (Incremental_inputs::report_script): Rewrite.
7392         (Incremental_inputs::finalize): Do nothing but finalize string table.
7393         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7394         (Incremental_inputs::sized_create_inputs_section_data): Remove.
7395         (Incremental_inputs::create_data_sections): New function.
7396         (Incremental_inputs::relocs_entsize): New function.
7397         (Output_section_incremental_inputs::set_final_data_size): New function.
7398         (Output_section_incremental_inputs::do_write): New function.
7399         (Output_section_incremental_inputs::write_header): New function.
7400         (Output_section_incremental_inputs::write_input_files): New function.
7401         (Output_section_incremental_inputs::write_info_blocks): New function.
7402         (Output_section_incremental_inputs::write_symtab): New function.
7403         * incremental.h (Incremental_script_entry): Forward declaration.
7404         (Incremental_object_entry): Forward declaration.
7405         (Incremental_archive_entry): Forward declaration.
7406         (Incremental_inputs): Forward declaration.
7407         (Incremental_inputs_header_data): Remove.
7408         (Incremental_inputs_header): Remove.
7409         (Incremental_inputs_header_write): Remove.
7410         (Incremental_inputs_entry_data): Remove.
7411         (Incremental_inputs_entry): Remove.
7412         (Incremental_inputs_entry_write): Remove.
7413         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
7414         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
7415         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7416         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
7417         Likewise.
7418         (Incremental_input_entry): New class.
7419         (Incremental_script_entry): New class.
7420         (Incremental_object_entry): New class.
7421         (Incremental_archive_entry): New class.
7422         (Incremental_inputs::Incremental_inputs): Initialize new data members.
7423         (Incremental_inputs::report_inputs): Remove.
7424         (Incremental_inputs::report_archive): Remove.
7425         (Incremental_inputs::report_archive_begin): New function.
7426         (Incremental_inputs::report_archive_end): New function.
7427         (Incremental_inputs::report_object): Change prototype.
7428         (Incremental_inputs::report_input_section): New function.
7429         (Incremental_inputs::report_script): Change prototype.
7430         (Incremental_inputs::get_reloc_count): New function.
7431         (Incremental_inputs::set_reloc_count): New function.
7432         (Incremental_inputs::create_data_sections): New function.
7433         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7434         (Incremental_inputs::inputs_section): New function.
7435         (Incremental_inputs::symtab_section): New function.
7436         (Incremental_inputs::relocs_section): New function.
7437         (Incremental_inputs::get_stringpool): Add const.
7438         (Incremental_inputs::command_line): Add const.
7439         (Incremental_inputs::inputs): Remove.
7440         (Incremental_inputs::command_line_key): New function.
7441         (Incremental_inputs::input_file_count): New function.
7442         (Incremental_inputs::input_files): New function.
7443         (Incremental_inputs::relocs_entsize): New function.
7444         (Incremental_inputs::sized_create_inputs_section_data): Remove.
7445         (Incremental_inputs::finalize_inputs): Remove.
7446         (Incremental_inputs::Input_info): Remove.
7447         (Incremental_inputs::lock_): Remove.
7448         (Incremental_inputs::inputs_): Change type.
7449         (Incremental_inputs::inputs_map_): Remove.
7450         (Incremental_inputs::current_object_entry_): New data member.
7451         (Incremental_inputs::inputs_section_): New data member.
7452         (Incremental_inputs::symtab_section_): New data member.
7453         (Incremental_inputs::relocs_section_): New data member.
7454         (Incremental_inputs::reloc_count_): New data member.
7455         (Incremental_inputs_reader): New class.
7456         (Incremental_symtab_reader): New class.
7457         (Incremental_relocs_reader): New class.
7458         * layout.cc (Layout::finalize): Move finalization of incremental info
7459         and creation of incremental info sections to follow finalization of
7460         symbol table.  Set offsets for postprocessing sections.
7461         (Layout::create_incremental_info_sections): Call
7462         Incremental_inputs::create_data_sections.  Add incremental symtab
7463         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
7464         sections to layout after input sections.
7465         * layout.h (struct Timespec): Forward declaration.
7466         (Layout::incremental_inputs): Add const.
7467         (Layout::create_incremental_info_sections): Add parameter.
7468         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
7469         * object.cc: Include incremental.h.
7470         (Relobj::finalize_incremental_relocs): New function.
7471         (Sized_relobj::do_layout): Record input sections in incremental info.
7472         * object.h (Object::output_section): New function.
7473         (Object::output_section_offset): Moved from Relobj.
7474         (Object::get_incremental_reloc_base): New function.
7475         (Object::get_incremental_reloc_count): New function.
7476         (Object::do_output_section): New function.
7477         (Object::do_output_section_offset): Moved from Relobj.
7478         (Object::do_get_incremental_reloc_base): New function.
7479         (Object::do_get_incremental_reloc_count): New function.
7480         (Object::Object): Initialize new data members.
7481         (Relobj::output_section): Renamed do_output_section and moved to
7482         protected.
7483         (Relobj::output_section_offset): Moved to Object.
7484         (Relobj::do_get_incremental_reloc_base): New function.
7485         (Relobj::do_get_incremental_reloc_count): New function.
7486         (Relobj::allocate_incremental_reloc_counts): New function.
7487         (Relobj::count_incremental_reloc): New function.
7488         (Relobj::finalize_incremental_relocs): New function.
7489         (Relobj::next_incremental_reloc_index): New function.
7490         (Relobj::reloc_counts_): New data member.
7491         (Relobj::reloc_bases_): New data member.
7492         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
7493         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
7494         (Sized_relobj::incremental_relocs_scan): New function.
7495         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7496         (Sized_relobj::incremental_relocs_write): New function.
7497         (Sized_relobj::incremental_relocs_write_reltype): New function.
7498         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
7499         incremental link.
7500         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
7501         archives and object files elsewhere.
7502         (Add_symbols::run): Report object files here.
7503         (Finish_group::run): Report end of archive at end of group.
7504         * reloc.cc: Include layout.h, incremental.h.
7505         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
7506         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
7507         (Sized_relobj::incremental_relocs_scan): New function.
7508         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7509         (Sized_relobj::do_relocate_sections): Write incremental relocations.
7510         (Sized_relobj::incremental_relocs_write): New function.
7511         (Sized_relobj::incremental_relocs_write_reltype): New function.
7512         * script.cc (read_input_script): Rewrite test for incremental link.
7513         Change call to Incremental_inputs::report_script.
7514         * symtab.h (Symbol_table::first_global_index): New function.
7515         (Symbol_table::output_count): New function.
7516
7517 2010-08-12  Doug Kwan  <dougkwan@google.com>
7518
7519         * arm.cc (Target_arm::merge_object_attributes): Check command line
7520         options --no-wchar-size-warning and --no-enum-size-warning.
7521         * options.h (General_options): Add ld-compatible options
7522         --no-enum-size-warning and --no-wchar-size-warning.
7523
7524 2010-08-04  Ian Lance Taylor  <iant@google.com>
7525
7526         * x86_64.cc (Target_x86_64::Scan::local): Use
7527         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
7528         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
7529         (Target_x86_64::Scan::global): Likewise.
7530         (Target_x86_64::Relocate::relocate): Likewise.
7531         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
7532         Likewise.
7533
7534 2010-08-03  Cary Coutant  <ccoutant@google.com>
7535
7536         * merge.cc (Output_merge_string::do_add_input_section): Count strings
7537         to reserve space in merged_strings vector. Keep total input size
7538         for stats.
7539         (Output_merge_string::do_print_merge_stats): Print total input size.
7540         * merge.h (Output_merge_string): Add input_size_ field.
7541         * stringpool.cc (Stringpool_template::string_length): Move
7542         implementations out of Stringpool_template class and place in
7543         stringpool.h.
7544         * stringpool.h (string_length): Move out of Stringpool_template.
7545
7546 2010-08-03  Ian Lance Taylor  <iant@google.com>
7547
7548         PR 11712
7549         * layout.cc (relaxation_loop_body): If address of load segment is
7550         set, adjust address to include headers if possible.
7551
7552 2010-08-03  Ian Lance Taylor  <iant@google.com>
7553
7554         * version.cc (version_string): Bump to 1.10.
7555
7556 2010-08-03  Ian Lance Taylor  <iant@google.com>
7557
7558         PR 11805
7559         * layout.h (enum Output_section_order): Define.
7560         (class Layout): Update declarations.
7561         * layout.cc (Layout::get_output_section): Add order parameter.
7562         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
7563         is_first_non_relro parameters.  Change all callers.
7564         (Layout::choose_output_section): Likewise.
7565         (Layout::add_output_section_data): Likewise.
7566         (Layout::make_output_section): Likewise.  Set order.
7567         (Layout::default_section_order): New function.
7568         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
7569         * output.cc (Output_section::Output_section): Initialize order_.
7570         Don't initialize deleted fields.
7571         (Output_segment::Output_segment): Don't initialize deleted
7572         fields.
7573         (Output_segment::add_output_section_to_load): New function
7574         replacing add_output_section.  Change all callers to call this or
7575         add_output_section_to_nonload.
7576         (Output_segment::add_output_section_to_nonload): New function.
7577         (Output_segment::remove_output_section): Rewrite.
7578         (Output_segment::add_initial_output_data): Likewise.
7579         (Output_segment::has_any_data_sections): Likewise.
7580         (Output_segment::is_first_section_relro): Likewise.
7581         (Output_segment::maximum_alignment): Likewise.
7582         (Output_segment::has_dynamic_reloc): New function replacing
7583         dynamic_reloc_count.  Change all callers.
7584         (Output_segment::has_dynamic_reloc_list): New function replacing
7585         dynamic_reloc_count_list.  Change all callers.
7586         (Output_segment::set_section_addresses): Rewrite.
7587         (Output_segment::set_offset): Rewrite.
7588         (Output_segment::find_first_and_last_list): Remove.
7589         (Output_segment::set_tls_offsets): Rewrite.
7590         (Output_segment::first_section_load_address): Likewise.
7591         (Output_segment::output_section_count): Likewise.
7592         (Output_segment::section_with_lowest_load_address): Likewise.
7593         (Output_segment::write_section_headers): Likewise.
7594         (Output_segment::print_sections_to_map): Likewise.
7595         * output.h (class Output_data): Remove dynamic_reloc_count_
7596         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
7597         (Output_data::add_dynamic_reloc): Rewrite.
7598         (Output_data::has_dynamic_reloc): New function.
7599         (Output_data::dynamic_reloc_count): Remove.
7600         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
7601         is_last_relro_, is_first_non_relro_, is_interp_,
7602         is_dynamic_linker_section_ fields.  Add order and set_order
7603         functions.  Remove is_relro_local, set_is_relro_local,
7604         is_last_relro, set_is_last_relro, is_first_non_relro,
7605         set_is_first_non_relro functions, is_interp, set_is_interp,
7606         is_dynamic_linker_section, and set_is_dynamic_linker_section
7607         functions.
7608         (class Output_segment): Change Output_data_list from std::list to
7609         std:;vector.  Add output_lists_ field.  Remove output_data_ and
7610         output_bss_ fields.  Update declarations.
7611
7612 2010-08-02  Ian Lance Taylor  <iant@google.com>
7613
7614         * arm.cc (Target_arm::gc_process_relocs): Use typename.
7615         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
7616         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
7617
7618 2010-08-02  Ian Lance Taylor  <iant@google.com>
7619
7620         PR 11855
7621         * script.cc (Script_options::Script_options): Initialize
7622         symbol_definitions_ and symbol_references_.
7623         (Script_options::add_symbol_assignment): Update
7624         symbol_definitions_ and symbol_references_.
7625         (Script_options::add_symbol_reference): New function.
7626         (script_symbol): New function.
7627         * script.h (class Script_options): Add symbol_definitions_ and
7628         symbol_references_ fields.
7629         (Script_options::referenced_const_iterator): New type.
7630         (Script_options::referenced_begin): New function.
7631         (Script_options::referenced_end): New function.
7632         (Script_options::is_referenced): New function.
7633         (Script_options::any_unreferenced): New function.
7634         * script-c.h (script_symbol): Declare.
7635         * yyscript.y (exp): Call script_symbol.
7636         * symtab.cc: Include "script.h".
7637         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
7638         Change all callers.  Check symbols referenced by scripts.
7639         (Symbol_table::add_undefined_symbols_from_command_line): Add
7640         layout parameter.  Change all callers.
7641         (Symbol_table::do_add_undefined_symbols_from_command_line):
7642         Likewise.  Break out loop body.  Check symbols referenced by
7643         scripts.
7644         (Symbol_table::add_undefined_symbol_from_command_line): New
7645         function broken out of
7646         do_add_undefined_symbols_from_command_line.
7647         * symtab.h (class Symbol_table): Update declarations.
7648         * archive.cc: Include "layout.h".
7649         (Archive::should_include_member): Add layout parameter.  Change
7650         all callers.  Check for symbol mentioned in expression.
7651         * archive.h (class Archive): Update declaration.
7652         * object.cc (Sized_relobj::do_should_include_member): Add layout
7653         parameter.
7654         * object.h (Object::should_include_member): Add layout parameter.
7655         Change all callers.
7656         (Object::do_should_include_member): Add layout parameter.
7657         (class Sized_relobj): Update declaration.
7658         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
7659         parameter.
7660         * dynobj.h (class Sized_dynobj): Update declaration.
7661         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
7662         layout parameter.
7663         * plugin.h (class Sized_pluginobj): Update declaration.
7664
7665 2010-08-02  Ian Lance Taylor  <iant@google.com>
7666
7667         PR 11866
7668         * output.cc (Output_segment::set_offset): Search for the first and
7669         last sections rather than assuming that the list is in order.
7670         (Output_segment::find_first_and_last_list): New function.
7671         * output.h (class Output_segment): Update declarations.
7672         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
7673         (relro_strip_test_SOURCES): New variable.
7674         (relro_strip_test_DEPENDENCIES): New variable.
7675         (relro_strip_test_LDFLAGS): New variable.
7676         (relro_strip_test_LDADD): New variable.
7677         (relro_strip_test.so): New target.
7678
7679 2010-08-02  Ian Lance Taylor  <iant@google.com>
7680
7681         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
7682         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
7683         (Target_i386::got_tlsdesc_section): New function.
7684         (Target_i386::got_section): Create space for GOT entries for
7685         TLSDESC relocations.
7686         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
7687         R_386_TLS_GOTDESC.
7688         (Target_i386::Scan::global): Likewise.
7689         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
7690         using TLSDESC GOT.
7691         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
7692         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
7693         (Target_x86_64::got_tlsdesc_section): New function.
7694         (Target_x86_64::got_section): Create space for GOT entries for
7695         TLSDESC relocations.
7696         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
7697         R_386_TLS_GOTDESC.
7698         (Target_x86_64::Scan::global): Likewise.
7699         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
7700         using TLSDESC GOT.
7701
7702 2010-08-02  Ian Lance Taylor  <iant@google.com>
7703
7704         * testsuite/final_layout.sh: Use dc to convert from hex to
7705         decimal.
7706
7707 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
7708
7709         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
7710         paramter to the call to gold::gc_process_relocs.
7711         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
7712         paramter to the call to gold::gc_process_relocs.
7713         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
7714         parameter to the call to gold::gc_process_relocs.
7715         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
7716         template parameter to the call to gold::gc_process_relocs.
7717         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
7718         paramter to the call to gold::gc_process_relocs.
7719         * gc.h (get_embedded_addend_size): New function.
7720         (gc_process_relocs): Save the size of the reloc for use by ICF.
7721         * icf.cc (get_section_contents): Get the addend from the text section
7722         for SHT_REL relocation sections.
7723         * icf.h (Icf::Reloc_addend_size_info): New typedef.
7724         (Icf::Reloc_info): Add new member reloc_addend_size_info.
7725         * int_encoding.h (read_from_pointer): New overloaded function.
7726         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
7727         * testsuite/icf_sht_rel_addend_test.sh: New file.
7728         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
7729         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
7730
7731 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7732
7733         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
7734         * Makefile.in: Regenerate.
7735         * testsuite/Makefile.in: Regenerate.
7736
7737 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
7738
7739         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
7740         * gold/testsuite/debug_msg.cc: Likewise.
7741         * gold/testsuite/odr_violation1.cc
7742         * gold/testsuite/odr_violation2.cc
7743
7744 2010-07-21  Cary Coutant  <ccoutant@google.com>
7745
7746         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
7747         string, and length fields.
7748         (Output_merge_string::Merged_strings_list): New type.
7749         (Output_merge_string::Merged_strings_lists): New typedef.
7750         (Output_merge_string): Replace merged_strings_ with
7751         merged_strings_lists_.
7752         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
7753         Merged_strings_list per input object and section.  Don't store pointer
7754         to the string.  Don't store length with each merged string entry.
7755         (Output_merge_string::finalize_merged_data): Loop over list of merged
7756         strings lists.  Recompute length of each merged string.
7757
7758 2010-07-15  Cary Coutant  <ccoutant@google.com>
7759
7760         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
7761         here.
7762
7763 2010-07-14  Ian Lance Taylor  <iant@google.com>
7764
7765         * descriptors.cc (Descriptors::open): Report correct name in error
7766         message.
7767
7768 2010-07-13  Doug Kwan  <dougkwan@google.com>
7769
7770         * arm.cc (Arm_input_section::Arm_input_section): For a
7771         SHT_ARM_EXIDX section, always keeps the input sections.
7772         (Arm_input_section::set_exidx_section_link): New method.
7773         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
7774         has_errors_ to false.
7775         (Arm_exidx_input_section::has_errors,
7776         Arm_exidx_input_section::set_has_errors): New methods.
7777         (Arm_exidx_input_section::has_errors_): New data member.
7778         (Arm_relobj::get_exidx_shndx_list): New method.
7779         (Arm_output_section::append_text_sections_to_list): Do not skip
7780         section without SHF_EXECINSTR.
7781         (Arm_output_section::fix_exidx_coverage): Skip input sections with
7782         errors.
7783         (Arm_relobj::make_exidx_input_section): Add new parameter for text
7784         section header.  Make error messages more verbose.  Check for
7785         a non-executable section linked to an EXIDX section.
7786         (Arm_relobj::do_read_symbols): Remove error checking, which has been
7787         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
7788         check that there is no deferred EXIDX section if we exit early.
7789         Instead of not making an EXIDX section in case of an error, make one
7790         and set the has_errors flag of it.
7791         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
7792         in a relocatable link.
7793         (Target_arm::do_relax): Look for the EXIDX output section instead of
7794         assuming that it is called .ARM.exidx.
7795         (Target_arm::fix_exidx_coverage): Add a new parameter for input
7796         section list.  Do not check for SHF_EXECINSTR section flags but
7797         skip any input section with errors.
7798         * output.cc (Output_section::Output_section): Initialize
7799         always_keeps_input_sections_ to false.
7800         (Output_section::add_input_section): Check for
7801         always_keeps_input_sections_.
7802         *  output.h (Output_section::always_keeps_input_sections,
7803         Output_section::set_always_keeps_input_sections): New methods.
7804         (Output_section::always_keeps_input_sections): New data member.
7805
7806 2010-07-13  Rafael Espindola  <espindola@google.com>
7807
7808         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
7809         * fileread.h (Input_file): Add try_extra_search_path and find_file.
7810
7811 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
7812             Ian Lance Taylor  <iant@google.com>
7813
7814         * output.h (Output_section_lookup_maps::add_merge_section):
7815         Correct check of whether value was inserted.
7816         (Output_section_lookup_maps::add_merge_input_section): Likewise.
7817         (Output_section_lookup_maps::add_relaxed_input_section):
7818         Likewise.
7819         * arm.cc (Target_arm::got_section): Remove used local os.
7820         * i386.cc (Target_i386::got_section): Likewise.
7821         * x86_64.cc (Target_x86_64::got_section): Likewise.
7822         * sparc.cc (Target_sparc::got_section): Likewise.
7823         (Target_sparc::relocate): Remove unused local have_got_offset.
7824         * powerpc.cc (Target_powerpc::relocate): Likewise.
7825
7826 2010-07-13  Ian Lance Taylor  <iant@google.com>
7827
7828         * compressed_output.cc (zlib_decompress): Fix signature in
7829         !HAVE_ZLIB_H case.
7830
7831         * archive.cc (Archive::include_member): Unlock an external member
7832         of a thin archive.  Don't bother to delete an object we know is
7833         NULL.
7834
7835 2010-07-12  Cary Coutant  <ccoutant@google.com>
7836
7837         * compressed_output.cc (zlib_decompress): New function.
7838         (get_uncompressed_size): New function.
7839         (decompress_input_section): New function.
7840         * compressed_output.h (get_uncompressed_size): New function.
7841         (decompress_input_section): New function.
7842         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
7843         Handle compressed debug sections.
7844         * layout.cc (is_compressed_debug_section): New function.
7845         (Layout::output_section_name): Map compressed section names to
7846         canonical names.
7847         * layout.h (is_compressed_debug_section): New function.
7848         (is_debug_info_section): Recognize compressed debug sections.
7849         * merge.cc: Include compressed_output.h.
7850         (Output_merge_data::do_add_input_section): Handle compressed
7851         debug sections.
7852         (Output_merge_string::do_add_input_section): Handle compressed
7853         debug sections.
7854         * object.cc: Include compressed_output.h.
7855         (Sized_relobj::Sized_relobj): Initialize new data members.
7856         (build_compressed_section_map): New function.
7857         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
7858         * object.h (Object::section_is_compressed): New method.
7859         (Object::do_section_is_compressed): New method.
7860         (Sized_relobj::Compressed_section_map): New type.
7861         (Sized_relobj::do_section_is_compressed): New method.
7862         (Sized_relobj::compressed_sections_): New data member.
7863         * output.cc (Output_section::add_input_section): Handle compressed
7864         debug sections.
7865         * reloc.cc: Include compressed_output.h.
7866         (Sized_relobj::write_sections): Handle compressed debug sections.
7867
7868 2010-07-08  Cary Coutant  <ccoutant@google.com>
7869
7870         * resolve.cc (Symbol_table::resolve): Remember whether undef was
7871         weak when resolving to a dynamic def.
7872         (Symbol_table::should_override): Add adjust_dyndef flag; set it
7873         for weak undef/dynamic def cases. Adjust callers.
7874         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
7875         undef_binding_weak_.
7876         (Symbol_table::sized_write_globals): Adjust symbol binding.
7877         (Symbol_table::sized_write_symbol): Add binding parameter.
7878         * symtab.h (Symbol::set_undef_binding): New method.
7879         (Symbol::is_undef_binding_weak): New method.
7880         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
7881         (Symbol_table::should_override): Add new parameter.
7882         (Symbol_table::sized_write_symbol): Add new parameter.
7883
7884         * testsuite/weak_undef_file1.cc: Add new test case.
7885         * testsuite/weak_undef_file2.cc: Fix header comment.
7886         * testsuite/weak_undef_test.cc: Add new test case.
7887
7888 2010-06-29  Doug Kwan  <dougkwan@google.com>
7889
7890         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
7891         Initialize USE_SYMBOL_.
7892         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
7893         definition.
7894         (Arm_reloc_property::uses_symbol_): New data member declaration.
7895         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
7896         uses symbol value and symbol is undefined but not weakly undefined.
7897
7898 2010-06-28  Rafael Espindola  <espindola@google.com>
7899
7900         * plugin.cc (Plugin::load): Use dlerror.
7901
7902 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
7903
7904         * symtab.cc (detect_odr_violations): When reporting an ODR
7905         violation, report an object where the symbol is defined.
7906
7907 2010-06-25  Doug Kwan  <dougkwan@google.com>
7908
7909         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
7910         (Target_arm::section_may_have_icf_unsafe_pointers): New method
7911         definition.
7912         (Target_arm::Scan::local_reloc_may_be_function_pointer,
7913         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
7914         target hook to detect function points.
7915         (Target_arm::Scan::possible_function_pointer_reloc): New method.
7916         * icf.h (Icf::check_section_for_function_pointers): Change type of
7917         parameter SECTION_NAME to const reference to std::string.  Use
7918         target hook to determine if section may have unsafe pointers.
7919         * target.h (Target::section_may_have_icf_unsafe_pointers): New
7920         method definition.
7921
7922 2010-06-21  Rafael Espindola  <espindola@google.com>
7923
7924         * fileread.cc (Input_file::find_fie): New
7925         (Input_file::open): Use Input_file::find_fie.
7926         * fileread.h (Input_file::find_fie): New
7927         * plugin.cc (set_extra_library_path): New.
7928         (Plugin::load): Add set_extra_library_path to the transfer vector.
7929         (Plugin_manager::set_extra_library_path): New.
7930         (Plugin_manager::add_input_file): Use the extra search path if set.
7931         (set_extra_library_path(): New.
7932         * plugin.h (Plugin_manager): Add set_extra_library_path and
7933         extra_search_path_.
7934
7935 2010-06-19  Cary Coutant  <ccoutant@google.com>
7936
7937         * layout.cc (gdb_sections): Add .debug_types.
7938         (lines_only_debug_sections): Likewise.
7939
7940 2010-06-18  Rafael Espindola  <espindola@google.com>
7941
7942         * plugin.cc (add_input_file,add_input_library)
7943         (Plugin_manager::add_input_file): Make filename arguments const.
7944         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
7945         const.
7946
7947 2010-06-16  Doug Kwan  <dougkwan@google.com>
7948
7949         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
7950         .ARM.attributes section if we have not merged any input
7951         attributes sections.
7952
7953 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7954
7955         * arm.cc: Allow combining objects with no EABI version
7956         information.
7957
7958 2010-06-15  Rafael Espindola  <espindola@google.com>
7959
7960         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
7961
7962 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7963
7964         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
7965         (struct iovec): Correct !HAVE_READV definition.
7966
7967 2010-06-10  Cary Coutant  <ccoutant@google.com>
7968
7969         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
7970         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
7971         reloc sections.
7972         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
7973
7974         PR 11683
7975         * symtab.h (Symbol::is_placeholder): New member function.
7976         * target-reloc.h (relocate_section): Check for placeholder symbols.
7977
7978         * testsuite/Makefile.am (plugin_test_8): New test.
7979         (plugin_test_9): New test.
7980         * testsuite/Makefile.in: Regenerate.
7981
7982 2010-06-09  Nick Clifton  <nickc@redhat.com>
7983
7984         * yyscript.y (input_list_element): Allow strings prefixed with
7985         the '-' character.  Treat these as libraries.
7986         * script.cc (script_add_library): New function.  Adds a library
7987         specified by "-l<name>" found in an input script.
7988         * script-c.h: Add prototype for script_add_library.
7989
7990 2010-06-07  Doug Kwan  <dougkwan@google.com>
7991
7992         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
7993         Restrict stub-group size to be within long conditional branch
7994         range when working around cortex-A8 erratum.
7995
7996 2010-06-07  Damien Diederen  <dd@crosstwine.com>
7997
7998         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
7999         #ifdef typo.
8000
8001 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
8002
8003         PR gold/11658
8004         * output.cc
8005         (Output_section::Input_section_sort_entry::compare_section_ordering):
8006         Change to return non-zero correctly.
8007         (Output_section::Input_section_sort_section_order_index_compare
8008         ::operator()): Change to fix ambiguity in comparisons.
8009
8010 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
8011
8012         * gold.h (is_wildcard_string): New function.
8013         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
8014         (Layout::layout_eh_frame): Ditto.
8015         (Layout::find_section_order_index): New method.
8016         (Layout::read_layout_from_file): New method.
8017         * layout.h (Layout::find_section_order_index): New method.
8018         (Layout::read_layout_from_file): New method.
8019         (Layout::input_section_position_): New private member.
8020         (Layout::input_section_glob_): New private member.
8021         * main.cc (main): Call read_layout_from_file here.
8022         * options.h (--section-ordering-file): New option.
8023         * output.cc (Output_section::input_section_order_specified_): New
8024         member.
8025         (Output_section::Output_section): Initialize new member.
8026         (Output_section::add_input_section): Add new parameter.
8027         Keep input sections when --section-ordering-file is used.
8028         (Output_section::set_final_data_size): Sort input sections when
8029         section ordering file is specified.
8030         (Output_section::Input_section_sort_entry): Add new parameter.
8031         Check sorting type.
8032         (Output_section::Input_section_sort_entry::compare_section_ordering):
8033         New method.
8034         (Output_section::Input_section_sort_compare::operator()): Change to
8035         consider section_order_index.
8036         (Output_section::Input_section_sort_init_fini_compare::operator()):
8037         Change to consider section_order_index.
8038         (Output_section::Input_section_sort_section_order_index_compare
8039         ::operator()): New method.
8040         (Output_section::sort_attached_input_sections): Change to sort
8041         according to section order when specified.
8042         (Output_section::add_input_section<32, true>): Add new parameter.
8043         (Output_section::add_input_section<64, true>): Add new parameter.
8044         (Output_section::add_input_section<32, false>): Add new parameter.
8045         (Output_section::add_input_section<64, false>): Add new parameter.
8046         * output.h (Output_section::add_input_section): Add new parameter.
8047         (Output_section::input_section_order_specified): New
8048         method.
8049         (Output_section::set_input_section_order_specified): New method.
8050         (Input_section::Input_section): Initialize section_order_index_.
8051         (Input_section::section_order_index): New method.
8052         (Input_section::set_section_order_index): New method.
8053         (Input_section::section_order_index_): New member.
8054         (Input_section::Input_section_sort_section_order_index_compare): New
8055         struct.
8056         (Output_section::input_section_order_specified_): New member.
8057         * script-sections.cc (is_wildcard_string): Delete and move modified
8058         method to gold.h.
8059         (Output_section_element_input::Output_section_element_input): Modify
8060         call to is_wildcard_string.
8061         (Output_section_element_input::Input_section_pattern
8062         ::Input_section_pattern): Ditto.
8063         (Output_section_element_input::Output_section_element_input): Ditto.
8064         * testsuite/Makefile.am (final_layout): New test case.
8065         * testsuite/Makefile.in: Regenerate.
8066         * testsuite/final_layout.cc: New file.
8067         * testsuite/final_layout.sh: New file.
8068
8069 2010-06-01  Rafael Espindola  <espindola@google.com>
8070
8071         * plugin.cc (Plugin::load): Pass the output name to the plugin.
8072
8073 2010-06-01  Rafael Espindola  <espindola@google.com>
8074
8075         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
8076         visibility of symbols.
8077
8078 2010-05-27  Doug Kwan  <dougkwan@google.com>
8079
8080         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
8081         from start of output section instead of address for a local symbol
8082         in a merged or relaxed section when doing a relocatable link.
8083
8084 2010-05-26  Rafael Espindola  <espindola@google.com>
8085
8086         PR 11604
8087         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
8088         adding sections the garbage collector removed.
8089         * gold/testsuite/Makefile.am: Add test.
8090         * gold/testsuite/Makefile.in: Regenerate.
8091         * gold/testsuite/plugin_test_7.sh: New.
8092         * gold/testsuite/plugin_test_7_1.c: New.
8093         * gold/testsuite/plugin_test_7_2.c: New.
8094
8095 2010-05-26  Rafael Espindola  <espindola@google.com>
8096
8097         * script-sections.cc (Output_section_definition::set_section_addresses):
8098         Check for --section-start.
8099
8100 2010-05-26  Doug Kwan  <dougkwan@google.com>
8101
8102         * arm.cc (Arm_scan_relocatable_relocs): New class.
8103         (Target_arm::relocate_special_relocatable): New method.
8104         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
8105         (Arm_relocate_functions::thumb_branch_common): Same.
8106         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
8107         instead of Default_scan_relocatable_relocs.
8108         * target-reloc.h (relocate_for_relocatable): Let target handle
8109         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
8110         * target.h (Sized_target::relocate_special_relocatable): New method.
8111
8112 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8113
8114         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
8115
8116 2010-05-23  Doug Kwan  <dougkwan@google.com>
8117
8118         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
8119         instead of a cast.
8120         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
8121         with a direct branch, not a conditional branch, to a stub.
8122         * merge.cc (Output_merge_base::record_input_section): New method
8123         defintion.
8124         (Output_merge_data::do_add_input_section): Record input section if
8125         keeps-input-sections flag is set.
8126         (Output_merge_string::do_add_input_section): Ditto.
8127         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
8128         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
8129         INPUT_SECTIONS_.
8130         (Output_merge_base::keeps_input_sections,
8131         Output_merge_base::set_keeps_input_sections,
8132         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
8133         method definitions.
8134         (Output_merge_base::Input_sections): New type declaration.
8135         (Output_merge_base::input_sections_begin,
8136         Output_merge_base::input_sections_end,
8137         Output_merge_base::do_set_keeps_input_sections): New method definitions.
8138         (Output_merge_base::bool keeps_input_sections_,
8139         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
8140         Output_merge_base::input_sections_): New data members.
8141         (Output_merge_data::do_set_keeps_input_sections): New method
8142         defintion.
8143         (Output_merge_string::do_set_keeps_input_sections): Ditto.
8144         * output.cc (Output_section::Input_section::relobj): Move method
8145         defintion from class declaration to here and handle merge sections.
8146         (Output_section::Input_section::shndx): Ditto.
8147         (Output_section::Output_section): Remove initializations of removed
8148         data members and initialize new data member LOOKUP_MAPS_.
8149         (Output_section::add_input_section): Set keeps-input-sections flag
8150         for a newly created merge output section as appropriate.  Adjust code
8151         to use Output_section_lookup_maps class.
8152         (Output_section::add_relaxed_input_section): Adjst code for lookup
8153         maps code refactoring.
8154         (Output_section::add_merge_input_section): Add a new parameter
8155         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
8156         class.  If adding input section to a newly created merge output
8157         section fails, remove the new merge section.
8158         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
8159         Adjust code for use of the Output_section_lookup_maps class.
8160         (Output_section::find_merge_section): Ditto.
8161         (Output_section::build_lookup_maps): New method defintion.
8162         (Output_section::find_relaxed_input_section): Adjust code to use
8163         Output_section_lookup_maps class.
8164         (Output_section::get_input_sections): Export merge sections.  Adjust
8165         code to use Output_section_lookup_maps class.
8166         (Output_section:::add_script_input_section): Adjust code to use
8167         Output_section_lookup_maps class.  Update lookup maps for merge
8168         sections also.
8169         (Output_section::discard_states): Use Output_section_lookup_maps.
8170         (Output_section::restore_states): Same.
8171         * output.h (Merge_section_properties): Move class defintion out of
8172         Output_section.
8173         (Output_section_lookup_maps): New class.
8174         (Output_section::Input_section::is_merge_section): New method
8175         defintion.
8176         (Output_section::Input_section::relobj): Move defintion out of class
8177         defintion.  Declare method only.
8178         (Output_section::Input_section::shndx): Ditto.
8179         (Output_section::Input_section::output_merge_base): New method defintion.
8180         (Output_section::Input_section::u2_.pomb): New union field.
8181         (Output_section::Merge_section_by_properties_map,
8182         Output_section::Output_section_data_by_input_section_map,
8183         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
8184         Remove types.
8185         (Output_section::add_merge_input_section): Add new parameter
8186         KEEPS_INPUT_SECTIONS.
8187         (Output_section::build_lookup_maps): New method declaration.
8188         (Output_section::merge_section_map_,
8189         Output_section::merge_section_by_properties_map_,
8190         Output_section::relaxed_input_section_map_,
8191         Output_section::is_relaxed_input_section_map_valid_): Remove data
8192         members.
8193         (Output_section::lookup_maps_): New data member.
8194
8195 2010-05-21  Doug Kwan  <dougkwan@google.com>
8196
8197         PR gold/11619
8198         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
8199         avoid a compilation error.
8200
8201 2010-05-19  Rafael Espindola  <espindola@google.com>
8202
8203         * script-sections.cc (Output_section_definition::allocate_to_segment):
8204         Update the phdrs_list even when the output section is NULL.
8205         * testsuite/Makefile.am: Add test.
8206         * testsuite/Makefile.in: Regenerate.
8207         * testsuite/script_test_9.cc: New.
8208         * testsuite/script_test_9.sh: New.
8209         * testsuite/script_test_9.t: New.
8210
8211 2010-05-19  Doug Kwan  <dougkwan@google.com>
8212
8213         * arm.cc (Arm_input_section::original_size): New method.
8214         (Arm_input_section::do_addralign): Add a cast.
8215         (Arm_input_section::do_output_offset): Remove static cast.
8216         (Arm_input_section::original_addralign,
8217          Arm_input_section::original_size_): Change type to uint32_t.
8218         (Arm_input_section::init): Add safe casts for section alignment
8219         and size.
8220         (Arm_input_section::set_final_data_size): Do not set address and
8221         offset of stub table.
8222         (Arm_output_section::fix_exidx_coverage): Change use of of
8223         Output_section::Simple_input_section to that of
8224         Output_section::Input_section.
8225         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
8226         except for the first pass.
8227         * output.cc (Output_section::get_input_sections): Change type of
8228         input_sections to std::list<Input_section>.
8229         (Output_section::add_script_input_section): Rename from
8230         Output_section::add_simple_input_section.  Change type of SIS
8231         parameter from Simple_input_section to Input_section.
8232         * output.h (Output_section::Simple_input_section): Remove class.
8233         (Output_section::Input_section): Change class visibility to public.
8234         (Output_section::Input_section::addralign): Use stored alignments
8235         for special input sections if set.
8236         (Output_section::Input_section::set_addralign): New method.
8237         (Output_section::get_input_sections): Change parameter type from
8238         list of Simple_input_section to list of Input_section.
8239         (Output_section::add_script_input_section): Rename from
8240         Output_section::add_simple_input_section. Change first parameter's
8241         type from Simple_input_section to Input_section and remove the
8242         second and third parameters.
8243         * script-sections.cc (Input_section::Input_section_list): Change
8244         type to list of Output_section::Input_section/
8245         (Input_section_info::Input_section_info): Change parameter type of
8246         INPUT_SECTION to Output_section::Input_section.
8247         (Input_section_info::input_section): Change return type.
8248         (Input_section_info::input_section_): Change type to
8249         Output_section::Input_section.
8250         (Output_section_element_input::set_section_addresses): Adjust code
8251         to use Output_section::Input_section instead of
8252         Output_section::Simple_input_section.  Adjust code for renaming
8253         of Output_section::add_simple_input_section.
8254         (Orphan_output_section::set_section_addresses): Ditto.
8255
8256 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8257
8258         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
8259         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
8260
8261 2010-05-18  Rafael Espindola  <espindola@google.com>
8262
8263         * options.cc (General_options::finalize): Handle -nostdlib.
8264         * options.h (nostdlib): New option.
8265         * script.cc (script_add_search_dir): Handle -nostdlib.
8266
8267 2010-05-12  Doug Kwan  <dougkwan@google.com>
8268
8269         * arm.cc (Target_arm::do_finalize_sections): Create an empty
8270         attributes section only if there no attributes section after merging.
8271         (Target_arm::merge_object_attributes): Move value of
8272         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
8273         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
8274         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
8275         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
8276         and arm_attr_merge_7.stdout.
8277         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
8278         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
8279         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
8280         arm_attr_merge_7b.o): New rules.
8281         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
8282         arm_attr_merge_7
8283         * testsuite/Makefile.in: Regenerate.
8284         * testsuite/arm_attr_merge.sh: New file.
8285         * testsuite/arm_attr_merge_[67][ab].s: Same.
8286
8287 2010-05-05  Nick Clifton  <nickc@redhat.com>
8288
8289         * po/es.po: Updated Spanish translation.
8290
8291 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
8292
8293         * Makefile.am (install-exec-local): Properly install gold as
8294         default cross linker.
8295         * Makefile.in: Regenerated.
8296
8297 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
8298             Nick Clifton  <nickc@redhat.com>
8299
8300         * configure.ac (install_as_default): Define and set to false
8301         unless --enable-gold or --enable-gold=both/gold has been
8302         specified.
8303         * configure: Regenerate.
8304
8305         * Makefile.am (install-exec-local): Install the executable as
8306         'ld.gold'.  If install_as_default is true then also install it as
8307         'ld'.
8308         * Makefile.in: Regenerated.
8309
8310 2010-04-24  Ian Lance Taylor  <iant@google.com>
8311
8312         * layout.cc (Layout::layout_reloc): In relocatable link don't
8313         combine reloc sections for grouped sections.
8314
8315 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
8316
8317         * gc.h (gc_process_relocs): Pass information on relocs pointing to
8318         sections that are not ordinary to icf.
8319         * icf.cc (get_section_contents): Handle relocation pointing to section
8320         with no object or shndx information.
8321         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
8322         * testsuite/Makefile.in: Regenerate.
8323         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
8324         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
8325
8326 2010-04-22  Ian Lance Taylor  <iant@google.com>
8327
8328         * expression.cc (Expression::Expression_eval_info): Add
8329         result_alignment_pointer field.
8330         (Expression::eval_with_dot): Add result_alignment_pointer
8331         parameter.  Change all callers.
8332         (Expression::eval_maybe_dot): Likewise.
8333         (class Binary_expression): Add alignment_pointer parameter to
8334         left_value and right_value.  Change all callers.
8335         (BINARY_EXPRESSION): Set result alignment.
8336         (class Trinary_expression): Add alignment_pointer parameter to
8337         arg2_value and arg3_value.  Change all callers.
8338         (Trinary_cond::value): Set result alignment.
8339         (Max_expression::value, Min_expression::value): Likewise.
8340         (Align_expression::value): Likewise.
8341         * script-sections.cc (class Sections_element): Add dot_alignment
8342         parameter to set_section_addresses virtual function.  Update
8343         instantiations.
8344         (class Output_section_element): Likewise.
8345         (Script_sections::create_segments): Add dot_alignment parameter.
8346         Change all callers.
8347         (Script_sections::create_segments_from_phdrs_clause): Likewise.
8348         (Script_sections::set_phdrs_clause_addresses): Likewise.
8349         * script-sections.h: Update declarations.
8350         * script.h: Update declarations.
8351         * output.h (Output_segment::set_minimum_p_align): Don't decrease
8352         min_p_align.
8353         * testsuite/script_test_3.t: Set large alignment.
8354         * testsuite/script_test_3.sh: Make sure that at least one LOAD
8355         segment has expected alignment.
8356
8357 2010-04-22  Nick Clifton  <nickc@redhat.com>
8358
8359         * po/gold.pot: Updated by the Translation project.
8360         * po/vi.po: Updated Vietnamese translation.
8361
8362 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
8363
8364         * testsuite/Makefile.am (check_PROGRAMS): Add
8365         icf_virtual_function_folding_test.
8366         * testsuite/Makefile.in: Regenerated.
8367
8368 2010-04-15  Andrew Haley  <aph@redhat.com>
8369
8370         * options.h (merge_exidx_entries): New option.
8371         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
8372         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
8373         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
8374         (Target_arm::merge_exidx_entries): New function.
8375         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
8376         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
8377         to Arm_exidx_fixup constructor.
8378         Add new arg, merge_exidx_entries.
8379         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
8380         Arm_output_section::fix_exidx_coverage.
8381
8382 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
8383
8384         * icf.cc (get_section_contents): Check for preemptible functions.
8385         Ignore addend when appropriate.
8386         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
8387         section folded.
8388         (add_from_relobj): Check for section folded.
8389         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
8390         * symtab.h (should_add_dynsym_entry): Add new parameter.
8391         * target-reloc.h (scan_relocs): Check for section folded.
8392         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
8393         Check reloc types for function pointers in shared objects.
8394         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
8395         case.
8396         (icf_preemptible_functions_test): New test case.
8397         (icf_string_merge_test): New test case.
8398         * testsuite.Makefile.in: Regenerate.
8399         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
8400         bar_glob.  Refactor code.
8401         * testsuite/icf_preemptible_functions_test.cc: New file.
8402         * testsuite/icf_preemptible_functions_test.sh: New file.
8403         * testsuite/icf_string_merge_test.cc: New file.
8404         * testsuite/icf_string_merge_test.sh: New file.
8405         * testsuite/icf_virtual_function_folding_test.cc: New file.
8406         * testsuite/icf_virtual_function_folding_test.sh: New file.
8407
8408 2010-04-14  Doug Kwan  <dougkwan@google.com>
8409
8410         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
8411         for local symbol recounting if we remove a section due to ICF.
8412         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
8413         there are no regular objects in input.
8414
8415 2010-04-13  Doug Kwan  <dougkwan@google.com>
8416
8417         * arm.cc (Arm_input_section::set_final_data_size): Compute
8418         accurate final data size instead of using current data size.
8419
8420 2010-04-09  Doug Kwan  <dougkwan@google.com>
8421
8422         * layout.cc (Layout::choose_output_section): Handle script section
8423         types.
8424         (Layout::make_output_section_for_script): Add section type parameter.
8425         Handle script section types.
8426         * layout.h (Layout::make_output_section_for_script): Add section
8427         type parameter.
8428         * output.cc (Output_section::Output_section): Initialize data member
8429         is_noload_.
8430         (Output_section::do_reset_address_and_file_offset): Do not set address
8431         to 0 if section is a NOLOAD section.
8432         * output.h (Output_section::is_noload): New method.
8433         (Output_section::set_is_noload): Ditto.
8434         (Output_section::is_noload_): New data member.
8435         * script-c.h (Script_section_type): New enum type.
8436         (struct Parser_output_section_header): Add new file section_type.
8437         * script-sections.cc (Sections_element::output_section_name): Add
8438         parameter for returning script section type.
8439         (Output_section_definition::output_section_name): Ditto.
8440         (Output_section_definition::section_type)P; New method.
8441         (Output_section_definiton::script_section_type_name): Ditto.
8442         (Output_section_definition::script_section_type_): New data member.
8443         (Output_section_definition::Output_section_definition): Initialize
8444         data member Output_section_definition::script_section_type_.
8445         (Output_section_definition::create_sections): Pass script section type
8446         to Layout::make_output_section_for_script.
8447         (Output_section_definition::output_section_name): Return script
8448         section type to caller.
8449         (Output_section_definition::set_section_address): Do not advance
8450         dot value and load address if section type is NOLOAD.  Set address
8451         of NOLOAD sections regardless of section flags.
8452         (Output_section_definition::print): Print section type if it is
8453         not SCRIPT_SECTION_TYPE_NONE.
8454         (Output_section_definition::section_type): New method.
8455         (Output_section_definition::script_section_type_name): Ditto.
8456         (Script_sections::output_section_name): Add new parameter
8457         PSECTION_TYPE for returning script section type.  Pass it to
8458         section elements.  Handle discard sections.
8459         (Sort_output_sections::operator()): Handle NOLOAD sections.
8460         * script-sections.h (Script_sections::Section_type): New enum type.
8461         (Script_sections::output_section_name): Add a new parameter for
8462         returning script section type.
8463         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
8464         INFO and NOLOAD.
8465         * yyscript.y (union): Add new field SECTION_TYPE.
8466         (COPY, DSECT, INFO, NOLOAD): New tokens.
8467         (opt_address_and_section_type): Change type to output_section_header.
8468         (section_type): New non-terminal
8469         (section_header): Handle section type.
8470         (opt_address_and_section_type): Return section type value.
8471
8472 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
8473
8474         * testsuite/plugin_common_test_1.c (foo): Add prototype.
8475         * testsuite/plugin_common_test_2.c (foo): Likewise.
8476
8477 2010-04-08  Doug Kwan  <dougkwan@google.com>
8478
8479         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
8480         Output_merge_data.
8481         * output.cc (Output_section::add_merge_input_section): Simplify
8482         code and return status of Output_merge_base::add_input_section.
8483         Update merge section map only if Output_merge_base::add_input_section
8484         returns true.
8485
8486 2010-04-07  Doug Kwan  <dougkwan@google.com>
8487
8488         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
8489         if section is marked as containing instructions but has no mapping
8490         symbols.
8491         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
8492         correct section index.
8493         (Arm_relobj::find_linked_text_section): Ditto.
8494
8495 2010-04-07  Cary Coutant  <ccoutant@google.com>
8496
8497         * archive.cc (include_member): Destroy Read_symbols_data object before
8498         releasing file.
8499         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
8500         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
8501         (Read_symbols_data::~Read_symbols_data) New destructor.
8502         (Section_relocs::Section_relocs) New constructor.
8503         (Section_relocs::~Section_relocs) New destructor.
8504         (Read_relocs_data::Read_relocs_data) New constructor.
8505         (Read_relocs_data::~Read_relocs_data) New destructor.
8506         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
8507         pointers to NULL after deleting.
8508
8509 2010-04-07  Doug Kwan  <dougkwan@google.com>
8510
8511         * arm.cc: Replace "endianity" with "endianness" in comments.
8512         (Arm_exidx_cantunwind): Ditto.
8513         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
8514         (Arm_relobj::merge_flags_and_attributes): New method.
8515         (Arm_relobj::merge_flags_and_attributes_): New data member.
8516         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
8517         (Arm_relobj::scan_sections_for_stubs): Ditto.
8518         (Arm_relobj::do_read_symbols): Check to see if we really want to
8519         merge processor-specific flags and attributes.  Exit early if
8520         an object is empty except for section names and the undefined symbol.
8521         (Target_arm::do_finalize_sections): Move check for ELF format to
8522         Arm_relobj::do_read_symbols.  Merge processor specific flags and
8523         attributes from a regular object only when we have determined that
8524         it is aapropriate.  Do not create an .ARM.attributes section in
8525         output if there is no regular input object.
8526         (Target_arm::merge_processor_specific_flags): Check
8527         --warn-mismatch before printing any error.
8528         (Target_arm::merge_object_attributes): Ditto.
8529         * gold.cc (queue_middle_tasks): Handle the case in which there is
8530         no regular object in input.
8531         * options.cc (General_options::parse_EB): New method.
8532         (General_options::parse_EL): Same.
8533         (General_options::General_options): Initialize endianness_.
8534         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
8535         New options.
8536         (General_options::Endianness): New enum.
8537         (General_options::endianness): New method.
8538         (General_options::endianness_): New data member.
8539         * parameters.cc (Parameters::set_options): Check target endianness.
8540         (Parameters::set_target_once): Ditto.
8541         (Parameters::check_target_endianness): New method.
8542         (parameters_force_valid_target): If either -EL or -EB is specified,
8543         use it to define endianness of default target.
8544         * parameters.h (Parameters::check_target_endianness): New method
8545         declaration.
8546         * target.h (class Target): Change "endianity" to "endianness"
8547         in comments.
8548
8549 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8550
8551         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
8552         * configure: Regenerate.
8553         * Makefile.in: Regenerate.
8554         * testsuite/Makefile.in: Regenerate.
8555
8556 2010-04-06  Cary Coutant  <ccoutant@google.com>
8557
8558         gcc PR lto/42757
8559         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
8560         prevailing definitions of common symbols.
8561         * testsuite/plugin_test_6.sh: New test case.
8562         * testsuite/plugin_common_test_1.c: New test case.
8563         * testsuite/plugin_common_test_2.c: New test case.
8564         * testsuite/Makefile.am (plugin_test_6): New test case.
8565         * testsuite/Makefile.in: Regenerate.
8566
8567 2010-04-06  Nick Clifton  <nickc@redhat.com>
8568
8569         * po/vi.po: New Vietnamese translation.
8570
8571 2010-03-30  Doug Kwan  <dougkwan@google.com>
8572
8573         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
8574
8575 2010-03-25  Doug Kwan  <dougkwan@google.com>
8576
8577         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
8578         to avoid a conversion warning on a 32-bit host.
8579
8580 2010-03-24  Ian Lance Taylor  <iant@google.com>
8581
8582         * testsuite/script_test_3.t: Add a TLS segment.
8583         * testsuite/Makefile.am (check_PROGRAMS): Add
8584         tls_phdrs_script_test.
8585         (tls_phdrs_script_test_SOURCES): Define.
8586         (tls_phdrs_script_test_DEPENDENCIES): Define.
8587         (tls_phdrs_script_test_LDFLAGS): Define.
8588         (tls_phdrs_script_test_LDADD): Define.
8589         * testsuite/Makefile.in: Rebuild.
8590
8591 2010-03-23  Cary Coutant  <ccoutant@google.com>
8592
8593         * fileread.cc (find_or_make_view): Fix comment.
8594
8595 2010-03-23  Ian Lance Taylor  <iant@google.com>
8596
8597         * script-sections.cc (class Orphan_section_placement): Define
8598         PLACE_TLS and PLACE_TLS_BSS.
8599         (Orphan_section_placement::Orphan_section_placement): Initialize
8600         new places.
8601         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
8602         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
8603         (tls_script_test_SOURCES): Define.
8604         (tls_script_test_DEPENDENCIES): Define.
8605         (tls_script_test_LDFLAGS): Define.
8606         (tls_script_test_LDADD): Define.
8607         * testsuite/Makefile.in: Rebuild.
8608
8609 2010-03-22  Doug Kwan  <dougkwan@google.com>
8610
8611         * arm.cc (Arm_relocate_functions::abs8,
8612         Arm_relocate_functions::abs16): Use correct check for overflow
8613         specified in the ARM ELF specs.
8614         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
8615         target of a BLX instruction specially.
8616         (Reloc_stub::stub_type_for_reloc): Ditto.
8617         (Relocate::relocate): Use symbolic names instead of numeric relocation
8618         codes to report error.
8619         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
8620         workaround.
8621         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
8622         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
8623         thumb2_blx_out_of_range.stdout
8624         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
8625         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
8626         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
8627         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
8628         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
8629         thumb2_blx_in_range, thumb2_blx_in_range.o,
8630         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
8631         thumb2_blx_out_of_range.o): New rules.
8632         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
8633         thumb2_blx_in_range and thumb2_blx_out_of_range.
8634         * testsuite/Makefile.in: Regenerate.
8635         * arm_branch_in_range.sh: Add tests for THUMB BLX.
8636         * testsuite/thumb_blx_in_range.s: New file.
8637         * testsuite/thumb_blx_out_of_range.s: New file.
8638
8639 2010-03-22  Rafael Espindola  <espindola@google.com>
8640
8641         * archive.cc (Should_include): Move to archive.h.
8642         (should_include_member): Make it a member of Archive.
8643         (Lib_group): New.
8644         (Add_lib_group_symbols): New.
8645         * archive.h: Include options.h.
8646         (Archive_member): Moved from Archive.
8647         (Should_include): Moved from archive.cc.
8648         (Lib_group): New.
8649         (Add_lib_group_symbols): New.
8650         * dynobj.cc (do_should_include_member): New.
8651         * dynobj.h (do_should_include_member): New.
8652         * gold.cc (queue_initial_tasks): Update call to queue.
8653         * main.cc (main): Print lib group stats.
8654         * object.cc (do_should_include_member): New.
8655         * object.h: Include archive.h.
8656         (Object::should_include_member): New.
8657         (Object::do_should_include_member): New.
8658         (Sized_relobj::do_should_include_member): New.
8659         * options.cc (General_options::parse_start_lib): New.
8660         (General_options::parse_end_lib): New.
8661         (Input_arguments::add_file): Handle lib groups.
8662         (Input_arguments::start_group): Check we are not in a lib.
8663         (Input_arguments::start_lib): New.
8664         (Input_arguments::end_lib): New.
8665         * options.h (General_options): Add start_lib and end_lib.
8666         (Input_argument::lib_): New.
8667         (Input_argument::lib): New.
8668         (Input_argument::is_lib): New.
8669         (Input_file_lib): New.
8670         (Input_arguments::in_lib_): New.
8671         (Input_arguments::in_lib): New.
8672         (Input_arguments::start_lib): New.
8673         (Input_arguments::end_lib_): New.
8674         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
8675         in unused members as preempted.
8676         (Sized_pluginobj::do_should_include_member): New.
8677         * plugin.h (Sized_pluginobj::do_should_include_member): New.
8678         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
8679         return the blocker.
8680         (Read_symbols::do_whole_lib_group): New.
8681         (Read_symbols::do_lib_group): New.
8682         (Read_symbols::do_read_symbols): Handle lib groups.
8683         (Read_symbols::get_name): Handle lib groups.
8684         * readsyms.h (Read_symbols): Add an archive member pointer.
8685         (Read_symbols::do_whole_lib_group): New.
8686         (Read_symbols::do_lib_group): New.
8687         (Read_symbols::member_): New.
8688         * script.cc (read_input_script): Update call to queue_soon.
8689
8690 2010-03-19  Doug Kwan  <dougkwan@google.com>
8691
8692         * arm.cc (Stub_table::Stub_table): Initialize new data members
8693         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8694         (Stub_table::add_reloc_stub): Assign stub offset and update
8695         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8696         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
8697         New data members.
8698         (Stub_table::update_data_size_and_addralign): Use
8699         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
8700         instead of going over all reloc stubs.
8701         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
8702         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8703         Stringpool_template::offset_ to size of Stringpool_char.
8704         (Stringpool_template::new_key_offset): Remove code to initialize
8705         Stringpool_template::offset_.
8706         * stringpool.h (Stringpool_template::set_no_zero_null): Set
8707         Stringpool_template::offset_ to zero.
8708
8709 2010-03-15  Doug Kwan  <dougkwan@google.com>
8710
8711         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8712         offset_.
8713         (Stringpool_template::new_key_offset): New method.
8714         (Stringpool_template::add_string): Assign offsets when adding new
8715         strings.
8716         (Stringpool_template::set_string_offsets): Do not set string offsets
8717         when not optimizing.
8718         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
8719         member size_.
8720         (Chunked_vector::clear): Clear size_.
8721         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
8722         (Chunked_vector::size): Return size_.
8723         (Chunked_vector::push_back): Use size_ to find insert position.
8724         (Chunked_vector::size_): New data member.
8725         (Stringpool_template::set_no_zero_null): Assert string set is empty.
8726         (Stringpool_template::new_key_offset): New method declaration.
8727         (Stringpool_template::offset_): New data member.
8728
8729 2010-03-15   Rafael Espindola  <espindola@google.com>
8730
8731         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
8732         Add_symbols' constructor.
8733         * readsyms.h (Add_symbols): Remove the input_group member.
8734
8735 2010-03-10  Ian Lance Taylor  <iant@google.com>
8736
8737         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
8738         target to ask whether a reference to a symbol requires a stack
8739         split.
8740         * target.h (Target::is_call_to_non_split): New function.
8741         (Target::do_is_call_to_non_split): Declare virtual function.
8742         * target.cc: Include "symtab.h".
8743         (Target::do_is_call_to_non_split): New function.
8744         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
8745
8746 2010-03-10  Cary Coutant  <ccoutant@google.com>
8747
8748         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
8749         (File_read::open[1]): Remove initial mapping of whole_file_view_.
8750         (File_read::open[2]): Add whole_file_view_ to list of views.
8751         (File_read::make_view): Remove test of whole_file_view_.
8752         (File_read::find_or_make_view): Create whole_file_view_ if
8753         necessary.
8754         (File_read::clear_views): Replace bool parameter with enum;
8755         adjust all callers.  Don't delete views with permanent data;
8756         do delete cached views and views from archives if
8757         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
8758         if clearing the corresponding view.
8759         * fileread.h (File_read::Clear_views_mode): New enum.
8760         (File_read::View::is_permanent_view): New method.
8761         (File_read::clear_views): Replace bool parameter
8762         with enum; adjust all callers.
8763         * options.h (General_options): Change keep_files_mapped option;
8764         add map_whole_files.
8765         * readsyms.cc (Add_symbols::run): Delete sd_ object before
8766         releasing the file.
8767         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
8768         the file.
8769
8770 2010-03-10  David S. Miller  <davem@davemloft.net>
8771
8772         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
8773
8774 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
8775
8776         * icf.cc (get_section_contents): Add '@' marker after processing the
8777         merge reloc.
8778
8779 2010-03-08  Doug Kwan  <dougkwan@google.com>
8780
8781         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
8782         due to a conversion warning.
8783         (Arm_relobj::update_output_local_symbol_count): Check for local
8784         symbol with unset output index.
8785
8786 2010-03-05  Ian Lance Taylor  <iant@google.com>
8787
8788         * options.h (class General_options): Add --spare-dynamic-tags.
8789         * output.cc (Output_data_dynamic::set_final_data_size): Implement
8790         --spare-dynamic-tags.
8791
8792 2010-03-05  Ian Lance Taylor  <iant@google.com>
8793
8794         * incremental.cc: Include "libiberty.h".
8795
8796 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
8797
8798         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
8799         function, is_info_ member.
8800         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
8801         (Versions::Versions): Update caller.
8802         (Versions::define_base_version): Likewise.
8803         (Versions::add_def): Likewise.
8804
8805 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
8806
8807         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
8808         (Scan::possible_function_pointer_reloc): New function.
8809         (Scan::local_reloc_may_be_function_pointer): Change to call
8810         possible_function_pointer_reloc.
8811         (Scan::global_reloc_may_be_function_pointer): Ditto.
8812         * icf.h (Icf::check_section_for_function_pointers): Change to reject
8813         relocations in ".data.rel.ro._ZTV" section.
8814         * testsuite/icf_safe_so_test.sh: Change to pass i386.
8815         * testsuite/icf_safe_so_test.cc: Ditto.
8816         * testsuite/icf_safe_test.cc: Ditto.
8817         * testsuite/icf_safe_test.sh: Ditto.
8818
8819 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8820             Ian Lance Taylor  <iant@google.com>
8821
8822         * target-reloc.h (relocate_section): Check the symbol table index
8823         for -1U before setting the local symbol index.
8824         (scan_relocatable_relocs): If copying the relocation, record that
8825         the local symbol is required.
8826         * object.h (Symbol_value::is_output_symtab_index_set): New
8827         function.
8828         (Symbol_value::may_be_discarded_from_output_symtab): New
8829         function.
8830         (Symbol_value::has_output_symtab_entry): New function.
8831         (Symbol_value::needs_output_symtab_entry): Remove.
8832         (Symbol_value::output_symtab_index): Make sure the symbol index is
8833         set.
8834         (Symbol_value::set_output_symtab_index): Make sure the symbol
8835         index is not set.  Make sure the new index is valid.
8836         (Symbol_value::set_must_have_output_symtab_entry): New function.
8837         (Symbol_value::has_output_dynsym_entry): New function.
8838         (Symbol_value::set_output_dynsym_index): Make sure the new index
8839         is valid.
8840         (Sized_relobj::set_must_have_output_symtab_entry): New function.
8841         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
8842         local symbol if permitted.
8843         (Sized_relobj::do_finalize_local_symbols): Call
8844         is_output_symtab_index_set rather than needs_output_symtab_entry.
8845         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
8846         rather than needs_output_symtab_entry.  Call
8847         has_output_dynsym_entry rather than needs_output_dynsym_entry.
8848         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
8849         is_output_symtab_index_set rather than needs_output_symtab_entry.
8850         * testsuite/discard_locals_relocatable_test.c: New file.
8851         * testsuite/discard_locals_test.sh: Test -r.
8852         * testsuite/Makefile.am (check_DATA): Add
8853         discard_locals_relocatable_test1.syms,
8854         discard_local_relocatable_test2.syms.
8855         (MOSTLYCLEANFILES): Likewise.  Also add
8856         discard_locals_relocatable_test1.lout and
8857         discard_locals_relocatable_test2.out.
8858         (discard_locals_relocatable_test1.syms): New target.
8859         (discard_locals_relocatable_test.o): New target.
8860         (discard_locals_relocatable_test1.out): New target.
8861         (discard_locals_relocatable_test2.syms): New target.
8862         (discard_locals_relocatable_test2.out): New target.
8863         (various): Add missing ../ld-new dependencies.
8864         * testsuite/Makefile.in: Rebuild.
8865
8866 2010-03-03  Nick Clifton  <nickc@redhat.com>
8867
8868         * po/fi.po: New Finnish translation.
8869
8870 2010-03-01  Doug Kwan  <dougkwan@google.com>
8871
8872         * layout.cc (Layout::Layout): Force section types of .init_array*,
8873         .preinit_array* and .fini_array* sections.
8874         * output.cc (Output_section::Input_section_sort_entry::has_priority):
8875         Fix check of return value of std::string::find.().
8876         (Output_section::Input_section_sort_compare::operator()): Remove
8877         comment about .init_array.
8878         (Output_section::Input_section_sort_init_fini_compare::operator()):
8879         New method.
8880         (Output_section::sort_attached_input_sections): Handle .init_array
8881         and .fini_array specially.
8882         * output.h (Output_section::Inut_section_sort_compare): Update
8883         comment.
8884         (Output_section::Input_section_sort_init_fini_compare): New struct.
8885
8886 2010-02-26  Doug Kwan  <dougkwan@google.com>
8887
8888         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
8889         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
8890         * testsuite/debug_msg.sh: Avoid matching source line number for
8891         use of global variable undef_int.
8892
8893 2010-02-26  Doug Kwan  <dougkwan@google.com>
8894
8895         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
8896         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
8897         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
8898         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
8899         * options.cc (General_options::General_options): Initialize member
8900         fix_v4bx_.
8901         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
8902         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
8903         and rm_no_fix_v4bx.stdout
8904         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
8905         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
8906         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
8907         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
8908         and arm_no_fix_v4bx.
8909         * Makefile.in: Regenerate.
8910         * testsuite/arm_fix_v4bx.s: New file.
8911         * testsuite/arm_fix_v4bx.sh: Ditto.
8912
8913 2010-02-24  Doug Kwan  <dougkwan@google.com>
8914
8915         * arm.cc (Target_arm::got_section): Make the .got section the first
8916         non RELRO section in the data segment.
8917         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
8918         suffixes of section names.
8919
8920 2010-02-24  Doug Kwan  <dougkwan@google.com>
8921
8922         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
8923         flags and attributes merging if an input file is a binary file.
8924         * fileread.cc (Input_file::open): Record format of original file.
8925         * fileread.h (Input_file::Format): New enum type.
8926         (Input_file::Input_file): Initialize data member format_.
8927         (Input_file::format): New method definition.
8928         (Input_file::format_):: New data member.
8929
8930 2010-02-24  Doug Kwan  <dougkwan@google.com>
8931
8932         * arm.cc (Arm_output_data_got): New class.
8933         (ARM_TCB_SIZE): New constant
8934         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
8935         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
8936         If user uses a script with a SECTIONS clause, issue only a warning
8937         for a misplaced EXIDX input section.  Otherwise, issue an error.
8938         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
8939         garbage collection.
8940         (Target_arm::got_mode_index_entry): Handle static linking.
8941         (Target_arm::Scan::local): Ditto.
8942         (Target_arm::Scan::global): Ditto.
8943         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
8944         all incorrectly implemented relocations.
8945         (Target_arm::fix_exidx_coverage): Pass layout to
8946         Arm_output_section::fix_exidx_coverage.
8947         * layout.cc (Layout::section_name_mapping): Remove trailing dots
8948         from ".ARM.exidx." and ".ARM.extab.".
8949
8950 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8951
8952         * arm.cc (Target_arm::do_finalize_sections): Create attribute
8953         section if it does not already exist.
8954         * attributes.cc (Attributes_section_data::Attributes_section_data):
8955         Don't crash if size is zero.
8956
8957 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8958             Ian Lance Taylor  <iant@google.com>
8959
8960         * gold.cc (queue_middle_tasks): If no input files were opened,
8961         exit.
8962         * workqueue.h (Task_function::Task_function): Assert that there is
8963         a blocker.
8964
8965 2010-02-22  Doug Kwan  <dougkwan@google.com>
8966
8967         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
8968         * icf.cc (get_section_contents): Cast snprintf arguments to long long
8969         types to avoid warnings due to different uint64_t implementations
8970         on different hosts.
8971
8972 2010-02-21  Doug Kwan  <dougkwan@google.com>
8973
8974         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
8975         handling of the maximum backward branch offset.
8976         (Arm_relocate_functions::thumb_branch_common): Ditto.
8977         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
8978         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
8979         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
8980         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
8981         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
8982         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
8983         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
8984         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
8985         thumb_bl_out_of_range thumb_bl_out_of_range.o,
8986         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
8987         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
8988         thumb2_bl_out_of_range.o): New rules.
8989         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
8990         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
8991         thumb2_bl_out_of_range
8992         * testsuite/Makefile.in: Regenerate.
8993         * testsuite/arm_bl_in_range.s: New file.
8994         * testsuite/arm_bl_out_of_range.s: Ditto.
8995         * testsuite/arm_branch_in_range.sh: Ditto.
8996         * testsuite/arm_branch_range.t: Ditto.
8997         * testsuite/thumb2_branch_range.t: Ditto.
8998         * testsuite/thumb_bl_in_range.s: Ditto.
8999         * testsuite/thumb_bl_out_of_range.s: Ditto.
9000         * testsuite/thumb_branch_range.t: Ditto.
9001
9002 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
9003
9004         * gc.h (gc_process_relocs): Change vectors to point to the new list.
9005         Add reloc offset information.
9006         * icf.cc (get_section_contents): Change iterators to point to the new
9007         vectors. Add reloc offset information to the contents.
9008         * icf.h (Icf::Sections_reachable_info): New typedef.
9009         (Icf::Sections_reachable_list): New typedef.
9010         (Icf::Offset_info): New typedef.
9011         (Icf::Reloc_info): New struct typedef.
9012         (Icf::Reloc_info_list): New typedef.
9013         (Icf::symbol_reloc_list): Delete method.
9014         (Icf::addend_reloc_list): Delete method.
9015         (Icf::section_reloc_list): Delete method.
9016         (Icf::reloc_info_list): New method.
9017         (Icf::reloc_info_list_): New member.
9018
9019 2010-02-19  Doug Kwan  <dougkwan@google.com>
9020
9021         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
9022         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
9023         * arm.cc (Arm_relocation_functions): New forward declaration.
9024         (Target_arm::Target_arm): Initialize new data members
9025         got_mod_index_offset_ and tls_base_symbol_defined_.
9026         (Target_arm::Relocate::relocate_tls): New method.
9027         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
9028          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
9029         New methods.
9030         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
9031         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
9032         (Target_arm::got_mod_index_offset_,
9033         Target_arm::tls_base_symbol_defined_): New data members.
9034         (Target_arm::Scan::local, Target::Scan::global,
9035         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
9036         relocations.
9037
9038 2010-02-18  Doug Kwan  <dougkwan@google.com>
9039
9040         * arm.cc (Arm_relobj::find_linked_text_section): New method.
9041         (Arm_relobj::make_exidx_input_section): Pass section index of linked
9042         text section as a parameter becuase some broken tools may not set
9043         the link in section header.
9044         (Target_arm::has_got_section): New method.
9045         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
9046         without any mapping symbol as data only.  Remove warning.
9047         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
9048         link in its section header, try to discover the link by inspecting the
9049         REL31 relocation at the beginning of the section.
9050         (Target_arm::Scan::check_non_pic): Report name of offending relocation
9051         in error message.
9052         (Target_arm::Scan::global): Treat any reference to the symbol
9053         _GLOBAL_OFFSET_TABLE_ as a GOT access.
9054
9055 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
9056
9057         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
9058         (Scan::global_reloc_may_be_function_pointer): New function.
9059         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
9060         (Scan::global_reloc_may_be_function_pointer): New function.
9061         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
9062         (Scan::global_reloc_may_be_function_pointer): New function.
9063         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
9064         (Scan::global_reloc_may_be_function_pointer): New function.
9065         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
9066         (Scan::global_reloc_may_be_function_pointer): New function.
9067         (Scan::possible_function_pointer_reloc): New function.
9068         (Target_x86_64::can_check_for_function_pointers): New function.
9069         * gc.h (gc_process_relocs): Scan relocation types to determine if
9070         function pointers were taken for targets that support it.
9071         * icf.cc (Icf::find_identical_sections): Include functions for
9072         folding in safe ICF whose pointer is not taken.
9073         * icf.h (Secn_fptr_taken_set): New typedef.
9074         (fptr_section_id_): New member.
9075         (section_has_function_pointers): New function.
9076         (set_section_has_function_pointers): New function.
9077         (check_section_for_function_pointers): New function.
9078         * options.h: Fix comment for safe ICF option.
9079         * target.h (can_check_for_function_pointers): New function.
9080         * testsuite/Makefile.am: Add icf_safe_so_test test case.
9081         Modify icf_safe_test for X86-64.
9082         * testsuite/Makefile.in: Regenerate.
9083         * testsuite/icf_safe_so_test.cc: New file.
9084         * testsuite/icf_safe_so_test.sh: New file.
9085         * testsuite/icf_safe_test.cc (kept_func_3): New function.
9086         (main): Change to take pointer to function kept_func_3.
9087         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
9088         folding is done correctly for X86-64.
9089
9090 2010-02-12  David S. Miller  <davem@davemloft.net>
9091
9092         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
9093         is_symbolless parameter.
9094         (Output_reloc<SHT_REL>::is_symbolless): New.
9095         (Output_reloc<SHT_REL>::is_symbolless_): New.
9096         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
9097         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
9098         (Output_reloc<SHT_RELA>::is_symbolless): New.
9099         (Output_data_reloc::add_global): Handle is_symbolless.
9100         (Output_data_reloc::add_global_relative): Likewise.
9101         (Output_data_reloc::add_local): Likewise.
9102         (Output_data_reloc::add_local_relative): Likewise.
9103         (Output_data_reloc::add_symbolless_global_addend): New.
9104         (Output_data_reloc::add_symbolless_local_addend): New.
9105         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
9106         is_symbolless.
9107         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
9108         instead of ->is_relative_
9109         (Output_reloc::write): Likewise.
9110         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
9111         (Output_reloc::write_rel): Simplify.
9112
9113         * sparc.cc (Target_sparc::Scan::local): Use
9114         ->add_symbolless_local_addend as needed.
9115         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
9116         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
9117         based upon relocation offset.
9118
9119 2010-02-11  Doug Kwan  <dougkwan@google.com>
9120
9121         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
9122         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
9123         beginning of function.
9124         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
9125         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
9126         parameter is_32bit in calls to should_apply_static_reloc.
9127         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
9128         (check_DATA): Add arm_abs_global.stdout.
9129         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
9130         arm_abs_global.stdout): New rules.
9131         (MOSTLLYCLEANFILES): Add arm_abs_global
9132         * Makefile.in: Regenerate.
9133         * testsuite/arm_abs_global.s: New file.
9134         * testsuite/arm_abs_global.sh: Ditto.
9135         * testsuite/arm_abs_lib.s: Ditto.
9136
9137 2010-02-11  Ian Lance Taylor  <iant@google.com>
9138
9139         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
9140         Read_relocs task.
9141         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
9142         Allocate_commons_task first.
9143         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
9144         task, rather than symtab_lock_.
9145         (Gc_process_relocs::~Gc_process_relocs): New function.
9146         (Gc_process_relocs::is_runnable): Check this_blocker_.
9147         (Gc_process_relocs::locks): Use next_blocker_ rather than
9148         blocker_.
9149         (Scan_relocs::~Scan_relocs): New function.
9150         (Scan_relocs::is_runnable): Check this_blocker_ rather than
9151         symtab_lock_.
9152         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
9153         next_blocker_.
9154         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
9155         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
9156         constructor accordingly.
9157         (class Gc_process_relocs): Likewise.
9158         (class Scan_relocs): Likewise.
9159         * common.h (class Allocate_commons_task): Remove symtab_lock_
9160         field, and corresponding constructor parameter.
9161         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
9162         symtab_lock_.
9163         (Allocate_commons_task::locks): Likewise.
9164
9165 2010-02-11  Ian Lance Taylor  <iant@google.com>
9166
9167         * gold-threads.h (class Once): Define.
9168         (class Initialize_lock): Rewrite as child of Once.
9169         * gold-threads.cc (class Once_initialize): Define.
9170         (once_pointer_control): New static variable.
9171         (once_pointer, once_arg): New static variables.
9172         (c_run_once): New static function.
9173         (Once::Once, Once::run_once, Once::internal_run): New functions.
9174         (class Initialize_lock_once): Remove.
9175         (initialize_lock_control): Remove.
9176         (initialize_lock_pointer): Remove.
9177         (initialize_lock_once): Remove.
9178         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
9179         (Initialize_lock::initialize): Rewrite.
9180         (Initialize_lock::do_run_once): New function.
9181         * archive.cc (Archive::interpret_header): Only clear name if it is
9182         not already empty.
9183         * fileread.cc: Include "gold-threads.h"
9184         (file_counts_lock): New static variable.
9185         (file_counts_initialize_lock): Likewise.
9186         (File_read::release): Only increment counts when using --stats.
9187         Use a lock around the increment.
9188         * parameters.cc (class Set_parameters_target_once): Define.
9189         (set_parameters_target_once): New static variable.
9190         (Parameters::Parameters): Move here from parameters.h.
9191         (Parameters::set_target): Rewrite.
9192         (Parameters::set_target_once): New function.
9193         (Parameters::clear_target): Move here and rewrite.
9194         * parameters.h (class Parameters): Update declarations.  Add
9195         set_parameters_target_once_ field.
9196         (Parameters::Parameters): Move to parameters.cc.
9197         (Parameters::clear_target): Likewise.
9198         * readsyms.cc (Read_symbols::do_group): Create a Start_group
9199         task.
9200         (Start_group::~Start_group): New function.
9201         (Start_group::is_runnable): New function.
9202         (Start_group::locks, Start_group::run): New functions.
9203         (Finish_group::run): Change saw_undefined to size_t.
9204         * readsyms.h (class Start_group): Define.
9205         (class Finish_group): Change saw_undefined_ field to size_t.
9206         (Finish_group::Finish_group): Remove saw_undefined and
9207         this_blocker parameters.  Change all callers.
9208         (Finish_group::set_saw_undefined): New function.
9209         (Finish_group::set_blocker): New function.
9210         * symtab.h (class Symbol_table): Change saw_undefined to return
9211         size_t.  Change saw_undefined_ field to size_t.
9212         * target-select.cc (Set_target_once::do_run_once): New function.
9213         (Target_selector::Target_selector): Initialize set_target_once_
9214         field.  Don't initialize lock_ and initialize_lock_ fields.
9215         (Target_selector::instantiate_target): Rewrite.
9216         (Target_selector::set_target): New function.
9217         * target-select.h (class Set_target_once): Define.
9218         (class Target_selector): Update declarations.  Make
9219         Set_target_once a friend.  Remove lock_ and initialize_lock_
9220         fields.  Add set_target_once_ field.
9221
9222 2010-02-10  Ian Lance Taylor  <iant@google.com>
9223
9224         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
9225         queueing any tasks.
9226         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
9227         (queue_middle_tasks): Add all blockers before queueing any tasks.
9228         (queue_final_tasks): Likewise.
9229         * token.h (Task_token::add_blockers): New function.
9230         * object.h (Input_objects::number_of_relobjs): New function.
9231
9232 2010-02-10  Ian Lance Taylor  <iant@google.com>
9233
9234         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
9235         shared, not if not position independent.
9236         * x86_64.cc (Relocate::relocate_tls): Likewise.
9237         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
9238         (tls_pie_pic_test): New target.
9239         * testsuite/Makefile.in: Rebuild.
9240
9241         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
9242         (tls_test_main_pie.o, tls_test_pie.o): New targets.
9243         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
9244         * testsuite/Makefile.in: Rebuild.
9245
9246 2010-02-09  David S. Miller  <davem@davemloft.net>
9247
9248         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
9249         R_SPARC_RELATIVE using ->add_local_relative().
9250         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
9251
9252         * output.h (Output_data_dynamic::add_section_size): New method
9253         that takes two Output_data objects.
9254         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
9255         entry param.  Handle it in initializers.
9256         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
9257         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
9258         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
9259         arg.
9260         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
9261         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
9262         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
9263         for dynrel_includes_plt.
9264         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9265         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9266         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
9267         before .rela.plt
9268         (Target_sparc::do_finalize_sections): Update to pass true for
9269         dynrel_includes_plt.
9270         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
9271         output before .rela.plt
9272         (Target_powerpc::do_finalize_sections): Update to pass true for
9273         dynrel_includes_plt when 32-bit.
9274
9275 2010-02-08  Doug Kwan  <dougkwan@google.com>
9276
9277         * arm.cc (Arm_relobj::simple_input_section_output_address): New
9278         method.
9279         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
9280         Arm_relobj::scan_section_for_cortex_a8_stubs,
9281         Arm_relobj::do_relocation_section): Instead of calling
9282         Output_section::output_address, use faster
9283         Arm_relobj::simple_input_section_output_address.
9284
9285 2010-02-08  David S. Miller  <davem@davemloft.net>
9286
9287         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
9288         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
9289         relocation helper function.
9290
9291         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
9292         just like R_SPARC_GOT{10,13,22}.
9293         (Target_sparc::Scan::local): Likewise.
9294         (Target_sparc::Relocate:relocate): Likewise.
9295
9296 2010-02-06  Ian Lance Taylor  <iant@google.com>
9297
9298         * configure.ac: Rewrite targetobjs duplicate removal code to use
9299         only shell constructs.
9300         * configure: Rebuild.
9301
9302 2010-02-05  Doug Kwan  <dougkwan@google.com>
9303
9304         PR 11247
9305         * arm.cc (Arm_relobj::section_is_scannable): New method.
9306         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
9307         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
9308
9309 2010-02-04  Doug Kwan  <dougkwan@google.com>
9310
9311         PR 11247
9312         * arm-reloc-property.cc (cstdio): Include.
9313         * configure.ac (targetobjs): Remove duplicates.
9314         * configure: Regenerate.
9315         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
9316         big and little endian version for a given address size.
9317
9318 2010-02-03  Doug Kwan  <dougkwan@google.com>
9319
9320         * arm-reloc-property.cc
9321         (Arm_reloc_property_table::reloc_name_in_error_message): New method
9322         definition.
9323         * arm-reloc-property.h
9324         (Arm_reloc_property_table::get_implemented_static_reloc_property):
9325         New method definition.
9326         (Arm_reloc_property_table::reloc_name_in_error_message): New method
9327         declaration.
9328         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
9329         overflow to N.
9330         (GOT_PREL): Change implemented to Y.
9331         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
9332         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
9333         (Arm_relocate_functions::movw_abs_nc): Remove method.
9334         (Arm_relocate_functions::movt_abs): Ditto.
9335         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
9336         (Arm_relocate_functions::thm_movt_abs): Ditto.
9337         (Arm_relocate_functions::movw_rel_nc): Ditto.
9338         (Arm_relocate_functions::movw_rel): Ditto.
9339         (Arm_relocate_functions::movt_rel): Ditto.
9340         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
9341         (Arm_relocate_functions:thm_movw_rel): Ditto.
9342         (Arm_relocate_functions:thm_movt_rel): Ditto.
9343         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
9344         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
9345         New method definitions.
9346         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
9347         (Arm_relocation_functions::arm_grp_ldr): Ditto.
9348         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
9349         (Arm_relocation_functions::arm_grp_ldc): Ditto.
9350         (Target_arm::Relocate::relocate): Check for non-static or
9351         unimplemented relocation code and exit early.  Change calls to
9352         Target_arm::reloc_uses_thumb_bit and
9353         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
9354         instead.  Refactor code to handle similar relocations to increase
9355         code sharing.  Remove check for unsupported relocation code in switch
9356         statement.
9357         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
9358         relocation property table to find out size.  Change error message to
9359         print out the name of a relocation code instead of the numeric value.
9360         (Target_arm::scan_reloc_for_stub): Use relocation property table
9361         instead of calling Target_arm::reloc_uses_thumb_bit().
9362
9363 2010-02-02  Doug Kwan  <dougkwan@google.com>
9364
9365         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
9366         types of relaxed input section.
9367
9368 2010-02-02  Doug Kwan  <dougkwan@google.com>
9369
9370         * Makefile.am (HFILES): Add arm-reloc-property.h.
9371         (DEFFILES): New.
9372         (TARGETSOURCES): Add arm-reloc-property.cc
9373         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
9374         (libgold_a_SOURCES): $(DEFFILES)
9375         * Makefile.in: Regenerate.
9376         * arm-reloc-property.cc: New file.
9377         * arm-reloc-property.h: New file.
9378         * arm-reloc.def: New file.
9379         * arm.cc: Update comments.
9380         (arm-reloc-property.h): New included header.
9381         (arm_reloc_property_table): New global variable.
9382         (Target_arm::do_select_as_default_target): New method definition.
9383         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
9384         arm-reloc-property to targ_extra_obj.
9385         * parameters.cc (set_parameters_target): Call
9386         Target::select_as_default_target().
9387         * target.h (Target::select_as_default_target): New method definition.
9388         (Target::do_select_as_default_target): Same.
9389
9390 2010-02-01  Doug Kwan  <dougkwan@google.com>
9391
9392         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
9393         first_output_text_section_.
9394         (Arm_exidx_fixup::first_output_text_section): New method definition.
9395         (Arm_exidx_fixup::first_output_text_section_): New data member.
9396         (Arm_exidx_fixup::process_exidx_section): Record the first text
9397         output section seen.
9398         (Arm_output_section::fix_exidx_coverage): Set correct linked section
9399         and entsize in output section header.
9400
9401 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9402
9403         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
9404         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
9405         (Arm_relocate_functions::thm_alu11): New Method.
9406         (Arm_relocate_functions::thm_pc8): New Method.
9407         (Arm_relocate_functions::thm_pc12): New Method.
9408         (Target_arm::Scan::local): Handle the relocations.
9409         (Target_arm::Scan::global): Likewise.
9410         (Target_arm::Relocate::relocate): Likewise.
9411         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9412
9413 2010-01-29  Doug Kwan  <dougkwan@google.com>
9414
9415         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
9416         of relocation types as ld.
9417
9418 2010-01-29  Doug Kwan  <dougkwan@google.com>
9419
9420         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
9421         to public.
9422         (Arm_relocate_functions::thumb_branch_common): Ditto.
9423         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
9424         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
9425         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
9426         Arm_relocate_functions::jump24): Remove.
9427         (Target_arm::Relocate::relocate): Adjust code to call
9428         Arm_relocation_functions::arm_branch_common and
9429         Arm_relocation_functions::thumb_branch_common instead of their removed
9430         wrappers.  Merge switch-cases together to reduce source code size.
9431
9432 2010-01-29  Doug Kwan  <dougkwan@google.com>
9433
9434         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
9435         output_local_symbol_count_needs_update_.
9436         (Arm_relobj::output_local_symbol_count_needs_update,
9437          Arm_relobj::set_output_local_symbol_count_needs_update,
9438          Arm_relobj::update_output_local_symbol_count): New methods.
9439         (Arm_relobj::output_local_symbol_count_needs_update_): New data
9440         member.
9441         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
9442         of pointed function as in a R_ARM_PREL31 relocation.
9443         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
9444         for output local symbol count updating.
9445         (Target_arm::do_relax): Update output local symbol counts in objects
9446         if necessary.
9447         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
9448
9449 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9450
9451         * arm.cc: Added support for the ARM relocations:
9452         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
9453         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
9454         (Arm_relocate_functions::movw_rel_nc): Renamed (was
9455         movw_prel_nc).
9456         (Arm_relocate_functions::movw_rel): New method.
9457         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
9458         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
9459         thm_movw_prel_nc).
9460         (Arm_relocate_functions::thm_movw_rel): New method.
9461         (Arm_relocate_functions::thm_movt_rel): Renamed (was
9462         thm_movt_prel).
9463         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
9464         relocations.
9465         (Target_arm::Scan::global): Likewise.
9466         (Target_arm::Relocate::relocate): Likewise.
9467         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9468         Likewise.
9469
9470 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9471
9472         * arm.cc: Added support for ARM group relocations.
9473         (Target_arm::reloc_needs_sym_origin): New method.
9474         (Arm_relocate_functions::calc_grp_kn): New method.
9475         (Arm_relocate_functions::calc_grp_residual): New method.
9476         (Arm_relocate_functions::calc_grp_gn): New method.
9477         (Arm_relocate_functions::arm_grp_alu): New Method.
9478         (Arm_relocate_functions::arm_grp_ldr): New Method.
9479         (Arm_relocate_functions::arm_grp_ldrs): New Method.
9480         (Arm_relocate_functions::arm_grp_ldc): New Method.
9481         (Target_arm::Scan::local): Handle the ARM group relocations.
9482         (Target_arm::Scan::global): Likewise.
9483         (Target_arm::Relocate::relocate): Likewise.
9484         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9485         Likewise.
9486
9487 2010-01-26  Doug Kwan  <dougkwan@google.com>
9488
9489         * arm.cc (set): Include.
9490         (class Arm_exidx_fixup): Change type of last_input_section_ to const
9491         pointer type.
9492         (Arm_output_section::Text_section_list): New type.
9493         (Arm_output_section::append_text_sections_to_list): New method.
9494         (Arm_output_section::fix_exidx_coverage): Ditto.
9495         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
9496         (Arm_relobj::convert_input_section_to_relaxed_section): Use
9497         Relobj::set_section_offset() instead of
9498         Sized_relobj::invalidate_section_offset().
9499         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
9500         parameter for section headers. Ignore relocation sections for
9501         unallocated sections and EXIDX sections.
9502         (Target_arm::fix_exidx_coverage): New method.
9503         (Target_arm::output_section_address_less_than): New type.
9504         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
9505         linked text section instead of the EXIDX section.
9506         (Arm_output_section::create_stub_group): Add an assertion to check
9507         that this is not an EXIDX output section.
9508         (Arm_output_section::append_text_sections_to_list): New method.
9509         (Arm_output_section::fix_exidx_coverage): Ditto.
9510         (Arm_relobj::scan_sections_for_stubs): Adjust call to
9511         Arm_relobj::section_needs_reloc_stub_scanning.
9512         (Target_arm::do_relax): Fix EXIDX output section coverage in the
9513         first pass.
9514         (Target_arm::fix_exidx_coverage): New method.
9515         * object.h (Relobj::set_output_section): New method.
9516         (Sized_relobj::invalidate_section_offset): Remove method.
9517         (Sized_relobj::do_invalidate_section_offset): Remove method.
9518         (Sized_relobj::do_set_section_offset): Handle offset value -1.
9519
9520 2010-01-25  Doug Kwan  <dougkwan@google.com>
9521
9522         * arm.cc (Arm_exidx_merged_section::do_output_offset):
9523         Fix warning due to signed and unsigned comparison on a 32-bit host.
9524
9525 2010-01-22  Doug Kwan  <dougkwan@google.com>
9526
9527         * arm.cc (Target_arm::do_relax): Record an output section for section
9528         offset adjustment it contains any stub table that has changed.
9529         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
9530         offsets in an output section if necessary.
9531         * output.cc (Output_section::Output_section): Initialize
9532         section_offsets_need_adjustments_.
9533         (Output_section::add_input_section_for_script): Renamed to
9534         Output_section::add_simple_input_section.
9535         (Output_section::save_states): Add a comment.
9536         (Output_section::discard_states): New method defintion.
9537         (Output_section::adjust_section_offsets): Same.
9538         * output.h (Output_section::add_input_section_for_script): Renamed to
9539         Output_section::add_simple_input_section.
9540         (Output_section::discard_states): New method declaration.
9541         (Output_section::adjust_section_offsets): Same.
9542         (Output_section::section_offsets_need_adjustment,
9543         Output_section::set_section_offsets_need_adjustment): New method
9544         definitions.
9545         (Output_section::section_offsets_need_adjustment_): New data member.
9546         * script-sections.cc
9547         (Output_section_element_input::set_section_address): Adjust code for
9548         renaming of Output_section::add_input_section_for_script.
9549         (Orphan_output_section::set_section_address): Same.
9550
9551 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9552
9553         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
9554         Fix_v4bx enum values .
9555         * gold/options.h (General_options): New option definitions.
9556         (General_options::fix_v4bx): New method.
9557         (General_options::Fix_v4bx): New enum.
9558         * gold/options.cc (General_options::parse_fix_v4bx): New method.
9559         (General_options::parse_fix_v4bx_interworking): New method.
9560
9561 2010-01-22  Doug Kwan  <dougkwan@google.com>
9562
9563         * arm.cc (Arm_exidx_fixup): New class.
9564
9565 2010-01-21  Doug Kwan  <dougkwan@google.com>
9566
9567         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
9568         classes.
9569         (Arm_exidx_section_offset_map): New type.
9570
9571 2010-01-21  Doug Kwan  <dougkwan@google.com>
9572
9573         * arm.cc (Arm_exidx_input_section): New class.
9574         (Arm_relobj::exidx_input_section_by_link,
9575         Arm_relobj::exidx_input_section_by_shndx,
9576         Arm_relobj::make_exidx_input_section): New methods.
9577         (read_arm_attributes_section): Remove.
9578         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
9579         information about them.
9580         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
9581         to here.
9582
9583 2010-01-20  Doug Kwan  <dougkwan@google.com>
9584
9585         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
9586         Input_section_specifier to Section_id.
9587         (Target_arm::new_arm_input_section: Adjust code for change of key
9588         type.
9589         (Target_arm::find_arm_input_section): Ditto.
9590         * gc.h (object.h): Include for Section_id nand Section_id_hash.
9591         (Section_id): Remove.
9592         (Garbage_collection::Section_id_hash): Remove.
9593         * icf.h (object.h): Include for Section_id nand Section_id_hash.
9594         (Section_id): Remove.
9595         (Icf::Section_id_hash): Remove.
9596         * object.h (Section_id, Const_section_id, Section_id_hash,
9597         Const_section_id_hash): New type definitions.
9598         * output.cc (Output_section::add_relaxed_input_section): Change to
9599         use Const_section_id instead of Input_section_specifier as key type.
9600         (Output_section::add_merge_input_section): Ditto.
9601         (Output_section::build_relaxation_map): Change to use Section_id
9602         instead of Input_section_specifier as key type.
9603         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9604         Ditto.
9605         (Output_section::convert_input_sections_to_relaxed_sections): Change
9606         to use Const_section_id instead of Input_section_specifier as key type.
9607         (Output_section::find_merge_section): Ditto.
9608         (Output_section::find_relaxed_input_section): Ditto.
9609         * output.h (Input_section_specifier): Remove class.
9610         (Output_section::Output_section_data_by_input_section_map): Change
9611         key type to Const_section_id.
9612         (Output_section::Output_relaxed_input_section_by_input_section_map):
9613         Ditto.
9614         (Output_section::Relaxation_map): Change key type to Section_id.
9615
9616 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9617
9618         * gold/arm.cc: Added support for R_ARM_V4BX relocation
9619         (class Arm_v4bx_stub): New class.
9620         (DEF_STUBS): Updated definition to support v4_veneer_bx.
9621         (Stub_factory::make_arm_v4bx_stub): New method.
9622         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
9623         (Stub_table::empty): Handle v4bx stubs.
9624         (Stub_table::add_arm_v4bx_stub): New method.
9625         (Stub_table::find_arm_v4bx_stub): New method.
9626         (Arm_relocate_functions::v4bx): New method.
9627         (Target_arm::fix_v4bx): New method.
9628         (Target_arm::Target_arm): Handle R_ARM_V4BX.
9629         (Stub_table::relocate_stubs): Likewise.
9630         (Stub_table::do_write): Likewise.
9631         (Stub_table::update_data_size_and_addralign): Likewise.
9632         (Stub_table::finalize_stubs):  Likewise.
9633         (Target_arm::Scan::local): Likewise.
9634         (Target_arm::Scan::global): Likewise.
9635         (Target_arm::do_finalize_sections): Likewise.
9636         (Target_arm::Relocate::relocate): Likewise.
9637         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9638         Likewise.
9639         (Target_arm::scan_reloc_for_stub): Likewise.
9640         (Target_arm::scan_reloc_section_for_stubs): Likewise.
9641
9642 2010-01-19  Ian Lance Taylor  <iant@google.com>
9643
9644         * output.cc (Output_section_headers::do_sized_write): Write large
9645         segment count to sh_info field.
9646         (Output_file_header::do_sized_write): For large segment count,
9647         write PN_XNUM to e_phnum field.
9648
9649 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9650
9651         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
9652         (Arm_relocate_functions::thm_jump8): New function.
9653         (Arm_relocate_functions::thm_jump11): New function.
9654         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
9655         R_ARM_THM_JUMP11.
9656         (Target_arm::Scan::global): Likewise.
9657         (Target_arm::Relocate::relocate): Likewise.
9658         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9659         Likewise.
9660
9661 2010-01-14  Doug Kwan  <dougkwan@google.com>
9662
9663         * arm.cc (map, utility): Include headers.
9664         (Target_arm::apply_cortex_a8_workaround): New method.
9665         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
9666         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
9667         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
9668         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
9669         the --[no-]fix-cortex-a8 command line options.
9670         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
9671         (Target_arm::relocate_stub): Use addend in instruction template.
9672         * options.h (DEFINE_bool): Set the user-set flag.
9673         (General_options): Add --[no-]-fix-cortex options.
9674         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
9675         : Update fast look-up map after conversion.
9676
9677 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
9678
9679         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
9680         in the first pass of do_layout.
9681
9682 2010-01-13  Doug Kwan  <dougkwan@google.com>
9683
9684         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9685         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
9686         apparent compiler problem of not folding static constant integral
9687         data members of elfcpp::Elf_sizes<32>.
9688
9689 2010-01-13  Doug Kwan  <dougkwan@google.com>
9690
9691         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9692         Arm_relobj::section_needs_cortex_a8_stub_scanning,
9693         Arm_relobj::scan_section_for_cortex_a8_erratum,
9694         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
9695         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
9696         sections to scan for relocation stubs into a new method
9697         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
9698         relocation and Cortex-A8 stub scanning.
9699         (Target_arm::do_relax): Force stubs to be after stubbed sections
9700         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
9701         the beginning of a new relaxation pass.  Update a comment.
9702         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
9703
9704 2010-01-12  Ian Lance Taylor  <iant@google.com>
9705
9706         * target-reloc.h (visibility_error): New inline function.
9707         (relocate_section): Call visibility_error.
9708         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
9709         (MOSTLYCLEANFILES): Likewise.
9710         (protected_4_pic.o, protected_3.err): New targets.
9711         * testsuite/protected_4.cc: New file.
9712
9713 2010-01-12  Doug Kwan  <dougkwan@google.com>
9714
9715         * arm.cc (Cortex_a8_reloc): New class.
9716         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
9717         and cortex_a8_relocs_info_.
9718         (Target_arm::fix_cortex_a8): New method definition.
9719         (Target_arm::Cortex_a8_relocs_info): New type.
9720         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
9721         New data member declarations.
9722         (Target_arm::scan_reloc_for_stub): Record information about
9723         relocations for THUMB branches that might be exempted from the
9724         Cortex-A8 workaround.
9725         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
9726         at the beginning of a relaxation pass.
9727
9728 2010-01-12  Doug Kwan  <dougkwan@google.com>
9729
9730         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
9731         (Arm_relobj::Mapping_symbol_position,
9732          Arm_reloj::Mapping_symbol_position_less,
9733          Arm_relobj::Mapping_symbols_info): New types.
9734         (Target_arm::is_mapping_symbol_name): New method definition.
9735         (Arm_relobj::do_count_local_symbols): Save information about mapping
9736         symbols.
9737
9738 2010-01-11  Doug Kwan  <dougkwan@google.com>
9739
9740         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
9741         Arm_relocate_functions::thumb32_branch_upper,
9742         Arm_relocate_functions::thumb32_branch_lower,
9743         Arm_relocate_functions::thumb32_cond_branch_offset,
9744         Arm_relocate_functions::thumb32_cond_branch_upper,
9745         Arm_relocate_functions::thumb32_cond_branch_lower,
9746         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
9747         branch offset encoding.
9748         (Arm_relocate_functions::thumb_branch_common): Use new branch
9749         offset encoding methods to avoid code duplication.
9750         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
9751         (Stub_addend_reader::operator()): Use new branch encoding method
9752         to avoid code duplication.
9753
9754 2010-01-11  Doug Kwan  <dougkwan@google.com>
9755
9756         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
9757         (Target_arm::do_finalize_sections): Define special EXIDX section
9758         symbols only if referenced.
9759         * gc.h (Garbage_collection::add_reference): New method.
9760         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
9761         code duplication.
9762
9763 2010-01-11  Ian Lance Taylor  <iant@google.com>
9764
9765         * script.cc (Version_script_info::build_expression_list_lookup):
9766         Change complaing about duplicate wildcard match from error to
9767         warning.
9768
9769         * script.cc (class Lazy_demangler): Recreate--revert part of patch
9770         of 2009-12-30.
9771         (Version_script_info::Version_script_info): Initialize globs_,
9772         default_version_, default_is_global_, and exact_.  Don't
9773         initialize globals_ or locals_.
9774         (Version_script_info::build_lookup_tables): Build local symbols
9775         first.
9776         (Version_script_info::unquote): New function.
9777         (Version_script_info::add_exact_match): New function.
9778         (Version_script_info::build_expression_list_lookup): Remove lookup
9779         parameter.  Add is_global parameter.  Change all callers.  Handle
9780         wildcard pattern specially.  Unquote pattern.  Call
9781         add_exact_match.
9782         (Version_script_info::get_name_to_match): New function.
9783         (Version_script_info::get_symbol_version): New function.
9784         (Version_script_info::get_symbol_version_helper): Remove.
9785         (Version_script_info::check_unmatched_names): Call unquote.
9786         * script.h (class Version_script_info): Change get_symbol_version
9787         to be non-inline and add is_global parameter; change all callers.
9788         Rewrite symbol_is_local.  Update declarations.  Define struct
9789         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
9790         Remove globals_ and locals_ members.  Add exact_, globs_,
9791         default_version_, is_global_.
9792         (Version_script_info::Glob): Remove pattern, add expression and
9793         is_global.  Update constructor.  Change all callers.
9794         * dynobj.cc (Versions::finalize): Mark the version symbol as the
9795         default version.
9796         (Versions::symbol_section_contents): If a symbol is undefined, or
9797         defined in a dynamic object, set the version index to
9798         VER_NDX_LOCAL.
9799         * symtab.cc (Symbol_table::add_from_relobj): Don't call
9800         symbol_is_local.
9801         (Symbol_table::add_from_pluginobj): Likewise.
9802         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
9803
9804 2010-01-11  Doug Kwan  <dougkwan@google.com>
9805
9806         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
9807         (incremental_dump_LDADD): Add linking option for libintl.
9808         * Makefile.in: Regenerate.
9809
9810 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
9811
9812         PR gold/11144
9813         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
9814         instead of -Ds.
9815         * testsuite/Makefile.in: Regenerated.
9816
9817 2010-01-10  Doug Kwan  <dougkwan@google.com>
9818
9819         * options.h (DEFINE_var): Use parentheses around argument varname__
9820         in macro body to avoid any unintended subsequent substitutions.
9821
9822 2010-01-10  Ian Lance Taylor  <iant@google.com>
9823
9824         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
9825         candidates before doing symbol resolution.
9826
9827         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
9828         ODR candidates if only one is weak.
9829
9830 2010-01-08  Ian Lance Taylor  <iant@google.com>
9831
9832         * script.cc (Version_script_info::build_expression_list_lookup):
9833         Don't warn about ambiguous version, just record the ambiguity.
9834         (Version_script_info::get_symbol_version_helper): Give error if
9835         version is ambiguous.
9836
9837 2010-01-08  Doug Kwan  <dougkwan@google.com>
9838
9839         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
9840         prev_data_size_ and prev_addralign_.  Remove initializer for
9841         deleted data member has_been_changed_.
9842         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
9843         to determine if the table is empty.
9844         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
9845         Remove.
9846         (Stub_table::add_reloc_stub): Define method in class definition
9847         instead of just declaring it there.
9848         (Stub_table::add_cortex_a8_stub): New method definition.
9849         (Stub_table::update_data_size_and_addralign): Ditto.
9850         (Stub_table::finalize_stubs): Ditto.
9851         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
9852         (Stub_table::do_addralign_): Return address alignment in the
9853         (Stub_table::do_reset_address_and_file_offset): Define method in
9854         class definition instead of declaring it there.  Set current data
9855         size to be the data size of the previous pass.
9856         (Stub_table::set_final_data_size): Use current data size as the
9857         final data size.
9858         (Stub_table::relocate_stub): Change parameter type of stub from
9859         Reloc_stub pointer to Stub pointer.
9860         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
9861         (Stub_table::Cortex_a8_stub_list): New typedef.
9862         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
9863          Stub_table::prev_addralign_): New data member.
9864         (Arm_relobj::Arm_relobj): Initialize data member
9865         section_has_cortex_a8_workaround_.
9866         (Arm_relobj::section_has_cortex_a8_workaround,
9867          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
9868          definitions.
9869         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
9870         declarations.
9871         (Target_arm::relocate_stub): Change parameter type of stub from
9872         Reloc_stub pointer to Stub pointer.
9873         (Insn_template::size, Insn_template::alignment): Handle
9874         THUMB16_SPECIAL_TYPE.
9875         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
9876          Stub_table::update_data_size_and_addralign,
9877          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
9878         definitions.
9879         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
9880         (Stub_table::do_write): Ditto.
9881         (Target_arm::do_relax): Adjust code for changes in Stub_table.
9882
9883 2010-01-08  Ian Lance Taylor  <iant@google.com>
9884
9885         PR 11108
9886         * symtab.h (class Symbol): Remove fields is_target_special_ and
9887         has_plt_offset_.  Add field is_defined_in_discarded_section_.
9888         (Symbol::is_defined_in_discarded_section): New function.
9889         (Symbol::set_is_defined_in_discarded_section): New function.
9890         (Symbol::has_plt_offset): Rewrite.
9891         (Symbol::set_plt_offset): Verify that new offset is not -1U.
9892         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
9893         Don't initialize is_target_special_ or has_plt_offset_.
9894         Initialize is_defined_in_discarded_section_.
9895         (Symbol_table::add_from_relobj): If appropriate, set
9896         is_defined_in_discarded_section.
9897         * resolve.cc (Symbol::override_base_with_special): Don't test
9898         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
9899         * target-reloc.h (relocate_section): Do special handling for
9900         symbols defined in discarded sections for global symbols as well
9901         as local symbols.
9902
9903 2010-01-08  Ian Lance Taylor  <iant@google.com>
9904
9905         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
9906         the SHT_SYMTAB case.
9907
9908 2010-01-08  Ian Lance Taylor  <iant@google.com>
9909
9910         * object.cc (Sized_relobj::do_layout): Don't get confused if
9911         layout_eh_frame returns NULL.
9912
9913 2010-01-08  Ian Lance Taylor  <iant@google.com>
9914
9915         PR 11084
9916         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
9917         dynamic symbol table, use the normal symbol table.
9918         (Sized_dynobj::do_read_symbols): Remove assertion about type of
9919         symbol table.
9920
9921 2010-01-08  Ian Lance Taylor  <iant@google.com>
9922
9923         PR 11072
9924         * layout.cc (Layout::include_section): Remove .gnu_debuglink
9925         sections.
9926
9927 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
9928
9929         * version.cc (print_version): Change to "Copyright 2010".
9930
9931 2010-01-08  Ian Lance Taylor  <iant@google.com>
9932
9933         PR 10287
9934         PR 11063
9935         * i386.cc (class Target_i386): Change return type of plt_section
9936         to be non-const.
9937         (class Output_data_plt_i386): Add tls_desc_rel_ field.
9938         (Output_data_plt_i386::Output_data_plt_i386): Initialize
9939         tls_desc_rel_ field.
9940         (Output_data_plt_i386::rel_tls_desc): New function.
9941         (Target_i386::rel_tls_desc_section): New function.
9942         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
9943         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
9944         R_386_TLS_DESC reloc in rel_tls_desc_section.
9945         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
9946         Define struct Tlsdesc_info.
9947         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
9948         (Target_x86_64::do_reloc_symbol_index): New function.
9949         (Target_x86_64::add_tlsdesc_info): New function.
9950         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
9951         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
9952         tlsdesc_rel_ field.
9953         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
9954         all callers.
9955         (Output_data_plt_x86_64::rela_tlsdesc): New function.
9956         (Target_x86_64::rela_tlsdesc_section): New function.
9957         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
9958         handling.
9959         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
9960         (Target_x86_64::do_reloc_addend): New function.
9961         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
9962         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
9963         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
9964         (Output_reloc::type): New function.
9965         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
9966         (Output_reloc::is_target_specific): New function.
9967         (Output_reloc::target_arg): New function.
9968         (class Output_reloc) [SHT_RELA]: Add four new constructors for
9969         absolute relocs and target specific relocs.
9970         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
9971         add_target_specific.
9972         (class Output_data_reloc) [SHT_RELA]: Likewise.
9973         * output.cc (Output_reloc::Output_reloc): Add four new versions
9974         for absolute relocs and target specific relocs.
9975         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
9976         (Output_reloc::get_symbol_index): Likewise.
9977         (Output_reloc::local_section_offset): Check that local_sym_index_
9978         is not TARGET_CODE or 0.
9979         (Output_reloc::symbol_value): Likewise.
9980         (Output_reloc::write) [SHT_RELA]: Call target for target specific
9981         reloc.
9982         * target.h (class Target): Add reloc_symbol_index and reloc_addend
9983         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
9984         functions.
9985         * layout.cc (add_target_dynamic_tags): Use output section for
9986         DT_PLTRELSZ and DT_JMPREL.
9987
9988 2010-01-07  Ian Lance Taylor  <iant@google.com>
9989
9990         PR 11061
9991         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
9992         function.
9993         (class Output_data_reloc_generic): Define.
9994         (class Output_data_reloc_base): Change base class to
9995         Output_data_reloc_generic.  Change add() method to call
9996         bump_relative_reloc_count for a relative reloc.  Remove
9997         sort_relocs_ field.
9998         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
9999         to sort_relocs().
10000         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
10001         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
10002         appropriate.
10003         * layout.h (class Layout): Update declaration.
10004
10005 2010-01-07  Ian Lance Taylor  <iant@google.com>
10006
10007         * output.h (class Output_data): Add const version of
10008         output_section and do_output_section.
10009         (class Output_section_data): Add const version of
10010         do_output_section.
10011         (class Output_section): Likewise.
10012         * layout.cc (Layout::add_target_dynamic_tags): New function.
10013         * layout.h (class Layout): Update declarations.
10014         * arm.cc (Target_arm::do_finalize_sections): Use
10015         add_target_dynamic_tags.
10016         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10017         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10018         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10019         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10020
10021 2010-01-07  Ian Lance Taylor  <iant@google.com>
10022
10023         PR 11042
10024         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
10025         object as needed.
10026
10027 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
10028             Ian Lance Taylor  <iant@google.com>
10029
10030         PR 11019
10031         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
10032         Xindex::read_symtab_xindex.
10033
10034 2010-01-07  Doug Kwan  <dougkwan@google.com>
10035
10036         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
10037         (Insn_template::thumb16_bcond_insn): New method declaration.
10038         (Insn_template): Fix spelling.
10039         (Stub::thumb16_special): New method declaration.
10040         (Stub::do_write): Define virtual method which was previously pure
10041         virtual.
10042         (Stub::do_thumb16_special): New method declaration.
10043         (Stub::do_fixed_endian_write): New template member.
10044         (Reloc_stub::do_write): Remove.
10045         (Reloc_stub::do_fixed_endian_write): Remove.
10046         (Cortex_a8_stub): New class definition.
10047         (Stub_factory::make_cortex_a8_stub): New method definition.
10048         (Stub_factory::Stub_factory): Add missing static storage class
10049         qualifier for elf32_arm_stub_a8_veneer_blx.
10050
10051 2010-01-07  Ian Lance Taylor  <iant@google.com>
10052
10053         PR 10980
10054         * options.h (class General_options): Add --warn-unresolved-symbols
10055         and --error-unresolved-symbols.
10056         * errors.cc (Errors::undefined_symbol): Implement
10057         --warn-unresolved-symbols.
10058
10059         * options.h (class General_options): Add -z text and -z textoff.
10060         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
10061
10062 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
10063
10064         * gc.h (Garbage_collection::Cident_section_map): New typedef.
10065         (Garbage_collection::cident_sections): New function.
10066         (Garbage_collection::add_cident_section): New function.
10067         (Garbage_collection::cident_sections_): New member.
10068         (gc_process_relocs): Add references to sections whose names are C
10069         identifiers.
10070         * gold.h (cident_section_start_prefix): New constant.
10071         (cident_section_stop_prefix): New constant.
10072         (is_cident): New function.
10073         * layout.cc (Layout::define_section_symbols): Replace string constants
10074         with the newly defined constants.
10075         * object.cc (Sized_relobj::do_layout): Track sections whose names are
10076         C identifiers.
10077         * testsuite/Makefile.am: Add gc_orphan_section_test.
10078         * testsuite/Makefile.in: Regenerate.
10079         * testsuite/gc_orphan_section_test.cc: New file.
10080         * testsuite/gc_orphan_section_test.sh: New file.
10081
10082 2010-01-06  Ian Lance Taylor  <iant@google.com>
10083
10084         PR 10980
10085         * options.h (class General_options): Add --warn-shared-textrel.
10086         * layout.cc (Layout::finish_dynamic_section): Implement
10087         --warn-shared-textrel.
10088
10089         PR 10980
10090         * options.h (class General_options): Add --warn-multiple-gp.
10091
10092 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10093
10094         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
10095         $(THREADSLIB) and $(LIBDL).
10096         * Makefile.in: Rebuild.
10097
10098 2010-01-06  Ian Lance Taylor  <iant@google.com>
10099
10100         PR 10980
10101         * options.cc (General_options::parse_section_start): New function.
10102         (General_options::section_start): New function.
10103         (General_options::General_options): Initialize all members.
10104         * options.h: Include <map>
10105         (class General_options): Add --section-start.  Add section_starts_
10106         member.
10107         * layout.cc (Layout::attach_allocated_section_to_segment): If
10108         --section-start was used, set the address of the segment.  Remove
10109         local sort_sections.
10110         (Layout::relaxation_loop_body): If the address of the load segment
10111         has been set by --section-start, don't use it.
10112         * output.h (Output_segment::update_flags_for_output_section): New
10113         function.
10114         * output.cc (Output_segment::add_output_section): Call
10115         update_flags_for_output_section.
10116
10117 2010-01-05  Ian Lance Taylor  <iant@google.com>
10118
10119         PR 10980
10120         * options.h (class General_options): Add --undefined-version.
10121         * script.cc (struct Version_expression): Add was_matched_by_symbol
10122         field.
10123         (Version_script_info::matched_symbol): New function.
10124         (Version_script_info::get_symbol_version_helper): Call
10125         matched_symbol.
10126         (Version_script_info::check_unmatched_names): New function.
10127         * script.h (class Version_script_info): Update declarations.
10128         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
10129
10130         * options.h (class General_options): Use DEFINE_bool_alias for
10131         allow_multiple_definition.
10132         * resolve.cc (Symbol_table::should_override): Don't test
10133         allow_multiple_definition.
10134
10135         PR 10980
10136         * options.h (class General_options): Add --cref.
10137         * main.cc (main): Print cref table if --cref.  Don't close mapfile
10138         until after printing cref table.
10139         * cref.cc: Include "symtab.h".
10140         (class Cref_inputs): Define Cref_table_compare and Cref_table.
10141         (Cref_table_compare::operator()): New function.
10142         (Cref_inputs::gather_cref): New function.
10143         (filecol): New static const.
10144         (Cref_inputs::print_cref): New function.
10145         (Cref::print_cref): New function.
10146         * cref.h: Include <cstdio>.
10147         (class Cref): Update declarations.
10148         * mapfile.h (Mapfile::file): New function.
10149         * object.h (class Object): Define Symbols.  Declare virtual
10150         do_get_global_symbols.
10151         (Object::get_global_symbols): New function.
10152         * object.cc (Input_objects::add_object): Pass object to cref_ if
10153         --cref.
10154         (Input_objects::archive_start): Likewise.
10155         (Input_objects::archive_stop): Likewise.
10156         (Input_objects::print_cref): New function.
10157         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
10158         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
10159         --cref.
10160         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
10161         function.
10162         * plugin.h (class Sized_pluginobj): Update declarations.
10163
10164 2010-01-05  Ian Lance Taylor  <iant@google.com>
10165
10166         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
10167         to is_default_version.  Rename insdef to insdefault.
10168         (Symbol_table::add_from_relobj): Rename def to is_default_version
10169         and local to is_forced_local.
10170         (Symbol_table::add_from_pluginobj): Likewise.
10171         (Symbol_table::add_from_dynobj): Likewise.
10172         (Symbol_table::define_special_symbol): Rename insdef to
10173         insdefault.
10174
10175 2010-01-04  Ian Lance Taylor  <iant@google.com>
10176
10177         PR 10980
10178         * options.h (class General_options): Add
10179         --allow-multiple-definition and -z muldefs.
10180         * resolve.cc (Symbol_table::should_override): Don't warn about a
10181         multiple symbol definition if --allow-multiple-definition or -z
10182         muldefs.
10183
10184         PR 10980
10185         * options.h (class General_options): Add --add-needed and
10186         --copy-dt-needed-entries.  Tweak --as-needed help entry.
10187         * object.cc (Input_objects::check_dynamic_dependencies): Give an
10188         error if --copy-dt-needed-entries aka --add-needed is used and
10189         would cause a change in behaviour.
10190
10191         PR 10980
10192         * options.h (class General_options): Add -G as a short version of
10193         --shared.  Add no-op options -assert, -g, and -i.
10194
10195 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
10196
10197         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
10198         check for .text or .gnu.linkonce.t sections.
10199         * icf.cc (Icf::find_identical_sections): Ditto.
10200         Change the detection for mangled function name within the section
10201         name.
10202         * icf.h (is_section_foldable_candidate): New function.
10203
10204 2009-12-30  Ian Lance Taylor  <iant@google.com>
10205
10206         PR 10980
10207         * options.h (class General_options): Permit two dashes with
10208         --retain-symbols-file.
10209
10210 2009-12-30  Ian Lance Taylor  <iant@google.com>
10211
10212         PR 10979
10213         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
10214         don't put the file header and segment headers in the text
10215         segment.
10216
10217         PR 10979
10218         * common.cc (Sort_commons::operator()): Stabilize sort when both
10219         entries are NULL.
10220         (Symbol_table::do_allocate_commons_list): When allocating common
10221         symbols, skip a symbol which is no longer common.
10222         * symtab.h (Symbol::is_common): Test whether the symbol comes from
10223         an object before checking its type.
10224         * testsuite/common_test_2.c: New file.
10225         * testsuite/common_test_3.c: New file.
10226         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
10227         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
10228         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
10229         (common_test_2_pic.o, common_test_2.so): New targets.
10230         (common_test_3_pic.o, common_test_3.so): New targets.
10231         * testsuite/Makefile.in: Rebuild.
10232
10233         PR 10979
10234         * script.cc (read_input_script): If we see a new SECTIONS clause,
10235         and we have added an input section, give an error.
10236         * layout.h (class Layout): Add have_added_input_section function.
10237         Add have_added_input_section_ field.
10238         * layout.cc (Layout::Layout): Initialize
10239         have_added_input_section_.
10240         (Layout::layout): Set have_added_input_section_.
10241         (Layout::layout_eh_frame): Likewise.
10242
10243 2009-12-30  Ian Lance Taylor  <iant@google.com>
10244
10245         PR 10931
10246         * options.h (class General_options): Add --sort-common option.
10247         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
10248         * common.cc (Sort_common): Add sort_order parameter to
10249         constructor.  Add sort_order_ field.
10250         (Sort_commons::operator): Check sort_order_.
10251         (Symbol_table::allocate_commons): Determine the sort order.
10252         (Symbol_table::do_allocate_commons): Add sort_order parameter.
10253         Change all callers.
10254         (Symbol_table::do_allocate_commons_list): Likewise.
10255
10256 2009-12-30  Ian Lance Taylor  <iant@google.com>
10257
10258         PR 10916
10259         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
10260         symbols from this object, don't change the visibility of an
10261         undefined symbol.
10262         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
10263
10264 2009-12-30  Ian Lance Taylor  <iant@google.com>
10265
10266         PR 10861
10267         * script.h (class Version_script_info): Define Language enum.
10268         Update declarations.  Define Glob, Exact, and Lookup types.  Add
10269         new fields globals_, locals_, and is_finalized_.
10270         * script.cc: Various formatting fixes.
10271         (class Parser_closure): Change language_stack_ from a vector of
10272         std::string to one of Version_script_info::Language.  Adjust all
10273         uses accordingly.
10274         (class Lazy_demangler): Remove.
10275         (struct Version_expression): Change language from std::string to
10276         Version_script_info::Language.
10277         (Version_script_info::Version_script_info): New function.
10278         (Version_script_info::~Version_script_info): Don't call clear.
10279         (Version_script_info::finalize): New function.
10280         (Version_script_info::build_lookup_tables): New function.
10281         (Version_script_info::build_expression_list_lookup): New
10282         function.
10283         (Version_script_info::get_symbol_version_helper): Rewrite to use
10284         lookup tables.
10285         (Version_script_info::print_expression_list): Adjust to use
10286         Version_script_info::Language.
10287         (script_push_lex_into_version_mode): Check that the version script
10288         has not been finalized.
10289         (version_script_push_lang): Change language string to
10290         Version_script_info::Language.
10291         * options.cc (Command_line::version_script): New function.
10292         * options.h (class General_options): Add finalize_dynamic_list
10293         function.  Change version_script from declaration to definition.
10294         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
10295         * testsuite/version_script.map: Remove duplicate def of foo.
10296         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
10297         version_script.map.
10298         * testsuite/Makefile.in: Rebuild.
10299
10300 2009-12-30  Ian Lance Taylor  <iant@google.com>
10301
10302         PR 10843
10303         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
10304         if the input symbol index is 0, make the output symbol index 0.
10305
10306 2009-12-30  Ian Lance Taylor  <iant@google.com>
10307
10308         PR 10670
10309         * options.h (class General_options): Add -x/--discard-all.
10310         * object.cc (Sized_relobj::do_count_local_symbols): Handle
10311         --discard-all.  If the local symbol needs a dynamic entry, check
10312         that before handling --discard-locals.
10313
10314 2009-12-30  Ian Lance Taylor  <iant@google.com>
10315
10316         PR 10450
10317         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
10318         flags to PF_R.
10319         (Output_segment::add_output_section): Don't change the flags if
10320         the type is PT_TLS.
10321
10322         PR 10450
10323         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
10324         GNU hash table if they need a dynamic value.  Otherwise, don't add
10325         them if they are defined in a dynamic object or are forced local.
10326
10327 2009-12-29  Ian Lance Taylor  <iant@google.com>
10328
10329         PR 10450
10330         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
10331         .gnu.hash table for a 32-bit target.
10332
10333         PR 10450
10334         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
10335         regular and a dynamic object only needs a dynamic symbol table
10336         entry if it is externally visible.
10337
10338         PR 10450
10339         * i386.cc (class Target_i386): Initialize global_offset_table_ in
10340         constructor.  Add global_offset_table_ field.
10341         (Target_i386::got_section): Set global_offset_table_.
10342         (Target_i386::do_finalize_sections): Set global_offset_table_
10343         size.
10344         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
10345         in constructor.  Add global_offset_table_ field.
10346         (Target_x86_64::got_section): Set global_offset_table_.
10347         (Target_x86_64::do_finalize_sections): Set global_offset_table_
10348         size.
10349
10350         * layout.cc (Layout::Layout): Initialize increase_relro_.
10351         (Layout::get_output_section): Add is_relro, is_last_relro, and
10352         is_first_non_relro parameters.  Change all callers.
10353         (Layout::choose_output_section): Likewise.
10354         (Layout::add_output_section_data): Likewise.
10355         (Layout::make_output_section): Likewise.
10356         (Layout::set_segment_offsets): Clear increase_relro when using a
10357         linker script.
10358         * layout.h (class Layout): Add increase_relro method.  Add
10359         increase_relro_ field.  Update declarations.
10360         * output.cc (Output_section::Output_section): Initialize
10361         is_last_relro_ and is_first_non_relro_.
10362         (Output_segment::add_output_section): Group relro sections is
10363         do_sort is true.  Handle is_last_relro and is_first_non_relro.
10364         (Output_segment::maximum_alignment): Remove relro handling.
10365         (Output_segment::set_section_addresses): Add increase_relro
10366         parameter.  Change all callers.  Add initial alignment to align
10367         relro sections on separate page.  Remove old relro handling.
10368         (Output_segment::set_section_list_addresses): Remove in_relro
10369         parameter.  Change all callers.
10370         (Output_segment::set_offset): Add increase parameter.  Change all
10371         callers.  Remove old relro handling.
10372         * output.h (class Output_section): Add new methods: is_last_relro,
10373         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
10374         Add is_last_relro_ and is_first_non_relro_ fields.
10375         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
10376         Create separate .got.plt section.  Call increase_relro.
10377         * x86_64.cc (Target_x86_64::got_section): Likewise.
10378         * testsuite/relro_script_test.t: Add .got.plt.
10379
10380         PR 10450
10381         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
10382         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
10383         (Layout::finalize): Call set_dynamic_symbol_size.
10384         (Layout::set_dynamic_symbol_size): New function.
10385         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
10386         set_dynamic_symbol_size.
10387
10388         PR 10450
10389         * output.h (class Output_section): Add is_entsize_zero_ field.
10390         * output.cc (Output_section::Output_section): Initialize
10391         is_entsize_zero_.
10392         (Output_section::set_entsize): If two different entsizes are
10393         requested, force it to zero.
10394         (Output_section::add_input_section): Set flags for .debug_str
10395         before updating section flags.  Set entsize.
10396         (Output_section::update_flags_for_input_section): Set SHF_MERGE
10397         and SHF_STRING if all input sections have those flags.
10398
10399 2009-12-29   Rafael Espindola  <espindola@google.com>
10400
10401         * main.cc (main): Fix the sys time reporting.
10402         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
10403         reporting.
10404
10405 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
10406
10407         * options.cc (General_options::parse_version): Allow -v to exit
10408         without an error if there is nothing to link.
10409
10410 2009-12-29  Ian Lance Taylor  <iant@google.com>
10411
10412         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
10413         using a version of gcc before 4.1.
10414         * configure: Rebuild.
10415
10416 2009-12-28  Chris Demetriou  <cgd@google.com>
10417
10418         * attributes.cc (Output_attributes_section_data::do_write): Use
10419         std::vector::front rather than std::vector::data.
10420
10421 2009-12-28  Ian Lance Taylor  <iant@google.com>
10422
10423         * symtab.h (class Symbol_table): Add enum Defined.
10424         * resolve.cc (Symbol_table::should_override): Add defined
10425         parameter.  Change all callers.  Test whether object is NULL
10426         before calling a method on it.
10427         (Symbol_table::report_resolve_problem): Add defined parameter.
10428         Change all callers.
10429         (Symbol_table::should_override_with_special): Likewise.
10430         * symtab.cc (Symbol_table::define_in_output_data): Add defined
10431         parameter.  Change all callers.
10432         (Symbol_table::do_define_in_output_data): Likewise.
10433         (Symbol_table::define_in_output_segment): Likewise.
10434         (Symbol_table::do_define_in_output_segment): Likewise.
10435         (Symbol_table::define_as_constant): Likewise.
10436         (Symbol_table::do_define_as_constant): Likewise.
10437         * script.h (class Symbol_assignment): Add is_defsym parameter to
10438         constructor; change all callers.
10439         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
10440         parameter.  Change all callers.  Add is_defsym_ field.
10441         (class Parser_closure): Add parsing_defsym parameter to
10442         constructor; change all callers.  Add parsing_defsym accessor
10443         function.  Add parsing_defsym_ field.
10444
10445 2009-12-28  Ian Lance Taylor  <iant@google.com>
10446
10447         * gold.cc (queue_middle_tasks): Fix formatting.
10448         * object.cc (Relobj::is_section_name_included): Likewise.
10449
10450 2009-12-23  Ian Lance Taylor  <iant@google.com>
10451
10452         * i386.cc (Target_i386::do_calls_non_split): Recognize
10453         -fsplit-stack prologue for a function with a static chain.
10454         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
10455         -fsplit-stack prologue when using %r11.
10456
10457 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
10458
10459         * options.cc (General_options::parse_version): Make -v continue and do
10460         the link like GNU ld does.
10461
10462 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
10463
10464         * Makefile.am (CCFILES): Add timer.cc.
10465         (HFILES): Add timer.h.
10466         * configure.ac: Check for sysconf and times.
10467         * main.cc: include timer.h.
10468         (main): Use Timer instead of get_run_time.
10469         * timer.cc: New.
10470         * timer.h: New.
10471         * workqueue.cc: include timer.h.
10472         (Workqueue::find_and_run_task):
10473         Report user, sys and wall time.
10474         * Makefile.in: Regenerate.
10475         * config.in: Regenerate.
10476         * configure: Regenerate.
10477
10478 2009-12-16  Doug Kwan  <dougkwan@google.com>
10479
10480         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
10481         sections.
10482         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
10483         relaxed input sections.
10484         * output.cc (Output_section::find_relaxed_input_section): Change
10485         return type to Output_relaxed_input_section pointer.  Adjust code
10486         for new type of relaxed_input_section_map_.
10487         * output.h (Output_section::find_relaxed_input_section): Change
10488         return type to Output_relaxed_input_section pointer.
10489         (Output_section::Output_relaxed_input_section_by_input_section_map):
10490         New type.
10491         (Output_section::relaxed_input_section_map_): Change type to
10492         Output_section::Output_relaxed_input_section_by_input_section_map.
10493         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
10494         input section.
10495
10496 2009-12-15  Ian Lance Taylor  <iant@google.com>
10497
10498         * layout.cc (Layout::create_shstrtab): Only write out after input
10499         sections if we are compressing debug sections.
10500
10501 2009-12-15  Ian Lance Taylor  <iant@google.com>
10502
10503         * archive.cc (Archive::add_symbols): Only look up a symbol without
10504         a version if there is, in fact, a version.
10505
10506 2009-12-14  Ian Lance Taylor  <iant@google.com>
10507
10508         Revert -Wshadow changes, all changes from:
10509         2009-12-11  Doug Kwan  <dougkwan@google.com>
10510         2009-12-11  Nick Clifton  <nickc@redhat.com>
10511         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
10512
10513 2009-12-11  Doug Kwan  <dougkwan@google.com>
10514
10515         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
10516         due to -Wshadow.
10517         * attributes.cc (Object_attribute::size): Ditto.
10518         (Attributes_section_data::size): Ditto.
10519         (Attributes_section_data::Attributes_section_data): Ditto.
10520         (Output_attributes_section_data::do_write): Ditto.
10521         * attributes.h (Object_attribute::set_type): Ditto.
10522         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
10523
10524 2009-12-11  Nick Clifton  <nickc@redhat.com>
10525
10526         * archive.cc: Fix shadowed variable warnings.
10527         * arm.cc: Likewise.
10528         * compressed_output.cc: Likewise.
10529         * compressed_output.h: Likewise.
10530         * configure: Likewise.
10531         * dwarf_reader.cc: Likewise.
10532         * dynobj.cc: Likewise.
10533         * dynobj.h: Likewise.
10534         * ehframe.cc: Likewise.
10535         * ehframe.h: Likewise.
10536         * errors.cc: Likewise.
10537         * expression.cc: Likewise.
10538         * fileread.cc: Likewise.
10539         * fileread.h: Likewise.
10540         * freebsd.h: Likewise.
10541         * i386.cc: Likewise.
10542         * icf.cc: Likewise.
10543         * incremental.h: Likewise.
10544         * layout.cc: Likewise.
10545         * layout.h: Likewise.
10546         * mapfile.cc: Likewise.
10547         * merge.cc: Likewise.
10548         * merge.h: Likewise.
10549         * object.cc: Likewise.
10550         * object.h: Likewise.
10551         * options.h: Likewise.
10552         * output.cc: Likewise.
10553         * output.h: Likewise.
10554         * parameters.cc: Likewise.
10555         * plugin.cc: Likewise.
10556         * powerpc.cc: Likewise.
10557         * reduced_debug_output.cc: Likewise.
10558         * reduced_debug_output.h: Likewise.
10559         * reloc.cc: Likewise.
10560         * reloc.h: Likewise.
10561         * resolve.cc: Likewise.
10562         * script-sections.cc: Likewise.
10563         * script.cc: Likewise.
10564         * script.h: Likewise.
10565         * sparc.cc: Likewise.
10566         * symtab.cc: Likewise.
10567         * symtab.h: Likewise.
10568         * target-select.cc: Likewise.
10569         * target-select.h: Likewise.
10570         * token.h: Likewise.
10571         * workqueue.cc: Likewise.
10572         * workqueue.h: Likewise.
10573         * x86_64.cc: Likewise.
10574
10575 2009-12-10  Doug Kwan  <dougkwan@google.com>
10576
10577         * arm.cc (attributes.h): New include.
10578         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
10579         (Arm_relobj::~Arm_relobj): Delete object pointed by
10580         attributes_section_data_.
10581         (Arm_relobj::attributes_section_data): New method definition.
10582         (Arm_relobj::attributes_section_data_): New data member declaration.
10583         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
10584         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
10585         attributes_section_data_.
10586         (Arm_dynobj::attributes_section_data): New method definition.
10587         (Arm_dynobj::attributes_section_data_): New data member declaration.
10588         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
10589         initialization value of may_use_blx_ to false.
10590         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
10591         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
10592         object attributes to compute results instead of hard-coding.
10593         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
10594         Target_arm::get_secondary_compatible_arch,
10595         Target_arm::set_secondary_compatible_arch
10596         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10597         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
10598         New method declarations.
10599         (Target_arm::get_aeabi_object_attribute): New method definition.
10600         (Target_arm::attributes_section_data_): New data member declaration.
10601         (read_arm_attributes_section): New template definition.
10602         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
10603         (Arm_dynobj::do_read_symbols): Ditto.
10604         (Target_arm::do_finalize_sections): Merge attributes sections from
10605         input.  Check for BLX use after attributes section merging.
10606         Fix __exidx_start and __exidx_end visibility.  Create an
10607         .ARM.attributes section if necessary.
10608         (Target_arm::get_secondary_compatible_arch,
10609         Target_arm::set_secondary_compatible_arch,
10610         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10611         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
10612         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
10613         New method definitions.
10614
10615 2009-12-09  Ian Lance Taylor  <iant@google.com>
10616
10617         * plugin.cc (Plugin::load): Don't cast from void* to a function
10618         pointer.
10619
10620 2009-12-09  Ian Lance Taylor  <iant@google.com>
10621
10622         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
10623         information fields.
10624
10625 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
10626
10627         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
10628         Replace two_file_shared_1.so with two_file_shared_2.so.
10629         * testsuite/Makefile.in: Regenerated.
10630
10631 2009-12-08  Doug Kwan  <dougkwan@google.com>
10632
10633         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
10634         (HFILES): Add attributes.h and int_encoding.h.
10635         * Makefile.in: Regenerate.
10636         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
10637         function definitions to int_encoding.cc
10638         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
10639         prototypes to int_encoding.h
10640         * reduced_debug_output.cc (int_encoding.h): New include.
10641         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
10642         function definitions to int_encoding.cc
10643         (insert_into_vector, read_from_pointer): Move template definitions to
10644         int_encoding.h
10645         * attributes.cc: New file.
10646         * attributes.h: New file.
10647         * int_encoding.cc: New file.
10648         * int_encoding.h: New file.
10649
10650 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
10651
10652         PR gold/11055
10653         * incremental-dump.cc (dump_incremental_inputs): New.
10654         (main): Use dump_incremental_inputs.
10655
10656 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
10657
10658         PR gold/10893
10659         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
10660         checking elfcpp::STT_FUNC.
10661         (Target_i386::Relocate::relocate): Likewise.
10662         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
10663
10664         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
10665         symbols from shared libraries into normal FUNC symbols.
10666
10667         * symtab.h (Symbol): Add is_func and use it.
10668
10669 2009-12-05  Doug Kwan  <dougkwan@google.com>
10670
10671         * arm.cc (Target_arm::arm_info): Initialize new fields
10672         attributes_section and attributes_vendor.
10673         * i386.cc (Target_i386::i386_info): Same.
10674         * object.cc (Sized_relobj::do_layout): Skip attribute section.
10675         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
10676         fields attributes_section and attributes_vendor.
10677         * sparc.cc (Target_sparc::sparc_info): Same.
10678         * target.h (Target::attributes_section, Target::attributes_vendor,
10679         Target::is_attributes_section, Target::attribute_arg_type,
10680         Target::attributes_order): New method definitions.
10681         (Target::Target_info::attributes_section,
10682         Target::Target_info::attributes_vendor): New fields.
10683         (Target::do_attribute_arg_type, Target::do_attributes_order): New
10684         virtual method definitions.
10685         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
10686         attributes_section and attributes_vendor.
10687         * testsuite/testfile.cc (Target_test::test_target_info): Same.
10688
10689 2009-12-05  Doug Kwan  <dougkwan@google.com>
10690
10691         * arm.cc: Update comments about interworking and stub generation.
10692         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
10693         considered as non-PIC.
10694         (Arm_relocate_functions::base_abs): Fix formatting.
10695         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
10696         of function to use GOT entry address instead of offset.
10697         (Target_arm::Scan::global): Issue an error if a symbol would need a
10698         PLT does not get one because it is untyped.  Remove code to create
10699         dynamic symbols for relative branches.
10700         (Target_arm::Relocate::relocate: Use 0 instead of false since function
10701         takes unsigned integer instead of boolean.
10702
10703 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
10704
10705         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
10706         (two_file_test_LDADD): Likewise.
10707         (common_test_1_LDADD): Likewise.
10708         (exception_test_LDADD) Likewise.
10709         (weak_test_LDADD): Likewise.
10710         (many_sections_test_LDADD): Likewise.
10711         (initpri1_LDADD): Likewise.
10712         (script_test_1_LDADD): Likewise.
10713         (script_test_2_LDADD): Likewise.
10714         (justsyms_LDADD): Likewise.
10715         (binary_test_LDADD): Likewise.
10716         (large_LDADD): Likewise.
10717         * testsuite/Makefile.in: Regenerated.
10718
10719 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
10720
10721         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
10722         (Symbol_table::override_with_special): Likewise.
10723         (Symbol_table::add_from_object): Likewise.
10724
10725 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10726
10727         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10728         Don't set the data_offset twice.
10729
10730 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10731
10732         * testsuite/Makefile.in: Regenerate.
10733
10734 2009-12-03  Doug Kwan  <dougkwan@google.com>
10735
10736         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
10737         (Target_arm::do_finalize_sections): Add parameter for symbol table
10738         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
10739         * i386.cc (Target_i386::do_finalize_sections): Add an additional
10740         parameter for symbol table pointer.
10741         * layout.cc (Layout::finalize): Call Target::finalize_sections with
10742         an additional parameter for a pointer to symbol table.
10743         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
10744         parameter for a symbol table pointer.
10745         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
10746         * target.h (Target::finalize_sections, Target::do_finalize_sections):
10747         Ditto.
10748         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
10749         parameter for a symbol table pointer.
10750
10751 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
10752
10753         * incremental.cc (Incremental_inputs_header)
10754         (Incremental_inputs_header_write, Incremental_inputs_entry)
10755         (Incremental_inputs_entry_write): Move ...
10756         * incremental.h (Incremental_inputs_header)
10757         (Incremental_inputs_header_write, Incremental_inputs_entry)
10758         (Incremental_inputs_entry_write): here.
10759
10760 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10761
10762         * incremental.cc (make_sized_incremental_binary): Set the target.
10763         Error if it is incompatible.
10764         * output.h (Output_file): Add filename method.
10765
10766 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10767
10768         * incremental.cc (Incremental_inputs_entry): Remove unused argument
10769         from the get_* methods.
10770
10771 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10772
10773         * incremental-dump.cc (main): Check that the offeset of a script is 0.
10774         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10775         Write 0 for the data_offset of scripts.
10776
10777 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10778
10779         * testsuite/Makefile.am: Add the incremental_test.sh test.
10780         * testsuite/incremental_test.sh: New.
10781         * testsuite/incremental_test_1.c: New.
10782         * testsuite/incremental_test_2.c: New.
10783
10784 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
10785
10786         * incremental-dump.cc (main): Fix typos.
10787
10788 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
10789
10790         PR gold/11025
10791         * incremental-dump.cc (main): Use llu to print 64 bit values.
10792
10793 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
10794             H.J. Lu  <hongjiu.lu@intel.com>
10795
10796         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
10797         $(LIBDL).
10798         (incremental_dump_LDADD): Likewise.
10799         * Makefile.in: Regenerated.
10800
10801 2009-11-25  Doug Kwan  <dougkwan@google.com>
10802
10803         Revert:
10804
10805         2009-11-25  Doug Kwan  <dougkwan@google.com>
10806
10807                 * arm.cc (Target_arm::Target_arm): Move method definition
10808                 outside of class definition.  Add code to handle
10809                 --target1-rel, --target1-abs and --target2= options.
10810                 (Target_arm::get_reloc_reloc_type): Change method to be
10811                 non-static and const.
10812                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
10813                 New data member declaration.
10814                 (Target_arm::Scan::local, Target_arm::Scan::global,
10815                 Target_arm::Relocate::relocate,
10816                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10817                 Adjust call to Target_arm::get_real_reloc_type.
10818                 (Target_arm::get_real_reloc_type): Use command line options
10819                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10820                 * options.h (--target1-rel, --target1-abs, --target2): New
10821                 ARM-only options.
10822
10823 2009-11-25  Doug Kwan  <dougkwan@google.com>
10824
10825         * arm.cc (Target_arm::Target_arm): Move method definition outside of
10826         class definition.  Add code to handle --target1-rel, --target1-abs
10827         and --target2= options.
10828         (Target_arm::get_reloc_reloc_type): Change method to be non-static
10829         and const.
10830         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
10831         member declaration.
10832         (Target_arm::Scan::local, Target_arm::Scan::global,
10833         Target_arm::Relocate::relocate,
10834         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
10835         call to Target_arm::get_real_reloc_type.
10836         (Target_arm::get_real_reloc_type): Use command line options to
10837         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10838         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
10839         options.
10840
10841 2009-11-25  Doug Kwan  <dougkwan@google.com>
10842
10843         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
10844         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
10845         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
10846         formatting.
10847         (Arm_relocate_functions::thm_call): Replace body with a call to
10848         Arm_relocate_functions::thumb_branch_common.
10849         (Arm_relocate_functions::thm_jump24,
10850         Arm_relocate_functions::thm_xpc22): New method definitions.
10851         (Arm_relocate_functions::thumb_branch_common): New method definition.
10852         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
10853         operator.
10854         (Target_arm::Relocate::relocate): Adjust call to thm_call.
10855         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
10856
10857 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10858
10859         * Makefile.am: Build incremental-dump
10860         * Makefile.in: Regenerate.
10861         * incremental-dump.cc: New.
10862         * incremental.cc (Incremental_inputs_header_data,
10863         Incremental_inputs_entry_data): Move to incremental.h
10864         * incremental.h: (Incremental_inputs_header_data,
10865         Incremental_inputs_entry_data): Move from incremental.cc
10866
10867 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10868
10869         * incremental.cc (Incremental_inputs_header,
10870         Incremental_inputs_header_write, Incremental_inputs_entry,
10871         Incremental_inputs_entry_write): Add a typedef with the data type.
10872
10873 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10874
10875         * incremental.cc (Incremental_inputs_header,
10876         Incremental_inputs_header_write, Incremental_inputs_entry,
10877         Incremental_inputs_entry_write): Update comment about which
10878         type has the filed descriptions.
10879
10880 2009-11-15  Doug Kwan  <dougkwan@google.com>
10881
10882         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
10883         (Arm_relocate_functions::arm_branch_common): Change method defintion
10884         in class definition to a method declaration and update list of formal
10885         parameters.
10886         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
10887         Arm_relocation_functions::jump24): Adjust call to
10888         Arm_relocate_functions::arm_branch_common.  Update list of formal
10889         parameters.
10890         (Arm_relocate_functions::xpc25): New method definition.
10891         (Arm_relocate_functions::arm_branch_common): Move method defintion
10892         out from class definition.  Use stubs for mode-switching and extending
10893         branch ranges.
10894         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
10895         specially.  Change code to enable use of stubs in ARM branches.
10896
10897 2009-11-10  Doug Kwan  <dougkwan@google.com>
10898
10899         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
10900         in method declaration.
10901         (Target_arm::relocate_stub): New method declaration.
10902         (Target_arm::default_target): Change to return a pointer instead of
10903         a const reference.
10904         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
10905         Target_arm::default_target.
10906         (Arm_Relobj::do_relocate_sections): Remove options paramater in
10907         method definition.
10908         (Target_arm::relocate_section): Adjust view.
10909         (Target_arm::relocate_stub): New method definition.
10910
10911 2009-11-10  Doug Kwan  <dougkwan@google.com>
10912
10913         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
10914         a format warning.
10915         * incremental.cc (open_incremental_binary): Initialized local
10916         variables to avoid warnings.
10917         * object.cc (make_elf_object): Ditto.
10918         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
10919         a format warning.
10920
10921 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
10922
10923         PR gold/10930
10924         * testsuite/plugin_test.c: Include "config.h".
10925
10926 2009-11-09  Doug Kwan  <dougkwan@google.com>
10927
10928         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
10929         (arm_symbol_value): Remove.
10930         (Arm_relocate_functions::arm_branch_common,
10931         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
10932         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
10933         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
10934         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
10935         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
10936         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
10937         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
10938         Arm_relocate_functions::thm_mobw_abs_nc,
10939         Arm_relocate_functions::thm_mov_abs,
10940         Arm_relocate_functions::movw_prel_nc,
10941         Arm_relocate_functions::thm_movt_abs,
10942         Arm_relocate_functions::movt_prel,
10943         Arm_relocate_functions::thm_movw_prel_nc,
10944         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
10945         (Target_arm::Relocate::relocate): Only decompose address into two
10946         parts if relocation type uses the thumb-bit and pass the actual
10947         bit instead of a flag indicating that the thumb-bit is used.  Adjust
10948         calls to methods in Arm_relocate_functions for this change.
10949
10950 2009-11-08  Ian Lance Taylor  <iant@google.com>
10951
10952         PR 10925
10953         * reloc.cc: Instantiate
10954         Sized_relobj::initialize_input_to_output_maps and
10955         Sized_relobj:free_input_to_output_maps.
10956
10957 2009-11-06  Ian Lance Taylor  <iant@google.com>
10958
10959         PR 10876
10960         * defstd.cc (in_segment): Set only_if_ref true for "end".
10961
10962 2009-11-06  Doug Kwan  <dougkwan@google.com>
10963
10964         * arm.cc (class Reloc_stub): Correct a comment.
10965         (Target_arm::Target_arm): Initialize arm_input_section_map_.
10966         (Target_arm::scan_section_for_stubs): New method declaration.
10967         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
10968         Change methods from private to protected.
10969         (Target_arm::do_may_relax): New method definition.
10970         (Target_arm::do_relax, Target_arm::group_sections,
10971         Target_arm::scan_reloc_for_stub,
10972         Target_arm::scan_reloc_section_for_stubs): New method declarations.
10973         (Target_arm::arm_input_section_map_): New data member declaration.
10974         (Target_arm::scan_reloc_for_stub,
10975         Target_arm::scan_reloc_section_for_stubs,
10976         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
10977         Target_arm::do_relax): New method definitions.
10978
10979 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
10980
10981         * configure.ac: Check for (struct stat)::st_mtim
10982         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
10983         * config.in: Regenerate.
10984         * configure: Regenerate.
10985
10986 2009-11-05  Ian Lance Taylor  <iant@google.com>
10987
10988         PR 10910
10989         * output.cc (Output_segment::add_output_section): Add missing
10990         return statement.
10991
10992 2009-11-04  Ian Lance Taylor  <iant@google.com>
10993
10994         PR 10880
10995         * object.h (class Object): Add is_needed and set_is_needed
10996         methods.  Add is_needed_ field.  Make bool fields into bitfields.
10997         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
10998         defined in a dynamic object and referenced by a regular object,
10999         set is_needed for the dynamic object.
11000         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
11001         if the file is marked with as_needed and it is not needed.
11002
11003 2009-11-04  Ian Lance Taylor  <iant@google.com>
11004
11005         PR 10887
11006         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
11007         tags if data is discarded by linker script.
11008         * i386.cc (Target_i386::do_finalize_sections): Likewise.
11009         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
11010         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
11011         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
11012
11013 2009-11-04  Ian Lance Taylor  <iant@google.com>
11014
11015         * layout.cc (Layout::get_output_section): Add is_interp and
11016         is_dynamic_linker_section parameters.  Change all callers.
11017         (Layout::choose_output_section): Likewise.
11018         (Layout::make_output_section): Likewise.
11019         (Layout::add_output_section_data): Add is_dynamic_linker_section
11020         parameter.  Change all callers.
11021         * layout.h (class Layout): Update declarations.
11022         * output.h (class Output_section): Add is_interp, set_is_interp,
11023         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
11024         Add is_interp_, is_dynamic_linker_section_ fields.  Change
11025         generate_code_fills_at_write_ to a bitfield.
11026         * output.cc (Output_section::Output_sections): Initialize new
11027         fields.
11028         (Output_segment::add_output_section): Add do_sort parameter.
11029         Change all callers.
11030
11031 2009-11-03  Ian Lance Taylor  <iant@google.com>
11032
11033         PR 10860
11034         * options.h (class General_options): Add --warn-common.
11035         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
11036         merging two common symbols.
11037         (Symbol_table::should_override): Handle --warn-common when merging
11038         a common symbol with a defined symbol.  Use report_resolve_problem
11039         for multiple definitions.
11040         (Symbol_table::report_resolve_problem): New function.
11041         * symtab.h (class Symbol_table): Declare report_resolve_problem.
11042
11043 2009-11-03  Doug Kwan  <dougkwan@google.com>
11044
11045         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
11046         stub_factory_.
11047         (Target_arm::stub_factory): New method definition.
11048         (Target_arm::new_arm_input_section,
11049         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
11050         Target_arm::reloc_uses_thumb_bit): New method declarations.
11051         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
11052         New type definitions.
11053         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
11054         member declarations.
11055         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
11056         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
11057         New method definitions.
11058
11059 2009-11-03  Ian Lance Taylor  <iant@google.com>
11060
11061         * options.h (class General_options): Add --warn_constructors.
11062
11063 2009-11-03  Ian Lance Taylor  <iant@google.com>
11064
11065         PR 10893
11066         * defstd.cc (in_section): Add entries for __rel_iplt_start,
11067         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
11068
11069 2009-11-03  Ian Lance Taylor  <iant@google.com>
11070
11071         PR 10895
11072         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
11073         --msgid-bugs-address.
11074         (install-pdf): New target.
11075         (install-data_yes): Look up one directory to find mkinstalldirs.
11076
11077 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
11078
11079         * po/Make-in (.po.gmo): Don't generate .gmo files in source
11080         tree.
11081
11082 2009-10-30  Doug Kwan  <dougkwan@google.com>
11083
11084         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
11085
11086 2009-10-30  Doug Kwan  <dougkwan@google.com>
11087
11088         * arm.cc (Stub_addend_reader): New struct template definition
11089         and partial specializations.
11090         (Stub_addend_reader::operator()): New method definition for a
11091         partially specialized template.
11092
11093 2009-10-30  Doug Kwan  <dougkwan@google.com>
11094
11095         * arm.cc (Arm_relobj::processor_specific_flags): New method
11096         definition.
11097         (Arm_relobj::do_read_symbols): New method declaration.
11098         (Arm_relobj::processor_specific_flags_): New data member declaration.
11099         (Arm_dynobj): New class definition.
11100         (Target_arm::do_finalize_sections): Add input_objects parameter.
11101         (Target_arm::do_adjust_elf_header): New method declaration.
11102         (Target_arm::are_eabi_versions_compatible,
11103         (Target_arm::merge_processor_specific_flags): New method declaration.
11104         (Target_arm::do_make_elf_object): New overloaded method definitions
11105         and declaration.
11106         (Arm_relobj::do_read_symbols): New method definition.
11107         (Arm_dynobj::do_read_symbols): Ditto.
11108         (Target_arm::do_finalize_sections): Add input_objects parameters.
11109         Merge processor-specific flags from all input objects.
11110         (Target_arm::are_eabi_versions_compatible,
11111         Target_arm::merge_processor_specific_flags,
11112         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
11113         New method definitions.
11114         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
11115         Input_objects pointer type parameter.
11116         * layout.cc (Layout::finalize): Pass input objects to target's.
11117         finalize_sections function.
11118         * output.cc (Output_file_header::do_sized_write): Set ELF file
11119         header's processor-specific flags.
11120         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
11121         Input_objects pointer type parameter.
11122         * sparc.cc (Target_sparc::do_finalize_sections): Same.
11123         * target.h (Input_objects): New forward class declaration.
11124         (Target::processor_specific_flags,
11125         Target::are_processor_specific_flags_sect): New method definitions.
11126         (Target::finalize_sections): Add input_objects parameter.
11127         (Target::Target): Initialize processor_specific_flags_ and
11128         are_processor_specific_flags_set_.
11129         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
11130         parameter.
11131         (Target::set_processor_specific_flags): New method definition.
11132         (Target::processor_specific_flags_,
11133         Target::are_processor_specific_flags_set_): New data member
11134         declarations.
11135         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
11136         Input_objects pointer type parameter.
11137
11138 2009-10-30  Doug Kwan  <dougkwan@google.com>
11139
11140         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
11141
11142 2009-10-28  Ian Lance Taylor  <iant@google.com>
11143
11144         * object.h (class Relobj): Drop options parameter from
11145         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
11146         do_scan_relocs, do_relocate.  Change all callers.
11147         (class Sized_relobj): Drop options parameters from
11148         do_gc_process_relocs, do_scan_relocs, do_relocate,
11149         do_relocate_sections, relocate_sections, emit_relocs_scan,
11150         emit_relocs_scan_reltype.  Change all callers.
11151         (struct Relocate_info): Remove options field and all references to
11152         it.
11153         * reloc.h (class Read_relocs): Remove options constructor
11154         parameter and options_ field.  Change all callers.
11155         (class Gc_process_relocs, class Scan_relocs): Likewise.
11156         (class Relocate_task): Likewise.
11157         * target-reloc.h (scan_relocs): Remove options parameter.  Change
11158         all callers.
11159         (scan_relocatable_relocs): Likewise.
11160         * target.h (class Sized_target): Remove options parameter from
11161         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
11162         all callers.
11163         * gc.h (gc_process_relocs): Remove options parameter.  Change all
11164         callers.
11165         * arm.cc: Update functions to remove options parameters.
11166         * i386.cc: Likewise.
11167         * powerpc.cc: Likewise.
11168         * sparc.cc: Likewise.
11169         * x86_64.cc: Likewise.
11170         * testsuite/testfile.cc: Likewise.
11171
11172 2009-10-28  Doug Kwan  <dougkwan@google.com>
11173
11174         * arm.cc (Arm_relobj): New class definition.
11175         (Arm_relobj::scan_sections_for_stubs,
11176         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
11177         New method definitions.
11178
11179 2009-10-28  Cary Coutant  <ccoutant@google.com>
11180
11181         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
11182         (Plugin::cleanup_done_): New member.
11183         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
11184         (Plugin_manager::cleanup_done_): Remove.
11185         (Plugin_manager::add_input_file): Edit error message.
11186         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
11187         (Plugin_manager::cleanup): Remove use of cleanup_done_.
11188
11189 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
11190
11191         * fileread.cc: (File_read::View::~View): Use the new
11192         data_ownership_ filed.
11193         (File_read::~File_read): Dispose the new whole_file_view_.
11194         (File_read::open): Mmap the whole file if needed.
11195         (File_read::open): Use whole_file_view_ instead of contents_.
11196         (File_read::find_view): Use whole_file_view_ if applicable.
11197         (File_read::do_read): Use whole_file_view_ instead of contents_.
11198         (File_read::make_view): Use whole_file_view_ instead of contents_,
11199         update File_read::View::View call.
11200         (File_read::find_or_make_view): Update File_read::View::View
11201         call.
11202         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
11203         remove contents_
11204         (File_read::View::Data_ownership): New enum.
11205         (File_read::View::View): Replace bool mapped_ with Data_ownership
11206         argument.
11207         (File_read::View::mapped_): Remove (replaced by data_ownership_).
11208         (File_read::View::data_ownership_): New field.
11209         (File_read::contents_): Remove (replaced by whole_file_view_).
11210         (File_read::whole_file_view_): New field.
11211         * options.h (class General_options): Add --keep-files-mapped.
11212
11213 2009-10-27  Cary Coutant  <ccoutant@google.com>
11214
11215         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
11216         * testsuite/Makefile.am (plugin_test_5): New test case.
11217         * testsuite/Makefile.in: Regenerate.
11218
11219 2009-10-25  Doug Kwan  <dougkwan@google.com>
11220
11221         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
11222         from private to protected to allow access by child class.
11223         (Sized_relobj::do_relocate_sections): New method declaration.
11224         (Sized_relobj::relocate_sections): Virtualize.
11225         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
11226         Sized_relobj::relocate_sections.  Instantiate template explicitly
11227         for different target sizes and endianity.
11228
11229 2009-10-24  Doug Kwan  <dougkwan@google.com>
11230
11231         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
11232         (Arm_input_section::as_arm_input_section): New method.
11233         (Arm_output_section): New class definition.
11234         (Arm_output_section::create_stub_group,
11235         Arm_output_section::group_sections): New method definitions.
11236
11237 2009-10-22  Doug Kwan  <dougkwan@google.com>
11238
11239         * arm.cc (Arm_input_section): New class definition.
11240         (Arm_input_section::init, Arm_input_section:do_write,
11241         Arm_input_section::set_final_data_size,
11242         Arm_input_section::do_reset_address_and_file_offset): New method
11243         definitions.
11244
11245 2009-10-21  Doug Kwan  <dougkwan@google.com>
11246
11247         * arm.cc (Stub_table, Arm_input_section): New forward class
11248         declarations.
11249         (Stub_table): New class defintion.
11250         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
11251         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
11252         New method definition.
11253
11254 2009-10-21  Doug Kwan  <dougkwan@google.com>
11255
11256         * arm.cc: Update copyright comments.
11257         (Target_arm): New forward class template declaration.
11258         (Arm_address): New type.
11259         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
11260         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
11261         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
11262         constants.
11263         (Insn_template): Same.
11264         (DEF_STUBS): New macro.
11265         (Stub_type): New enum type.
11266         (Stub_template): New class definition.
11267         (Stub): Same.
11268         (Reloc_stub): Same.
11269         (Stub_factory): Same.
11270         (Target_arm::Target_arm): Initialize may_use_blx_ and
11271         should_force_pic_veneer_.
11272         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
11273         Target_arm::should_force_pic_veneer,
11274         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
11275         Target_arm::using_thumb_only, Target_arm:;default_target): New
11276         method defintions.
11277         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
11278         New data member declarations.
11279         (Insn_template::size, Insn_template::alignment): New method defintions.
11280         (Stub_template::Stub_template): New method definition.
11281         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
11282         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
11283         (Stub_factory::Stub_factory): New method definition.
11284         * gold.h (string_hash): New template.
11285         * output.h (Input_section_specifier::hash_value): Use
11286         gold::string_hash.
11287         (Input_section_specifier::string_hash): Remove.
11288         * stringpool.cc (Stringpool_template::string_hash): Use
11289         gold::string_hash.
11290
11291 2009-10-20  Doug Kwan  <dougkwan@google.com>
11292
11293         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
11294         symbols of relaxed input sections.
11295         * output.h (Output_section::find_relaxed_input_section): Make
11296         method public.
11297
11298 2009-10-16  Doug Kwan  <dougkwan@google.com>
11299
11300         * dynobj.cc (Versions::Versions): Initialize version_script_.
11301         Only insert base version symbol definition for a shared object
11302         if version script defines any version versions.
11303         (Versions::define_base_version): New method definition.
11304         (Versions::add_def): Check that base version is not needed.
11305         (Versions::add_need): Define base version lazily.
11306         * dynobj.h (Versions::define_base_version): New method declaration.
11307         (Versions::needs_base_version_): New data member declaration.
11308         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
11309         (check_DATA): Add no_version_test.stdout.
11310         (libno_version_test.so, no_version_test.o no_version_test.stdout):
11311         New make rules.
11312         * testsuite/Makefile.in: Regenerate.
11313         * testsuite/no_version_test.c: New file.
11314         * testsuite/no_version_test.sh: Ditto.
11315
11316 2009-10-16  Doug Kwan  <dougkwan@google.com>
11317
11318         * expression.cc (class Segment_start_expression): New class definition.
11319         (Segment_start_expression::value): New method definition.
11320         (script_exp_function_segment_start): Return a new
11321         Segment_start_expression.
11322         * gold/script-c.h (script_saw_segment_start_expression): New function
11323         prototype.
11324         * script-sections.cc (Script_sections::Script_sections): Initialize
11325         SAW_SEGMENT_START_EXPRESSION_ to false.
11326         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
11327         and -Tbbs options to specify section addresses if given in
11328         command line and no SEGMENT_START expression is seen in a script.
11329         * script-sections.h (Script_sections::saw_segment_start_expression,
11330         Script_sections::set_saw_segment_start_expression): New method
11331         definition.
11332         (Script_sections::saw_segment_start_expression_): New data member
11333         declaration.
11334         * script.cc (script_saw_segment_start_expression): New function.
11335         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
11336         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
11337         script_test_7.sh and script_test_8.sh.
11338         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
11339         script_test_8.stdout.
11340         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
11341         (script_test_6, script_test_6.stdout, script_test_7,
11342         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
11343         * Makefile.in: Regenerate.
11344         * testsuite/script_test_6.sh: New file.
11345         * testsuite/script_test_6.t: Same.
11346         * testsuite/script_test_7.sh: Same.
11347         * testsuite/script_test_7.t: Same.
11348         * testsuite/script_test_8.sh: Same.
11349
11350 2009-10-16  Doug Kwan  <dougkwan@google.com>
11351
11352         * output.cc (Output_segment::set_section_list_address): Cast
11353         expressions to unsigned long long type to avoid format warnings.
11354
11355 2009-10-15  Ian Lance Taylor  <iant@google.com>
11356
11357         * script.cc (Script_options::add_symbol_assignment): Always add a
11358         dot assignment to script_sections_.
11359         * script-sections.cc (Script_sections::add_dot_assignment):
11360         Initialize if necessary.
11361
11362         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
11363         program headers with no load segment if there is a linker script.
11364
11365         * layout.cc (Layout::set_segment_offsets): Align the file offset
11366         to the segment aligment for -N or -n with no load segment.
11367         * output.cc (Output_segment::add_output_section): Don't crash if
11368         the first section is a TLS section.
11369         (Output_segment::set_section_list_addresses): Print an error
11370         message if the address moves backward in a linker script.
11371         * script-sections.cc
11372         (Output_section_element_input::set_section_addresses): Don't
11373         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
11374         (Orphan_output_section::set_section_addresses): Likewise.
11375
11376 2009-10-15  Doug Kwan  <dougkwan@google.com>
11377
11378         * layout.cc (Layout::finish_dynamic_section): Generate tags
11379         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
11380         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
11381         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
11382
11383 2009-10-14  Ian Lance Taylor  <iant@google.com>
11384
11385         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
11386         fields.
11387         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
11388         data_shdr fields of relinfo.
11389         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
11390         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
11391         R_386_TLS_LDO_32, adjust based on section flags.
11392         (Target_i386::Relocate::fix_up_ldo): Remove.
11393
11394 2009-10-13  Ian Lance Taylor  <iant@google.com>
11395
11396         Add support for -pie.
11397         * options.h (class General_options): Add -pie and
11398         --pic-executable.
11399         (General_options::output_is_position_independent): Test -pie.
11400         (General_options::output_is_executable): Return true if not shared
11401         and not relocatable.
11402         (General_options::output_is_pie): Remove.
11403         * options.cc (General_options::finalize): Reject incompatible uses
11404         of -pie.
11405         * gold.cc (queue_middle_tasks): A -pie link is not static.
11406         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
11407         * symtab.cc (Symbol::final_value_is_known): Return false if
11408         output_is_position_independent.
11409         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
11410         output_is_position_independent.
11411         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
11412         output_is_position_independent.
11413         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
11414         output_is_position_independent.
11415         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
11416         two_file_pie_test.
11417         (basic_pie_test.o, basic_pie_test): New targets.
11418         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
11419         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
11420         (two_file_pie_test): New target.
11421         * testsuite/Makefile.in: Rebuild.
11422         * README: Remove note saying that -pie is not supported.
11423
11424 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
11425
11426         * options.h (class General_options): Add -init and -fini.
11427         * layout.cc (Layout::finish_dynamic_section): Emit
11428         given init and fini functions.
11429
11430 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
11431
11432         * gc.h (gc_process_relocs): Check if icf is enabled using new
11433         function.
11434         * gold.cc (queue_initial_tasks): Likewise.
11435         (queue_middle_tasks): Likewise.
11436         * object.cc (do_layout): Likewise.
11437         * symtab.cc (is_section_folded): Likewise.
11438         * main.cc (main): Likewise.
11439         * reloc.cc (Read_relocs::run): Likewise.
11440         (Sized_relobj::do_scan_relocs): Likewise.
11441         * icf.cc (is_function_ctor_or_dtor): New function.
11442         (Icf::find_identical_sections): Check if function is ctor or dtor when
11443         safe icf is chosen.
11444         * options.h (General_options::icf): Change option to be an enum.
11445         (Icf_status): New enum.
11446         (icf_enabled): New method.
11447         (icf_safe_folding): New method.
11448         (set_icf_status): New method.
11449         (icf_status_): New variable.
11450         * (options.cc) (General_options::finalize): Set icf_status_.
11451         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
11452         icf_test and icf_keep_unique_test to use the --icf enum flag.
11453         * testsuite/icf_safe_test.sh: New file.
11454         * testsuite/icf_safe_test.cc: New file.
11455
11456 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
11457
11458         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
11459         includes to gc.h and icf.h.
11460         * arm.cc: Include gc.h.
11461         * gold.cc: Likewise.
11462         * i386.cc: Likewise.
11463         * powerpc.cc: Likewise.
11464         * sparc.cc: Likewise.
11465         * x86_64.cc: Likewise.
11466         * gc.h: Include icf.h.
11467
11468 2009-10-11  Ian Lance Taylor  <iant@google.com>
11469
11470         * plugin.cc: Include "gold.h" before other header files.
11471
11472 2009-10-10  Chris Demetriou  <cgd@google.com>
11473
11474         * options.h (Input_file_argument::Input_file_type): New enum.
11475         (Input_file_argument::is_lib_): Replace with...
11476         (Input_file_argument::type_): New member.
11477         (Input_file_argument::Input_file_argument): Take Input_file_type
11478         'type' rather than boolean 'is_lib' as second argument.
11479         (Input_file_argument::is_lib): Use type_.
11480         (Input_file_argument::is_searched_file): New function.
11481         (Input_file_argument::may_need_search): Handle is_searched_file.
11482         * options.cc (General_options::parse_library): Support -l:filename.
11483         (General_options::parse_just_symbols): Update for Input_file_argument
11484         changes.
11485         (Command_line::process): Likewise.
11486         * archive.cc (Archive::get_file_and_offset): Likewise.
11487         * plugin.cc (Plugin_manager::release_input_file): Likewise.
11488         * script.cc (read_script_file, script_add_file): Likewise.
11489         * fileread.cc (Input_file::Input_file): Likewise.
11490         (Input_file::will_search_for): Handle is_searched_file.
11491         (Input_file::open): Likewise.
11492         * readsyms.cc (Read_symbols::get_name): Likewise.
11493         * testsuite/Makefile.am (searched_file_test): New test.
11494         * testsuite/Makefile.in: Regenerate.
11495         * testsuite/searched_file_test.cc: New file.
11496         * testsuite/searched_file_test_lib.cc: New file.
11497
11498 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11499             Ian Lance Taylor  <iant@google.com>
11500
11501         * descriptor.cc: Include <cstdio> and "binary-io.h".
11502         (Descriptors::open): Open the files in binary mode always.
11503         * script.cc (Lex::get_token): Treat \r as whitespace.
11504
11505 2009-10-09  Ian Lance Taylor  <iant@google.com>
11506
11507         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
11508
11509 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11510             Ian Lance Taylor  <iant@google.com>
11511
11512         * configure.ac: Check for readv function also.
11513         * fileread.cc (readv): Define if not HAVE_READV.
11514         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
11515         does not exist.
11516         * config.in: Regenerate.
11517         * configure: Regenerate.
11518
11519 2009-10-09  Doug Kwan  <dougkwan@google.com>
11520
11521         * layout.cc (Layout::make_output_section): Call target hook to make
11522         ordinary output section.
11523         (Layout::finalize): Adjust parameter list of call the
11524         Target::may_relax().
11525         * layout.h (class Layout::section_list): New method.
11526         * merge.h (Output_merge_base::entsize): Change visibility to public.
11527         (Output_merge_base::is_string, Output_merge_base::do_is_string):
11528         New methods.
11529         (Output_merge_string::do_is_string): New method.
11530         * object.cc (Sized_relobj::do_setup): renamed from
11531         Sized_relobj::set_up.
11532         * object.h (Sized_relobj::adjust_shndx,
11533         Sized_relobj::initializ_input_to_output_maps,
11534         Sized_relobj::free_input_to_output_maps): Change visibilities to
11535         protected.
11536         (Sized_relobj::setup): Virtualize.
11537         (Sized_relobj::do_setup): New method declaration.
11538         (Sized_relobj::invalidate_section_offset,
11539         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
11540         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
11541         * options.cc (parse_int): New function.
11542         * options.h (parse_int): New declaration.
11543         (DEFINE_int): New macro.
11544         (stub_group_size): New option.
11545         * output.cc (Output_section::Output_section): Initialize memebers
11546         merge_section_map_, merge_section_by_properties_map_,
11547         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
11548         (Output_section::add_input_section): Handled deferred code-fill
11549         generation and remove an old comment.
11550         (Output_section::add_relaxed_input_section): New method definition.
11551         (Output_section::add_merge_input_section): Use merge section by
11552         properties map to speed to search.  Update merge section maps
11553         as appropriate.
11554         (Output_section::build_relaxation_map): New method definition.
11555         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11556         Same.
11557         (Output_section::relax_input_section): Renamed to
11558         Output_section::convert_input_sections_to_relaxed_sections and change
11559         interface to take a vector of pointers to relaxed sections.
11560         (Output_section::find_merge_section,
11561         Output_section::find_relaxed_input_section): New method definitions.
11562         (Output_section::is_input_address_mapped,
11563         Output_section::output_offset, Output_section::output_address):
11564         Use output section data maps to speed up searching.
11565         (Output_section::find_starting_output_address): Add comments.
11566         (Output_section::do_write,
11567         Output_section::write_to_postprocessing_buffer): Do code-fill
11568         generation as appropriate.
11569         (Output_section::get_input_sections): Invalidate relaxed input section
11570         map.
11571         (Output_section::restore_states): Adjust type of checkpoint .
11572         Invalidate relaxed input section map.
11573         * output.h (Output_merge_base): New class declaration.
11574         (Input_section_specifier): New class defintion.
11575         (class Output_relaxed_input_section) Change base class to
11576         Output_section_data_build.
11577         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
11578         base class initializer.
11579         (Output_section::add_relaxed_input_section): New method declaration.
11580         (Output_section::Input_section): Change visibility to protected.
11581         (Output_section::Input_section::relobj,
11582         Output_section::Input_section::shndx): Handle relaxed input sections.
11583         Output_section::input_sections) Change visibility to protected.  Also
11584         define overload to return a non-const pointer.
11585         (Output_section::Merge_section_properties): New class defintion.
11586         (Output_section::Merge_section_by_properties_map,
11587         Output_section::Output_section_data_by_input_section_map,
11588         Output_section::Relaxation_map): New types.
11589         (Output_section::relax_input_section): Rename method to
11590         Output_section::convert_input_sections_to_relaxed_sections and change
11591         interface to take a vector of relaxed section pointers.
11592         (Output_section::find_merge_section,
11593         Output_section::find_relaxed_input_section,
11594         Output_section::build_relaxation_map,
11595         Output_section::convert_input_sections_in_list_to_relaxed_sections):
11596         New method declarations.
11597         (Output_section::merge_section_map_
11598         Output_section::merge_section_by_properties_map_,
11599         Output_section::relaxed_input_section_map_,
11600         Output_section::is_relaxed_input_section_map_valid_,
11601         Output_section::generate_code_fills_at_write_): New data members.
11602         * script-sections.cc
11603         (Output_section_element_input::set_section_addresses): Call
11604         current_data_size and addralign methods of relaxed input sections.
11605         (Orphan_output_section::set_section_addresses): Call current_data_size
11606         and addralign methods of relaxed input sections.
11607         * symtab.cc (Symbol_table::compute_final_value): Extract template
11608         from the body of Symbol_table::sized_finalize_symbol.
11609         (Symbol_table::sized_finalized_symbol): Call
11610         Symbol_table::compute_final_value.
11611         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
11612         (Symbol_table::compute_final_value): New templated method declaration.
11613         * target.cc (Target::do_make_output_section): New method defintion.
11614         * target.h (Target::make_output_section): New method declaration.
11615         (Target::relax): Add more parameters for input objects, symbol table
11616         and layout.  Adjust call to do_relax.
11617         (Target::do_make_output_section): New method declaration.
11618         (Target::do_relax): Add parameters for input objects, symbol table
11619         and layout.
11620
11621 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11622
11623         * pread.c: Include stdio.h.
11624
11625 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11626
11627         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
11628         defined.
11629
11630 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11631
11632         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
11633         Change read_shndx type to unsigned int.
11634         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11635         int.
11636         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11637         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
11638         Change read_shndx type to unsigned int.
11639         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11640         int.
11641         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11642         * layout.cc (Layout::create_symtab_sections): Cast the result of
11643         local_symcount * symsize to off_t in the gold_assert.
11644
11645 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11646
11647         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
11648         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
11649         R_ARM_BASE_ABS.
11650         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
11651         (Arm_relocate_functions::thm_abs5): New function.
11652         (Arm_relocate_functions::abs12): New function.
11653         (Arm_relocate_functions::abs16): New function.
11654         (Arm_relocate_functions::base_abs): New function.
11655         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
11656         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
11657         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
11658         R_ARM_BASE_ABS.
11659         (Scan::global): Likewise.
11660         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
11661         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
11662         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
11663         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
11664         R_ARM_BASE_ABS.
11665
11666 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11667
11668         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
11669         (Arm_relocate_functions::movt_prel): New function.
11670         (Arm_relocate_functions::thm_movw_prel_nc): New function.
11671         (Arm_relocate_functions::thm_movt_prel): New function.
11672         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
11673         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
11674         (Scan::global, Relocate::relocate): Likewise.
11675         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11676
11677 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11678
11679         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
11680         Incremental_checker.
11681         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
11682         unsigned int.
11683         (class Incremental_inputs_header): New class.
11684         (Incremental_inputs_header_writer): Edit comment.
11685         (Incremental_inputs_entry): New class.
11686         (Incremental_inputs_entry_writer): Edit comment.
11687         (Sized_incremental_binary::do_find_incremental_inputs_section):
11688         Add *strtab_shndx parameter, fill it.
11689         (Sized_incremental_binary::do_check_inputs): New method.
11690         (Incremental_checker::can_incrementally_link_output_file): Use
11691         Sized_incremental_binary::check_inputs.
11692         (Incremental_inputs::report_command_line): Save command line in
11693         command_line_.
11694         * incremental.h:
11695         (Incremental_binary::find_incremental_inputs_section): New
11696         method.
11697         (Incremental_binary::do_find_incremental_inputs_section): Add
11698         strtab_shndx parameter.
11699         (Incremental_binary::do_check_inputs): New pure virtual method.
11700         (Sized_incremental_binary::do_check_inputs): Declare.
11701         (Incremental_checker::Incremental_checker): Add incremental_inputs
11702         parameter, use it to initialize incremental_inputs_.
11703         (Incremental_checker::incremental_inputs_): New field.
11704         (Incremental_checker::command_line): New method.
11705         (Incremental_checker::inputs): New method.
11706         (Incremental_checker::command_line_): New field.
11707
11708 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11709
11710         * incremental.cc: Include <cstdarg> and "target-select.h".
11711         (vexplain_no_incremental): New function.
11712         (explain_no_incremental): New function.
11713         (Incremental_binary::error): New method.
11714         (Sized_incremental_binary::do_find_incremental_inputs_section): New
11715         method.
11716         (make_sized_incremental_binary): New function.
11717         (open_incremental_binary): New function.
11718         (can_incrementally_link_file): Add checks if output is ELF and has
11719         inputs section.
11720         * incremental.h: Include "elfcpp_file.h" and "output.h".
11721         (Incremental_binary): New class.
11722         (Sized_incremental_binary): New class.
11723         (open_incremental_binary): Declare.
11724         * object.cc (is_elf_object): Use
11725         elfcpp::Elf_recognizer::is_elf_file.
11726         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
11727         * output.h (Output_file::filesize): New method.
11728
11729 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11730
11731         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
11732         New function.
11733         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
11734         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
11735         function.
11736         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
11737         function.
11738         (Arm_relocate_functions::movw_abs_nc): New function.
11739         (Arm_relocate_functions::movt_abs): New function.
11740         (Arm_relocate_functions::thm_movw_abs_nc): New function.
11741         (Arm_relocate_functions::thm_movt_abs): New function.
11742         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
11743         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
11744         (Scan::global): Likewise.
11745         (Relocate::relocate): Likewise.
11746         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11747
11748 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11749
11750         * arm.cc (Arm_relocate_functions::got_prel) New function.
11751         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
11752         (Relocate::relocate): Likewise.
11753         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11754
11755 2009-10-06  Ian Lance Taylor  <iant@google.com>
11756
11757         * options.h (class General_options): Define
11758         split_stack_adjust_size parameter.
11759         * object.h (class Object): Add uses_split_stack_ and
11760         has_no_split_stack_ fields.  Add uses_split_stack and
11761         has_no_split_stack accessor functions.  Declare
11762         handle_split_stack_section.
11763         (class Reloc_symbol_changes): Define.
11764         (class Sized_relobj): Define Function_offsets.  Declare
11765         split_stack_adjust, split_stack_adjust_reltype, and
11766         find_functions.
11767         * object.cc (Object::handle_split_stack_section): New function.
11768         (Sized_relobj::do_layout): Call handle_split_stack_section.
11769         * dynobj.cc (Sized_dynobj::do_layout): Call
11770         handle_split_stack_section.
11771         * reloc.cc (Sized_relobj::relocate_sections): Call
11772         split_stack_adjust for executable sections in split_stack
11773         objects.  Pass reloc_map to relocate_section.
11774         (Sized_relobj::split_stack_adjust): New function.
11775         (Sized_relobj::split_stack_adjust_reltype): New function.
11776         (Sized_relobj::find_functions): New function.
11777         * target-reloc.h: Include "object.h".
11778         (relocate_section): Add reloc_symbol_changes parameter.  Change
11779         all callers.
11780         * target.h (class Target): Add calls_non_split method.  Declare
11781         do_calls_non_split virtual method.  Declare match_view and
11782         set_view_to_nop.
11783         * target.cc: Include "elfcpp.h".
11784         (Target::do_calls_non_split): New function.
11785         (Target::match_view): New function.
11786         (Target::set_view_to_nop): New function.
11787         * gold.cc (queue_middle_tasks): Give an error if mixing
11788         split-stack and non-split-stack objects with -r.
11789         * i386.cc (Target_i386::relocate_section): Add
11790         reloc_symbol_changes parameter.
11791         (Target_i386::do_calls_non_split): New function.
11792         * x86_64.cc (Target_x86_64::relocate_section): Add
11793         reloc_symbol_changes parameter.
11794         (Target_x86_64::do_calls_non_split): New function.
11795         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
11796         parameter.
11797         * powerpc.cc (Target_powerpc::relocate_section): Add
11798         reloc_symbol_changes parameter.
11799         * sparc.cc (Target_sparc::relocate_section): Add
11800         reloc_symbol_changes parameter.
11801         * configure.ac: Call AM_CONDITIONAL for the default target.
11802         * configure: Rebuild.
11803         * testsuite/Makefile.am (TEST_AS): New variable.
11804         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
11805         (check_DATA): Add split_i386 and split_x86_64 files.
11806         (SPLIT_DEFSYMS): Define.
11807         (split_i386_[1234n].o): New targets.
11808         (split_i386_[124]): New targets.
11809         (split_i386_[1234r].stdout): New targets.
11810         (split_x86_64_[1234n].o): New targets.
11811         (split_x86_64_[124]): New targets.
11812         (split_x86_64_[1234r].stdout): New targets.
11813         (MOSTLYCLEANFILES): Add new executables.
11814         * testsuite/split_i386.sh: New file.
11815         * testsuite/split_x86_64.sh: New file.
11816         * testsuite/split_i386_1.s: New file.
11817         * testsuite/split_i386_2.s: New file.
11818         * testsuite/split_i386_3.s: New file.
11819         * testsuite/split_i386_4.s: New file.
11820         * testsuite/split_i386_n.s: New file.
11821         * testsuite/split_x86_64_1.s: New file.
11822         * testsuite/split_x86_64_2.s: New file.
11823         * testsuite/split_x86_64_3.s: New file.
11824         * testsuite/split_x86_64_4.s: New file.
11825         * testsuite/split_x86_64_n.s: New file.
11826         * testsuite/testfile.cc (Target_test): Update relocation_section
11827         function.
11828         * testsuite/Makefile.in: Rebuild.
11829
11830 2009-10-06  Ian Lance Taylor  <iant@google.com>
11831
11832         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
11833         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
11834         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
11835         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
11836         the address on ldo_addrs_.
11837         (Target_i386::Relocate::fix_up_ldo): New function.
11838
11839 2009-10-06   Rafael Espindola  <espindola@google.com>
11840
11841         * plugin.cc (add_input_library): New.
11842         (Plugin::load): Add add_input_library to tv.
11843         (Plugin_manager::add_input_file): Add the is_lib argument.
11844         (add_input_file): Update call to Plugin_manager::add_input_file.
11845         (add_input_library): New.
11846         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
11847
11848 2009-09-30  Doug Kwan  <dougkwan@google.com>
11849
11850         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
11851         symbol and call Symbol::may_need_copy_reloc to determine if
11852         a copy reloc is needed.
11853         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
11854         nocopyreloc is given in command line.
11855         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
11856         given in command line.
11857         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
11858         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
11859         of the removed Target_i386::may_need_copy_reloc.
11860         * options.h (copyreloc): New option with default value false.
11861         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11862         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
11863         instead of the removed Target_powerpc::may_need_copy_reloc.
11864         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11865         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
11866         instead of the removed Target_sparc::may_need_copy_reloc.
11867         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
11868         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
11869         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
11870         instead of the removed Target_x86_64::may_need_copy_reloc.
11871
11872 2009-09-30  Ian Lance Taylor  <iant@google.com>
11873
11874         * object.h (class Object): Remove target_ field, and target,
11875         sized_target, and set_target methods.
11876         (Object::sized_target): Remove.
11877         (class Sized_relobj): Update declarations.  Remove sized_target.
11878         * object.cc (Sized_relobj::setup): Remove target parameter.
11879         Change all callers.
11880         (Input_objects::add_object): Don't do anything with the target.
11881         (make_elf_sized_object): Add punconfigured parameter.  Change all
11882         callers.  Set or test parameter target.
11883         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
11884         Change all callers.
11885         * parameters.cc (Parameters::set_target): Change parameter type to
11886         be non-const.
11887         (Parameters::default_target): Remove.
11888         (set_parameters_target): Change parameter type to be non-const.
11889         (parameters_force_valid_target): New function.
11890         (parameters_clear_target): New function.
11891         * parameters.h (class Parameters): Update declarations.  Remove
11892         default_target method.  Add sized_target and clear_target
11893         methods.  Change target_ to be non-const.
11894         (set_parameters_target): Update declaration.
11895         (parameters_force_valid_target): Declare.
11896         (parameters_clear_target): Declare.
11897         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
11898         as NULL if we aren't searching.
11899         (Add_symbols::run): Don't check for compatible target.
11900         * fileread.cc (Input_file::open_binary): Call
11901         parameters_force_valid_target.
11902         * gold.cc (queue_middle_tasks): Likewise.
11903         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
11904         set_target on object.
11905         * dynobj.h (class Sized_dynobj): Update declarations.
11906         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
11907         make_elf_object returns NULL.
11908         (Archive::include_member): Don't check whether object target is
11909         compatible.
11910         * output.cc (Output_section::add_input_section): Get target from
11911         parameters.
11912         (Output_section::relax_input_section): Likewise.
11913         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
11914         parameters.
11915         (Sized_relobj::do_scan_relocs): Likewise.
11916         (Sized_relobj::relocate_sections): Likewise.
11917         * resolve.cc (Symbol_table::resolve): Likewise.
11918         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
11919         parameter.  Change all callers.
11920         (Symbol_table::add_from_object): Get target from parameters.
11921         (Symbol_table::add_from_relobj): Don't check object target.
11922         (Symbol_table::add_from_dynobj): Likewise.
11923         (Symbol_table::define_special_symbol): Get target from
11924         parameters.
11925         * symtab.h (class Symbol_table): Update declaration.
11926         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
11927         parameter.  Change all callers.  Clear parameter target.
11928         (Binary_test): Test target here.
11929         * testsuite/object_unittest.cc (gold_testsuite): Remove
11930         target_test_pointer parameter.  Change all callers.
11931         (Object_test): Test target here.
11932
11933 2009-09-26  Ian Lance Taylor  <iant@google.com>
11934
11935         * testsuite/initpri1.c: Don't try to use constructor priorities if
11936         compiling with gcc before 4.3.
11937
11938 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
11939
11940         * testsuite/retain_symbols_file_test.sh (check_present): Change
11941         output file name to retain_symbols_file_test.stdout.
11942         (check_absent): Likewise.
11943
11944 2009-09-18  Craig Silverstein  <csilvers@google.com>
11945
11946         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
11947         * options.cc: Include <cerrno> and <fstream>.
11948         (General_options::finalize): Parse -retain-symbols-file tag.
11949         * options.h: New flag.
11950         (General_options): New method should_retain_symbol, new
11951         variable symbols_to_retain.
11952         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
11953         should_retain_symbol map.
11954         * testsuite/Makefile.am (retain_symbols_file_test): New test.
11955         * testsuite/Makefile.in: Regenerate.
11956         * testsuite/retain_symbols_file_test.sh: New file.
11957
11958 2009-09-18  Nick Clifton  <nickc@redhat.com>
11959
11960         * po/es.po: Updated Spanish translation.
11961
11962 2009-09-17  Doug Kwan  <dougkwan@google.com>
11963
11964         * debug.h (DEBUG_RELAXATION): New constant.
11965         (DEBUG_ALL): Add DEBUG_RELAXATION.
11966         (debug_string_to_enum): Add relaxation debug option.
11967         * layout.cc
11968         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
11969         Layout::Relaxation_debug_check::read_sections,
11970         Layout::Relaxation_debug_check::read_sections): New method definitions.
11971         (Layout::Layout): Initialize data members
11972         record_output_section_data_from_scrips_,
11973         script_output_section_data_list_ and relaxation_debug_check_.
11974         (Layout::save_segments, Layout::restore_segments,
11975         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11976         Layout::relaxation_loop_body): New method definitions.
11977         (Layout::finalize): Support relaxation.  Move section layout code to
11978         Layout::relaxation_loop_body.
11979         (Layout::set_asection_address_from_script): Move code for orphan
11980         section placement out.
11981         (Layout::place_orphan_sections_in_script): New method definition.
11982         * layout.h (Output_segment_headers, Output_file_header):
11983         New forward class declarations.
11984         (Layout::~Layout): Define.
11985         (Layout::new_output_section_data_from_script): New method definition.
11986         (Layout::place_orphan_sections_in_script): New method declaration.
11987         (Layout::Segment_states): New type declaration.
11988         (Layout::save_segments, Layout::restore_segments,
11989         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11990         Layout::relaxation_loop_body): New method declarations.
11991         (Layout::Output_section_data_list): New type declaration.
11992         (Layout::Relaxation_debug_check): New class definition.
11993         (Layout::record_output_section_data_from_script_,
11994         Layout::script_output_section_data_list_, Layout::segment_states_,
11995         Layout::relaxation_debug_check_): New data members.
11996         * output.cc: (Output_section_headers::do_size): New method definition.
11997         (Output_section_headers::Output_section_headers): Move size
11998         computation to Output_section_headers::do_size.
11999         (Output_segment_headers::do_size): New method definition.
12000         (Output_file_header::Output_file_header): Move size computation to
12001         Output_file_header::do_size and call it.
12002         (Output_file_header::do_size): New method definition.
12003         (Output_data_group::Output_data_group): Adjust call to
12004         Output_section_data.
12005         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
12006         (Output_symtab_xindex::do_write): Add array bound check.
12007         (Output_section::Input_section::print_to_mapfile): Handle
12008         RELAXED_INPUT_SECTION_CODE.
12009         (Output_section::Output_section): Initialize data member checkpoint_.
12010         (Output_section::~Output_section): Delete checkpoint object pointed
12011         by checkpoint_.
12012         (Output_section::add_input_section): Always add an Input_section if
12013         relaxing.
12014         (Output_section::add_merge_input_section): Add assert.
12015         (Output_section::relax_input_section): New method definition.
12016         (Output_section::set_final_data_size): Set load address to zero for
12017         an unallocated section.
12018         (Output_section::do_address_and_file_offset_have_reset_values):
12019         New method definition.
12020         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
12021         Handle relaxed input section.
12022         (Output_section::sort_attached_input_sections): Checkpoint input
12023         section list lazily.
12024         (Output_section::get_input_sections): Change type of input_sections to
12025         list of Simple_input_section pointers.  Checkpoint input section list
12026         lazily.  Also handle relaxed input sections.
12027         (Output_section::add_input_section_for_script): Take a reference to
12028         a Simple_input_section object instead of Relobj pointer and section
12029         index as parameter.  Handle relaxed input sections.
12030         (Output_section::save_states, Output_section::restore_states): New
12031         method definitions.
12032         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
12033         (Output_data::is_data_size_fixed): New method definition.
12034         (Output_data::reset_addresss_and_file_offset): Do not reset data size
12035         if it is fixed.
12036         (Output_data::address_and_file_offset_have_reset_values): New method
12037         definition.
12038         (Output_data::do_address_and_file_offset_have_reset_values): New method
12039         definition.
12040         (Output_data::set_data_size): Check that data size is not fixed.
12041         (Output_data::fix_data_size): New method definition.
12042         (Output_data::is_data_size_fixed_): New data member.
12043         (Output_section_headers::set_final_data_size): New method definition.
12044         (Output_section_headers::do_size): New method declaration.
12045         (Output_segment_headers::set_final_data_size): New method definition.
12046         (Output_segment_headers::do_size): New method declaration.
12047         (Output_file_header::set_final_data_size)::New method definition.
12048         (Output_file_header::do_size)::New method declaration.
12049         (Output_section_data::Output_section_data): Add new parameter
12050         is_data_size_fixed and use it to fix data size.
12051         (Output_data_const::Output_data_const): Adjust call to base class
12052         constructor and fix data size.
12053         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
12054         base class constructor and fix data size.
12055         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
12056         base class constructor and fix data size.
12057         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
12058         class constructor and fix data size.
12059         (Output_data_group::set_final_data_size): New method definition.
12060         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
12061         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
12062         class constructor and fix data size.
12063         (Output_relaxed_input_section): New class definition.
12064         (Output_section::Simple_input_section): New class definition.
12065         (Output_section::get_input_sections): Adjust parameter list.
12066         (Output_section::add_input_section_for_script): Same.
12067         (Output_section::save_states, Output_section::restore_states,
12068         Output_section::do_address_and_file_offset_have_reset_values,
12069         (Output_section::Input_section::Input_section): Handle
12070         RELAXED_INPUT_SECTION_CODE.  Add new overload for
12071         Output_relaxed_input_section.
12072         (Output_section::Input_section::is_input_section,
12073         Output_section::Input_section::set_output_section): Handle relaxed
12074         input section.
12075         (Output_section::Input_section::is_relaxed_input_section,
12076         Output_section::Input_section::output_section_data,
12077         Output_section::Input_section::relaxed_input_section): New method
12078         definitions.
12079         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
12080         value.
12081         (Output_section::Input_section::u1_): Update comments.
12082         (Output_section::Input_section::u2_): Add new union member poris.
12083         (Output_section::Checkpoint_output_section): New classs definition.
12084         (Output_section::relax_input_section): New method declaration.
12085         (Output_section::checkpoint_): New data member.
12086         (Output_segment): Update comments.
12087         (Output_segment::Output_segment): Un-privatize copy constructor.
12088         (Output_segment::operator=): Un-privatize.
12089         * script-sections.cc (Output_section_element::Input_section_list):
12090         Change element type to Output_section::Simple_input_section.
12091         (Output_section_element_dot_assignment::set_section_addresses):
12092         Register output section data for relaxation clean up.
12093         (Output_data_exression::Output_data_expression): Adjust call to base
12094         constructor to fix data size.
12095         (Output_section_element_data::set_section_addresses): Register
12096         Output_data_expression object for relaxation clean up.
12097         (struct Input_section_info): Replace Relobj pointer and section index
12098         pair with Output_section::Simple_input_section and Convert struct to a
12099         class.
12100         (Input_section_sorter::operator()): Adjust access to
12101         Input_section_info data member to use accessors.
12102         (Output_section_element_input::set_section_addresses): Use layout
12103         parameter.  Adjust code to use Output_section::Simple_input_section
12104         and Input_secction_info classes.  Register filler for relaxation
12105         clean up.
12106         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
12107         and section index pair with Output_section::Simple_input_section
12108         class.  Adjust code accordingly.
12109         (Phdrs_element::release_segment): New method definition.
12110         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
12111         segment list.
12112         (Script_sections::release_segments): New method definition.
12113         * gold/script-sections.h (Script_sections::release_segments): New
12114         method declaration.
12115         * gold/target.h (Target::may_relax, Target::relax,
12116         Target::do_may_relax, Target::do_relax): New method definitions.
12117
12118 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12119
12120         * arm.cc (has_signed_unsigned_overflow): New function.
12121         (Arm_relocate_functions::abs8): New function.
12122         (Target_arm::Scan::local): Handle R_ARM_ABS8.
12123         (Target_arm::Scan::global): Likewise.
12124         (Target_arm::relocate::relocate): Likewise.
12125         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
12126         Likewise.
12127
12128 2009-09-16  Cary Coutant  <ccoutant@google.com>
12129
12130         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
12131         * testsuite/Makefile.in: Regenerate.
12132
12133 2009-09-11  Nick Clifton  <nickc@redhat.com>
12134
12135         * po/gold.pot: Updated by the Translation project.
12136
12137 2009-09-08  Cary Coutant  <ccoutant@google.com>
12138
12139         * output.cc (Output_file::open): Add execute permission to empty file.
12140         * testsuite/Makefile.am (permission_test): New test.
12141         * testsuite/Makefile.in: Regenerate.
12142
12143 2009-09-02  Ian Lance Taylor  <iant@google.com>
12144
12145         * output.cc (Output_file::resize): Call map_no_anonymous rather
12146         than map.
12147
12148 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
12149
12150         * gold.cc: Include "incremental.h".
12151         (queue_initial_tasks): Call Incremental_checker methods.
12152         * incremental.cc: Include "output.h".
12153         (Incremental_checker::can_incrementally_link_output_file): New
12154         method.
12155         * incremental.h (Incremental_checker): New class.
12156
12157         * output.cc (Output_file::open_for_modification): New method.
12158         (Output_file::map_anonymous): Changed return type to bool.  Record
12159         map in base_ field.
12160         (Output_file::map_no_anonymous): New method, broken out of map.
12161         (Output_file::map): Use map_no_anonymous and map_anonymous.
12162         * output.h (class Output_file): Update declarations.
12163
12164 2009-08-24  Cary Coutant  <ccoutant@google.com>
12165
12166         * options.h (Command_line::Pre_options): New class.
12167         (Command_line::pre_options): New member.
12168         * options.cc (gold::options::ready_to_register): New variable.
12169         (One_option::register_option): Do nothing if not registering options.
12170         Assert if same short option registered twice.
12171         (General_options::General_options): Turn off option registration when
12172         done constructing.
12173         (Command_line::Pre_options::Pre_options): New constructor.
12174
12175 2009-08-24  Cary Coutant  <ccoutant@google.com>
12176
12177         * options.h (General_options::no_keep_memory): Remove incorrect
12178         short option.
12179
12180 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
12181
12182         * Makefile.am (am__skiplex, am__skipyacc): New.
12183         * Makefile.in: Regenerate.
12184
12185 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
12186
12187         * Makefile.am (AM_CPPFLAGS): Renamed from ...
12188         (INCLUDES): ... this.
12189         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
12190         (AM_CPPFLAGS): Renamed from ...
12191         (INCLUDE): ... this.
12192         * Makefile.in, testsuite/Makefile.in: Regenerate.
12193
12194         * Makefile.in: Regenerate.
12195         * aclocal.m4: Likewise.
12196         * config.in: Likewise.
12197         * configure: Likewise.
12198         * testsuite/Makefile.in: Likewise.
12199
12200         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12201         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12202         * Makefile.in: Regenerate.
12203         * testsuite/Makefile.in: Regenerate.
12204
12205 2009-08-19  Cary Coutant  <ccoutant@google.com>
12206
12207         * resolve.cc (Symbol_table::resolve): Don't complain about defined
12208         symbols in shared libraries overridden by hidden or internal symbols
12209         in the main program.
12210
12211 2009-08-19  Chris Demetriou  <cgd@google.com>
12212
12213         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
12214         checking source file names in error messages.
12215
12216 2009-08-18  Doug Kwan  <dougkwan@google.com>
12217
12218         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
12219         an elcpp::Ehdr as parameter.  Adjust call to set_target.
12220         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
12221         an elfcpp::Ehdr as parameter.
12222         * object.cc (Object::set_target): Remove the version that looks up
12223         a target and sets it.
12224         (Sized_relobj::setup): Take a Target object instead of
12225         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
12226         (make_elf_sized_object): Find target and ask target to
12227         make an ELF object.
12228         * object.h: (Object::set_target): Remove the version that looks up
12229         a target and sets it.
12230         (Sized_relobj::setup): Take a Target object instead of
12231         an elfcpp:Ehdr as parameter.
12232         * target.cc: Include dynobj.h.
12233         (Target::do_make_elf_object_implementation): New.
12234         (Target::do_make_elf_object): New.
12235         * target.h (Target::make_elf_object): New template declaration.
12236         (Target::do_make_elf_object): New method declarations.
12237         (Target::do_make_elf_object_implementation): New template declaration.
12238
12239 2009-08-14  Ian Lance Taylor  <iant@google.com>
12240
12241         * gold.h (FUNCTION_NAME): Define.
12242         (gold_unreachable): Use FUNCTION_NAME.
12243
12244 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
12245
12246         * icf.cc (Icf::find_identical_sections): Issue a warning when a
12247         symbol in the --keep-unique list is not found.
12248
12249 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
12250
12251         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
12252         been maked as --keep-unique.
12253         (Icf::unfold_section): New function.
12254         * icf.h (Icf::unfold_section): New function.
12255         * options.h (General_options::keep_unique): New option.
12256         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
12257         * testsuite/Makefile.in: Regenerate.
12258         * testsuite/icf_keep_unique_test.sh: New file.
12259         * testsuite/icf_keep_unique_test.cc: New file.
12260
12261 2009-08-12  Cary Coutant  <ccoutant@google.com>
12262
12263         PR 10471
12264         * resolve.cc (Symbol_table::resolve): Check for references from
12265         dynamic objects to hidden and internal symbols.
12266         * testsuite/Makefile.am (hidden_test.sh): New test.
12267         * testsuite/Makefile.in: Regenerate.
12268         * testsuite/hidden_test.sh: New script.
12269         * testsuite/hidden_test_1.c: New test source.
12270         * testsuite/hidden_test_main.c: New test source.
12271
12272 2009-08-11  Doug Kwan  <dougkwan@google.com>
12273
12274         * arm.cc: Update comments.
12275         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
12276         segment to locate the .ARM.exidx section if present.
12277
12278 2009-08-09  Doug Kwan  <dougkwan@google.com>
12279
12280         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
12281         patch.
12282
12283 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
12284         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
12285         compiler warnings.
12286
12287 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
12288
12289         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
12290         valid tls_segment only for non-debug-section relocations.
12291         * testsuite/Makefile.am: Add gc_tls_test.
12292         * testsuite/Makefile.in: Regenerate.
12293         * testsuite/gc_tls_test.cc: New file.
12294         * testsuite/gc_tls_test.sh: New file.
12295
12296 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
12297
12298         * icf.cc: New file.
12299         * icf.h: New file.
12300         * Makefile.am (CCFILES): Add icf.cc.
12301         (HFILES): Add icf.h
12302         * Makefile.in: Regenerate.
12303         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
12304         * gc.h (gc_process_relocs): Populate lists used by icf to contain
12305         section, symbol and addend information for the relocs.
12306         * gold.cc (queue_middle_tasks): Call identical code folding.
12307         * gold.h: Add defines for multimap.
12308         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
12309         to the call of finalize_local_symbols.
12310         * main.cc (main): Create object of class Icf.
12311         * object.cc (Sized_relobj::do_layout): Allow this function to be
12312         called twice during icf.
12313         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
12314         to sections marked as identical by icf.
12315         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
12316         when available.
12317         (Sized_relobj::do_section_entsize): New function.
12318         * object.h (Object::section_entsize): New function.
12319         (Object::do_section_entsize): New pure virtual function.
12320         (Relobj::finalize_local_symbols): Add new parameter.
12321         (Relobj::do_section_entsize): New function.
12322         * options.h (General_options::icf): New option.
12323         (General_options::icf_iterations): New option.
12324         (General_options::print_icf_sections): New option.
12325         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
12326         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
12327         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
12328         icf.
12329         * symtab.cc (Symbol_table::is_section_folded): New function.
12330         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
12331         to sections marked as identical by icf.
12332         * symtab.h (Symbol_table::set_icf): New function.
12333         (Symbol_table::icf): New function.
12334         (Symbol_table::is_section_folded): New function.
12335         (Symbol_table::icf_): New data member.
12336         * target-reloc.h (relocate_section): Ignore sections folded by icf.
12337         * testsuite/Makefile.am: Add commands to build icf_test.
12338         * testsuite/Makefile.in: Regenerate.
12339         * testsuite/icf_test.sh: New file.
12340         * testsuite/icf_test.cc: New file.
12341
12342 2009-07-24  Chris Demetriou  <cgd@google.com>
12343
12344         * layout.cc (is_compressible_debug_section): Fix incorrect
12345         comment about compressed section names.
12346
12347 2009-07-20  Ian Lance Taylor  <ian@airs.com>
12348
12349         PR 10419
12350         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
12351
12352 2009-07-16  Ian Lance Taylor  <iant@google.com>
12353
12354         PR 10400
12355         * layout.h: #include <map>.
12356         (class Kept_section): Change from struct to class.  Add accessors
12357         and setters.  Add section size to Comdat_group mapping.  Change
12358         Comdat_group to std::map.  Add is_comdat_ field.  Add
12359         linkonce_size field in union.
12360         (class Layout): Update declaration of find_or_add_kept_section.
12361         Don't declare find_kept_object.
12362         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
12363         parameter.  Add object, shndx, is_comdat, and is_group_name
12364         parameters.  Change all callers.  Adjust for new Kept_section.
12365         (Layout::find_kept_object): Remove.
12366         * object.cc (Sized_relobj::include_section_group): Update use of
12367         Kept_section.  Rename secnum to shndx.  Only record
12368         Kept_comdat_section if sections are the same size.
12369         (Sized_relobj::include_linkonce_section): Update use of
12370         Kept_section.  Only record Kept_comdat_section if sections are the
12371         same size.  Set size of linkonce section.
12372         (Sized_relobj::map_to_kept_section): Update call to
12373         get_kept_comdat_section.
12374         * object.h (class Sized_relobj): Rename fields in
12375         Kept_comdat_section to drop trailing underscores; change object
12376         field to Relobj*.  Change Kept_comdat_section_table to store
12377         struct rather than pointer.
12378         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
12379         Add kept_object and kept_shndx parameters.  Change all callers.
12380         (Sized_relobj::get_kept_comdat_section): Change return type to
12381         bool.  Add kept_object and kept_shndx parameters.  Change all
12382         callers.
12383         * plugin.cc (Pluginobj::include_comdat_group): Update call to
12384         Layout::find_or_add_kept_section.
12385
12386 2009-07-09  Ian Lance Taylor  <iant@google.com>
12387
12388         * merge.cc (Object_merge_map::initialize_input_to_output_map):
12389         Reserve space in the hash table.
12390
12391 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
12392
12393         * fileread.cc (File_read::get_mtime): New method.
12394         * fileread.h (Timespec): New structure.
12395         (File_read::get_mtime): New method.
12396         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
12397         Renamed from timestamp_nsec.
12398         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
12399         Elf_Xword.
12400         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
12401         timestamp_nsec.
12402         (Incremental_inputs::report_archive): Save mtime; style fix.
12403         (Incremental_inputs::report_obejct): Save mtime; style fix.
12404         (Incremental_inputs::report_script): Save mtime; style fix.
12405         (Incremental_inputs::finalize_inputs): Style fix.
12406         (Incremental_inputs::finalize): Style fix.
12407         (Incremental_inputs::create_input_section_data): Store inputs
12408         mtime.
12409         * incremental.h (Incremental_inputs::report_script): Add mtime
12410         argument.
12411         (Incremental_inputs::Input_info::Input_info): Intialize only one
12412         union member.
12413         (Incremental_inputs::Input_info::archive): Move to nameless
12414         union.
12415         (Incremental_inputs::Input_info::obejct): Move to nameless union.
12416         (Incremental_inputs::Input_info::script): Move to nameless union.
12417         (Incremental_inputs::mtime): New field.
12418         * script.cc (read_input_script): Pass file mtime to
12419         Incremental_input.
12420         * script.h (Script_info::inputs): Style fix.
12421
12422 2009-07-01  Ian Lance Taylor  <ian@airs.com>
12423
12424         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
12425         instead of 32.
12426
12427 2009-06-24  Ian Lance Taylor  <iant@google.com>
12428
12429         PR 10156
12430         * layout.cc (Layout::choose_output_section): If we find an
12431         existing section, update the flags.
12432         (Layout::create_notes): New function, broken out of
12433         Layout::finalize.
12434         (Layout::finalize): Don't create note sections.
12435         (Layout::create_note): Don't crash if linker script discards
12436         section.
12437         (Layout::create_gold_note): Likewise.
12438         (Layout::create_build_id): Likewise.  Don't set
12439         after_input_sections on the section.
12440         (Layout::create_executable_stack_info): Remove target parameter.
12441         Change caller.
12442         * layout.h (class Layout): Declare create_notes.  Update
12443         declaration of create_executable_stack_info.
12444         * gold.cc (queue_middle_tasks): Call create_notes.
12445         * output.cc (Output_section::update_flags_for_input_section): Move
12446         here from output.h.  If SHF_ALLOC flag is newly set, mark address
12447         invalid.
12448         * output.h (Output_data::mark_address_invalid): New function.
12449         (class Output_section): Only declare, not define,
12450         update_flags_for_input_section.  Remove set_flags.
12451
12452 2009-06-24  Ian Lance Taylor  <iant@google.com>
12453
12454         * script-sections.cc (Output_section_definition::
12455         set_section_addresses): Rename shadowing local load_address to
12456         laddr.
12457
12458 2009-06-24  Ian Lance Taylor  <iant@google.com>
12459
12460         PR 10244
12461         * reloc.cc (relocate_sections): Skip empty relocation sections.
12462
12463 2009-06-23  Ian Lance Taylor  <iant@google.com>
12464
12465         PR 10156
12466         * layout.cc (Layout::create_note): Use choose_output_section
12467         rather than make_output_section.
12468
12469 2009-06-23  Ian Lance Taylor  <iant@google.com>
12470
12471         PR 10237
12472         * options.cc (General_options::parse_V): Set printed_version_.
12473         (General_options::General_options): Initialize printed_version_.
12474         * options.h (class General_options): Add printed_version_ field.
12475         * gold.cc (queue_initial_tasks): If there are no input files,
12476         don't give a fatal error if we printed the version information.
12477         (queue_middle_tasks): If using -r with a shared object, give a
12478         fatal error rather than an ordinary error.
12479
12480 2009-06-23  Ian Lance Taylor  <iant@google.com>
12481
12482         PR 10219
12483         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
12484         (Layout::make_output_section): Set have_stabstr_section_ if we see
12485         a .stab*str section.
12486         (Layout::finalize): Call link_stabs_sections.
12487         (Layout::link_stabs_sections): New file.
12488         * layout.h (class Layout): Add have_stabstr_section_ field.
12489         Declare link_stabs_sections.
12490
12491 2009-06-23  Doug Kwan  <dougkwan@google.com>
12492
12493         * Makefile.am (libgold_a_LIBADD): New.
12494         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
12495         * Makefile.in: Regenerate.
12496         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
12497         * configure: Regenerate.
12498         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
12499         * fileread.cc: Include sys/state.h
12500         * gold.h: Declare memmem and strndup if found missing.
12501         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
12502
12503 2009-06-23  Ian Lance Taylor  <iant@google.com>
12504
12505         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
12506         * configure: Rebuild.
12507
12508 2009-06-23  Ian Lance Taylor  <iant@google.com>
12509
12510         PR 10147
12511         * object.cc (Object::section_contents): Don't try to get a view if
12512         the section has length zero.
12513         (Object::handle_gnu_warning_section): If the section is empty, use
12514         the name of the section as the warning.
12515
12516 2009-06-23  Ian Lance Taylor  <iant@google.com>
12517
12518         PR 10133
12519         * stringpool.h (class Stringpool_template): Add optimize_ field.
12520         (Stringpool_template::set_optimize): New function.
12521         * stringpool.cc (Stringpool_template::Stringpool_template):
12522         Initialize optimize_ field.
12523         (Stringpool_template::set_string_offsets): Test local optimize
12524         fild rather than parameter.
12525         * layout.cc (Layout::Layout): Call set_optimize on the section
12526         name stringpool.
12527
12528 2009-06-22  Ian Lance Taylor  <iant@google.com>
12529
12530         PR 10030
12531         * yyscript.y: Parse TARGET.
12532         * script.cc (script_set_target): New function.
12533         * script-c.h (script_set_target): Declare.
12534         * options.cc (General_options::string_to_object_format): Rename
12535         from string_to_object_format in anonymous namespace.  Change
12536         callers.
12537         * options.h (class General_options): Declare
12538         string_to_object_format.
12539
12540 2009-06-22  Ian Lance Taylor  <iant@google.com>
12541
12542         * script-sections.cc (Script_sections::create_segments): Don't put
12543         program headers in a PT_LOAD segment if -n or -N.
12544
12545 2009-06-22  Ian Lance Taylor  <iant@google.com>
12546
12547         PR 10141
12548         * options.h (class General_options): Add -z lazy and -z now.  Sort
12549         -z options into alphabetical order.
12550         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
12551
12552 2009-06-21  Ian Lance Taylor  <iant@google.com>
12553
12554         * layout.cc (Layout::make_output_section): Call
12555         Target::new_output_section.
12556         (Layout::attach_allocated_section_to_segment): Put large section
12557         sections in a separate load segment with the large segment flag
12558         set.
12559         (Layout::segment_precedes): Sort large data segments after other
12560         load segments.
12561         (align_file_offset): New static function.
12562         (Layout::set_segment_offsets): Use align_file_offset.
12563         * output.h (class Output_section): Add is_small_section_ and
12564         is_large_section_ fields.
12565         (Output_section::is_small_section): New function.
12566         (Output_section::set_is_small_section):  New function.
12567         (Output_section::is_large_section): New function.
12568         (Output_section::set_is_large_section): New function.
12569         (Output_section::is_large_data_section): New function.
12570         (class Output_segment): Add is_large_data_segment_ field.
12571         (Output_segment::is_large_data_segment): New function.
12572         (Output_segment::set_is_large_data_segment): New function.
12573         * output.cc (Output_section::Output_section): Initialize new
12574         fields.
12575         (Output_segment::Output_segment): Likewise.
12576         (Output_segment::add_output_section): Add assertion that large
12577         data sections always go in large data segments.  Force small data
12578         sections to the end of the list of data sections.  Force small BSS
12579         sections to the start of the list of BSS sections.  For large BSS
12580         sections to the end of the list of BSS sections.
12581         * symtab.h (class Symbol): Declare is_common_shndx.
12582         (Symbol::is_defined): Check Symbol::is_common_shndx.
12583         (Symbol::is_common): Likewise.
12584         (class Symbol_table): Define enum Commons_section_type.  Update
12585         declarations.  Add small_commons_ and large_commons_ fields.
12586         * symtab.cc (Symbol::is_common_shndx): New function.
12587         (Symbol_table::Symbol_table): Initialize new fields.
12588         (Symbol_table::add_from_object): Put small and large common
12589         symbols in the right list.
12590         (Symbol_table::sized_finalized_symbol): Check
12591         Symbol::is_common_shndx.
12592         (Symbol_table::sized_write_globals): Likewise.
12593         * common.cc (Symbol_table::do_allocate_commons): Allocate new
12594         common symbol lists.  Don't call do_allocate_commons_list if the
12595         list is empty.
12596         (Symbol_table::do_allocate_commons_list): Remove is_tls
12597         parameter.  Add comons_section_type parameter.  Change all
12598         callers.  Handle small and large common symbols.
12599         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
12600         Symbol::is_common_shndx.
12601         * resolve.cc (symbol_to_bits): Likewise.
12602         * target.h (Target::small_common_shndx): New function.
12603         (Target::small_common_section_flags): New function.
12604         (Target::large_common_shndx): New function.
12605         (Target::large_common_section_flags): New function.
12606         (Target::new_output_section): New function.
12607         (Target::Target_info): Add small_common_shndx, large_common_shndx,
12608         small_common_section_flags, and large_common_section_flags
12609         fields.
12610         (Target::do_new_output_section): New virtual function.
12611         * arm.cc (Target_arm::arm_info): Initialize new fields.
12612         * i386.cc (Target_i386::i386_info): Likewise.
12613         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
12614         Likewise.
12615         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
12616         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12617         (Target_x86_64::do_new_output_section): New function.
12618         * configure.ac: Define conditional MCMODEL_MEDIUM.
12619         * testsuite/Makefile.am (check_PROGRAMS): Add large.
12620         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
12621         (large_LDFLAGS): Define.
12622         * testsuite/large.c: New file.
12623         * testsuite/testfile.cc (Target_test::test_target_info):
12624         Initialize new fields.
12625         * configure, testsuite/Makefile.in: Rebuild.
12626
12627 2009-06-05  Doug Kwan  <dougkwan@google.com>
12628
12629         * Makefile.am (CCFILES): Add target.cc.
12630         * Makefile.in: Regenerate.
12631         * i386.cc (class Target_i386): Define new virtual method to
12632         override do_is_local_label_name in parent.
12633         * object.cc (Sized_relobj::do_count_local_symbols): Discard
12634         local symbols if --discard-locals or -X is given.
12635         * options.h (class General_options): Declare new options
12636         '--discard-locals' and '-X' for discarding locals.
12637         * target.h (class Target): Define new methods is_local_label_name.
12638         Declare new virtual method do_is_local_label_name.
12639         * target.cc: New file.
12640         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
12641         (check_SCRIPTS): Add discard_locals_test.sh.
12642         (check_DATA): Add discard_local_tests.syms.
12643         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
12644         (discard_local_tests.syms, discard_locals_test.o): New make rules.
12645         * testsuite/Makefile.in: Regenerate.
12646         * testsuite/discard_locals_test.c: New file.
12647         * testsuite/discard_locals_test.sh: Same.
12648
12649 2009-06-05  Doug Kwan  <dougkwan@google.com>
12650
12651         * object.cc (Sized_relobj::Sized_relobj): Initialize
12652         discarded_eh_frame_shndx_ to -1U.
12653         (Sized_relobj::do_layout): Record index of a discard .eh_frame
12654         section.
12655         (Sized_relobj::do_count_local_symbols): Skip local symbols in
12656         a discarded .eh_frame section.
12657         (Sized_relobj::do_finalize_local_symbols): Ditto.
12658         * object.h (class Sized_relobj): Declare new member
12659         discarded_eh_frame_shndx_.
12660         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
12661         (local_labels_test.o, local_labels_test): New rules.
12662         * testsuite/Makefile.in: Regenerate.
12663
12664 2009-06-04  Doug Kwan  <dougkwan@google.com>
12665
12666         * layout.cc (Layout::section_name_mapping): Add mapping for
12667         special ARM sections.
12668
12669 2009-06-03  Doug Kwan  <dougkwan@google.com>
12670
12671         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
12672         (utils::has_overflow): Same.
12673
12674 2009-06-03  Ian Lance Taylor  <iant@google.com>
12675
12676         * layout.cc (Layout::section_name_mapping): New array, replacing
12677         Layout::linkonce_mapping.
12678         (Layout::section_name_mapping_count): New variable, replacing
12679         Layout::linkonce_mapping_count.
12680         (Layout::linkonce_output_name): Remove.
12681         (Layout::output_section_name): Rewrite.
12682         * layout.h (class Layout): Rename Linkonce_mapping to
12683         Section_name_mapping, linkonce_mapping to section_name_mapping,
12684         linkonce_mapping_count to section_name_mapping_count.  Don't
12685         declare linkonce_output_name.
12686
12687 2009-06-03  Doug Kwan  <dougkwan@google.com>
12688
12689         * gold/arm.cc (namespace utils): New.
12690         (Target_arm::reloc_is_non_pic): Define new method.
12691         (class Arm_relocate_functions): New.
12692         (Target_arm::Relocate::relocate): Handle relocation types used by
12693         Android.
12694
12695 2009-06-03  Ian Lance Taylor  <iant@google.com>
12696
12697         * arm.cc (Target_arm::scan::global): Use || instead of |.
12698
12699 2009-06-02  Doug Kwan  <dougkwan@google.com>
12700
12701         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
12702         issued_non_pic_error_.
12703         (class Target_arm::Scan): Declare new method check_non_pic.
12704         Define new method symbol_needs_plt_entry.
12705         Declare new data member issued_non_pic_error_.
12706         (class Target_arm::Relocate): Declare new method
12707         should_apply_static_reloc.
12708         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
12709         (Target_arm::Scan::check_non_pic): Define new method.
12710         (Target_arm::Scan::local): Handle a small subset of reloc types used
12711         by Android.
12712         (Target_arm::Scan::local): Same.
12713         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
12714
12715 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
12716
12717         * incremental.cc (Incremental_inputs::report_command_line): Filter
12718         out --incremental-* options.
12719
12720 2009-05-29  Doug Kwan  <dougkwan@google.com>
12721
12722         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
12723         template class.
12724         (class Target_arm): Update comment.
12725         (Target_arm::Target_arm): Initialize new data members GOT_,
12726         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
12727         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
12728         and Target_arm::rel_dyn_section.
12729         Declare new_enum Target_arm::Got_type.
12730         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
12731         and DYNBSS_.
12732         Update commments for member do_dynsym_value.
12733         (Target_arm::got_size, Target_arm::plt_section,
12734         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
12735         new methods inside class defintion.
12736         (Target_arm::got_section): Define new method.
12737         (Target_arm::rel_dyn_section): Same.
12738         (Output_data_plt_arm): New template class.
12739         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
12740         (Output_data_plt_arm:do_adjust_output_section): Define new method.
12741         (Output_data_plt_arm::add_entry): Same.
12742         (Output_data_plt_arm::first_plt_entry): Define new
12743         static data member for PLT instruction template.
12744         (Output_data_plt_arm::plt_entry): Same.
12745         (Output_data_plt_arm::do_write): Define new method.
12746         (Target_arm::make_plt_entry): Same.
12747         (Target_arm::do_finalize_sections): Same.
12748         (Target_arm::do_dynsym_value): Same.
12749
12750 2009-05-28  Doug Kwan  <dougkwan@google.com>
12751
12752         * Makefile.am (TARGETSOURCES): Add arm.cc.
12753         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
12754         * Makefile.in: Regenerate.
12755         * arm.cc: New file.
12756         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
12757
12758 2009-05-26  Doug Kwan  <dougkwan@google.com>
12759
12760         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
12761         (General_options::check_excluded_libs): Strip off directories in
12762         archive name before matching like GNU ld does.
12763         * testsuite/Makefile.am (MOSTLYCLEANFILES,
12764         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
12765         (exclude_libs_test_LDFLAGS): Add linker option
12766         -Wl,--exclude-libs,libexclude_libs_test_3
12767         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
12768         an explicit archive without using -l.
12769         (alt/libexclude_libs_test_3.a): New make rule.
12770         * testsuite/Makefile.in: Regenerate.
12771         * testsuite/exclude_libs_test.c : Declare lib3_default().
12772         (main): Call it.
12773         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
12774         * exclude_libs_test_3.c: New file.
12775
12776 2009-05-26  Nick Clifton  <nickc@redhat.com>
12777
12778         * po/id.po: New Indonesian translation.
12779         * po/gold.pot: Updated template file.
12780
12781 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
12782
12783         * testsuite/Makefile.am: Add -ffunction-sections to compile
12784         gc_comdat_test files.  Add -Wl,--gc-sections to build
12785         gc_comdat_test.
12786         * testsuite/Makefile.in: Regenerate.
12787         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
12788
12789 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
12790
12791         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
12792         kept comdat section was garbage collected.
12793         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
12794         * testsuite/Makefile.in: Regenerate.
12795         * testsuite/gc_comdat_test.sh: New file.
12796         * testsuite/gc_comdat_test_1.cc: New file.
12797         * testsuite/gc_comdat_test_2.cc: New file.
12798
12799 2009-05-19  Doug Kwan  <dougkwan@google.com>
12800
12801         * archive.cc (Archive::Archive): Move constructor from archive.h
12802         to here.  Initialize no_export_.
12803         (Archive::get_elf_object_for_member): Set no_export flag of object.
12804         * archive.h (Archive::Archive): Move constructor body to
12805         archive.cc.
12806         (Archive::no_export): New method.
12807         (Archive::no_export_): New field.
12808         * object.h (Object::Object): Initialize no_export_ to false.
12809         (Object::no_export, Object::set_no_export): New methods.
12810         (Object::no_export_): New field.
12811         * options.cc (General_options::parse_exclude_libs): New method.
12812         (General_options::check_excluded_libs) Same.
12813         * options.h (exclude_libs): New option.
12814         (General_options::check_excluded_libs): New method declaration.
12815         (General_options::excluded_libs_): New field.
12816         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
12817         default or protected visibility if an object has no-export flag set.
12818         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
12819         (check_SCRIPTS): Add exclude_libs_test.sh.
12820         (check_DATA): Add exclude_libs_test.syms.
12821         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
12822         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
12823         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
12824         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
12825         (exclude_libs_test.syms, libexclude_libs_test_1.a,
12826         libexclude_libs_test_2.a): New rules.
12827         * testsuite/Makefile.in: Regenerate.
12828         * testsuite/exclude_libs_test.c: New file.
12829         * testsuite/exclude_libs_test.sh: Ditto.
12830         * testsuite/exclude_libs_test_1.c: Ditto.
12831         * testsuite/exclude_libs_test_2.c: Ditto.
12832
12833 2009-05-15  Ian Lance Taylor  <iant@google.com>
12834
12835         * configure.ac: Check for declarations for cases where libiberty.h
12836         checks HAVE_DECL_xxx.
12837         * configure, config.in: Rebuild.
12838
12839 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
12840
12841         * gold.h (Incremental_argument_list): Remove (invalid) forward
12842         declaration.
12843         * incremental.cc (Incremental_inputs::report_achive): New method.
12844         (Incremental_inputs::report_object): New method.
12845         (Incremental_inputs::report_script): New method.
12846         (Incremental_inputs::finalize_inputs): New method.
12847         (Incremental_inputs::finalize): Call finalize_inputs().
12848         (Incremental_inputs::sized_create_incremental_inputs_section_data):
12849         Create inputs entries.
12850         * incremental.h (Incremental_input_type): New enum.
12851         (Incremental_inputs::Incremental_input): Initialize new fields.
12852         (Incremental_inputs::report_inputs): New method.
12853         (Incremental_inputs::report_achive): New method.
12854         (Incremental_inputs::report_object): New method.
12855         (Incremental_inputs::report_script): New method.
12856         (Incremental_inputs::finalize_inputs): New method.
12857         (Incremental_inputs::Input_info): New struct.
12858         (Incremental_inputs::Input_info_map): New typedef.
12859         (Incremental_inputs::lock_): New field.
12860         (Incremental_inputs::Inputs_): New field.
12861         (Incremental_inputs::Inputs_map): New field.
12862         * main.cc (main): Call Incremental_input::report_inputs.
12863         * options.h (Input_argument_list): Typedef moved from
12864         Input_arguments.
12865         (Input_file_group::Files): Remove, use ::Input_argument_list.
12866         (Input_file_group::Input_argument_list): Remove, use
12867         ::Input_argument_list.
12868         * plugin.cc (Plugin_manager::add_input_file): Add error in
12869         incremental build.
12870         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
12871         functions.
12872         * script.cc (read_input_script): Call
12873         Incremental_input::report_script.
12874         * script.h (Script_info): New class.
12875
12876 2009-04-27  Ian Lance Taylor  <iant@google.com>
12877
12878         * x86_64.cc (do_adjust_output_section): Set entsize to
12879         plt_entry_size.
12880
12881 2009-04-23  Elliott Hughes  <enh@google.com>
12882
12883         * output.cc (Output_file::close): After short writes, continue
12884         writing from the correct offset in the buffer being written.
12885
12886 2009-04-23  Chris Demetriou  <cgd@google.com>
12887
12888         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
12889         * configure: Regenerate.
12890         * config.in: Regenerate.
12891         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
12892         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
12893
12894 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
12895
12896         * incremental.cc (Incremental_inputs_header_data): Renamed from
12897         Incremental_input_header_data.
12898         (Incremental_inputs_header_data::data_size): New field.
12899         (Incremental_inputs_header_data::put_input_file_count): Renamed
12900         from input_file_count.
12901         (Incremental_inputs_header_data::put_command_line_offset): Renamed
12902         from command_line_offset.
12903         (Incremental_inputs_header_data::put_reserved): Renamed from
12904         put_reserved.
12905         (Incremental_inputs_entry_data): Renamed from
12906         Incremental_input_entry_data.
12907         (Incremental_inputs_entry_data::data_size): New field.
12908         (Incremental_inputs::report_command_line): New method.
12909         (Incremental_inputs::finalize): New method.
12910         (Incremental_inputs::create_incremental_inputs_data): New method.
12911         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
12912         * incremental.h: New file.
12913         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
12914         (Layout::finalize): Create incremental inputs section in
12915         incremental builds.
12916         (Layout::create_incremental_info_sections): New method.
12917         * layout.h (Layout::incremental_inputs): New method.
12918         (Layout::create_incremental_info_sections): New method.
12919         (Layout::incremental_inputs_): New field.
12920         * main.cc (main): Notify Incremental_input of the command line.
12921
12922 2009-04-01  Ian Lance Taylor  <iant@google.com>
12923             Mikolaj Zalewski  <mikolajz@google.com>
12924
12925         * gold.h (reserve_unordered_map): Define, three versions, one for
12926         each version of Unordered_map.
12927         * layout.cc (Layout::Layout): Remove options parameter.  Add
12928         number_of_input_files parameter.  Don't initialize options_.
12929         Initialize number_of_input_files_ and resized_signatures_.  Move
12930         sections_are_attached_.
12931         (Layout::layout_group): Reserve space for group_signatures_.
12932         (Layout::find_or_add_kept_section): Change name parameter to be a
12933         reference.  Resize signatures_ map when it gets large enough.
12934         (Layout::layout_eh_frame): Use parameters->options() instead of
12935         this->options_.
12936         (Layout::make_output_section): Likewise.
12937         (Layout::attach_allocated_section_to_segment): Likewise.
12938         (Layout::finalize, Layout::create_executable_stack): Likewise.
12939         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
12940         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
12941         * layout.h (class Layout): Update declarations.  Remove options_
12942         field.  Add number_of_input_files_ and resized_signatures_
12943         fields.  Move sections_are_attached_ field.
12944         * main.cc (main): Pass number of input files to Layout
12945         constructor.  Don't pass options.
12946
12947 2009-03-30  Ian Lance Taylor  <iant@google.com>
12948
12949         * ffsll.c (ffsll): Correct implementation.
12950
12951 2009-03-27  Ian Lance Taylor  <iant@google.com>
12952
12953         * ffsll.c: New file.
12954         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
12955         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
12956         * ftruncate.c (ftruncate): Declare before definition.
12957         * mremap.c (mremap): Likewise.
12958         * pread.c (pread): Likewise.
12959         * configure, Makefile.in, config.in: Rebuild.
12960
12961         * mremap.c: New file.
12962         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
12963         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
12964         (mremap): Declare if HAVE_MREMAP is not defined.
12965         * configure, Makefile.in, config.in: Rebuild.
12966
12967 2009-03-27  Cary Coutant  <ccoutant@google.com>
12968
12969         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
12970         position independent.
12971         * sparc.cc (Target_sparc::check_non_pic): Likewise.
12972         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
12973
12974 2009-03-24  Cary Coutant  <ccoutant@google.com>
12975
12976         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
12977         an executable.
12978         (needs_dynamic_reloc): Likewise.
12979
12980 2009-03-24  Ian Lance Taylor  <iant@google.com>
12981
12982         * yyscript.y (file_cmd): Recognize EXTERN.
12983         (extern_name_list, extern_name_list_body): New nonterminals.
12984         * script.cc (script_add_extern): Define.
12985         * script-c.h (script_add_extern): Declare.
12986
12987 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
12988
12989         * object.cc (is_elf_object): Define.
12990         * object.h (is_elf_object): Declare.
12991         * archive.cc (Archive::get_elf_object_for_member): Call
12992         is_elf_object.
12993         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
12994
12995 2009-03-24  Elliott Hughes  <enh@google.com>
12996
12997         * output.cc (Output_file::map_anonymous): Define.
12998         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
12999         try an anonymous one.  Report the size if the mmap fails.
13000         * output.h (class Output_file): Declare map_anonymous.
13001
13002 2009-03-24  Ian Lance Taylor  <iant@google.com>
13003
13004         * target-select.cc (instantiate_target): Don't acquire the lock if
13005         the instantiated_target_ field has already been set.
13006
13007 2009-03-23  Ian Lance Taylor  <iant@google.com>
13008
13009         * gold-threads.h (class Initialize_lock): Define.
13010         * gold-threads.cc (class Initialize_lock_once): Define.
13011         (initialize_lock_control): New static variable.
13012         (initialize_lock_pointer): New static variable.
13013         (initialize_lock_once): New static function.
13014         (Initialize_lock::Initialize_lock): Define.
13015         (Initialize_lock::initialize): Define.
13016         * target-select.h: Include "gold-threads.h".
13017         (class Target_selector): Add lock_ and initialize_lock_ fields.
13018         Don't define instantiate_target, just declare it.
13019         * target-select.cc (Target_selector::Target_selector): Initialize
13020         new fields.
13021         (Target_selector::instantiate_target): Define.
13022         * descriptors.h: Include "gold-threads.h".
13023         (class Descriptors): Add initialize_lock_ field.
13024         * descriptors.cc (Descriptors::Descriptors): Initialize new
13025         field.
13026         (Descriptors::open): Use initialize_lock_ field
13027         * errors.h (class Errors): Add initialize_lock_ field.
13028         * errors.cc (Errors::Errors): Initialize new field.
13029         (Errors::initialize_lock): Use initialize_lock_ field.
13030         * powerpc.cc (class Target_selector_powerpc): Remove
13031         instantiated_target_ field.  In do_recognize call
13032         instantiate_target rather than do_instantiate_target.  In
13033         do_instantiate_target just allocate a new target.
13034         * sparc.cc (class Target_selector_sparc): Likewise.
13035
13036         * freebsd.h: New file.
13037         * i386.cc: Include "freebsd.h".
13038         (Target_i386): Derive from Target_freebsd rather than
13039         Sized_target.
13040         (Target_selector_i386): Derive from Target_selector_freebsd rather
13041         than Target_selector.
13042         * x86_64.cc: Include "freebsd.h".
13043         (Target_x86_64): Derive from Target_freebsd rather than
13044         Sized_target.
13045         (Target_selector_x86_64): Derive from Target_selector_freebsd
13046         rather than Target_selector.
13047         * target.h (class Target): Add adjust_elf_header and
13048         do_adjust_elf_header.
13049         * output.cc (Output_file_header:: do_sized_write): Call target
13050         adjust_elf_header routine.
13051         * configure.tgt: Set targ_osabi.
13052         * configure.ac: Define GOLD_DEFAULT_OSABI.
13053         * parameters.cc (Parameters::default_target): Pass
13054         GOLD_DEFAULT_OSABI to select_target.
13055         * target-select.h (class Target_selector): Make instantiate_target
13056         protected rather than private.
13057         * Makefile.am (HFILES): Add freebsd.h.
13058         * configure, Makefile.in, config.in: Rebuild.
13059
13060         * merge.cc (do_add_input_section): Correct pend value.  Change
13061         message about last entry not being null terminated from error to
13062         warning.
13063
13064 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
13065
13066         * incremental.cc: New file.
13067         * Makefile.am (CCFILES): Add incremental.cc.
13068         * Makefile.in: Rebuild.
13069
13070 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
13071
13072         * layout.cc (Layout::output_section_name): Preserve names
13073         of '.note.' sections.
13074
13075 2009-03-19  Ian Lance Taylor  <iant@google.com>
13076
13077         * descriptors.cc (Descriptors::open): Check that the options are
13078         valid before using them.
13079
13080 2009-03-18  Ian Lance Taylor  <iant@google.com>
13081
13082         * script-sections.h: Include <list>.
13083         (class Script_sections): Change Sections_elements from std::vector
13084         to std::list.  Typedef public Elements_iterator.  Add
13085         orphan_section_placement_, data_segment_align_start_, and
13086         saw_data_segment_align_ fields.  Remove data_segment_align_index_
13087         field.
13088         * script-sections.cc (class Orphan_section_placement): New class.
13089         (class Sections_element): Add virtual functions is_relro and
13090         orphan_section_init.  Remove virtual function place_orphan_here.
13091         (class Output_section_definition): Add is_relro and
13092         orphan_section_init.  Remove place_orphan_here.
13093         (class Orphan_output_section): Likewise.
13094         (Script_sections::Script_sections): Update for field changes.
13095         (Script_sections::data_segment_align): Set saw_data_segment_align_
13096         and data_segment_align_start_, not data_segment_align_index.
13097         (Script_sections::data_segment_relro_end): Check
13098         saw_data_segment_align_.  Use data_segment_align_start_ rather
13099         than data_segment_align_index_.
13100         (Script_sections::place_orphan): Rewrite to use
13101         Orphan_section_placement.
13102
13103 2009-03-17  Ian Lance Taylor  <iant@google.com>
13104
13105         * archive.cc (Archive::add_symbols): Check for a version attached
13106         to the symbol name in the archive map.
13107         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
13108         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
13109         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
13110         (ver_test_11.a): New target.
13111         * testsuite/Makefile.in: Rebuild.
13112
13113         * configure.ac: Check for chsize and posix_fallocate.  Replace
13114         ftruncate.
13115         * ftruncate.c: New file, from gnulib.
13116         * output.cc (posix_fallocate): Define dummy version if not
13117         HAVE_POSIX_FALLOCATE.
13118         (Output_file::map): Call posix_fallocate rather than lseek and
13119         write.
13120         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
13121         * configure, Makefile.in, config.in: Rebuild.
13122
13123 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
13124
13125         * layout.h (Layout::create_note): Add section_name parameter.
13126         * layout.cc (Layout::create_note): Likewise.
13127         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
13128
13129 2009-03-17  Ian Lance Taylor  <iant@google.com>
13130
13131         * descriptors.cc: Include "options.h".
13132         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
13133         (Descriptors::open): Always use O_CLOEXEC when opening a new
13134         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
13135         then set FD_CLOEXEC.
13136
13137         * sparc.cc (class Target_sparc): Add has_got_section.
13138         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
13139         make sure we have a GOT section.
13140
13141         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
13142         (Target_sparc::Scan::local): Likewise.
13143         (Target_sparc::Scan::global): Likewise.
13144         (Target_sparc::Relocate::relocate): Likewise.
13145         (Target_sparc::Relocate::relocate_tls): Likewise.
13146
13147         * symtab.cc (Symbol_table::define_default_version): New function,
13148         broken out of add_from_object.
13149         (Symbol_table::add_from_object): Call define_default_version.
13150         (Symbol_table::define_special_symbol): Add resolve_oldsym
13151         parameter.  Change all callers.  If the version for a symbol comes
13152         from a version script, resolve it with the symbol with the same
13153         name with no version.  Also add the symbol without a version if
13154         appropriate.
13155         (do_define_in_output_data): If resolving with oldsym, don't delete
13156         sym.
13157         (do_define_in_output_segment): Likewise.
13158         (do_define_as_constant): Likewise.
13159         * symtab.h (class Symbol_table): Update declarations.
13160
13161 2009-03-13  Ian Lance Taylor  <iant@google.com>
13162
13163         * readsyms.cc (Read_symbols::incompatible_warning): New function.
13164         (Read_symbols::requeue): New function.
13165         (Read_symbols::do_read_symbols): If make_elf_object fails because
13166         the target type is not configured, and the file was searched for,
13167         issue a warning and retry with the next directory.
13168         (Add_symbols::run): If the file has an incompatible format, and
13169         it was searched for, requeue the Read_symbols task.  On error,
13170         release the object.
13171         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
13172         dirindex parameter to constructor.  Change all callers.  Declare
13173         incompatible_warning and requeue.
13174         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
13175         input_argument_ and input_group_ fields.  Add them to
13176         constructor.  Change all callers.
13177         (class Read_script): Add dirindex_ field.  Add it to constructor.
13178         Change all callers.
13179         * archive.cc (Archive::setup): Remove input_objects parameter.
13180         Change all callers.
13181         (Archive::get_file_and_offset): Likewise.
13182         (Archive::read_all_symbols): Likewise.
13183         (Archive::read_symbols): Likewise.
13184         (Archive::get_elf_object_for_member): Remove input_objects
13185         parameter.  Add punconfigured parameter.  Change all callers.
13186         (Archive::add_symbols): Change return type to bool.  Check return
13187         value of include_member.
13188         (Archive::include_all_members): Likewise.
13189         (Archive::include_member): Change return type to bool.  Return
13190         false if first included object has incompatible target.  Set
13191         included_member_ field.
13192         (Add_archive_symbols::run): If add_symbols returns false, requeue
13193         Read_symbols task.
13194         * archive.h (class Archive): Add included_member_ field.
13195         Initialize it in constructor.  Add input_file and searched_for
13196         methods.  Update declarations.
13197         (class Add_archive_symbols): Add dirpath_, dirindex_, and
13198         input_argument_ fields.  Add them to constructor.  Change all
13199         callers.
13200         * script.cc: Include "target-select.h".
13201         (class Parser_closure): Add skip_on_incompatible_target_ and
13202         found_incompatible_target_ fields.  Add
13203         skip_on_incompatible_target parameter to constructor.  Change all
13204         callers.  Add methods skip_on_incompatible_target,
13205         clear_skip_on_incompatible_target, found_incompatible_target, and
13206         set_found_incompatible_target.
13207         (read_input_script): Add dirindex parameter.  Change all callers.
13208         If parser finds an incompatible target, requeue Read_symbols
13209         task.
13210         (script_set_symbol): Clear skip_on_incompatible_target in
13211         closure.
13212         (script_add_assertion, script_parse_option): Likewise.
13213         (script_start_sections, script_add_phdr): Likewise.
13214         (script_check_output_format): New function.
13215         * script.h (read_input_script): Update declaration.
13216         * script-c.h (script_check_output_format): Declare.
13217         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
13218         (ignore_cmd): Remove OUTPUT_FORMAT.
13219         * fileread.cc (Input_file::Input_file): Add explicit this.
13220         (Input_file::will_search_for): New function.
13221         (Input_file::open): Add pindex parameter.  Change all callers.
13222         * fileread.h (class Input_file): Add input_file_argument method.
13223         Declare will_search_for.  Update declarations.
13224         * object.cc (make_elf_object): Add punconfigured parameter.
13225         Change all callers.
13226         * object.h (class Object): Make input_file public.  Add
13227         searched_for method.
13228         (make_elf_object): Update declaration.
13229         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
13230         restart search.
13231         * dirsearch.h (class Dirsearch): Update declaration.
13232         * options.h (class General_options): Add --warn-search-mismatch.
13233         * parameters.cc (Parameters::is_compatible_target): New function.
13234         * parameters.h (class Parameters): Declare is_compatible_target.
13235         * workqueue.cc (Workqueue::add_blocker): New function.
13236         * workqueue.h (class Workqueue): Declare add_blocker.
13237
13238         * fileread.cc (Input_file::open): Remove options parameter.
13239         Change all callers.
13240         (Input_file::open_binary): Likewise.
13241         * script.cc (read_input_script): Likewise.
13242         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
13243         options parameter from constructor.  Change all callers.
13244         (class Read_script): Likewise.
13245         * fileread.h (class Input_file): Update declarations.
13246         * script.h (read_input_script): Update declaration.
13247
13248 2009-03-10  Nick Clifton  <nickc@redhat.com>
13249
13250         * po/es.po: New Spanish translation.
13251
13252 2009-03-06  Cary Coutant  <ccoutant@google.com>
13253
13254         * options.cc (parse_short_option): Keep dash_z from registering itself.
13255
13256 2009-03-03  Ian Lance Taylor  <iant@google.com>
13257
13258         PR 9918
13259         * target-reloc.h (relocate_section): Pass output_section to
13260         relocate.
13261         * i386.cc (Target_i386::should_apply_static_reloc): Add
13262         output_section parameter.  Change all callers.
13263         (Target_i386::Relocate::relocate): Add output_section parameter.
13264         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13265         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
13266         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
13267         * testsuite/two_file_shared.sh: New script.
13268         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
13269         (check_DATA): Add two_file_shared.dbg.
13270         (two_file_shared.dbg): New target.
13271         * testsuite/Makefile.in: Rebuild.
13272
13273 2009-03-01  Ian Lance Taylor  <iant@google.com>
13274
13275         * configure.ac: Check for byteswap.h.
13276         * configure: Rebuild.
13277         * config.in: Rebuild.
13278
13279 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
13280
13281         * layout.cc (Layout::find_or_add_kept_section): New function.
13282         (Layout::add_comdat): Removed.
13283         * layout.h (struct Kept_section): Move out of class Layout.
13284         Remove trailing underscores from field names.  Add group_sections
13285         field.  Rename group_ field to is_group.  Change all uses.
13286         (class Layout): Declare find_or_add_kept_section, not add_comdat.
13287         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
13288         comdat_groups_ field.
13289         (Sized_relobj::include_section_group): Use
13290         find_or_add_kept_section and Kept_section::group_sections.
13291         (Sized_relobj::include_linkonce_section): Likewise.
13292         * object.cc (class Sized_relobj): Don't define Comdat_group or
13293         Comdat_group_table.  Remove find_comdat_group and
13294         add_comdat_group.  Remove comdat_groups_ field.
13295         * plugin.cc (include_comdat_group): Use
13296         Layout::find_or_add_kept_section.
13297
13298 2009-02-28  Ian Lance Taylor  <iant@google.com>
13299
13300         * README: --gc-sections and map files are now supported.  Document
13301         some build requirements.
13302
13303         PR 6992
13304         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
13305         relocatable link set the value of the section symbol to zero.
13306         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
13307         relocatable link don't include the section address in the local
13308         symbol value.
13309
13310 2009-02-27  Ian Lance Taylor  <iant@google.com>
13311
13312         PR 6811
13313         * options.h (class Search_directory): Add is_system_directory.
13314         (class General_options): Declare is_in_system_directory.
13315         * options.cc (get_relative_sysroot): Make static.
13316         (get_default_sysroot): Make static.
13317         (General_optoins::is_in_system_directory): New function.
13318         * fileread.cc (Input_file::is_in_system_directory): New function.
13319         * fileread.h (class Input_file): Declare is_in_system_directory.
13320         * object.h (class Object): Add is_in_system_directory.
13321         (class Input_objects): Remove system_library_directory_ field.
13322         * object.cc (Input_objects::add_object): Don't set
13323         system_library_directory_.
13324         (input_objects::found_in_system_library_directory): Remove.
13325         * symtab.cc (Symbol_table::write_globals): Remove input_objects
13326         parameter.  Change all callers.
13327         (Symbol_table::sized_write_globals): Likewise.
13328         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
13329         Call Object::is_in_system_directory.
13330         * symtab.h (class Symbol_table): Update declarations.
13331
13332         PR 5990
13333         * descriptors.h (Open_descriptor): Add is_on_stack field.
13334         * descriptors.cc (Descriptors::open): If the descriptor is on the
13335         top of the stack, remove it.  Initialize is_on_stack field.
13336         (Descriptors::release): Only add pod to stack if it is not on the
13337         stack already.
13338         (Descriptors::close_some_descriptor): Clear stack_next and
13339         is_on_stack fields.
13340
13341         PR 7091
13342         * output.cc (Output_section::find_starting_output_address): Rename
13343         from starting_output_address; add PADDR parameter; change return
13344         type.
13345         * output.h (class Output_section): Declare
13346         find_starting_output_address instead of starting_output_address.
13347         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
13348         section symbol for which we can't find a merge section.
13349
13350         PR 9836
13351         * symtab.cc (Symbol_table::add_from_object): If the visibility is
13352         hidden or internal, force the symbol to be local.
13353         * resolve.cc (Symbol::override_visibility): Define.
13354         (Symbol::override_base): Use override_visibility.
13355         (Symbol_table::resolve): Likewise.
13356         (Symbol::override_base_with_special): Likewise.
13357         (Symbol_table::override_with_special): If the visibility is hidden
13358         or internal, force the symbol to be local.
13359         * symtab.h (class Symbol): Add set_visibility and
13360         override_visibility.
13361         * testsuite/ver_test_1.sh: New file.
13362         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
13363         (check_DATA): Add ver_test_1.syms.
13364         (ver_test_1.syms): New target.
13365         * testsuite/Makefile.in: Rebuild.
13366
13367 2009-02-25  Cary Coutant  <ccoutant@google.com>
13368
13369         * layout.cc (Layout::choose_output_section): Don't rename sections
13370         when using a linker script that has a SECTIONS clause.
13371         * Makefile.in: Regenerate.
13372
13373         * testsuite/Makefile.am (script_test_5.sh): New test case.
13374         * testsuite/Makefile.in: Regenerate.
13375         * testsuite/script_test_5.cc: New file.
13376         * testsuite/script_test_5.sh: New file.
13377         * testsuite/script_test_5.t: New file.
13378
13379 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
13380
13381         * archive.cc (Archive::include_member): Update calls to add_symbols.
13382         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
13383         the Layout argument.
13384         * dynobj.h (do_add_symbols): Add the Layout argument.
13385         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
13386         Layout argument.
13387         * object.h (Object::add_symbols): Add the Layout argument.
13388         (Object::do_add_symbols): Add the Layout argument.
13389         (Sized_relobj::do_add_symbols): Add the Layout argument.
13390         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
13391         Unify the two versions.
13392         (Add_plugin_symbols): Remove.
13393         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
13394         (Sized_pluginobj::do_add_symbols): Unify the two versions.
13395         (Add_plugin_symbols): Remove.
13396         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
13397         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
13398         (Add_symbols::run): Make it work with Pulginobj.
13399
13400 2009-02-06  Ian Lance Taylor  <iant@google.com>
13401
13402         * object.cc (Sized_relobj::do_layout): Make info message start
13403         with lower case letter.
13404
13405 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
13406
13407         * binary.cc: Fix file comment.
13408
13409         * options.h (enum Incremental_disposition): Define.
13410         (class General_options): Add new options: --incremental,
13411         --incremental_changed, --incremental_unchanged,
13412         --incremental_unknown.  Add incremental_disposition_ and
13413         implicit_incremental_ fields.
13414         (General_options::incremental_disposition): New function.
13415         (class Position_dependent_options): Add incremental_disposition
13416         option.
13417         (Position_dependent_options::copy_from_options): Set incremental
13418         dispositions.
13419         * options.cc (General_options::parse_incremental_changed): New
13420         function.
13421         (General_options::parse_incremental_unchanged): New function.
13422         (General_options::parse_incremental_unknown): New function.
13423         (General_options::General_options): Initialize new fields
13424         incremental_disposition_ and implicit_incremental_.
13425         (General_options::finalize): Check for uasge of --incremental-*
13426         without --incremental.
13427
13428 2009-02-06  Chris Demetriou  <cgd@google.com>
13429
13430         * gold.h (gold_undefined_symbol): Change to take only a Symbol
13431         pointer and to report location as the file name associated with
13432         the symbol.
13433         (gold_undefined_symbol_at_location): New function to replace the
13434         old gold_undefined_symbol functionality.
13435         * target-reloc.h (relocate_section): Update to use
13436         gold_undefined_symbol_at_location.
13437         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13438         Call gold_undefined_symbol function rather than gold_error.
13439         * errors.h (Errors::undefined_symbol): Take location as a
13440         string, rather than calculating it from a relocation.
13441         * errors.cc (Errors::fatal): Print "fatal error:" before the
13442         formatted message.
13443         (Errors::error, Errors::error_at_location): Print "error: "
13444         before the formatted message.
13445         (Errors::undefined_symbol): Take location as a string, rather
13446         than calculating it from a relocation.
13447         (gold_undefined_symbol_at_location): New function akin to
13448         old gold_undefined_symbol, calculates location from relocation.
13449         (gold_undefined_symbol): Change to take only a Symbol pointer
13450         and to report location as the file name associated with the symbol.
13451         * testsuite/debug_msg.sh: Update for changed error messages.
13452         * testsuite/undef_symbol.sh: Likewise.
13453
13454 2009-02-04  Duncan Sands  <baldrick@free.fr>
13455
13456         PR 9812
13457         * reduced_debug_output.h
13458         (Output_reduced_debug_abbrev_section::failed): Use format for
13459         gold_warning.
13460         (Output_reduced_debug_info_section::faild): Likewise.
13461
13462 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
13463
13464         * script.cc (Lazy_demangler): New class.
13465         (Version_script_info::get_symbol_version_helper): Demangle a
13466         symbol only once.
13467
13468 2009-01-29  Cary Coutant  <ccoutant@google.com>
13469
13470         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
13471         to __tls_get_addr.
13472         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13473
13474 2009-01-28  Ian Lance Taylor  <iant@google.com>
13475
13476         * version.cc (version_string): Bump to 1.9.
13477
13478         * gold.h: Include <cstring> and <stdint.h>.
13479         * version.cc: Include <cstdio>.
13480         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
13481         warning.
13482         * reduced_debug_output.cc (insert_into_vector): Rename from
13483         Insert_into_vector; change all callers.  Use Swap_unaligned to
13484         avoid aliasing issue; remove union since it is unnecessary.
13485
13486 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
13487
13488         * Makefile.am (CCFILES): Add gc.cc.
13489         (HFILES): Add gc.h.
13490         * Makefile.in: Regenerate.
13491         * gold.cc (Gc_runner): New class.
13492         (queue_initial_tasks): Call garbage collection related tasks
13493         when corresponding options are invoked.
13494         (queue_middle_gc_tasks): New function.
13495         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
13496         processed early before laying out sections during garbage collection.
13497         * gold.h (queue_middle_gc_tasks): New function.
13498         (is_prefix_of): Move from "layout.cc".
13499         * i386.cc (Target_i386::gc_process_relocs): New function.
13500         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
13501         * main.cc (main): Create object of class "Garbage_collection".
13502         * object.cc (Relobj::copy_symbols_data): New function.
13503         (Relobj::is_section_name_included): New function.
13504         (Sized_relobj::do_layout): Allow this function to be called twice
13505         during garbage collection and defer layout of section during the
13506         first call.
13507         * object.h (Relobj::get_symbols_data): New function.
13508         (Relobj::is_section_name_included): New function.
13509         (Relobj::copy_symbols_data): New function.
13510         (Relobj::set_symbols_data): New function.
13511         (Relobj::get_relocs_data): New function.
13512         (Relobj::set_relocs_data): New function.
13513         (Relobj::is_output_section_offset_invalid): New pure virtual function.
13514         (Relobj::gc_process_relocs): New function.
13515         (Relobj::do_gc_process_relocs): New pure virtual function.
13516         (Relobj::sd_): New data member.
13517         (Sized_relobj::is_output_section_offset_invalid): New function.
13518         (Sized_relobj::do_gc_process_relocs): New function.
13519         * options.h (General_options::gc_sections): Modify to not be a no-op.
13520         (General_options::print_gc_sections): New option.
13521         * plugin.cc (Plugin_finish::run): Remove function call to
13522         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
13523         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
13524         * reloc.cc (Read_relocs::run): Add task to process relocs and
13525         determine unreferenced sections when doing garbage collection.
13526         (Gc_process_relocs): New class.
13527         (Sized_relobj::do_gc_process_relocs): New function.
13528         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
13529         sections that are garbage collected.
13530         * reloc.h (Gc_process_relocs): New class.
13531         * sparc.cc (Target_sparc::gc_process_relocs): New function.
13532         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
13533         symbols whose corresponding sections are garbage collected.
13534         (Symbol_table::Symbol_table): Add new parameter for the garbage
13535         collection object.
13536         (Symbol_table::gc_mark_undef_symbols): New function.
13537         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13538         (Symbol_table::gc_mark_dyn_syms): New function.
13539         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
13540         as garbage.
13541         (Symbol_table::add_from_object): Likewise.
13542         (Symbol_table::add_from_relobj): When building shared objects, do not
13543         treat externally visible symbols as garbage.
13544         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
13545         table information for static and relocatable links.
13546         * symtab.h (Symbol_table::set_gc): New function.
13547         (Symbol_table::gc): New function.
13548         (Symbol_table::gc_mark_undef_symbols): New function.
13549         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13550         (Symbol_table::gc_mark_dyn_syms): New function.
13551         (Symbol_table::gc_): New data member.
13552         * target.h (Sized_target::gc_process_relocs): New pure virtual
13553         function.
13554         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
13555         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
13556
13557 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
13558
13559         * options.h (General_options::gc_sections): Define as a no-op for now.
13560         (General_options::no_keep_memory): Ditto.
13561         (General_options::Bshareable): Define.
13562         * options.cc (General_options::finalize): Honor -Bshareable.
13563
13564 2009-01-20  Andreas Schwab  <schwab@suse.de>
13565
13566         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
13567         read the value in the contents, since we don't use it.  Use the
13568         template endianness when writing.
13569         (Relocate::relocate): Use it for R_PPC_REL16_HA.
13570
13571 2009-01-19  Andreas Schwab  <schwab@suse.de>
13572
13573         * configure.tgt (powerpc64-*): Fix targ_obj.
13574
13575 2009-01-15  Ian Lance Taylor  <iant@google.com>
13576
13577         * object.cc (Sized_relobj::write_local_symbols): Don't write out
13578         local symbols when stripping all symbols.
13579
13580 2009-01-14  Cary Coutant  <ccoutant@google.com>
13581
13582         * output.cc (Output_reloc): Add explicit instantiations.
13583
13584 2009-01-14  Cary Coutant  <ccoutant@google.com>
13585
13586         * archive.cc (Archive::get_elf_object_for_member): Remove call
13587         to File_read::claim_for_plugin.
13588         * descriptors.cc (Descriptors::open): Remove reference to
13589         is_claimed.
13590         (Descriptors::claim_for_plugin): Remove.
13591         * descriptors.h (Descriptors::claim_for_plugin): Remove.
13592         (Descriptors::is_claimed): Remove.
13593         (claim_descriptor_for_plugin): Remove.
13594         * fileread.cc (File_read::claim_for_plugin): Remove.
13595         * fileread.h (File_read::claim_for_plugin): Remove.
13596         (File_read::descriptor): Reopen descriptor if necessary.
13597         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
13598         (Plugin_manager::all_symbols_read): Add task parameter. Change
13599         all callers.
13600         (Plugin_manager::get_input_file): New function.
13601         (Plugin_manager::release_input_file): New function.
13602         (Pluginobj::Pluginobj): Add filesize parameter and initialize
13603         corresponding data member.
13604         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
13605         and pass to base constructor. Change all callers.
13606         (get_input_file, release_input_file): New functions.
13607         (make_sized_plugin_object): Add filesize parameter. Change all callers.
13608         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
13609         (Plugin_manager::all_symbols_read): Add task parameter.
13610         (Plugin_manager::get_input_file): New function.
13611         (Plugin_manager::release_input_file): New function.
13612         (Plugin_manager::task_): New data member.
13613         (Pluginobj::Pluginobj): Add filesize parameter.
13614         (Pluginobj::filename): New function.
13615         (Pluginobj::descriptor): New function.
13616         (Pluginobj::filesize): New function.
13617         (Pluginobj::filesize_): New data member.
13618         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
13619         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
13620         File_read::claim_for_plugin; use Object::unlock to unlock the file.
13621
13622         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
13623         with archive libraries.
13624         * testsuite/Makefile.in: Regenerate.
13625         * testsuite/plugin_test.c (struct sym_info): New type.
13626         (get_input_file, release_input_file): New static variables.
13627         (onload): Capture new transfer vector entries.
13628         (claim_file_hook): Stop reading at end of file according to filesize.
13629         Factor out parsing of readelf output into separate function.
13630         (all_symbols_read_hook): Exercise get_input_file and release_input_file
13631         APIs and get the source file name from the symbol table.  Convert
13632         source file name to corresponding object file name.  Print info
13633         message when adding new input files.
13634         (parse_readelf_line): New function.
13635         * testsuite/plugin_test_1.sh: Add checks for new info messages.
13636         * testsuite/plugin_test_2.sh: Likewise.
13637         * testsuite/plugin_test_3.sh: Likewise.
13638         * testsuite/plugin_test_4.sh: New test case.
13639
13640 2009-01-07  Ian Lance Taylor  <iant@google.com>
13641
13642         * version.cc (version_string): Bump to 1.8.
13643
13644 2008-12-23  Cary Coutant  <ccoutant@google.com>
13645
13646         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
13647         * plugin.cc (Plugin_manager::finish): Rename as
13648         layout_deferred_objects.  Move cleanup to separate function.
13649         (Plugin_manager::cleanup): New function.
13650         (Plugin_finish::run): Call layout_deferred_objects and cleanup
13651         separately.
13652         * plugin.h (Plugin_manager::finish): Rename as
13653         layout_deferred_objects.
13654         (Plugin_manager::cleanup): New function.
13655         (Plugin_manager::cleanup_done): New field.
13656
13657 2008-12-23  Cary Coutant  <ccoutant@google.com>
13658
13659         * plugin.cc (is_visible_from_outside): New function.
13660         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
13661         so we don't return "IR only" status for exported symbols or -r links.
13662
13663         * testsuite/Makefile.am (plugin_test_3): New test case.
13664         * testsuite/Makefile.in: Regenerate.
13665         * testsuite/plugin_test_3.sh: New file.
13666
13667 2008-12-22  Cary Coutant  <ccoutant@google.com>
13668
13669         * object.cc (Sized_relobj::layout_section): New function.
13670         (Sized_relobj::do_layout): Defer layout of input sections until after
13671         plugin has provided replacement files.
13672         (Sized_relobj::do_layout_deferred_sections): New function.
13673         * object.h (Relobj::set_section_offset): Remove virtual keyword.
13674         (Relobj::layout_deferred_sections): New function.
13675         (Relobj::do_layout_deferred_sections): New function.
13676         (Sized_relobj::do_layout_deferred_sections): New function.
13677         (Sized_relobj::layout_section): New function.
13678         (Sized_relobj::Deferred_layout): New structure.
13679         (Sized_relobj::deferred_layout_): New field.
13680         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
13681         Change all callers.  Layout deferred sections.
13682         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
13683         references.
13684         (Plugin_hook::run): Move code from do_plugin_hook inline.
13685         (Plugin_hook::do_plugin_hook): Remove.
13686         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
13687         (Plugin_manager::finish): Renamed, was cleanup.
13688         (Plugin_manager::should_defer_layout): New function.
13689         (Plugin_manager::add_deferred_layout_object): New function.
13690         (Plugin_manager::Deferred_layout_list): New type.
13691         (Plugin_manager::deferred_layout_objects_): New field.
13692         (Plugin_hook::do_plugin_hook): Remove.
13693
13694 2008-12-17  Ian Lance Taylor  <iant@google.com>
13695
13696         * options.h (class General_options): Add --no case for
13697         --export-dynamic.
13698
13699 2008-12-16  Cary Coutant  <ccoutant@google.com>
13700
13701         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
13702         vector.
13703         (Plugin_manager::claim_file): Create plugin object even if
13704         plugin did not call the add_symbols callback.
13705         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
13706         asking for more symbols than were added.
13707         * testsuite/Makefile.am (plugin_test_1): Add test case with
13708         no global symbols.
13709         (empty.syms): New target.
13710         * testsuite/Makefile.in: Regenerate.
13711         * testsuite/plugin_test.c (claim_file_hook): Add new debug
13712         message. Don't call add_symbols if no globals.
13713         (all_symbols_read_hook): Don't provide replacement for empty
13714         claimed file.
13715
13716 2008-12-12  Ian Lance Taylor  <iant@google.com>
13717
13718         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
13719         r_type == 0 for a local symbol with r_sym == 0.
13720         (scan_relocatable_relocs): Pass r_sym to
13721         local_non_section_strategy.
13722         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
13723         r_sym parameter.
13724
13725         * configure.ac: Update test for TLS descriptors: they are
13726         supported as of glibc 2.9.
13727         * configure: Rebuild.
13728
13729 2008-12-11  Ian Lance Taylor  <iant@google.com>
13730
13731         PR 7091
13732         * target-reloc.h (Default_scan_relocatable_relocs): For each
13733         function, map r_type == 0 to RELOC_DISCARD.
13734
13735 2008-12-10  Cary Coutant  <ccoutant@google.com>
13736
13737         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
13738         object to override a kept COMDAT group from a plugin object.
13739
13740 2008-12-09  Ian Lance Taylor  <iant@google.com>
13741
13742         PR 7088
13743         * yyscript.y (file_cmd): Handle INPUT.
13744
13745         * testsuite/initpri1.c: Change all declarations to be full
13746         prototypes by adding void, to avoid compiler warnings.
13747
13748 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
13749
13750         * options.cc (General_options::parse_plugin_opt): New.
13751         (General_options::add_plugin): The argument now is just the filename.
13752         (General_options::add_plugin_option): New.
13753         * options.h (plugin_opt): New.
13754         (add_plugin): Change argument name.
13755         (add_plugin_option): New.
13756         * plugin.cc (Plugin::load): Don't parse the plugin option.
13757         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
13758         (Plugin::add_option): New.
13759         (Plugin::args_): Change type.
13760         (Plugin::filename_): New.
13761         (Plugin_manager::add_plugin_option): New.
13762         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
13763         * testsuite/Makefile.in: Regenerate.
13764
13765 2008-12-05  Cary Coutant  <ccoutant@google.com>
13766
13767         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
13768         Handle --strip-lto-sections option.
13769         * options.h (strip_lto_sections): New option.
13770
13771 2008-12-01  Cary Coutant  <ccoutant@google.com>
13772
13773         * plugin.cc (ld_plugin_message): Change format parameter to const.
13774         Fix mismatch between new[] and delete.
13775
13776 2008-11-14  Cary Coutant  <ccoutant@google.com>
13777
13778         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
13779         instead of -1U.
13780
13781 2008-11-05  Craig Silverstein  <csilvers@google.com>
13782
13783         * options.cc (General_options::parse_dynamic_list): New function.
13784         * options.h (General_options): New flags dynamic_list,
13785         dynamic_list_data, dynamic_list_cpp_new, and
13786         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
13787         (General_options::in_dynamic_list): New function.
13788         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
13789         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
13790         (Lex::can_continue_name): Likewise.
13791         (yylex): Likewise.
13792         (read_script_file): New parameter script_options.
13793         (read_dynamic_list): New function.
13794         (Script_options::define_dynamic_list): New function.
13795         (dynamic_list_keyword_parsecodes): New variable.
13796         (dynamic_list_keywords): New variable.
13797         * script.h (Script_options::define_dynamic_list): New function
13798         prototype.
13799         (read_dynamic_list): New function prototype.
13800         * symtab.cc (strprefix): New macro.
13801         (Symbol::should_add_dynsym_entry): Support dynamic_list,
13802         dynamic_list_data, dynamic_list_cpp_new, and
13803         dynamic_list_cpp_typeinfo.
13804         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
13805         (dynamic_list_expr): New rule.
13806         (dynamic_list_nodes): Likewise.
13807         (dynamic_list_node): Likewise.
13808         * testsuite/Makefile.am (dynamic_list): New test.
13809         * testsuite/Makefile.in: Regenerated.
13810         * testsuite/dynamic_list.t: New file.
13811         * testsuite/dynamic_list.sh: New file.
13812
13813 2008-11-05  Craig Silverstein  <csilvers@google.com>
13814
13815         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
13816         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
13817         (t11_last): Likewise.
13818         * testsuite/ver_test_6.c (main): Likewise.
13819
13820 2008-10-07  Cary Coutant  <ccoutant@google.com>
13821
13822         * options.c (General_options::finalize): Add check for -static and
13823         -shared.
13824         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
13825         is not empty.
13826
13827 2008-10-02  Cary Coutant  <ccoutant@google.com>
13828
13829         * plugin.cc (make_sized_plugin_object): Fix conditional
13830         compilation to work when not all targets are enabled.
13831
13832 2008-09-29  Cary Coutant  <ccoutant@google.com>
13833
13834         * archive.cc (Archive::get_file_and_offset): Use filename instead
13835         of name to get library path.
13836         (Archive::include_member): Unlock external member of a thin archive.
13837
13838         * testsuite/Makefile.am (TEST_AR): New variable.
13839         (thin_archive_test_1): New test.
13840         (thin_archive_test_2): New test.
13841         * testsuite/Makefile.in: Regenerate.
13842         * testsuite/thin_archive_main.cc: New file.
13843         * testsuite/thin_archive_test_1.cc: New file.
13844         * testsuite/thin_archive_test_2.cc: New file.
13845         * testsuite/thin_archive_test_3.cc: New file.
13846         * testsuite/thin_archive_test_4.cc: New file.
13847
13848 2008-09-29  Cary Coutant  <ccoutant@google.com>
13849
13850         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
13851         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
13852         instead of -1U.
13853         (Sized_relobj::do_finalize_local_symbols): Likewise.
13854         (Sized_relobj::map_to_kept_section): Likewise.
13855         * object.h (Sized_relobj::invalid_address): New constant.
13856         (Sized_relobj::do_output_section_offset): Check for invalid_address
13857         and return -1ULL.
13858         * output.cc (Output_reloc::local_section_offset): Use constant
13859         invalid_address instead of -1U.
13860         (Output_reloc::get_address): Likewise.
13861         (Output_section::output_address): Change -1U to -1ULL.
13862         * output.h (Output_reloc::invalid_address): New constant.
13863         * reloc.cc (Sized_relobj::write_sections): Use constant
13864         invalid_address instead of -1U.
13865         (Sized_relobj::relocate_sections): Likewise.
13866         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
13867         values for merge sections.
13868         * target-reloc.h (relocate_for_relocatable): Use constant
13869         invalid_address instead of -1U.
13870
13871 2008-09-19  Cary Coutant  <ccoutant@google.com>
13872
13873         Add plugin functionality for link-time optimization (LTO).
13874         * configure.ac (plugins): Add --enable-plugins option.
13875         * configure: Regenerate.
13876         * config.in: Regenerate.
13877         * Makefile.am (LIBDL): New variable.
13878         (CCFILES): Add plugin.cc.
13879         (HFILES): Add plugin.h.
13880         (ldadd_var): Add LIBDL.
13881         * Makefile.in: Regenerate.
13882
13883         * archive.cc: Include "plugin.h".
13884         (Archive::setup): Don't preread archive symbols when using a plugin.
13885         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
13886         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
13887         files.
13888         (Archive::include_member): Add symbols from plugin objects.
13889         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
13890         * descriptors.cc (Descriptors::open): Check for file descriptors
13891         abandoned by plugins.
13892         (Descriptors::claim_for_plugin): New function.
13893         * descriptors.h (Descriptors::claim_for_plugin): New function.
13894         (Open_descriptor::is_claimed): New field.
13895         (claim_descriptor_for_plugin): New function.
13896         * fileread.cc (File_read::claim_for_plugin): New function.
13897         * fileread.h (File_read::claim_for_plugin): New function.
13898         (File_read::descriptor): New function.
13899         * gold.cc: Include "plugin.h".
13900         (queue_initial_tasks): Add task to call plugin hooks for generating
13901         new object files.
13902         * main.cc: Include "plugin.h".
13903         (main): Load plugin libraries.
13904         * object.h (Pluginobj): Declare.
13905         (Object::pluginobj): New function.
13906         (Object::do_pluginobj): New function.
13907         (Object::set_target): New function.
13908         * options.cc: Include "plugin.h".
13909         (General_options::parse_plugin): New function.
13910         (General_options::General_options): Initialize plugins_ field.
13911         (General_options::add_plugin): New function.
13912         * options.h (Plugin_manager): Declare.
13913         (General_options): Add --plugin option.
13914         (General_options::has_plugins): New function.
13915         (General_options::plugins): New function.
13916         (General_options::add_plugin): New function.
13917         (General_options::plugins_): New field.
13918         * plugin.cc: New file.
13919         * plugin.h: New file.
13920         * readsyms.cc: Include "plugin.h".
13921         (Read_symbols::do_read_symbols): Check for archive before checking
13922         for ELF file.  Call plugin hooks to claim files.
13923         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
13924         from a real object file; force override when processing replacement
13925         files.
13926         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
13927         (Symbol::init_base_object): Likewise.
13928         (Symbol::init_base_output_data): Likewise.
13929         (Symbol::init_base_output_segment): Likewise.
13930         (Symbol::init_base_constant): Likewise.
13931         (Symbol::init_base_undefined): Likewise.
13932         (Symbol::output_section): Assert that object is not a plugin.
13933         (Symbol_table::add_from_pluginobj): New function.
13934         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
13935         undefined.
13936         (Symbol_table::sized_write_globals): Likewise.
13937         (Symbol_table::add_from_pluginobj): Instantiate template.
13938         * symtab.h (Sized_pluginobj): Declare.
13939         (Symbol::in_real_elf): New function.
13940         (Symbol::set_in_real_elf): New function.
13941         (Symbol::in_real_elf_): New field.
13942         (Symbol_table::add_from_pluginobj): New function.
13943
13944         * testsuite/Makefile.am (AM_CFLAGS): New variable.
13945         (LIBDL): New variable.
13946         (LDADD): Add LIBDL.
13947         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
13948         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
13949         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
13950         (MOSTLYCLEANFILES): Likewise.
13951         * testsuite/Makefile.in: Regenerate.
13952         * testsuite/plugin_test.c: New file.
13953         * testsuite/plugin_test_1.sh: New file.
13954         * testsuite/plugin_test_2.sh: New file.
13955
13956 2008-09-16  Ian Lance Taylor  <iant@google.com>
13957
13958         * target-reloc.h (relocate_section): Check whether a symbol is
13959         defined by the ABI before reporting an undefined symbol error.
13960         * target.h (Target::is_defined_by_abi): Make parameter const.
13961         (Target::do_is_defined_by_abi): Likewise.
13962         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
13963         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
13964         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
13965         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
13966         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
13967         * testsuite/Makefile.in: Rebuild.
13968
13969         * fileread.cc (make_view): Add casts to avoid warning.
13970
13971 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13972
13973         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
13974         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13975
13976 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13977
13978         * options.h (General_options::output_is_executable): New.
13979         (General_options::output_is_pie): New.
13980         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
13981         for shared libraries.
13982         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13983
13984 2008-09-11  Chris Demetriou  <cgd@google.com>
13985
13986         * options.h (origin): New -z option.
13987         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
13988         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
13989         in DT_FLAGS_1.
13990
13991 2008-09-05  Cary Coutant  <ccoutant@google.com>
13992
13993         * fileread.cc (File_read::make_view): Add check for attempt to map
13994         beyond end of file.
13995
13996 2008-09-05  Cary Coutant  <ccoutant@google.com>
13997
13998         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
13999         explicit instantiations.
14000
14001 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
14002
14003         PR gold/6858
14004         * options.cc (General_options::finalize): Allow undefined symbols
14005         in shlibs if linking -shared.
14006
14007         PR gold/6859
14008         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
14009         symbols as not needing a dynsym entry.
14010
14011 2008-08-20  Craig Silverstein  <csilvers@google.com>
14012
14013         * fileread.cc (File_read::open): Do not lock the file unless it
14014         was successfully opened.
14015
14016 2008-08-14  Cary Coutant  <ccoutant@google.com>
14017
14018         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
14019         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
14020         * testsuite/tls_test.cc (struct int128): 128-bit struct
14021         for testing TLS relocs with non-zero addend.
14022         (v12): New TLS variable.
14023         (t12): New test.
14024         (t_last): Add check for v12.
14025         * testsuite/tls_test.h (t12): New function.
14026         * testsuite/tls_test_main.cc (thread_routine): Call new test.
14027
14028 2008-08-13  Ian Lance Taylor  <iant@google.com>
14029
14030         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
14031         set tls_segment_ or relro_segment_.
14032         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
14033         when appropriate.
14034         * output.h (Output_section::clear_is_relro): New function.
14035         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
14036         sections specially even when output_data_ is empty.
14037         (Output_segment::maximum_alignment): When first section is relro,
14038         only force alignment for PT_LOAD segments.
14039         * script.cc (script_data_segment_align): New function.
14040         (script_data_segment_relro_end): New function.
14041         * script-c.h (script_data_segment_align): Declare.
14042         (script_data_segment_relro_end): Declare.
14043         * script-sections.h (class Script_sections): Declare
14044         data_segment_align and data_segment_relro_end.  Add fields
14045         segment_align_index_ and saw_relro_end_.
14046         * script-sections.cc (class Sections_element): Add set_is_relro
14047         virtual function.  Add new bool* parameter to place_orphan_here.
14048         Add get_output_section virtual function.
14049         (class Output_section_definition): Add set_is_relro.  Add new
14050         bool* parameter to place_orphan_here.  Add get_output_section.
14051         Add is_relro_ field.
14052         (Output_section_definition::Output_section_definition): Initialize
14053         evaluated_address_, evaluated_load_address, evaluated_addralign_,
14054         and is_relro_ fields.
14055         (Output_section_definition::place_orphan_here): Add is_relro
14056         parameter.
14057         (Output_section_definition::set_section_addresses): Set relro for
14058         output section.
14059         (Output_section_definition::alternate_constraint): Likewise.
14060         (class Orphan_output_section): Add new bool* parameter to
14061         place_orphan_here.  Add get_output_section.
14062         (Orphan_output_section::place_orphan_here): Add is_relro
14063         parameter.
14064         (Script_sections::Script_sections): Initialize
14065         data_segment_align_index_ and saw_relro_end_.
14066         (Script_sections::data_segment_align): New function.
14067         (Script_sections::data_segment_relro_end): New function.
14068         (Script_sections::place_orphan): Set or clear is_relro.
14069         (Script_sections::set_section_addresses): Force alignment of first
14070         TLS section.
14071         * yyscript.y (exp): Call script_data_segment_align and
14072         script_data_segment_relro_end.
14073         * testsuite/relro_script_test.t: New file.
14074         * testsuite/relro_test.cc (using_script): Declare.
14075         (t1, t2): Test using_script.
14076         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
14077         (relro_script_test_SOURCES): Define.
14078         (relro_script_test_DEPENDENCIES): Define.
14079         (relro_script_test_LDFLAGS): Define.
14080         (relro_script_test_LDADD): Define.
14081         (relro_script_test.so): New target.
14082         * testsuite/Makefile.in: Rebuild.
14083
14084 2008-08-06  Cary Coutant <ccoutant@google.com>
14085
14086         * archive.cc (Archive::total_archives, Archive::total_members)
14087         (Archive::total_members_loaded): New variables.
14088         (Archive::setup): Add parameter.  Add option to preread
14089         archive symbols.
14090         (Archive::read_armap): Add counter.
14091         (Archive::get_file_and_offset): New function.
14092         (Archive::get_elf_object_for_member): New function.
14093         (Archive::read_all_symbols): New function.
14094         (Archive::read_symbols): New function.
14095         (Archive::add_symbols): Add counters.
14096         (Archive::include_all_members): Use armap to find members if it's
14097         already built.
14098         (Archive::include_member): Skip reading symbols if already read.
14099         Factored code into Archive::get_file_and_offset and
14100         Archive::get_elf_object_for_member.  Changed call to
14101         Mapfile::report_include_archive_member.
14102         (Archive::print_stats): New function.
14103         * archive.h: Declare Object and Read_symbols_data classes.
14104         (Archive::Archive): Add initializers for new members.
14105         (Archive::setup): Add parameter.
14106         (Archive::print_stats): New function.
14107         (Archive::total_archives, Archive::total_members)
14108         (Archive::total_members_loaded): New variables.
14109         (Archive::get_file_and_offset): New function.
14110         (Archive::get_elf_object_for_member): New function.
14111         (Archive::read_all_symbols): New function.
14112         (Archive::read_symbols): New function.
14113         (Archive::Archive_member): New class.
14114         (Archive::members_): New member.
14115         (Archive::num_members_): New member.
14116         * main.cc: Include archive.h.
14117         (main): Call Archive::print_stats.
14118         * mapfile.cc (Mapfile::report_include_archive_member): Delete
14119         archive parameter; member_name is now the fully-decorated name.
14120         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
14121         * options.h: (General_options): Add --preread-archive-symbols option.
14122         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
14123         Archive::setup.
14124
14125 2008-08-04  Ian Lance Taylor  <iant@google.com>
14126
14127         * symtab.h (Symbol::use_plt_offset): New function.
14128         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
14129         * powerpc.cc (Relocate::relocate): Likewise.
14130         * sparc.cc (Relocate::relocate): Likewise.
14131         * x86_64.cc (Relocate::relocate): Likewise.
14132         * testsuite/weak_plt.sh: New test.
14133         * testsuite/weak_plt_main.cc: New test.
14134         * testsuite/weak_plt_shared.cc: New test.
14135         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
14136         (check_PROGRAMS): Add weak_plt.
14137         (check_DATA): Add weak_plt_shared.so.
14138         (weak_plt_main_pic.o, weak_plt): New targets.
14139         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
14140         * testsuite/Makefile.in: Rebuild.
14141
14142         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
14143         gcctestdir/ld.
14144         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
14145         * testsuite/Makefile.in: Rebuild.
14146
14147 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
14148
14149         * Makefile.am (POTFILES.in): Set LC_ALL=C.
14150         * Makefile.in: Regenerate.
14151         * po/POTFILES.in: Regenerate.
14152
14153 2008-07-29  Ian Lance Taylor  <iant@google.com>
14154
14155         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
14156         symbols before other symbols.
14157         * testsuite/script_test_2.cc (test_addr): Declare.
14158         (test_addr_alias): Declare.
14159         (main): Check that test_addr and test_addr_alias have the right
14160         values.
14161         * testsuite/script_test_2.t: Define test_addr_alias and
14162         test_addr.
14163
14164 2008-07-24  Ian Lance Taylor  <iant@google.com>
14165
14166         PR 5990
14167         * descriptors.cc: New file.
14168         * descriptors.h: New file.
14169         * gold-threads.h (class Hold_optional_lock): New class.
14170         * fileread.cc: Include "descriptors.h".
14171         (File_read::~File_read): Release descriptor rather than closing
14172         it.
14173         (File_read::open) [file]: Call open_descriptor rather than open.
14174         Set is_descriptor_opened_.
14175         (File_read::open) [memory]: Assert that descriptor is not open.
14176         (File_read::reopen_descriptor): New function.
14177         (File_read::release): Release descriptor.
14178         (File_read::do_read): Make non-const.  Reopen descriptor.
14179         (File_read::read): Make non-const.
14180         (File_read::make_view): Reopen descriptor.
14181         (File_read::do_readv): Likewise.
14182         * fileread.h (class File_read): Add is_descriptor_opened_ field.
14183         Update declarations.
14184         * layout.cc: Include "descriptors.h".
14185         (Layout::create_build_id): Use open_descriptor rather than open.
14186         * output.cc: Include "descriptors.h".
14187         (Output_file::open): Use open_descriptor rather than open.
14188         * archive.cc (Archive::const_iterator): Change Archive to be
14189         non-const.
14190         (Archive::begin, Archive::end): Make non-const.
14191         (Archive::count_members): Likewise.
14192         * archive.h (class Archive): Update declarations.
14193         * object.h (Object::read): Make non-const.
14194         * Makefile.am (CCFILES): Add descriptors.cc.
14195         (HFILES): Add descriptors.h.
14196         * Makefile.in: Rebuild.
14197
14198         PR 6716
14199         * gold.h: Always include <clocale>.  Add Solaris workarounds
14200         following code in binutils/sysdep.h.
14201
14202         PR 6048
14203         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
14204         this->eh_frame_hdr_ is NULL before using it.
14205
14206         * dynobj.cc (Versions::Versions): Update comment.
14207
14208         * dynobj.cc (Versions::Versions): If there is an soname, use it as
14209         the base version name.
14210
14211         * stringpool.cc (Stringpool_template::add_with_length): Set key to
14212         array size plus one.
14213         (Stringpool_template::set_string_offsets): Subtract one from key
14214         before using it as an array index.
14215         (Stringpool_template::get_offset_with_length): Likewise.
14216         (Stringpool_template::write_to_buffer): Likewise.
14217         * stringpool.h (Stringpool_template::get_offset_from_key):
14218         Likewise.
14219
14220 2008-07-23  Ian Lance Taylor  <iant@google.com>
14221
14222         PR 6658
14223         * object.h (Merged_symbol_value::value): Do our best to handle a
14224         negative addend.
14225
14226         PR 6647
14227         * script.cc (Version_script_info::get_versions): Don't add empty
14228         version tag to return value.
14229         (Version_script_info::get_symbol_version_helper): Change return
14230         type to bool.  Add pversion parameter.  Change all callers.
14231         (script_register_vers_node): Don't require a non-NULL tag.
14232         * script.h (class Version_script_info): Update declarations.
14233         (Version_script_info::get_symbol_version): Change return type to
14234         bool.  Add version parameter.  Change all callers.
14235         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
14236         handling.  Handle an empty version from a version script.
14237         (Symbol_table::define_special_symbol): Likewise.
14238         * testsuite/ver_test_10.script: New file.
14239         * testsuite/ver_test_10.sh: New file.
14240         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
14241         (check_DATA): Add ver_test_10.syms.
14242         (ver_test_10.syms, ver_test_10.so): New target.
14243         * testsuite/Makefile.in: Rebuild.
14244
14245 2008-07-23  Simon Baldwin  <simonb@google.com>
14246
14247         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
14248         to zero for undefined symbols from dynamic libraries.
14249
14250 2008-07-23  Ian Lance Taylor  <iant@google.com>
14251
14252         * symtab.cc (Symbol_table::resolve): Remove version parameter.
14253         Change all callers.
14254         * symtab.h (class Symbol_table): Update declaration.
14255         * testsuite/ver_test_9.cc: New file.
14256         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
14257         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
14258         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
14259         (ver_test_9.so, ver_test_9.o): New targets.
14260         * testsuite/Makefile.in: Rebuild.
14261
14262 2008-07-22  Ian Lance Taylor  <iant@google.com>
14263
14264         * options.h (class General_options): Define --check-sections.
14265         * layout.cc (Layout::set_segment_offsets): Handle
14266         --check-sections.
14267
14268         * options.h (class General_options): Define -n/--nmagic and
14269         -N/--omagic.
14270         * options.cc (General_options::finalize): For -n/--nmagic or
14271         -N/--omagic, set -static.
14272         * layout.cc (Layout::attach_allocated_section_to_segment): If
14273         -N/--omagic, don't put read-only and read-write sections in
14274         different segments.
14275         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
14276         finding a read-only segment.
14277         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
14278         don't set the minimum segment alignment to the common page size,
14279         and don't set the file offset to the address modulo the page size.
14280         * script-sections.cc (Script_sections::create_segments): If
14281         -n/--omagic, don't put read-only and read-write sections in
14282         different segments.
14283
14284         * cref.cc: New file.
14285         * cref.h: New file.
14286         * options.h (class General_options): Add --print-symbol-counts.
14287         * main.cc (main): Issue defined symbol report if requested.
14288         * archive.cc (Archive::interpret_header): Make into a const member
14289         function.
14290         (Archive::add_symbols): Call Input_objects::archive_start and
14291         archive_stop.
14292         (Archive::const_iterator): Define new class.
14293         (Archive::begin, Archive::end): New functions.
14294         (Archive::include_all_members): Rewrite to use iterator.
14295         (Archive::count_members): New function.
14296         * archive.h (class Archive): Update declarations.
14297         (Archive::filename): New function.
14298         * object.cc: Include "cref.h".
14299         (Sized_relobj::Sized_relobj): Initialize defined_count_.
14300         (Sized_relobj::do_get_global_symbol_counts): New function.
14301         (Input_objects::add_object): Add object to cross-referencer.
14302         (Input_objects::archive_start): New function.
14303         (Input_objects::archive_stop): New function.
14304         (Input_objects::print_symbol_counts): New function.
14305         * object.h: Declare Cref and Archive.
14306         (Object::get_global_symbol_counts): New function.
14307         (Object::do_get_global_symbol_counts): New pure virtual function.
14308         (class Sized_relobj): Add defined_count_ field.  Update
14309         declarations.
14310         (class Input_objects): Add cref_ field.  Update constructor.
14311         Update declarations.
14312         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
14313         defined_count_.
14314         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
14315         symbol counts.
14316         (Sized_dynobj::do_get_global_symbol_counts): New function.
14317         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
14318         defined_count_.  Update declarations.  Define Symbols typedef.
14319         * symtab.cc (Symbol_table::add_from_relobj): Add defined
14320         parameter.  Change all callers.
14321         (Symbol_table::add_from_dynobj): Add sympointers and defined
14322         parameters.  Change all callers.
14323         * symtab.h (class Symbol_table): Update declarations.
14324         * Makefile.am (CCFILES): Add cref.cc.
14325         (HFILES): Add cref.h.
14326         * Makefile.in: Rebuild.
14327
14328 2008-07-22  Simon Baldwin  <simonb@google.com>
14329
14330         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
14331         to zero when writing undefined symbols.
14332
14333 2008-07-22  Ian Lance Taylor  <iant@google.com>
14334
14335         * output.cc (Output_section::add_input_section): Don't try to
14336         merge empty merge sections.
14337
14338 2008-07-21  Craig Silverstein  <csilvers@google.com>
14339
14340         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
14341         Include symbol version in error message.
14342
14343 2008-07-20  Chris Demetriou  <cgd@google.com>
14344
14345         * configure.ac (gold_cv_c_random_seed): New configured variable.
14346         (RANDOM_SEED_CFLAGS): New substituted variable.
14347         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
14348         * configure: Rebuild.
14349         * Makefile.in: Likewise.
14350         * testsuite/Makefile.in: Likewise.
14351
14352 2008-07-18  Ian Lance Taylor  <iant@google.com>
14353
14354         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
14355         where we see NAME/NULL and NAME/VERSION  as separate symbols.
14356         * testsuite/ver_test_main.cc (main): Call t4.
14357         (t4, t4_2a): Define.
14358         * testsuite/ver_test_2.cc (t4_2): Define.
14359         * testsuite/ver_test_2.script: Put t4_2a in VER2.
14360         * testsuite/ver_test_4.cc (t4_2a): Define.
14361         * testsuite/ver_test_4.script: Put t4_2a in VER2.
14362         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
14363
14364 2008-07-17  Ian Lance Taylor  <iant@google.com>
14365
14366         * dynobj.cc (Versions::add_def): If we give an error about a
14367         missing version, go ahead and create the version anyhow.
14368
14369 2008-07-10  Ian Lance Taylor  <iant@google.com>
14370
14371         Handle output sections with more than 0x7fffffff bytes.
14372         * object.h (class Relobj): Change map_to_output_ to
14373         output_sections_, and just keep a section pointer.  Change all
14374         uses.  Move comdat group support to Sized_relobj.
14375         (Relobj::is_section_specially_mapped): Remove.
14376         (Relobj::output_section): Remove poff parameter.  Change all
14377         callers.
14378         (Relobj::output_section_offset): New function.
14379         (Relobj::set_section_offset): Rewrite.
14380         (Relobj::map_to_output): Remove.
14381         (Relobj::output_sections): New function.
14382         (Relobj::do_output_section_offset): New pure virtual function.
14383         (Relobj::do_set_section_offset): Likewise.
14384         (class Sized_relobj): Add section_offsets_ field.  Add comdat
14385         group support from Relobj.  Update declarations.
14386         (Sized_relobj::get_output_section_offset): New function.
14387         (Sized_relobj::do_output_section_offset): New function.
14388         (Sized_relobj::do_set_section_offset): New function.
14389         * object.cc (Relobj::output_section_address): Remove.
14390         (Sized_relobj::Sized_relobj): Initialize new fields.
14391         (Sized_relobj::include_section_group): Cast find_kept_object to
14392         Sized_relobj.
14393         (Sized_relobj::include_linkonce_section): Likewise.
14394         (Sized_relobj::do_layout): Use separate arrays for output section
14395         and output offset.
14396         (Sized_relobj::do_count_local_symbols): Change map_to_output to
14397         output_sections.
14398         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
14399         output_sections and section_offsets.
14400         (Sized_relobj::write_local_symbols): Likewise.
14401         (map_to_kept_section): Compute output address directly.
14402         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
14403         output_sections and section_offsets.
14404         (Sized_relobj::write_sections): Likewise.
14405         (Sized_relobj::relocate_sections): Likewise.
14406         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
14407         * output.h (class Output_reloc): Update declarations.  Change
14408         u2_.relobj to Sized_relobj*.
14409         (class Output_data_reloc): Change add functions to use
14410         Sized_relobj*.
14411         * output.cc (Output_reloc::Output_reloc): Change relobj to
14412         Sized_relobj*.
14413         (Output_reloc::local_section_offset): Change return type to
14414         Elf_Addr.  Use get_output_section_offset.
14415         (Output_reloc::get_address): Likewise.
14416         (Output_section::is_input_address_mapped): Don't call
14417         is_section_specially_mapped.
14418         (Output_section::output_offset): Likewise.
14419         (Output_section::output_address): Likewise.
14420         (Output_section::starting_output_address): Likewise.
14421         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
14422         parameter to Sized_relobj*.
14423         (Copy_relocs::need_copy_reloc): Likewise.
14424         (Copy_relocs::save): Likewise.
14425         * copy-relocs.h (class Copy_relocs): Update declarations.
14426         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
14427         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
14428         * target-reloc.h (relocate_for_relocatable): Change
14429         offset_in_output_section type to Elf_Addr.  Change code that uses
14430         it as well.
14431         * layout.cc (Layout::layout): Always set *off.
14432         * mapfile.cc (Mapfile::print_input_section): Use
14433         output_section_offset.
14434         * i386.cc (Target_i386::copy_reloc): Change object parameter to
14435         Sized_relobj*.
14436         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
14437         * sparc.cc (Target_sparc::copy_reloc): Likewise.
14438         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
14439
14440 2008-07-03  Ian Lance Taylor  <iant@google.com>
14441
14442         * layout.cc (Layout::include_section): Do not discard unrecognized
14443         SHT_STRTAB sections.
14444
14445 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
14446
14447         * script.cc (Lex::can_continue_name): Make '?' allowable in
14448         version-script names.
14449         * testsuite/version_script.map: Change glob pattern to use '?'
14450
14451 2008-06-30  Manish Singh  <yosh@gimp.org>
14452
14453         PR 6585
14454         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
14455         Correct typo.
14456
14457 2008-06-30  Ian Lance Taylor  <iant@google.com>
14458
14459         PR 6660
14460         PR 6682
14461         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
14462         versions]: Don't try to read the value in the contents, since we
14463         don't use it.  Use the template endianness when writing.
14464
14465 2008-06-25  Cary Coutant  <ccoutant@google.com>
14466
14467         * fileread.cc (File_read::make_view): Assert on zero-length view.
14468         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
14469         symbol table when there are no symbols to read.
14470
14471 2008-06-23  Craig Silverstein  <csilvers@google.com>
14472
14473         * version.cc (version_string): Bump to 1.7
14474
14475 2008-06-18  Craig Silverstein  <csilvers@google.com>
14476
14477         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
14478         constant 0xFFFF to type Valtype.
14479         (Powerpc_relocate_functions::rel16_ha): Likewise.
14480
14481 2008-06-17  Ian Lance Taylor  <iant@google.com>
14482
14483         * output.h (Output_section::Input_section): Initialize p2align_ to
14484         zero for Output_section_data constructors.
14485         (Output_section::Input_section::addralign): If not an input
14486         section, return the alignment of the Output_section_data.
14487         * testsuite/copy_test.cc: New file.
14488         * testsuite/copy_test_1.cc: New file.
14489         * testsuite/copy_test_2.cc: New file.
14490         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
14491         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
14492         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
14493         (copy_test_1_pic.o, copy_test_1.so): New targets.
14494         (copy_test_2_pic.o, copy_test_2.so): New targets.
14495         * testsuite/Makefile.in: Rebuild.
14496
14497         * script-sections.cc (Script_sections::place_orphan): Initialize
14498         local variable exact.
14499
14500 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
14501
14502         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
14503
14504 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
14505             David S. Miller  <davem@davemloft.net>
14506
14507         * powerpc.cc: New file.
14508         * Makefile.am (TARGETSOURCES): Add powerpc.cc
14509         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
14510         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
14511         * Makefile.in: Rebuild.
14512
14513 2008-06-09  Ian Lance Taylor  <iant@google.com>
14514
14515         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
14516         <exception>.
14517         (throwing, orig_terminate): New static variables.
14518         (terminate_handler): New static function.
14519         (t2): Set terminate handler.
14520
14521 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
14522
14523         PR 6584
14524         * binary.cc (Binary_to_elf::sized_convert): Fix .data
14525         alignment.
14526
14527 2008-05-30  Cary Coutant  <ccoutant@google.com>
14528
14529         * archive.cc (Archive::include_all_members) Correct to step
14530         over symbol table and extended name table in thin archives.
14531
14532 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
14533
14534         PR 6407
14535         * target-reloc.h (relocate_for_relocatable): Fix new_offset
14536         calculation.
14537
14538 2008-05-28  Caleb Howe  <cshowe@google.com>
14539
14540         * reduced_debug_output.cc: New file.
14541         * reduced_debug_output.h: New file.
14542         * options.h (class General_options): Add --strip-debug-non-line.
14543         * options.cc (General_options::finalize): Add strip_debug_non_line
14544         to the strip heirarchy.
14545         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
14546         fields.
14547         * layout.cc: Include "reduced_debug_output.h".
14548         (Layout::Layout): Initialize new fields.
14549         (line_only_debug_sections): New static array.
14550         (is_lines_only_debug_sections): New static inline function.
14551         (Layout::include_section): Handle --strip-debug-non-line.
14552         (Layout::make_output_section): If --strip-debug-non-line, build
14553         new output sections for .debug_abbrev and .debug_info.
14554         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
14555         gold.  Warn about possible overflow.
14556         (read_signed_LEB_128): Likewise.
14557         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
14558         (read_signed_LEB_128): Declare.
14559         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
14560         (HFILES): Add reduced_debug_output.h.
14561         * Makefile.in: Rebuild.
14562
14563 2008-05-21  Ian Lance Taylor  <iant@google.com>
14564
14565         * mapfile.cc: New file.
14566         * mapfile.h: New file.
14567         * options.h (class General_options): Add -M/--print-map and -Map.
14568         * options.cc (General_options::finalize): Make -M equivalent to
14569         -Map -.
14570         * main.cc: Include <cstdio> and "mapfile.h".
14571         (main): Open mapfile if requested.
14572         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
14573         constructor.  Change caller.
14574         (queue_initial_tasks): Add mapfile parameter.  Change caller.
14575         (queue_middle_tasks): Likewise.
14576         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
14577         declarations.
14578         * archive.cc: Include "mapfile.h".
14579         (Archive::add_symbols): Add mapfile parameter.  Change all
14580         callers.  Pass mapfile, symbol, and reason to include_member.
14581         (Archive::include_all_members): Add mapfile parameter.  Change all
14582         callers.
14583         (Archive::include_member): Add mapfile, sym, and why parameters.
14584         Change all callers.  Report inclusion to map file.
14585         * archive.h: Include "fileread.h".
14586         (class Archive): Update declarations.
14587         (Archive::file): New const method.
14588         (class Add_archive_symbols): Add mapfile_ field.  Update
14589         constructor.  Change all callers.
14590         * readsyms.h (class Read_symbols): Likewise.
14591         (class Finish_group): Likewise.
14592         (class Read_script): Likewise.
14593         * common.cc: Include "mapfile.h".
14594         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
14595         all callers.
14596         (Symbol_table::do_allocate_commons): Likewise.
14597         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
14598         symbol allocation to mapfile.
14599         * common.h (class Allocate_commons_task): Add mapfile_ field.
14600         Update constructor.  Change all callers.
14601         * symtab.h (class Symbol_table): Update declarations.
14602         * layout.cc: Include "mapfile.h".
14603         (Layout_task_runner::run): Print information to mapfile.
14604         (Layout::create_gold_note): Change Output_data_fixed_space to
14605         Output_data_zero_fill.
14606         (Layout::create_build_id): Likewise.
14607         (Layout::print_to_mapfile): New function.
14608         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
14609         constructor.  Change caller.
14610         (class Layout): Declare print_to_mapfile.
14611         * output.cc (Output_section::Input_section::print_to_mapfile): New
14612         function.
14613         (Output_section::add_input_section): If producing a map, always
14614         add to input_sections_ list.
14615         (Output_section::do_print_to_mapfile): New function.
14616         (Output_segment::print_sections_to_mapfile): New function.
14617         (Output_segment::print_section_list_to_mapfile): New function.
14618         * output.h: Include "mapfile.h".
14619         (Output_data::print_to_mapfile): New function.
14620         (Output_data::do_print_to_mapfile): New virtual function.
14621         (Output_segment_headers::do_print_to_mapfile): New function.
14622         (Output_file_header::do_print_to_mapfile): New function.
14623         (Output_data_const::do_print_to_mapfile): New function.
14624         (class Output_data_const_buffer): Add map_name_ field.  Update
14625         constructor.  Change all callers.  Add do_print_to_mapfile
14626         function.
14627         (class Output_data_fixed_space): Likewise.
14628         (class Output_data_space): Likewise.
14629         (class Output_data_zero_fill): New class.
14630         (Output_data_strtab::do_print_to_mapfile): New function.
14631         (Output_data_reloc_base::do_print_to_mapfile): New function.
14632         (Output_relocatable_relocs::do_print_to_mapfile): New function.
14633         (Output_data_group::do_print_to_mapfile): New function.
14634         (Output_data_got::do_print_to_mapfile): New function.
14635         (Output_data_dynamic::do_print_to_mapfile): New function.
14636         (Output_symtab_xindex::do_print_to_mapfile): New function.
14637         (class Output_section): Declare do_print_to_mapflie.  Declare
14638         print_to_mapfile in Input_section.
14639         (class Output_segment): Declare new functions.
14640         * object.h (Sized_relobj::symbol_count): New function.
14641         * script-sections.cc
14642         (Output_section_element_dot_assignment::set_section_addresses):
14643         Change Output_data_fixed_space to Output_data_zero_fill.
14644         (Output_data_expression::do_print_to_mapfile): New function.
14645         * script.cc (read_input_script): Add mapfile parameter.  Change
14646         all callers.
14647         * script.h (read_input_script): Update declaration.
14648         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
14649         (Eh_frame::do_print_to_mapfile): New function.
14650         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
14651         (Output_merge_string::do_print_to_mapfile): New function.
14652         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
14653         function.
14654         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
14655         function.
14656         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
14657         function.
14658         * Makefile.am (CCFILES): Add mapfile.cc.
14659         (HFILES): Add mapfile.h.
14660         * Makefile.in: Rebuild.
14661
14662 2008-05-19  Ian Lance Taylor  <iant@google.com>
14663
14664         * options.h (class General_options): Add -z relro.
14665         * layout.cc (Layout::Layout): Initialize relro_segment_.
14666         (Layout::add_output_section_data): Return the output section.
14667         (Layout::make_output_section): Rcognize relro sections and mark
14668         them appropriately.
14669         (Layout::attach_allocated_section_to_segment): Put relro sections
14670         in a PT_GNU_RELRO segment.
14671         (Layout::create_initial_dynamic_sections): Mark the .dynamic
14672         section as relro.
14673         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
14674         PT_TLS segments.
14675         (Layout::linkonce_mapping): Map d.rel.ro.local to
14676         .data.rel.ro.local.
14677         (Layout::output_section_name): Us .data.rel.ro.local for any
14678         section which begins with that.
14679         * layout.h (class Layout): Update add_output_section_data
14680         declaration.  Add relro_segment_ field.
14681         * output.cc (Output_section::Output_section): Initialize is_relro_
14682         and is_relro_local_ fields.
14683         (Output_segment::add_output_section): Group relro sections.
14684         (Output_segment::is_first_section_relro): New function.
14685         (Output_segment::maximum_alignment): If there is a relro section,
14686         align the segment to the common page size.
14687         (Output_segment::set_section_addresses): Track whether we are
14688         looking at relro sections.  If the last section is a relro
14689         section, align to the common page size.
14690         (Output_segment::set_section_list_addresses): Add in_relro
14691         parameter.  Change all callers.  Align to the page size when
14692         moving from relro to non-relro section.
14693         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
14694         segment.
14695         * output.h (class Output_section): Add is_relro_ and
14696         is_relro_local_ fields.
14697         (Output_section::is_relro): New function.
14698         (Output_section::set_is_relro): New function.
14699         (Output_section::is_relro_local): New function.
14700         (Output_section::set_is_relro_local): New function.
14701         (class Output_segment): Update declarations.
14702         * i386.cc (Target_i386::got_section): Mark .got section as relro.
14703         * sparc.cc (Target_sparc::got_section): Likewise.
14704         * x86_64.cc (Target_x86_64::got_section): Likewise.
14705         * testsuite/relro_test_main.cc: New file.
14706         * testsuite/relro_test.cc: New file.
14707         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
14708         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
14709         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
14710         (relro_test.so, relro_test_pic.o): New targets.
14711         * testsuite/Makefile.in: Rebuild.
14712
14713 2008-05-16  Ian Lance Taylor  <iant@google.com>
14714
14715         * output.cc (Output_segment::add_output_section): Remove front
14716         parameter.
14717         * output.h (class Output_segment): Remove
14718         add_initial_output_section and overloaded add_output_section.
14719         Update declaration of remaining add_output_section.
14720         * layout.cc (Layout::create_interp): Call add_output_section
14721         rather than add_initial_output_section.
14722         (Layout::finish_dynamic_section): Likewise.
14723
14724         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
14725         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
14726         know the dynamic type.
14727         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
14728         field.  Initialize it in constructor.
14729         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
14730         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
14731         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
14732         reloc.
14733
14734         * output.cc (Output_reloc::get_address): Change return type to
14735         Elf_Addr.
14736         * output.h (class Output_reloc): Update get_address declaration.
14737         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
14738         for section addresses.
14739
14740 2008-05-09  Ian Lance Taylor  <iant@google.com>
14741
14742         PR 6493
14743         * gold.cc (gold_nomem): Use return value of write.
14744
14745 2008-05-08  Ian Lance Taylor  <iant@google.com>
14746
14747         * symtab.c (Symbol::init_base_output_data): Add version
14748         parameter.  Change all callers.
14749         (Symbol::init_base_output_segment): Likewise.
14750         (Symbol::init_base_constant): Likewise.
14751         (Symbol::init_base_undefined): Likewise.
14752         (Sized_symbol::init_output_data): Likewise.
14753         (Sized_symbol::init_output_segment): Likewise.
14754         (Sized_symbol::init_constant): Likewise.
14755         (Sized_symbol::init_undefined): Likewise.
14756         (Symbol_table::do_define_in_output_data): If the new symbol has a
14757         version, mark it as the default.
14758         (Symbol_table::do_define_in_output_segment): Likewise.
14759         (Symbol_table::do_define_as_constant): Likewise.
14760         * symtab.h (class Symbol): Update declarations.
14761         (class Sized_symbol): Likewise.
14762         * resolve.cc (Symbol::override_version): New function.
14763         (Symbol::override_base): Call override_version.
14764         (Symbol::override_base_with_special): Likewise.
14765         * testsuite/ver_script_8.script: New file.
14766         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
14767         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
14768         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
14769         (ver_test_8_1.so, ver_test_8_2.so): New targets.
14770
14771 2008-05-06  Ian Lance Taylor  <iant@google.com>
14772
14773         PR 6049
14774         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
14775         functions.
14776         (class General_options): Remove existing --undefined, and add
14777         --no-undefined instead.  Add new --undefined as synonym for -u.
14778         * archive.cc (Archive::add_symbols): Check whether symbol was
14779         named with -u.
14780         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
14781         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
14782         all uses.  Add IS_UNDEFINED.  Update declarations to split
14783         different versions of init_base.  Declare init_base_undefined.
14784         (Symbol::is_defined): Handle IS_UNDEFINED.
14785         (Symbol::is_undefined): Likewise.
14786         (Symbol::is_weak_undefined): Call is_undefined.
14787         (Symbol::is_absolute): Handle IS_CONSTANT.
14788         (class Sized_symbol): Update declarations to split different
14789         versions of init.  Declare init_undefined.
14790         (class Symbol_table): Declare new functions.
14791         * symtab.cc (Symbol::init_base_object): Rename from init_base.
14792         Change all callers.
14793         (Symbol::init_base_output_data): Likewise.
14794         (Symbol::init_base_output_segment): Likewise.
14795         (Symbol::init_base_constant): Likewise.
14796         (Symbol::init_base_undefined): New function.
14797         (Sized_symbol::init_object): Rename from init.  Change all
14798         callers.
14799         (Sized_symbol::init_output_data): Likewise.
14800         (Sized_symbol::init_output_segment): Likewise.
14801         (Sized_symbol::init_constant): Likewise.
14802         (Sized_symbol::init_undefined): New function.
14803         (Symbol_table::add_undefined_symbols_from_command_line): New
14804         function.
14805         (Symbol_table::do_add_undefined_symbols_from_command_line): New
14806         function.
14807         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
14808         (Symbol::output_section): Likewise.
14809         (Symbol::set_output_section): Likewise.
14810         (Symbol_table::sized_finalize_symbol): Likewise.
14811         (Symbol_table::sized_write_globals): Likewise.
14812         * resolve.cc (Symbol_table::should_override): Likewise.
14813         (Symbol::override_base_with_special): Likewise.
14814
14815         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
14816         symbol, change it to have default visibility.
14817         * testsuite/protected_1.cc: New file.
14818         * testsuite/protected_2.cc: New file.
14819         * testsuite/protected_3.cc: New file.
14820         * testsuite/protected_main_1.cc: New file.
14821         * testsuite/protected_main_2.cc: New file.
14822         * testsuite/protected_main_3.cc: New file.
14823         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
14824         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
14825         (protected_1_LDFLAGS, protected_1_LDADD): Define.
14826         (protected_1.so): New target.
14827         (protected_1_pic.o, protected_2_pic.o): New targets.
14828         (protected_3_pic.o): New target.
14829         (check_PROGRAMS): Add protected_2.
14830         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
14831         (protected_2_LDFLAGS, protected_2_LDADD): Define.
14832         * testsuite/Makefile.in: Rebuild.
14833
14834         * options.h (DEFINE_var): Add set_user_set_##varname__.
14835         (DEFINE_bool_alias): New macro.
14836         (class General_options): Define -Bstatic using DEFINE_bool_alias
14837         rather than DEFINE_special.  Add --undefined as an alias for -z
14838         defs.
14839         * options.cc (General_options::parse_Bstatic): Remove.
14840
14841         * options.h (class General_options): Add --fatal-warnings.
14842         * main.cc (main): Implement --fatal-warnings.
14843         * errors.h (Errors::warning_count): New function.
14844
14845         * options.h (class General_options): Add -Bsymbolic-functions.
14846         * symtab.h (Symbol::is_preemptible): Check for
14847         -Bsymbolic-functions.
14848
14849 2008-05-05  Ian Lance Taylor  <iant@google.com>
14850
14851         * options.h (DEFINE_bool): For DASH_Z, create the negative option
14852         as noVARNAME rather than no-VARNAME.
14853         (class General_options): Add option -z combreloc.
14854         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
14855         get_address.
14856         (Output_reloc::sort_before) [SHT_REL]: New function.
14857         (Output_reloc::sort_before) [SHT_RELA]: New function.
14858         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
14859         Sort_relocs_comparison.
14860         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
14861         parameter.  Change all callers.
14862         (Output_data_reloc::Output_data_reloc) [both versions]: Add
14863         sort_relocs parameter.  Change all callers.
14864         * output.cc (Output_reloc::get_address): New function, broken out
14865         of write_rel.
14866         (Output_reloc::write_rel): Call it.
14867         (Output_reloc::compare): New function.
14868         (Output_data_reloc_base::do_write): Optionally sort relocs.
14869
14870         * configure.ac: If targ_extra_obj is set, link it in.
14871         * configure.tgt: Initialize all variables.
14872         (x86_64*): Set targ_extra_obj and targ_extra_size.
14873         * configure: Rebuild.
14874
14875         * object.cc (Sized_relobj::include_section_group): Adjust section
14876         indexes read from group data.  Build vector to pass to
14877         layout_group.
14878         * layout.cc (Layout::layout_group): Add flags and shndxes
14879         parameters.  Remove contents parameter.  Change caller.  Update
14880         explicit instantiations.
14881         * layout.h (class Layout): Update layout_group declaration.
14882         * output.cc (Output_data_group::Output_data_group): Add flags and
14883         input_shndxes parameters.  Remove contents parameter.  Change
14884         caller.
14885         (Output_data_group::do_write): Change input_sections_ to
14886         input_shndxes_.
14887         * output.h (class Output_data_group): Update constructor
14888         declaration.  Rename input_sections_ to input_shndxes_.
14889         * testsuite/many_sections_test.cc: Add template.
14890
14891 2008-04-30  Cary Coutant  <ccoutant@google.com>
14892
14893         * target-reloc.h (relocate_section): Fix dead-pointer bug.
14894
14895         * layout.cc (Layout::include_section): Refactored check for debug
14896         info section.
14897         (Layout::add_comdat): Add new parameters.  Change type
14898         of signature parameter.  Add object and shndx to signatures table.
14899         (Layout::find_kept_object): New function.
14900         * layout.h: Include <cstring>.
14901         (Layout::is_debug_info_section): New function.
14902         (Layout::add_comdat): Add new parameters.
14903         (Layout::find_kept_object): New function.
14904         (Layout::Kept_section): New struct.
14905         (Layout::Signatures): Change type of map range.
14906         * object.cc (Relobj::output_section_address): New function.
14907         (Sized_relobj::include_section_group): Add new parameters.  Change
14908         calls to Layout::add_comdat.  Change to build table of kept comdat
14909         groups and table mapping discarded sections to kept sections.
14910         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
14911         (Sized_relobj::do_layout): Change calls to include_section_group and
14912         include_linkonce_section.
14913         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
14914         value to zero when section is discarded.
14915         (Sized_relobj::map_to_kept_section): New function.
14916         * object.h (Relobj::output_section_address): New function.
14917         (Relobj::Comdat_group): New type.
14918         (Relobj::find_comdat_group): New function.
14919         (Relobj::Comdat_group_table): New type.
14920         (Relobj::Kept_comdat_section): New type.
14921         (Relobj::Kept_comdat_section_table): New type.
14922         (Relobj::add_comdat_group): New function.
14923         (Relobj::set_kept_comdat_section): New function.
14924         (Relobj::get_kept_comdat_section): New function.
14925         (Relobj::comdat_groups_): New field.
14926         (Relobj::kept_comdat_sections_): New field.
14927         (Symbol_value::input_value): Update comment.
14928         (Sized_relobj::map_to_kept_section) New function.
14929         (Sized_relobj::include_linkonce_section): Add new parameter.
14930         * target-reloc.h (Comdat_behavior): New type.
14931         (get_comdat_behavior): New function.
14932         (relocate_section): Add code to map a discarded section to the
14933         corresponding kept section when applying a relocation.
14934
14935 2008-04-30  Craig Silverstein  <csilvers@google.com>
14936
14937         * dwarf_reader.cc (next_generation_count): New static var.
14938         (Addr2line_cache_entry): New struct.
14939         (addr2line_cache): New static var.
14940         (Dwarf_line_info::one_addr2line): Added caching.
14941         (Dwarf_line_info::clear_addr2line_cache): New function.
14942         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
14943         cache-size parameter.
14944         (Dwarf_line_info::one_addr2line_cache): New function.
14945         * symtab.cc (Symbol_table::detect_odr_violations): Pass
14946         new cache-size argument to one_addr2line(), and clear cache.
14947
14948 2008-04-28  Cary Coutant  <ccoutant@google.com>
14949
14950         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
14951         R_386_PC8 relocations.
14952
14953 2008-04-23  Ian Lance Taylor  <iant@google.com>
14954
14955         * object.cc (Sized_relobj::include_section_group): Check for
14956         invalid section group.
14957
14958         * object.cc (make_elf_object): Correct test for 64-bit ELF file
14959         header size.
14960
14961         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
14962         than read for file header.
14963         * archive.cc (Archive::include_member): Likewise.
14964
14965 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
14966
14967         * aclocal.m4: Regenerate.
14968         * configure: Regenerate.
14969
14970 2008-04-19  Ian Lance Taylor  <iant@google.com>
14971
14972         * version.cc (version_string): Bump to 1.6.
14973
14974         * testsuite/Makefile.am (many_sections_r_test): New target.
14975         (many_sections_r_test_SOURCES): Remove.
14976         (many_sections_r_test_DEPENDENCIES): Remove.
14977         (many_sections_r_test_LDFLAGS): Remove.
14978         (many_sections_r_test_LDADD): Remove.
14979
14980         * object.cc (Sized_relobj::do_add_symbols): Always pass
14981         local_symbol_count_ to add_from_relobj.
14982
14983         * testsuite/Makefile.am (many_sections_check.h): Only check one in
14984         every thousand variables.
14985         * testsuite/Makefile.in: Rebuild.
14986
14987         * object.cc (Xindex::initialize_symtab_xindex): New function.
14988         (Xindex::read_symtab_xindex): New function.
14989         (Xindex::sym_xindex_to_shndx): New function.
14990         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
14991         available.
14992         (Sized_relobj::do_initialize_xindex): New function.
14993         (Sized_relobj::do_read_symbols): Adjust section links.
14994         (Sized_relobj::symbol_section_and_value): Add is_ordinary
14995         parameter.  Change all callers.
14996         (Sized_relobj::include_section_group): Adjust section links and
14997         symbol section indexes.
14998         (Sized_relobj::do_layout): Adjust section links.
14999         (Sized_relobj::do_count_local_symbols): Adjust section links and
15000         symbol section indexes.
15001         (Sized_relobj::do_finalize_local_symbols): Distinguish between
15002         ordinary and special symbols.
15003         (Sized_relobj::write_local_symbols): Add symtab_xindex and
15004         dynsym_xindex parameters.  Change all callers.  Adjust section
15005         links.  Use SHN_XINDEX when needed.
15006         (Sized_relobj::get_symbol_location_info): Adjust section links.
15007         Don't get fooled by special symbols.
15008         * object.h (class Xindex): Define.
15009         (class Object): Add xindex_ parameter.  Declare virtual functoin
15010         do_initialize_xindex.
15011         (Object::adjust_sym_shndx): New function.
15012         (Object::set_xindex): New protected function.
15013         (class Symbol_value): Add is_ordinary_shndx_ field.
15014         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
15015         (Symbol_value::value): Assert ordinary section.
15016         (Symbol_value::initialize_input_to_output_map): Likewise.
15017         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
15018         Change all callers.
15019         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
15020         all callers.
15021         (class Sized_relobj): Update declarations.
15022         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
15023         parameter.  Change all callers.
15024         (Sized_relobj::adjust_shndx): New function.
15025         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
15026         field.
15027         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
15028         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
15029         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
15030         (Sized_dynobj::read_dynsym_section): Adjust section links.
15031         (Sized_dynobj::read_dynamic): Likewise.
15032         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
15033         section links.
15034         (Sized_dynobj::do_initialize_xindex): New function.
15035         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
15036         do_initialize_xindex.
15037         (Sized_dynobj::adjust_shndx): New function.
15038         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
15039         dynsym_xindex_ fields.
15040         (Layout::finalize): Add a call to set_section_indexes before
15041         creating the symtab sections.
15042         (Layout::set_section_indexes): Don't do anything if the section
15043         already has a section index.
15044         (Layout::create_symtab_sections): Add shnum parameter.  Change
15045         caller.  Create .symtab_shndx section if needed.
15046         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
15047         caller.
15048         (Layout::allocated_output_section_count): New function.
15049         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
15050         needed.
15051         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
15052         fields.  Update declarations.
15053         (Layout::symtab_xindex): New function.
15054         (Layout::dynsym_xindex): New function.
15055         (class Write_symbols_task): Add layout_ field.
15056         (Write_symbols_task::Write_symbols_task): Add layout parameter.
15057         Change caller.
15058         * output.cc (Output_section_headers::Output_section_headers): Add
15059         shstrtab_section parameter.  Change all callers.
15060         (Output_section_headers::do_sized_write): Store overflow values
15061         for section count and section string table section index in
15062         section header zero.
15063         (Output_file_header::do_sized_write): Check for overflow of
15064         section count and section string table section index.
15065         (Output_symtab_xindex::do_write): New function.
15066         (Output_symtab_xindex::endian_do_write): New function.
15067         * output.h (class Output_section_headers): Add shstrtab_section_.
15068         Update declarations.
15069         (class Output_symtab_xindex): Define.
15070         (Output_section::has_out_shndx): New function.
15071         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
15072         field.
15073         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
15074         Change all callers.
15075         (Sized_symbol::init): Likewise.
15076         (Symbol::output_section): Check for ordinary symbol.
15077         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
15078         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
15079         callers.
15080         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
15081         Change all callers.  Simplify handling of symbols from sections
15082         not included in the link.
15083         (Symbol_table::add_from_dynobj): Handle ordinary symbol
15084         distinction.
15085         (Weak_alias_sorter::operator()): Assert that symbols are
15086         ordinary.
15087         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
15088         distinction.
15089         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
15090         parameters.  Change all callers.
15091         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
15092         symbol distinction.  Use SHN_XINDEX when needed.
15093         (Symbol_table::write_section_symbol): Add symtab_xindex
15094         parameter.  Change all callers.
15095         (Symbol_table::sized_write_section_symbol): Likewise.  Use
15096         SHN_XINDEX when needed.
15097         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
15098         declarations.
15099         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
15100         (Symbol::is_defined): Check is_ordinary.
15101         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
15102         (Symbol::is_absolute, Symbol::is_common): Likewise.
15103         (class Sized_symbol): Update declarations.
15104         (class Symbol_table): Update declarations.
15105         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
15106         parameters.  Change all callers.
15107         (Sized_symbol::override): Likewise.
15108         (Symbol_table::override): Likewise.
15109         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
15110         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
15111         is_ordinary, and orig_st_shndx parameters.  Change all callers.
15112         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
15113         to be in an ordinary section.
15114         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
15115         object and is_ordinary parameters.  Change all callers.
15116         (Sized_dwarf_line_info::read_relocs): Add object parameter.
15117         Change all callers.  Don't add undefined or non-ordinary symbols
15118         to reloc_map_.
15119         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
15120         Change all callers.
15121         * dwarf_reader.h (class Sized_dwarf_line_info): Update
15122         declarations.
15123         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
15124         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
15125         (Sized_relobj::relocate_sections): Likewise.
15126         * target-reloc.h (scan_relocs): Adjust section symbol index.
15127         (scan_relocatable_relocs): Likewise.
15128         * i386.cc (Scan::local): Check for ordinary symbols.
15129         * sparc.cc (Scan::local): Likewise.
15130         * x86_64.cc (Scan::local): Likewise.
15131         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
15132         to symbol_section_and_value.
15133         * testsuite/many_sections_test.cc: New file.
15134         * testsuite/Makefile.am (BUILT_SOURCES): Define.
15135         (check_PROGRAMS): Add many_sections_test.
15136         (many_sections_test_SOURCES): Define.
15137         (many_sections_test_DEPENDENCIES): Define.
15138         (many_sections_test_LDFLAGS): Define.
15139         (BUILT_SOURCES): Add many_sections_define.h.
15140         (many_sections_define.h): New target.
15141         (BUILT_SOURCES): Add many_sections_check.h.
15142         (many_sections_check.h): New target.
15143         (check_PROGRAMS): Add many_sections_r_test.
15144         (many_sections_r_test_SOURCES): Define.
15145         (many_sections_r_test_DEPENDENCIES): Define.
15146         (many_sections_r_test_LDFLAGS): Define.
15147         (many_sections_r_test_LDADD): Define.
15148         (many_sections_r_test.o): New target.
15149         * testsuite/Makefile.in: Rebuild.
15150
15151 2008-04-17  Cary Coutant  <ccoutant@google.com>
15152
15153         * errors.cc (Errors::info): New function.
15154         (gold_info): New function.
15155         * errors.h (Errors::info): New function.
15156         * gold.h (gold_info): New function.
15157         * object.cc (Input_objects::add_object): Print trace output.
15158         * options.cc (options::parse_set): New function.
15159         (General_options::parse_wrap): Deleted.
15160         (General_options::General_options): Deleted initializer.
15161         * options.h (options::String_set): New typedef.
15162         (options::parse_set): New function.
15163         (DEFINE_set): New macro.
15164         (General_options::wrap): Changed to use DEFINE_set. Changed
15165         callers of any_wrap_symbols and is_wrap_symbol.
15166         (General_options::trace, General_options::trace_symbol):
15167         New options.
15168         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
15169         (General_options::wrap_symbols_): Deleted.
15170         * symtab.cc (Symbol_table::add_from_object): Print trace output.
15171
15172 2008-04-17  David S. Miller  <davem@davemloft.net>
15173
15174         * options.cc (General_options::parse_V): New function.
15175         * options.h: Add entries for -V and -Qy.
15176
15177 2008-04-17  Ian Lance Taylor  <iant@google.com>
15178
15179         * common.cc (Symbol_table::allocate_commons): Remove options
15180         parameter.  Change caller.
15181         (Symbol_table::do_allocate_commons): Remove options parameter.
15182         Change caller.  Just call do_allocate_commons_list twice.
15183         (Symbol_table::do_allocate_commons_list): New function, broken out
15184         of do_allocate_commons.
15185         * common.h (class Allocate_commons_task): Remove options_ field.
15186         Update constructor.
15187         * symtab.cc (Symbol_table::Symbol_table): Initialize
15188         tls_commons_.
15189         (Symbol_table::add_from_object): Put TLS common symbols on
15190         tls_commons_ list.
15191         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
15192         which are IN_OUTPUT_DATA.
15193         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
15194         allocate_commons and do_allocate_commons declarations.  Declare
15195         do_allocate_commons_list.
15196         * gold.cc (queue_middle_tasks): Update creation of
15197         Allocate_commons_task to not pass options.
15198         * testsuite/Makefile.am (INCLUDES): Add -I.. .
15199         (TLS_TEST_C_FLAGS): New variable.
15200         (tls_test_c_pic.o): New target.
15201         (tls_test_shared.so): Link in tls_test_c_pic.o.
15202         (tls_test_c_pic_ie.o): New target.
15203         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
15204         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
15205         (tls_test_c.o): New target.
15206         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
15207         (tls_pic_test_LDADD): Likewise.
15208         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
15209         (tls_shared_gd_to_ie_test_LDADD): Likewise.
15210         (tls_test_c_gnu2.o): New target.
15211         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
15212         tls_test_c_gnu2.o.
15213         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
15214         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
15215         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
15216         * testsuite/tls_test.cc: Include "config.h".
15217         (t_last): Call t11_last.
15218         * testsuite/tls_test.h (t11, t11_last): Declare.
15219         * testsuite/tls_test_c.c: New file.
15220         * testsuite/tls_test_main.cc (thread_routine): Call t11.
15221         * configure.ac: Check for OpenMP support.
15222         * configure, config.in, Makefile.in: Rebuild.
15223         * testsuite/Makefile.in: Rebuild.
15224
15225 2008-04-16  Cary Coutant  <ccoutant@google.com>
15226
15227         * i386.cc (Target_i386::define_tls_base_symbol): New function.
15228         (Target_i386::tls_base_symbol_defined_): New field.
15229         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15230         (Target_i386::Scan::global): Likewise.
15231         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
15232         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
15233         (Target_x86_64::tls_base_symbol_defined_): New field.
15234         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15235         (Target_x86_64::Scan::global): Likewise.
15236
15237 2008-04-16  Cary Coutant  <ccoutant@google.com>
15238
15239         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
15240         (Symbol::needs_plt_entry): Allow weak undefined symbols.
15241         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
15242         building shared libraries.
15243         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
15244         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
15245         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
15246         * testsuite/Makefile.in: Rebuild.
15247         * testsuite/weak_undef.h: New file.
15248         * testsuite/weak_undef_file1.cc: Add extra test cases.
15249         * testsuite/weak_undef_file2.cc: Likewise.
15250         * testsuite/weak_undef_test.cc: Likewise.
15251
15252 2008-04-16  David S. Miller  <davem@davemloft.net>
15253
15254         * sparc.cc (Target_sparc::Scan): Change from struct to class.
15255         Add issued_non_pic_error_ field.  Declare check_non_pic.
15256         (Target_sparc::Scan::check_non_pic): New function.
15257         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
15258         (Target_sparc::Scan::global): Likewise.
15259
15260         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
15261         * configure: Rebuild.
15262
15263         * options.h (DEFINE_enable): New macro.
15264         (new_dtags): New enable option.
15265         (initfirst, interpose, loadfltr, nodefaultlib,
15266         nodelete, nodlopen, nodump): New -z options.
15267         * layout.cc (Layout:finish_dynamic_section): If new
15268         dtags enabled, emit DT_RUNPATH.  Also, emit a
15269         DT_FLAGS_1 containing any specified -z flags.
15270
15271 2008-04-16  Ian Lance Taylor  <iant@google.com>
15272
15273         * copy-relocs.cc: New file.
15274         * copy-relocs.h: New file.
15275         * reloc.cc: Remove Copy_relocs code.
15276         * reloc.h: Likewise.
15277         * reloc-types.h (struct Reloc_types) [both versions]: Add
15278         get_reloc_addend_noerror.
15279         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
15280         variants of add_global which take an addend which must be zero.
15281         * i386.cc: Include "copy-relocs.h".
15282         (class Target_i386): Change type of copy_relocs_ to variable,
15283         update initializer.
15284         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
15285         Change all callers.
15286         (Target_i386::do_finalize_sections): Change handling of
15287         copy_relocs_.
15288         * sparc.cc: Include "copy-relocs.h".
15289         (class Target_sparc): Change type of copy_relocs_ to variable,
15290         update initializer.
15291         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
15292         Change all callers.
15293         (Target_sparc::do_finalize_sections): Change handling of
15294         copy_relocs_.
15295         * x86_64.cc: Include "copy-relocs.h".
15296         (class Target_x86_64): Change type of copy_relocs_ to variable,
15297         update initializer.
15298         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
15299         class.  Change all callers.
15300         (Target_x86_64::do_finalize_sections): Change handling of
15301         copy_relocs_.
15302         * Makefile.am (CCFILES): Add copy-relocs.cc.
15303         (HFILES): Add copy-relocs.h.
15304
15305         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
15306
15307         * testsuite/script_test_4.sh: Permit leading zeroes.
15308
15309 2008-04-15  Ian Lance Taylor  <iant@google.com>
15310
15311         * script-sections.cc (Script_sections::create_segments): Use
15312         header_size_adjustment even when there is enough room for the
15313         headers.
15314         * testsuite/script_test_4.sh: New file.
15315         * testsuite/script_test_4.t: New file.
15316         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
15317         (check_DATA): Add script_test_4.stdout.
15318         (MOSTLYCLEANFILES): Likewise.
15319         (script_test_4): New target.
15320         (script_test_4.stdout): New target.
15321         * testsuite/Makefile.in: Rebuild.
15322
15323         * sparc.cc: Add definitions for Output_data_plt_sparc class
15324         constants.
15325
15326 2008-04-14  David S. Miller  <davem@davemloft.net>
15327
15328         * sparc.cc: New file.
15329         * Makefile.am (TARGETSOURCES): Add sparc.cc
15330         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
15331         * configure.tgt: Document targ_extra_size and
15332         targ_extra_big_endian.  Add entries for sparc-* and
15333         sparc64-*.
15334         * configure.ac: Handle targ_extra_size and
15335         targ_extra_big_endian.
15336         * Makefile.in: Rebuild.
15337         * configure: Likewise.
15338         * po/POTFILES.in: Likewise.
15339         * po/gold.pot: Likewise.
15340
15341 2008-04-14  Ian Lance Taylor  <iant@google.com>
15342
15343         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
15344         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
15345         in the name/type/flags to section mapping.  Don't call
15346         allocate_output_section.
15347         (Layout::choose_output_section): Change parameter from adjust_name
15348         to is_input_section.  Don't permit input sections after sections
15349         are attached to segments.  Don't call allocate_output_section.
15350         (Layout::layout_eh_frame): Call update_flags_for_input_section,
15351         not write_enable_output_section.
15352         (Layout::make_output_section): Don't push to
15353         unattached_section_list_ nor call attach_to_segment.  Call
15354         attach_section_to_segment if sections are attached.
15355         (Layout::attach_sections_to_segments): New function.
15356         (Layout::attach_section_to_segment): New function.
15357         (Layout::attach_allocated_section_to_segment): Rename from
15358         attach_to_segment.  Remove flags parameter.
15359         (Layout::allocate_output_section): Remove function.
15360         (Layout::write_enable_output_section): Remove function.
15361         * layout.h (class Layout): Update for above changes.  Add new
15362         field sections_are_attached_.
15363         * output.h (Output_section::update_flags_for_input_section): New
15364         function.
15365         * output.cc (Output_section::add_input_section): Call
15366         update_flags_for_input_section.
15367         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
15368
15369 2008-04-11  Cary Coutant  <ccoutant@google.com>
15370
15371         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
15372         thought unnecessary.
15373         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
15374
15375 2008-04-11  Ian Lance Taylor  <iant@google.com>
15376
15377         * output.h (class Output_section_data): Remove inline definition
15378         of set_addralign.
15379         * output.cc (Output_section_data::set_addralign): New function.
15380
15381 2008-04-11  Cary Coutant  <ccoutant@google.com>
15382
15383         Add support for TLS descriptors for i386 and x86_64.
15384         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
15385         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
15386         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
15387         GOT_TYPE_TLS_DESC.
15388         (Target_i386::got_mod_index_entry): Remove unnecessary code.
15389         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
15390         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
15391         relocations.
15392         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
15393         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
15394         Fix problem with initial-exec relocations.
15395         (Target_i386::Relocate::relocate_tls): Likewise.
15396         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
15397         relaxation.
15398         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
15399         support for section-plus-offset dynamic table entries.
15400         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
15401         (Output_data_dynamic::Dynamic_entry): Add support for
15402         section-plus-offset dynamic table entries.
15403         (Output_data_dynamic::Classification): Likewise.
15404         (Output_data_dynamic::classification_): Renamed offset_.
15405         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
15406         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
15407         (Target_x86_64::make_plt_section): New function.
15408         (Target_x86_64::reserve_tlsdesc_entries): New function.
15409         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
15410         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
15411         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
15412         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
15413         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
15414         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
15415         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
15416         add extra PLT entry for TLS descriptors.
15417         (Output_data_plt_x86_64::got_): New field.
15418         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
15419         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
15420         fields.
15421         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
15422         descriptors.
15423         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
15424         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
15425         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
15426         R_386_TLS_DESC_CALL relocations.
15427         (Target_x86_64::Scan::global): Likewise.
15428         (Target_x86_64::do_finalize_sections): Add dynamic table entries
15429         for TLS descriptors.
15430         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
15431         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
15432         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
15433         GD-to-IE relaxation.
15434         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
15435         and TLS_DESCRIPTORS.
15436         * Makefile.in: Rebuild.
15437         * configure: Rebuild.
15438         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
15439         (tls_test_shared2.so): New target.
15440         (tls_shared_gd_to_ie_test_SOURCES): New variable.
15441         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
15442         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
15443         (tls_shared_gd_to_ie_test_LDADD): New variable.
15444         (tls_shared_gnu2_gd_to_ie_test): New target.
15445         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
15446         New targets.
15447         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
15448         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
15449         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
15450         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
15451         (tls_shared_gnu2_test): New target.
15452         (tls_test_gnu2_shared.so): New target.
15453         (tls_shared_gnu2_test_SOURCES): New variable.
15454         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
15455         (tls_shared_gnu2_test_LDFLAGS): New variable.
15456         (tls_shared_gnu2_test_LDADD): New variable.
15457         * testsuite/Makefile.in: Rebuild.
15458         * testsuite/Makefile.
15459
15460 2008-04-11  Ian Lance Taylor  <iant@google.com>
15461
15462         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
15463         justsyms.t.
15464         * testsuite/Makefile.in: Rebuild.
15465
15466         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
15467         long.
15468         * testsuite/script_test_2.cc (main): Adjust test.
15469
15470 2008-04-11  David S. Miller  <davem@davemloft.net>
15471             Ian Lance Taylor  <iant@google.com>
15472
15473         * options.h (General_options): Add entries for '-Y' and
15474         '-relax'.
15475         * options.cc (General_options:finalize): If -Y was used, add those
15476         entries to the library path instead of the default "/lib" and
15477         "/usr/lib".
15478
15479 2008-04-11  David S. Miller  <davem@davemloft.net>
15480
15481         * testsuite/justsyms.t: Start at 0x100.
15482         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
15483         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
15484         long.
15485         * testsuite/script_test_2.cc: Adjust string and section length
15486         checks.
15487
15488 2008-04-09  Ian Lance Taylor  <iant@google.com>
15489
15490         PR gold/5996
15491         * script-sections.cc (Sections_element::allocate_to_segment): Add
15492         orphan parameter.
15493         (Output_section_definition::allocate_to_segment): Likewise.
15494         (Orphan_output_section::allocate_to_segment): Likewise.
15495         (Script_sections::attach_sections_using_phdrs_clause): Don't
15496         propagate non-PT_LOAD segments to orphan sections.
15497         * testsuite/Makefile.am (script_test_3.stdout): Generate using
15498         readelf rather than objdump.
15499         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
15500         .interp section and PT_INTERP segment are the same size.
15501         * testsuite/Makefile.in: Rebuild.
15502
15503         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
15504         aliases for symbols defined in the same object.
15505         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
15506         (weak_alias_test_SOURCES): New variable.
15507         (weak_alias_test_DEPENDENCIES): New variable.
15508         (weak_alias_test_LDFLAGS): New variable.
15509         (weak_alias_test_LDADD): New variable.
15510         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
15511         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
15512         (weak_alias_test_3.o): New target.
15513         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
15514         * testsuite/weak_alias_test_main.cc: New file.
15515         * testsuite/weak_alias_test_1.cc: New file.
15516         * testsuite/weak_alias_test_2.cc: New file.
15517         * testsuite/weak_alias_test_3.cc: New file.
15518
15519 2008-04-08  Ian Lance Taylor  <iant@google.com>
15520
15521         * options.h (class General_options): Add --noinhibit-exec option.
15522         * main.cc (main): Check --noinhibit-exec.
15523
15524         * options.h (class General_options): Define --wrap as a special
15525         option.  Add wrap_symbols_ field.
15526         (General_options::any_wrap_symbols): New function.
15527         (General_options::is_wrap_symbol): New function.
15528         * options.cc (General_options::parse_wrap): New function.
15529         (General_options::General_options): Initialize wrap_symbols_.
15530         * symtab.cc (Symbol_table::wrap_symbol): New function.
15531         (Symbol_table::add_from_object): Handle --wrap.
15532         * symtab.h (class Symbol_table): Declare wrap_symbol.
15533         * target.h (Target::wrap_char): New function.
15534         (Target::Target_info): Add wrap_char field.
15535         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
15536         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
15537         * testsuite/testfile.cc (Target_test::test_target_info):
15538         Likewise.
15539
15540         * errors.cc (Errors::undefined_symbol): Mention symbol version if
15541         there is one.
15542
15543         * layout.h (class Layout): Add added_eh_frame_data_ field.
15544         * layout.cc (Layout::Layout): Initialize new field.
15545         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
15546         output section until we find a section we merged successfully.
15547         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
15548         that the size be non-zero.
15549
15550         * merge.cc (Object_merge_map::get_output_offset): Remove inline
15551         qualifier.
15552
15553 2008-04-08  Craig Silverstein  <csilvers@google.com>
15554
15555         * configure.ac: Export new conditional variable HAVE_ZLIB.
15556         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
15557         on HAVE_ZLIB.
15558         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
15559         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15560
15561 2008-04-07  Ian Lance Taylor  <iant@google.com>
15562
15563         * version.cc (version_string): Set to "1.5".
15564
15565         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
15566         Add issued_non_pic_error_ field.  Declare check_non_pic.
15567         (Target_x86_64::Scan::check_non_pic): New function.
15568         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
15569         (Target_x86_64::Scan::global): Likewise.
15570
15571         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
15572         addend parameter.  Change caller.  Handle merge sections.
15573         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
15574         Address to Addend.  Don't add in the result of
15575         local_section_offset, pass down the addend and use the returned
15576         value.
15577         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
15578         Update declarations of local_section_offset and symbol_value.
15579         * testsuite/two_file_test_1.cc (t18): New function.
15580         * testsuite/two_file_test_2.cc (f18): New function.
15581         * testsuite/two_file_test_main.cc (main): Call t18.
15582         * testsuite/two_file_test.h (t18, f18): Declare.
15583
15584         * configure.ac: Don't test for objdump, c++filt, or readelf.
15585         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
15586         conditionals.
15587         (TEST_READELF): New variable.
15588         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
15589         (check_PROGRAMS): Add two_file_strip_test.
15590         (two_file_strip_test): New target.
15591         (check_PROGRAMS): Add two_file_same_shared_strip_test.
15592         (two_file_same_shared_strip_test_SOURCES): New variable.
15593         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
15594         (two_file_same_shared_strip_test_LDFLAGS): New variable.
15595         (two_file_same_shared_strip_test_LDADD): New variable.
15596         (two_file_shared_strip.so): New target.
15597         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
15598         (ver_test_5.syms, ver_test_7.syms): Likewise.
15599         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
15600         (strip_test_3.stdout): Use TEST_OBJDUMP.
15601         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15602
15603 2008-04-04  Cary Coutant  <ccoutant@google.com>
15604
15605         * symtab.h (Symbol::is_weak_undefined): New function.
15606         (Symbol::is_strong_undefined): New function.
15607         (Symbol::is_absolute): New function.
15608         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
15609         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
15610         absolute symbols.
15611         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
15612         (weak_undef_test): New target.
15613         * testsuite/Makefile.in: Rebuild.
15614         * testsuite/weak_undef_file1.cc: New file.
15615         * testsuite/weak_undef_file2.cc: New file.
15616         * testsuite/weak_undef_test.cc: New file.
15617
15618 2008-04-03  Craig Silverstein  <csilvers@google.com>
15619
15620         * compressed_output.h (class Output_compressed_section): Use
15621         unsigned buffer.
15622         * compressed_output.cc (zlib_compress): Use unsigned buffers,
15623         add zlib header.
15624         (zlib_compressed_suffix): Removed.
15625         (Output_compressed_section::set_final_data_size): Use unsigned
15626         buffers.
15627         * testsuite/Makefile.am (flagstest_compress_debug_sections):
15628         Fix linker invocation.
15629         (flagstest_o_specialfile_and_compress_debug_sections):
15630         Likewise.
15631         * testsuite/Makefile.in: Regenerated.
15632
15633 2008-04-02  David S. Miller  <davem@davemloft.net>
15634
15635         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
15636         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
15637
15638 2008-04-02  Craig Silverstein  <csilvers@google.com>
15639
15640         * TODO: New file.
15641
15642 2008-04-02  Ian Lance Taylor  <iant@google.com>
15643
15644         * fileread.cc (File_read::find_view): Add byteshift and vshifted
15645         parameters.  Update for new key type to views_.  Change all
15646         callers.
15647         (File_read::read): Adjust for byteshift in returned view.
15648         (File_read::add_view): New function, broken out of
15649         find_and_make_view.
15650         (File_read::make_view): New function, broken out of
15651         find_and_make_view.
15652         (File_read::find_or_make_view): Add offset and aligned
15653         parameters.  Rewrite accordingly.  Change all callers.
15654         (File_read::get_view): Add offset and aligned parameters.  Adjust
15655         for byteshift in return value.
15656         (File_read::get_lasting_view): Likewise.
15657         * fileread.h (class File_read): Update declarations.
15658         (class File_read::View): Add byteshift_ field.  Add byteshift to
15659         constructor.  Add byteshift method.
15660         * archive.h (Archive::clear_uncached_views): New function.
15661         (Archive::get_view): Add aligned parameter.  Change all callers.
15662         * object.h (Object::get_view): Add aligned parameter.  Change all
15663         callers.
15664         (Object::get_lasting_view): Likewise.
15665
15666         * fileread.cc (File_read::release): Don't call clear_views if
15667         there are multiple objects.
15668         * fileread.h (File_read::clear_uncached_views): New function.
15669         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
15670         on the archive.
15671
15672 2008-03-31  Cary Coutant  <ccoutant@google.com>
15673
15674         Add thin archive support.
15675         * archive.cc (Archive::armagt): New const.
15676         (Archive::setup): Remove task parameter and calls to unlock.
15677         (Archive::unlock_nested_archives): New function.
15678         (Archive::read_header): Add nested_off parameter. Change
15679         all callers.
15680         (Archive::interpret_header): Likewise.
15681         (Archive::include_all_members): Change to handle thin
15682         archives.
15683         (Archive::include_member): Likewise.
15684         * archive.h (Archive::Archive): Add new parameters and
15685         initializers.
15686         (Archive::armagt): New const.
15687         (Archive::setup): Remove task parameter.
15688         (Archive::unlock_nested_archives): New function.
15689         (Archive::read_header): Add nested_off parameter.
15690         (Archive::interpret_header): Likewise.
15691         (Archive::Nested_archive_table): New typedef.
15692         (Archive::is_thin_archive_): New field.
15693         (Archive::nested_archives_): New field.
15694         (Archive::options_): New field.
15695         (Archive::dirpath_): New field.
15696         (Archive::task_): New field.
15697         * readsyms.cc (Read_symbols::do_read_symbols): Add check
15698         for thin archives.  Pass additional parameters to
15699         Archive::Archive.  Unlock the archive file after calling
15700         Archive::setup.
15701
15702 2008-03-29  Ian Lance Taylor  <iant@google.com>
15703
15704         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
15705         version symbol to be local.
15706         * testsuite/ver_test_4.sh: New file.
15707         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
15708         (check_DATA): Add ver_test_4.syms.
15709         (ver_test_4.syms): New target.
15710         * testsuite/Makefile.in: Rebuild.
15711
15712         * output.cc
15713         (Output_section::Input_section_sort_entry::has_priority): New
15714         function.
15715         (Output_section::Input_section_sort_entry::match_file_name): New
15716         function.
15717         (Output_section::Input_section_sort_entry::match_section_name):
15718         Remove.
15719         (Output_section::Input_section_sort_entry::match_section_name_prefix):
15720         Remove.
15721         (Output_section::Input_section_sort_entry::match_section_file):
15722         Remove.
15723         (Output_section::Input_section_sort_compare::operator()): Rewrite
15724         using new Input_section_sort_entry functions.  Sort crtbegin and
15725         crtend first.  Sort sections with no priority before sections with
15726         a priority.
15727         * testsuite/initpri1.c (d3): Check j != 4.
15728         (cd5): New constructor/destructor function.
15729         (main): Check j != 2.
15730
15731         * symtab.cc (Symbol_table::add_from_object): If we don't use the
15732         new symbol when resolving, don't call set_is_default.
15733         * testsuite/ver_test_7.cc: New file.
15734         * testsuite/ver_test_7.sh: New file.
15735         * testsuite/Makefile.am (ver_test_7.so): New target.
15736         (ver_test_7.o): New target.
15737         (check_SCRIPTS): Add ver_test_7.sh.
15738         (check_DATA): Add ver_test_7.syms.
15739         (ver_test_7.syms): New target.
15740
15741 2008-03-28  Ian Lance Taylor  <iant@google.com>
15742
15743         * layout.cc (Layout::layout): If we see an input section with a
15744         name that needs sorting, set the must_sort flag for the output
15745         section.
15746         (Layout::make_output_section): If the name of the output section
15747         indicates that it might require sorting, set the may_sort flag.
15748         * output.h (Output_section::may_sort_attached_input_sections): New
15749         function.
15750         (Output_section::set_may_sort_attached_input_sections): New
15751         function.
15752         (Output_section::must_sort_attached_input_sections): New
15753         function.
15754         (Output_section::set_must_sort_attached_input_sections): New
15755         function.
15756         (class Output_section): Declare Input_section_sort_entry.  Define
15757         Input_section_sort_compare.  Declare
15758         sort_attached_input_sections.  Add new fields:
15759         may_sort_attached_input_sections_,
15760         must_sort_attached_input_sections_,
15761         attached_input_sections_are_sorted_.
15762         * output.cc (Output_section::Output_section): Initialize new
15763         fields.
15764         (Output_section::add_input_section): Add an entry to
15765         input_sections_ if may_sort or must_sort are true.
15766         (Output_section::set_final_data_size): Call
15767         sort_attached_input_sections if necessary.
15768         (Output_section::Input_section_sort_entry): Define new class.
15769         (Output_section::Input_section_sort_compare::operator()): New
15770         function.
15771         (Output_section::sort_attached_input_sections): New function.
15772         * configure.ac: Check whether the compiler supports constructor
15773         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
15774         * testsuite/initpri1.c: New file.
15775         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
15776         CONSTRUCTOR_PRIORITY.
15777         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
15778         (initpri1_LDFLAGS): New variable.
15779         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15780
15781 2008-03-27  Ian Lance Taylor  <iant@google.com>
15782
15783         * common.cc (Sort_commons::operator): Correct sorting algorithm.
15784         * testsuite/common_test_1.c: New file.
15785         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
15786         (common_test_1_SOURCES): New variable.
15787         (common_test_1_DEPENDENCIES): New variable.
15788         (common_test_1_LDFLAGS): New variable.
15789
15790         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
15791         and commons_ correctly when NAME/VERSION does not override
15792         NAME/NULL.
15793         * testsuite/ver_test_6.c: New file.
15794         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
15795         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
15796         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
15797
15798 2008-03-26  Ian Lance Taylor  <iant@google.com>
15799
15800         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
15801         of an undefined symbol from a version script.
15802         * testsuite/Makefile.am (ver_test_5.so): New target.
15803         (ver_test_5.o): New target.
15804         (check_SCRIPTS): Add ver_test_5.sh.
15805         (check_DATA): Add ver_test_5.syms.
15806         (ver_test_5.syms): New target.
15807         * testsuite/ver_test_5.cc: New file.
15808         * testsuite/ver_test_5.script: New file.
15809         * testsuite/ver_test_5.sh: New file.
15810         * Makefile.in, testsuite/Makefile.in: Rebuild.
15811
15812         PR gold/5986
15813         Fix problems building gold with gcc 4.3.0.
15814         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
15815         (gold_error_at_location, gold_warning_at_location): Use it.
15816         * configure.ac: Check whether we can compile and use a template
15817         function with a printf attribute.
15818         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
15819         when jumping over bytes.
15820         * object.cc: Instantiate Object::read_section_data.
15821         * debug.h: Include <cstring>
15822         * dwarf_reader.cc: Include <algorithm>
15823         * main.cc: Include <cstring>.
15824         * options.cc: Include <cstring>.
15825         * output.cc: Include <cstring>.
15826         * script.cc: Include <cstring>.
15827         * script.h: Include <string>.
15828         * symtab.cc: Include <cstring> and <algorithm>.
15829         * target-select.cc: Include <cstring>.
15830         * version.cc: Include <string>.
15831         * testsuite/testmain.cc: Include <cstdlib>.
15832         * configure, config.in: Rebuild.
15833
15834 2008-03-25  Ian Lance Taylor  <iant@google.com>
15835
15836         * options.cc: Include "../bfd/bfdver.h".
15837         (options::help): Print bug reporting address.
15838
15839         * version.cc (print_version): Adjust output for current value of
15840         BFD_VERSION_STRING.
15841
15842         * NEWS: New file.
15843
15844         * options.cc (options::help): Print list of supported targets.
15845         * target-select.h: Include <vector>.
15846         (class Target_selector): Make machine_, size_, and is_big_endian_
15847         fields const.  Add bfd_name_ and instantiated_target_ fields.
15848         (Target_selector::Target_selector): Add bfd_name parameter.
15849         (Target_selector::recognize): Make non-virtual, call
15850         do_recognize.
15851         (Target_selector::recognize_by_name): Make non-virtual, call
15852         do_recognize_by_name.
15853         (Target_selector::supported_names): New function.
15854         (Target_selector::bfd_name): New function.
15855         (Target_selector::do_instantiate_target): New pure virtual
15856         function.
15857         (Target_selector::do_recognize): New virtual function.
15858         (Target_selector::do_recognize_by_name): New virtual function.
15859         (Target_selector::instantiate_target): New private function.
15860         (supported_target_names): Declare.
15861         * target-select.cc (Target_selector::Target_selector): Update for
15862         new parameter and fields.
15863         (select_target_by_name): Check that the name matches before
15864         calling recognize_by_name.
15865         (supported_target_names): New function.
15866         * i386.cc (class Target_selector_i386): Update Target_selector
15867         constructor call.  Remove recognize and recognize_by_name.  Add
15868         do_instantiate_target.
15869         * x86_64.cc (class Target_selector_x86_64): Likewise.
15870         * testsuite/testfile.cc (class Target_selector_test): Update for
15871         changes to Target_selector.
15872
15873         * README: Rewrite, with some notes on unsupported features.
15874
15875 2008-03-24  Cary Coutant  <ccoutant@google.com>
15876
15877         * i386.cc (Target_i386::Got_type): New enum declaration.
15878         (Target_i386::Scan::local): Updated callers of Output_data_got
15879         member functions.
15880         (Target_i386::Scan::global): Likewise.
15881         (Target_i386::Relocate::relocate): Likewise.
15882         (Target_i386::Relocate::relocate_tls): Likewise.
15883         * object.h (Got_offset_list): New class.
15884         (Sized_relobj::local_has_got_offset): Added got_type parameter.
15885         (Sized_relobj::local_got_offset): Likewise.
15886         (Sized_relobj::set_local_got_offset): Likewise.
15887         (Sized_relobj::local_has_tls_got_offset): Removed.
15888         (Sized_relobj::local_tls_got_offset): Removed.
15889         (Sized_relobj::set_local_tls_got_offset): Removed.
15890         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
15891         * output.cc (Output_data_got::add_global): Added got_type parameter.
15892         (Output_data_got::add_global_with_rel): Likewise.
15893         (Output_data_got::add_global_with_rela): Likewise.
15894         (Output_data_got::add_global_pair_with_rel): New function.
15895         (Output_data_got::add_global_pair_with_rela): New function.
15896         (Output_data_got::add_local): Added got_type parameter.
15897         (Output_data_got::add_local_with_rel): Likewise.
15898         (Output_data_got::add_local_with_rela): Likewise.
15899         (Output_data_got::add_local_pair_with_rel): New function.
15900         (Output_data_got::add_local_pair_with_rela): New function.
15901         (Output_data_got::add_global_tls): Removed.
15902         (Output_data_got::add_global_tls_with_rel): Removed.
15903         (Output_data_got::add_global_tls_with_rela): Removed.
15904         (Output_data_got::add_local_tls): Removed.
15905         (Output_data_got::add_local_tls_with_rel): Removed.
15906         (Output_data_got::add_local_tls_with_rela): Removed.
15907         * output.h (Output_data_got::add_global): Added got_type parameter.
15908         (Output_data_got::add_global_with_rel): Likewise.
15909         (Output_data_got::add_global_with_rela): Likewise.
15910         (Output_data_got::add_global_pair_with_rel): New function.
15911         (Output_data_got::add_global_pair_with_rela): New function.
15912         (Output_data_got::add_local): Added got_type parameter.
15913         (Output_data_got::add_local_with_rel): Likewise.
15914         (Output_data_got::add_local_with_rela): Likewise.
15915         (Output_data_got::add_local_pair_with_rel): New function.
15916         (Output_data_got::add_local_pair_with_rela): New function.
15917         (Output_data_got::add_global_tls): Removed.
15918         (Output_data_got::add_global_tls_with_rel): Removed.
15919         (Output_data_got::add_global_tls_with_rela): Removed.
15920         (Output_data_got::add_local_tls): Removed.
15921         (Output_data_got::add_local_tls_with_rel): Removed.
15922         (Output_data_got::add_local_tls_with_rela): Removed.
15923         * resolve.cc (Symbol::override_base_with_special): Removed
15924         reference to has_got_offset_ field.
15925         * symtab.cc (Symbol::init_fields): Replaced initialization
15926         of got_offset_ with got_offsets_.  Removed initialization
15927         of has_got_offset_
15928         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
15929         (Symbol::got_offset): Likewise.
15930         (Symbol::set_got_offset): Likewise.
15931         (Symbol::has_tls_got_offset): Removed.
15932         (Symbol::tls_got_offset): Removed.
15933         (Symbol::set_tls_got_offset): Removed.
15934         (Symbol::got_offset_): Removed.
15935         (Symbol::tls_mod_got_offset_): Removed.
15936         (Symbol::tls_pair_got_offset_): Removed.
15937         (Symbol::got_offsets_): New field.
15938         (Symbol::has_got_offset): Removed.
15939         (Symbol::has_tls_mod_got_offset): Removed.
15940         (Symbol::has_tls_pair_got_offset): Removed.
15941         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
15942         (Target_x86_64::Scan::local): Updated callers of Output_data_got
15943         member functions.
15944         (Target_x86_64::Scan::global): Likewise.
15945         (Target_x86_64::Relocate::relocate): Likewise.
15946         (Target_x86_64::Relocate::relocate_tls): Likewise.
15947
15948 2008-03-25  Ben Elliston  <bje@au.ibm.com>
15949
15950         * yyscript.y: Fix spelling error in comment.
15951
15952 2008-03-24  Ian Lance Taylor  <iant@google.com>
15953
15954         * options.h (class General_options): Define build_id option.
15955         * layout.h (class Layout): Declare write_build_id, create_note,
15956         create_build_id.  Add build_id_note_ member.
15957         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
15958         "libiberty.h", "md5.h", "sha1.h".
15959         (Layout::Layout): Initialize eh_frame_data_,
15960         eh_frame_hdr_section_, and build_id_note_.
15961         (Layout::finalize): Call create_build_id.
15962         (Layout::create_note): New function, broken out of
15963         Layout::create_gold_note.
15964         (Layout::create_gold_note): Call create_note.
15965         (Layout::create_build_id): New function.
15966         (Layout::write_build_id): New function.
15967         (Close_task_runner::run): Call write_build_id.
15968
15969         * x86_64.cc: Correct license to GPLv3.
15970
15971 2008-03-23  Ian Lance Taylor  <iant@google.com>
15972
15973         * options.cc: Include "demangle.h".
15974         (parse_optional_string): New function.
15975         (parse_long_option): Handle takes_optional_argument.
15976         (parse_short_option): Update dash_z initializer.  Handle
15977         takes_optional_argument.
15978         (General_options::General_options): Initialize do_demangle_.
15979         (General_options::finalize): Set do_demangle_.  Handle demangling
15980         style.
15981         * options.h (parse_optional_string): Declare.
15982         (struct One_option): Add optional_arg field.  Update constructor.
15983         Update call constructor calls.  Add takes_optional_argument
15984         function.
15985         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
15986         (DEFINE_optional_string): Define.
15987         (General_options::demangle): Change from DEFINE_bool to
15988         DEFINE_optional_string.
15989         (General_options::no_demangle): New function.
15990         (General_options::do_demangle): New function.
15991         (General_options::set_do_demangle): New function.
15992         (General_options::execstack_status_): Move definition to end of
15993         class definition.
15994         (General_options::static_): Likewise.
15995         (General_options::do_demangle_): New field.
15996         * object.cc (big_endian>::get_symbol_location_info): Call
15997         Options::do_demangle, not Options::demangle.
15998         * symtab.cc (demangle): Likewise.
15999
16000 2008-03-22  Ian Lance Taylor  <iant@google.com>
16001
16002         * gold.h: Include <cstddef> and <sys/types.h>
16003         * options.h: Include <cstring>.
16004
16005 2008-03-21  Ian Lance Taylor  <iant@google.com>
16006
16007         * Added source code to GNU binutils.
16008 \f
16009 Copyright (C) 2008-2014 Free Software Foundation, Inc.
16010
16011 Copying and distribution of this file, with or without modification,
16012 are permitted in any medium without royalty provided the copyright
16013 notice and this notice are preserved.
16014
16015 Local Variables:
16016 mode: change-log
16017 left-margin: 8
16018 fill-column: 74
16019 version-control: never
16020 End: