0bde6a1cd0ad506f990d37430f4fdd27b78453b5
[platform/upstream/binutils.git] / gold / ChangeLog
1 2014-06-03  Alan Modra  <amodra@gmail.com>
2
3         * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
4         st_other output.
5
6 2014-06-02  Alan Modra  <amodra@gmail.com>
7
8         * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
9         Only ignore relocs on ELFv1.
10         (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
11
12 2014-05-30  Cary Coutant  <ccoutant@google.com>
13
14         * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
15         * testsuite/Makefile.in: Regenerate.
16         * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
17
18 2014-05-27  H.J. Lu  <hongjiu.lu@intel.com>
19
20         PR gold/16945
21         * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
22         for got_offset.  Properly get GOT address for R_X86_64_PLTOFF64.
23
24 2014-05-15  Alan Modra  <amodra@gmail.com>
25
26         * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
27         Compare FDE contents with DW_CFA_nop rather than 0.
28
29 2014-05-13  Sriraman Tallam  <tmsriram@google.com>
30
31         * symtab.h (may_need_copy_reloc): Remove check for position independent
32         code.
33         * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
34         position independence before pc absolute may_need_copy_reloc call.
35         Add check for executable output befor pc relative may_need_copy_reloc
36         call.
37         * i386.cc: Ditto.
38         * arm.cc: Ditto.
39         * sparc.cc: Ditto.
40         * tilegx.cc: Ditto.
41         * powerpc.cc: Add check for no position independence before
42         may_need_copy_reloc calls.
43         * testsuite/pie_copyrelocs_test.cc: New file.
44         * testsuite/pie_copyrelocs_shared_test.cc: New file.
45         * Makefile.am (pie_copyrelocs_test): New test.
46         * Makefile.in: Regenerate.
47
48 2014-05-08  Martin Liška  <mliska@suse.cz>
49
50         * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
51
52 2014-05-06  Cary Coutant  <ccoutant@google.com>
53
54         PR gold/16900
55         * i386.cc (Output_data_got_plt_i386): New class.
56         (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
57         parameter. Change all callers.
58         (Output_data_plt_i386::layout_): Remove.
59         (Output_data_plt_i386::got_plt_): Change type.
60         (Target_i386::got_plt_): Change type. Change all references.
61         (Target_i386::got_section): Create instance of new class.
62         (Output_data_got_plt_i386::do_write): New function.
63         * x86_64.cc (Output_data_got_plt_x86_64): New class.
64         (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
65         parameter. Change all callers.
66         (Output_data_plt_x86_64::layout_): Remove.
67         (Output_data_plt_x86_64::got_plt_): Change type.
68         (Target_x86_64::got_plt_): Change type. Change all references.
69         (Target_x86_64::got_section): Create instance of new class.
70         (Output_data_got_plt_x86_64::do_write): New function.
71         (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
72         (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
73         class.
74
75 2014-05-05  Cary Coutant  <ccoutant@google.com>
76
77         * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
78         if we have pubnames/pubtypes.
79
80 2014-05-02  Cary Coutant  <ccoutant@google.com>
81
82         * defstd.cc (in_segment): Define __ehdr_start here...
83         * layout.cc (Layout::finalize): ...Instead of here.  Set the
84         output segment when known.
85         * resolve.cc (Symbol::override_base_with_special): Remember
86         the original binding.
87         * symtab.cc (Symbol::set_output_segment): New function.
88         (Symbol::set_undefined): New function.
89         * symtab.h (Symbol::is_weak_undefined): Check original undef
90         binding.
91         (Symbol::is_strong_undefined): New function.
92         (Symbol::set_output_segment): New function.
93         (Symbol::set_undefined): New function.
94         * target-reloc.h (is_strong_undefined): Remove.
95         (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
96         Check for hidden undefs.
97         (relocate_section): Call Symbol::is_strong_undefined.
98
99         * testsuite/Makefile.am (ehdr_start_test_1)
100         (ehdr_start_test_2, ehdr_start_test_3)
101         (ehdr_start_test_4, ehdr_start_test_5): New test cases.
102         * testsuite/Makefile.in: Regenerate.
103         * testsuite/ehdr_start_def.cc: New source file.
104         * testsuite/ehdr_start_test.cc: New source file.
105         * testsuite/ehdr_start_test.t: New linker script.
106         * testsuite/ehdr_start_test_4.sh: New shell script.
107
108 2014-04-23  Cary Coutant  <ccoutant@google.com>
109
110         PR gold/16870
111         * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
112
113 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
114
115         * layout.cc (Layout::include_section): Allow a target to decide
116         whether to include a section.
117         * target.h (Target::should_include_section): New function.
118         (Target::do_should_include_section): New function.
119
120 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
121
122         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
123         inline into ...
124         (Copy_relocs::emit): ... here.
125         * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
126         (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
127         (Copy_reloc_entry::entries_): Change from private to protected.
128
129 2014-04-02  Sriraman Tallam  <tmsriram@google.com>
130
131         * icf.cc (get_section_contents): Replace copies of reloc
132         vectors with const references.
133
134 2014-04-02  Cary Coutant  <ccoutant@google.com>
135
136         * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
137         (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
138         * configure: Regenerate.
139         * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
140         -fno-use-linker-plugin.
141         (LINK1, CXXLINK1): Add it to the link command.
142         * testsuite/Makefile.in: Regenerate.
143
144 2014-03-12  Alan Modra  <amodra@gmail.com>
145
146         * Makefile.in: Regenerate.
147
148 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
149
150         * symtab.h (Symbol::set_nonvis): New function.
151
152 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
153
154         * symtab.cc (Sized_symbol<32>::init_output_data):
155         Instantiate the template.
156         (Sized_symbol<64>::init_output_data): Likewise.
157
158 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
159
160         * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
161         adjust dynamic symbol value.
162         * target.h (Target::adjust_dyn_symbol): New function.
163         (Target::do_adjust_dyn_symbol): New function.
164
165 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
166
167         * output.cc (Output_data_dynamic::Dynamic_entry::write):
168         Get the value of DYNAMIC_CUSTOM dynamic entry.
169         * output.h (Output_data_dynamic::add_custom): New function.
170         (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
171         dynamic entry.
172         (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
173         * target.h (Target::dynamic_tag_custom_value): New function.
174         (Target::do_dynamic_tag_custom_value): New function.
175
176 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
177
178         * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
179         dynsym indexes.
180         * target.h (Target::has_custom_set_dynsym_indexes): New function.
181         (Target::do_has_custom_set_dynsym_indexes): New function.
182         (Target::set_dynsym_indexes): New function.
183         (Target::do_set_dynsym_indexes): New function.
184
185 2014-03-07  Alan Modra  <amodra@gmail.com>
186
187         * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
188         CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
189         (Powerpc_relocate_functions::has_overflow_unsigned): New function.
190         (Powerpc_relocate_functions::has_overflow_bitfield,
191         overflowed): Use the above.
192         (Target_powerpc::Relocate::relocate): Correct overflow checking
193         for a number of relocations.  Modify overflow test for 16-bit
194         fields in instructions to signed/unsigned according to whether
195         the field takes a signed or unsigned value.
196
197 2014-03-05  Alan Modra  <amodra@gmail.com>
198
199         Update copyright years.
200
201 2014-03-05  Alan Modra  <amodra@gmail.com>
202
203         * powerpc.cc (Target_powerpc::Scan::local, global): Support
204         R_PPC64_ADDR64_LOCAL.
205         (Target_powerpc::Relocate::relocate): Likewise.
206
207 2014-03-03  Alan Modra  <amodra@gmail.com>
208
209         * dwp.cc (print_version): Update copyright year to current.
210
211 2014-02-10  Alan Modra  <amodra@gmail.com>
212
213         * po/gold.pot: Regenerate.
214
215 2014-02-06  Cary Coutant  <ccoutant@google.com>
216
217         Fix problem where -u is ignored when a weak undef is seen.
218
219         * archive.cc (Library_base::should_include_member): Reorder
220         code to check for -u option if a weak undef has already been seen.
221         * testsuite/Makefile.am (weak_undef_test_2): New test case.
222         * testsuite/Makefile.in: Regenerate.
223         * testsuite/weak_undef_file3.cc: New file.
224         * testsuite/weak_undef_file4.cc: New file.
225         * testsuite/weak_undef_test_2.cc: New file.
226
227 2014-02-05  Cary Coutant  <ccoutant@google.com>
228
229         Fix issues with gold undefined symbol diagnostics.
230
231         PR binutils/15435
232         * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
233         check to here.
234         * target-reloc.h (is_strong_undefined): New function.
235         (relocate_section): Move undef vtable symbol check from here.
236         Check for is_strong_undefined.
237
238 2014-02-05  Cary Coutant  <ccoutant@google.com>
239
240         Fix problems with the --dynamic-list option.
241
242         PR gold/13577
243         * options.cc (General_options::parse_dynamic_list):
244         Set have_dynamic_list_.
245         (General_options::General_options): Initialize have_dynamic_list_.
246         (General_options::finalize): Turn off -Bsymbolic and
247         -Bsymbolic-functions if --dynamic-list provided.
248         * options.h (General_options::have_dynamic_list): New function.
249         (General_options::have_dynamic_list_): New data member.
250         * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
251         correctly.
252
253         PR gold/16530
254         * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
255         in --dynamic-list, mark it.
256
257         * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
258         (dynamic_list_2): New test case.
259         * testsuite/Makefile.in: Regenerate.
260         * testsuite/dynamic_list_2.cc: New file.
261         * testsuite/dynamic_list_2.t: New file.
262         * testsuite/dynamic_list_lib1.cc: New file.
263         * testsuite/dynamic_list_lib2.cc: New file.
264         * testsuite/gc_dynamic_list_test.c: New file.
265         * testsuite/gc_dynamic_list_test.sh: New file.
266         * testsuite/gc_dynamic_list_test.t: New file.
267
268 2014-01-28  Cary Coutant  <ccoutant@google.com>
269
270         Add .gdb_index version 7 support.
271
272         * gold/dwarf_reader.cc: include <utility> (for make_pair).
273         (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
274         debug sections.
275         (Dwarf_ranges_table::read_ranges_table): Likewise.
276         (Dwarf_pubnames_table::read_section): Check for GNU-style
277         sections, and for compressed debug sections.
278         (Dwarf_pubnames_table::read_header): Compute end address of table.
279         (Dwarf_pubnames_table::next_name): Return flag_byte.  Check
280         for end of list by offset, not by offset == 0.
281         (Dwarf_info_reader::do_read_string_table): Check for compressed
282         debug sections.
283         * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
284         Initialize new data members.
285         (Dwarf_pubnames_table::next_name): return flag_byte.
286         (Dwarf_pubnames_table::end_of_table_): New data member.
287         (Dwarf_pubnames_table::is_gnu_style_): New data member.
288         * gold/gdb-index.cc (gdb_index_version): Update to version 7.
289         (Gdb_index_info_reader::read_pubtable): Read flag_byte.
290         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
291         read skeleton type unit DIEs.
292         (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
293         (Gdb_index::do_write): Write flag_byte.
294         * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
295         (Gdb_index::Cu_vector): Store flags along with cu indexes.
296         * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
297         * gold/testsuite/gdb_index_test_comm.sh: Likewise.
298
299 2014-01-08  H.J. Lu  <hongjiu.lu@intel.com>
300
301         * version.cc (print_version): Update copyright year to 2014.
302
303 2013-12-19  Dimitry Andric  <dimitry@andric.com>
304
305         * stringpool.cc (Stringpool_template::reserve): Add
306         HAVE_UNORDERED_MAP case.
307         * stringpool.cc (Stringpool_template::print_stats): Likewise.
308
309 2013-12-18  Cary Coutant  <ccoutant@google.com>
310
311         * configure.ac: Check for <unordered_set> and <unordered_map>.
312         * config.in: Regenerate.
313         * configure: Regenerate.
314         * system.h: Use <unordered_set> and <unordered_map> if available.
315
316 2013-12-10  Roland McGrath  <mcgrathr@google.com>
317
318         * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
319         with $(INSTALL_PROGRAM_ENV).
320         * Makefile.in: Regenerate.
321
322 2013-11-22  Cary Coutant  <ccoutant@google.com>
323
324         * configure.ac: Add check for which library is needed for
325         dlopen.
326         * configure: Regenerate.
327
328 2013-11-22  Cary Coutant  <ccoutant@google.com>
329
330         * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
331         assembler.
332         * testsuite/Makefile.in: Regenerate.
333
334 2013-11-17  H.J. Lu  <hongjiu.lu@intel.com>
335
336         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
337         Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
338         R_X86_64_PC32 and R_X86_64_PLT32, respectively.
339         (Target_x86_64<size>::Scan::local): Likewise.
340         (Target_x86_64<size>::Scan::global): Likewise.
341         (Target_x86_64<size>::Relocate::relocate): Likewise.
342         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
343         Likewise.
344         (Target_x86_64<size>::Scan::check_non_pic(): Handle
345         R_X86_64_PC32_BND.
346
347         * testsuite/Makefile.am (check_PROGRAMS): Add
348         exception_x86_64_bnd_test.
349         (exception_x86_64_bnd_test_SOURCES): New macro.
350         (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
351         (exception_x86_64_bnd_test_LDFLAGS): Likewise.
352         (exception_x86_64_bnd_test_LDADD): Likewise.
353         (exception_x86_64_bnd_1.o): New rule.
354         (exception_x86_64_bnd_2.o): Likewise.
355         * testsuite/Makefile.in: Regenerated.
356
357 2013-11-15  Alan Modra  <amodra@gmail.com>
358
359         * powerpc.cc (Target_powerpc::glink_section): Provide non-const
360         accessor.
361         (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
362         Only call ppc64_local_entry_offset for 64-bit.  Restrict
363         symval_for_branch lookup to ELFv1.
364         (Stub_table::add_plt_call_entry): Use unsigned int off.
365         (Output_data_glink::Address, invalid_address): New.
366         (Output_data_glink::add_eh_frame): Move out of line.  Add
367         support for ELFv2.
368         (Output_data_glink::add_global_entry, find_global_entry,
369         global_entry_address): New functions.
370         (Output_data_glink::global_entry_stubs_, end_branch_table_,
371         ge_size): New variables.
372         (Output_data_glink::set_final_data_size): Add global entry
373         stub sizing.
374         (Output_data_glink::do_write): Write global entry stubs.
375         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
376         parameter.  Return true for ELFv2.  Adjust callers.
377         (Target_powerpc::Scan::local, global): Restrict opd lookup to
378         ELFv1.  Similarly for ifunc and dynamic relocation processing
379         specific to ELFv1.  Recognize that symbols are defined on
380         their plt entries for ELFv2.
381         (Target_powerpc::symval_for_branch): Assert if called for
382         ELFv2 or ppc32.
383         (Target_powerpc::Relocate::relocate): Use global entry plt
384         stub for symbol value if such exists on ELFv2.
385         (Target_powerpc::Relocate::relocate): Don't call
386         symval_for_branch when ELFv2.  Do adjust for local entry
387         offset when ELFv2.
388         (Target_powerpc::do_dynsym_value): Set symbols to global entry
389         plt stub for ELFv2.
390         (Target_powerpc::do_plt_address_for_global): Similarly.
391
392 2013-11-14  Cary Coutant  <ccoutant@google.com>
393
394         Revert patch -- this did not fix the problem, and there is
395         no race there.
396
397         2013-11-14  Cary Coutant  <ccoutant@google.com>
398
399             PR gold/14860
400             * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
401             (Ehframe_hdr::set_final_data_size): Allocate a Lock.
402             * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
403             updating fde_offsets_.
404             (Eh_frame_hdr::lock_): New data member.
405
406 2013-11-14  Cary Coutant  <ccoutant@google.com>
407
408         * dwp.cc (Dwo_file_entry): New type.
409         (File_list): Use Dwo_file_entry.
410         (Dwo_file::verify): New function.
411         (Dwo_file::verify_dwo_list): New function.
412         (Dwo_file::sized_verify_dwo_list): New function.
413         (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
414         list.
415         (Dwp_options): New enum type.
416         (dwp_options): Add --verify-only.
417         (usage): Likewise.
418         (main): Likewise.
419         * dwp.h (gold_info): Add declaration.
420
421 2013-11-14  Cary Coutant  <ccoutant@google.com>
422
423         PR gold/14860
424         * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
425         (Ehframe_hdr::set_final_data_size): Allocate a Lock.
426         * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
427         updating fde_offsets_.
428         (Eh_frame_hdr::lock_): New data member.
429
430 2013-11-06  Cary Coutant  <ccoutant@google.com>
431
432         PR gold/15758
433         * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
434         before reloc sections.
435
436 2013-11-04  Alan Modra  <amodra@gmail.com>
437
438         * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
439         (Symbol::needs_dynamic_reloc): Test new flag.
440         * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
441         (Target_powerpc::Scan::get_reference_flags): Add target param.
442         Return FUNC_DESC_ABI for 64-bit ELFv1.
443         (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
444         call.
445         (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
446         (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
447
448 2013-10-31  Cary Coutant  <ccoutant@google.com>
449
450         Restore support for dwp v2 DWARF package file format.
451
452         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
453         tu_length parameter.  Adjust all callers.
454         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
455         * dwp.cc: Include dwarf.h.
456         (Section_bounds): New struct type.
457         (Unit_set): New struct type.
458         (Dwo_file::Dwo_file): Initialize new data member.
459         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
460         Combine and rename to...
461         (Dwo_file::read_unit_index): ...this.
462         (Dwo_file::sized_read_compunit_index)
463         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
464         (Dwo_file::sized_read_unit_index): ...this.
465         (Dwo_file::copy_section): Remove section_name, is_str_offsets
466         parameters; add section_id parameter.
467         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
468         (Dwo_file::add_unit_set): ...this.
469         (Dwo_file::shndx_map_): Remove.
470         (Dwo_file::sect_offsets_): New data member.
471         (Dwp_output_file::Dwp_output_file): Initialize new data members.
472         (Dwp_output_file::add_section): Rename to...
473         (Dwp_output_file::add_contribution): ...this.
474         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
475         (Dwp_output_file::add_tu_set): Likewise.
476         (Dwp_output_file::Contribution): New type.
477         (Dwp_output_file::Section::contributions): New data member.
478         (Dwp_output_file::Cu_or_tu_set): Remove.
479         (Dwp_output_file::Section::Section): New ctor.
480         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
481         (Dwp_output_file::Dwp_index::Section_table): New type.
482         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
483         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
484         parameter.
485         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
486         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
487         (Dwp_output_file::Dwp_index::section_table): New member function.
488         (Dwp_output_file::Dwp_index::section_table_end): New member function.
489         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
490         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
491         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
492         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
493         (Dwp_output_file::Dwp_index::section_table_): New data member.
494         (Dwp_output_file::Dwp_index::section_mask_): New data member.
495         (Dwp_output_file::add_output_section): New member function.
496         (Dwp_output_file::write_new_section): New member function.
497         (Dwp_output_file::write_contributions): New member function.
498         (Dwp_output_file::section_id_map_): New data member.
499         (class Dwo_id_info_reader): Remove.
500         (class Unit_reader): New class.
501         (get_dwarf_section_name): New function.
502         (Dwo_file::read_executable): Adjust initializations of class data.
503         (Dwo_file::read): Add support for v2 package file format.
504         (Dwo_file::read_unit_index): Likewise.
505         (Dwo_file::sized_read_unit_index): Likewise.
506         (Dwo_file::copy_section): Likewise.
507         (Dwo_file::add_unit_set): Likewise.
508         (Dwp_output_file::add_output_section): Likewise.
509         (Dwp_output_file::add_contribution): Likewise.
510         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
511         for empty slot.
512         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
513         file format.
514         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
515         slot.
516         (Dwp_output_file::initialize): Remove unused function.
517         (Dwp_output_file::finalize): Add support for v2 package file format.
518         (Dwp_output_file::write_index): Likewise.
519         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
520         function prototype.
521
522 2013-10-31  Cary Coutant  <ccoutant@google.com>
523
524         * configure.ac: Fix check for -fmerge-constants.
525         * configure.ac: Regenerate.
526
527 2013-10-30  Roland McGrath  <mcgrathr@google.com>
528
529         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
530         Correct 9-byte nop sequence to match what the assembler generates.
531
532 2013-10-30  Alan Modra  <amodra@gmail.com>
533
534         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
535         ppc64_local_entry_offset, ppc64_local_entry_offset,
536         do_read_symbols): New functions.
537         (Powerpc_relobj::e_flags_, st_other_): New vars.
538         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
539         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
540         (Powerpc_relobj::e_flags_): New var.
541         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
542         and adjust for ELFv2.
543         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
544         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
545         (Powerpc_dynobj::do_find_special_sections): Likewise.
546         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
547         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
548         to ELFv2 local entry.
549         (Target_powerpc::do_relax): No thread safe barriers needed for
550         ELFv2.
551         (Output_data_plt_powerpc::initial_plt_entry_size_,
552         plt_entry_size): Delete.  Replace all uses with
553         first_plt_entry_offset() and plt_entry_size().
554         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
555         reserved_size parm.  Update callers.
556         (Output_data_plt_powerpc::entry_count): Update.
557         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
558         and use Target_powerpc::first_plt_entry_offset().
559         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
560         rename to plt_entry_size.
561         (Output_data_plt_powerpc::add_ifunc_entry,
562         add_local_ifunc_entry): Adjust reloc for ELFv2.
563         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
564         (glink_eh_frame_fde_64v2): New.
565         (Stub_table::plt_call_size): Support ELFv2 sizing.
566         (Output_data_glink::add_eh_frame): Use the new FDE.
567         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
568         (Stub_table::do_write): Write ELFv2 stubs and glink.
569         (Target_powerpc::Relocate::relocate): Replaces nop after call
570         with ld 2,24(1) and adjust local offset destination for ELFv2.
571
572 2013-10-30  Alan Modra  <amodra@gmail.com>
573
574         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
575         (Target_powerpc::Scan::global, local): Likewise.
576         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
577         on all ppc64 @h and @ha relocs.
578
579 2013-10-14  Alan Modra  <amodra@gmail.com>
580
581         * output.h (Output_data_got::add_constant): Tidy.
582         (Output_data_got::add_constant_pair): New function.
583         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
584         methods used so as to first call reserve_ent().
585
586 2013-10-11  Roland McGrath  <mcgrathr@google.com>
587
588         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
589         add_got_entry and add_got_entry_pair.
590
591         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
592         (HAVE_PUBNAMES): Likewise.
593         * configure: Regenerate.
594
595         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
596         * testsuite/Makefile.in: Regenerate.
597
598         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
599         Remove const from declaration.
600         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
601         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
602         * output.h (Output_file_header): Remove const from member target_
603         and corresponding constructor argument.
604         * output.cc (Output_file_header::Output_file_header): Update prototype.
605         (Output_file_header::do_sized_write): Use this->target_ in place
606         of parameters()->target().
607
608         * testsuite/undef_symbol.cc (Foo::get_a): New method.
609
610         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
611         * configure: Regenerate.
612         * Makefile.in: Regenerate.
613         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
614         * testsuite/merge_string_literals_2.c: Likewise.
615         * testsuite/Makefile.am
616         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
617         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
618         literal -fmerge-constants.
619         * testsuite/Makefile.in: Regenerate.
620
621         * i386.cc (Target_i386): Remove unused member dynbss_.
622         * arm.cc (Target_arm): Likewise.
623         * powerpc.cc (Target_powerpc): Likewise.
624         * sparc.cc (Target_sparc): Likewise.
625         * tilegx.cc (Target_tilegx): Likewise.
626         * x86_64.cc (Target_x86_64): Likewise.
627         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
628         type_signature_, type_offset_.
629         * plugin.h (Plugin_hook): Remove unused member layout_.
630         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
631         mapfile_.
632         (Read_member): Remove unused members input_objects_, symtab_,
633         mapfile_, layout_.
634         (Check_library): Remove unused member symtab_.
635         * archive.h (Lib_group): Remove unused member lib_.
636         * archive.cc (Lib_group::Lib_group): Update initializer.
637         * incremental.h (Incremental_binary): Remove unused member target_.
638         (Incremental_script_entry): Removed unused member script_.
639         * layout.h (Write_symbols_task): Remove unused member input_objects_.
640         * icf.h (Icf): Remove unused member num_tracked_relocs.
641
642         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
643         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
644         its only use.
645         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
646
647         * archive.h: Use struct rather than class for forward declaration
648         of Read_symbols_data.
649
650 2013-10-07  Cary Coutant  <ccoutant@google.com>
651
652         PR gold/16010
653         * testsuite/Makefile.am (icf_test): Fix dependencies.
654         (icf_safe_test): Likewise.
655         (icf_safe_so_test): Likewise.
656         (large_symbol_alignment): Add empty _LDADD rule.
657         * testsuite/Makefile.in: Regenerate.
658
659 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
660
661         PR gold/15927
662         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
663         relocation for R_X86_64_32 on x32.
664
665 2013-08-27  Roland McGrath  <mcgrathr@google.com>
666
667         * output.cc (Output_segment::set_section_addresses): Take new
668         Target* argument.  If target->isolate_execinstr() and the segment
669         is executable and starts at a target->abi_pagesize() boundary,
670         pad its end out to a target->abi_pagesize() boundary with code fill.
671         * output.h (Output_segment::set_section_addresses): Update decl.
672         * layout.h (Layout::check_output_data_for_reset_values): Take new
673         argument RELAX_OUTPUTS.
674         (Layout): New member relax_output_list_.
675         (Layout::add_relax_output): New method.
676         * layout.cc (Layout::Layout): Update constructor.
677         (Layout::reset_relax_output): New method.
678         (Layout::clean_up_after_relaxation): Call it.
679         (Layout::prepare_for_relaxation): Update caller.
680         (Layout::set_segment_offsets): Update callers of set_section_addresses.
681         Call reset_relax_output before re-processing segments for
682         isolate_execinstr case.
683         (Layout::write_data): Handle relax_output_list_.
684         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
685         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
686
687 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
688
689         PR binutils/15834
690         * object.h: Fix typos.
691
692 2013-08-16  Roland McGrath  <mcgrathr@google.com>
693
694         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
695         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
696
697 2013-08-07  Cary Coutant  <ccoutant@google.com>
698
699         Revert support for v2 DWP files:
700
701         2013-03-01  Cary Coutant  <ccoutant@google.com>
702
703             Add dwp support for v2 DWARF package file format.
704             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
705             tu_length parameter.  Adjust all callers.
706             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
707             * dwp.cc: Include dwarf.h.
708             (Section_bounds): New struct type.
709             (Unit_set): New struct type.
710             (Dwo_file::Dwo_file): Initialize new data member.
711             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
712             Combine and rename to...
713             (Dwo_file::read_unit_index): ...this.
714             (Dwo_file::sized_read_compunit_index)
715             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
716             (Dwo_file::sized_read_unit_index): ...this.
717             (Dwo_file::copy_section): Remove section_name, is_str_offsets
718             parameters; add section_id parameter.
719             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
720             (Dwo_file::add_unit_set): ...this.
721             (Dwo_file::shndx_map_): Remove.
722             (Dwo_file::sect_offsets_): New data member.
723             (Dwp_output_file::Dwp_output_file): Initialize new data members.
724             (Dwp_output_file::add_section): Rename to...
725             (Dwp_output_file::add_contribution): ...this.
726             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
727             (Dwp_output_file::add_tu_set): Likewise.
728             (Dwp_output_file::Contribution): New type.
729             (Dwp_output_file::Section::contributions): New data member.
730             (Dwp_output_file::Cu_or_tu_set): Remove.
731             (Dwp_output_file::Section::Section): New ctor.
732             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
733             (Dwp_output_file::Dwp_index::Section_table): New type.
734             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
735             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
736             parameter.
737             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
738             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
739             (Dwp_output_file::Dwp_index::section_table): New member function.
740             (Dwp_output_file::Dwp_index::section_table_end): New member function.
741             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
742             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
743             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
744             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
745             (Dwp_output_file::Dwp_index::section_table_): New data member.
746             (Dwp_output_file::Dwp_index::section_mask_): New data member.
747             (Dwp_output_file::add_output_section): New member function.
748             (Dwp_output_file::write_new_section): New member function.
749             (Dwp_output_file::write_contributions): New member function.
750             (Dwp_output_file::section_id_map_): New data member.
751             (class Dwo_id_info_reader): Remove.
752             (class Unit_reader): New class.
753             (get_dwarf_section_name): New function.
754             (Dwo_file::read_executable): Adjust initializations of class data.
755             (Dwo_file::read): Add support for v2 package file format.
756             (Dwo_file::read_unit_index): Likewise.
757             (Dwo_file::sized_read_unit_index): Likewise.
758             (Dwo_file::copy_section): Likewise.
759             (Dwo_file::add_unit_set): Likewise.
760             (Dwp_output_file::add_output_section): Likewise.
761             (Dwp_output_file::add_contribution): Likewise.
762             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
763             for empty slot.
764             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
765             file format.
766             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
767             slot.
768             (Dwp_output_file::initialize): Remove unused function.
769             (Dwp_output_file::finalize): Add support for v2 package file format.
770             (Dwp_output_file::write_index): Likewise.
771             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
772             function prototype.
773
774 2013-07-31  Cary Coutant  <ccoutant@google.com>
775
776         * object.cc (Sized_relobj::do_output_section_address): New function.
777         (Sized_relobj): Instantiate explicitly.
778         * object.h (Object::output_section_address): New function.
779         (Object::do_output_section_address): New function.
780         (Sized_relobj::do_output_section_address): New function.
781         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
782
783 2013-07-30  Cary Coutant  <ccoutant@google.com>
784             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
785
786         * parameters.cc (Parameters::entry): Return target-specific entry
787         symbol name.
788         * target.h (Target::entry_symbol_name): New function.
789         (Target_info::entry_symbol_name): New data member.
790
791         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
792         * i386.cc (Target_i386::i386_info): Likewise.
793         (Target_i386_nacl::i386_nacl_info): Likewise.
794         * sparc.cc (Target_sparc::sparc_info): Likewise.
795         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
796         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
797         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
798         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
799
800 2013-07-22  Sterling Augustine  <saugustine@google.com>
801
802         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
803         Convert parameter shndx to local variable. Add parameters symtab
804         and symtab_size.  Scan over section names.  Find relocation
805         section corresponding to current section.  Create and initialize
806         reloc_mapper_ and reloc_type_.
807         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
808         unit_length to off_t.  Initialize member unit_length_.  Fill in field
809         cu_offset_.
810         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
811         Initialize new fields unit_length_ and cu_offset_.
812         (Dwarf_pubnames_table::read_section): Update prototype.
813         (Dwarf_pubnames_table::cu_offset): New member function.
814         (Dwarf_pubnames_table::subsection_size): Likewise.
815         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
816         New fields.
817         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
818         member functions public.
819         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
820         Update comment.  Rework logic.  Move repeated parts to...
821         (Gdb_index_info_reader::read_pubtable): ...here. New function.
822         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
823         pubtypes_table_, and stmt_list_offset.
824         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
825         Gdb_index::find_pubtype_offset,
826         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
827         (Gdb_index::pubnames_read): Update prototype and rework logic.
828         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
829         Forward declare.
830         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
831         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
832         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
833         Gdb_index::map_pubtable_to_dies):
834         Declare functions.
835         (Gdb_index::pubnames_read): Update declaration.
836         (Gdb_index::Pubname_offset_map): New type.
837         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
838         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
839         Gdb_index::stmt_list_offset): Declare.
840         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
841         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
842         Gdb_index::pubtypes_offset_): Remove.
843
844 2013-07-19  Roland McGrath  <mcgrathr@google.com>
845
846         * options.h (General_options): Add -Trodata-segment option.
847         * parameters.cc (Parameters::check_rodata_segment): New function.
848         (Parameters::set_target_once): Call it.
849         * parameters.h (Parameters): Declare it (private member function).
850         * layout.cc (load_seg_unusable_for_headers): New function, broken
851         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
852         then validate rodata segment rather than text segment.
853         (relaxation_loop_body): Call that.
854         (is_text_segment): New function.  Don't admit a non-executable
855         segment if TARGET->isolate_execinstr().
856         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
857
858 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
859
860         PR gold/15070
861         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
862         * nacl.h (Sniff_file::View::View): Request aligned view.
863
864 2013-07-11  Cary Coutant  <ccoutant@google.com>
865
866         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
867         correct BRLT entry size.
868
869 2013-07-03  Alan Modra  <amodra@gmail.com>
870
871         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
872         comment.
873
874 2013-07-01  Cary Coutant  <ccoutant@google.com>
875
876         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
877         reloc_type_.
878         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
879         (Dwarf_ranges_table::lookup_reloc): New function.
880         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
881         reloc_type_.
882         (Dwarf_ranges_table::lookup_reloc): New function.
883         (Dwarf_ranges_table::reloc_type_): New data member.
884
885 2013-06-27  Jing Yu  <jingyu@google.com>
886
887         PR gold/15662
888         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
889         function.
890         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
891         (Target_powerpc::do_relax): Call the above.
892
893 2013-06-27  Cary Coutant  <ccoutant@google.com>
894
895         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
896         on garbage collected .opd section.
897
898 2013-06-27  Alan Modra  <amodra@gmail.com>
899
900         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
901         is non-zero.
902         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
903         (Target_powerpc::do_function_location): Likewise for loc->shndx.
904
905 2013-06-14  Cary Coutant  <ccoutant@google.com>
906
907         * resolve.cc (Symbol::override_base): Don't override st_type
908         from plugin placeholder symbols.
909         (Symbol_table::resolve): Likewise.
910         (Symbol_table::should_override): Don't complain about TLS mismatch
911         if the TO symbol is a plugin placeholder.
912         * testsuite/Makefile.am (plugin_test_tls): New test.
913         * testsuite/Makefile.in: Regenerate.
914         * testsuite/plugin_test_tls.sh: New test script.
915         * testsuite/two_file_test_2_tls.cc: New test source.
916         * testsuite/two_file_test_tls.cc: New test source.
917
918 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
919
920         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
921         the maximum segment alignment is larger than the page size.
922         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
923         correctly aligns the symbols with large alignemnt.
924         * testsuite/Makefile.in: Regenerate.
925         * testsuite/large_symbol_alignment.cc: New file.
926
927 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
928             Sriraman Tallam  <tmsriram@google.com>
929
930         * options.h (sort_section): New option.
931         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
932         Rename from Input_section_sort_section_name_special_ordering_compare.
933         (Input_section_sort_section_name_compare): New struct.
934         * output.cc (Output_section::Input_section_sort_section_name_compare::
935         operator()): New function.
936         (Output_section::sort_attached_input_sections): Use new sort function
937         for .text if --sort-section=name is specified.
938         * layout.cc (Layout::make_output_section):
939         Add sorting by name when --sort-section=name is specified.
940         * testsuite/Makefile.am (text_section_grouping): Test option
941         --sort-section=name.
942         * testsuite/Makefile.in: Regenerate.
943         * testsuite/section_sorting_name.cc: New file.
944         * testsuite/section_sorting_name.sh: New file.
945
946 2013-05-21  Cary Coutant  <ccoutant@google.com>
947
948         * symtab.h (Symbol::is_cxx_vtable): New function.
949         * target-reloc.h (relocate_section): Check for vtable symbol.
950         * testsuite/Makefile.am (missing_key_func.sh): New test case.
951         * testsuite/Makefile.in: Regenerate.
952         * testsuite/missing_key_func.cc: New test source.
953         * testsuite/missing_key_func.sh: New test script.
954
955 2013-05-21  Cary Coutant  <ccoutant@google.com>
956
957         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
958         type of enclosing symbol.
959         (Relocate_info::location): Check symbol type when describing symbol.
960         * object.h (Symbol_location_info): Remove unused line_number;
961         add enclosing_symbol_type.
962         * testsuite/debug_msg.sh: Adjust expected output.
963
964 2013-05-13  Cary Coutant  <ccoutant@google.com>
965
966         * configure.ac: Export DEFAULT_TARGET.
967         * configure: Regenerate.
968         * Makefile.in: Regenerate.
969         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
970         * testsuite/Makefile.in: Regenerate.
971         * testsuite/debug_msg.sh: Delete duplicate tests.
972         Don't check undef_int error message match for powerpc where the
973         source file and line number aren't available.
974
975 2013-05-10  Roland McGrath  <mcgrathr@google.com>
976
977         * options.h (General_options): Add --rosegment-gap option.
978         * options.cc (finalize): --rosegment-gap implies --rosegment.
979         * layout.cc (set_segment_offsets): Let user option override
980         target->rosegment_gap().
981
982 2013-05-10  Roland McGrath  <mcgrathr@google.com>
983
984         * options.h (General_options): Remove leading space from help
985         messages for -nostdlib and --rosegment.
986
987 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
988
989         PR ld/15365
990         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
991
992 2013-05-03  Alan Modra  <amodra@gmail.com>
993
994         * merge.cc (Output_merge_string::do_add_input_section): Correct
995         scan for number of strings.  Rename vars to avoid shadowing.
996         Include missing terminator in input_size_.
997
998 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
999
1000         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
1001         Restore empty string handling.
1002
1003 2013-05-01  Cary Coutant  <ccoutant@google.com>
1004
1005         * stringpool.cc (Stringpool_template::new_key_offset): Fix
1006         uninitialized warning.
1007
1008 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1009
1010         * output.cc (Output_section::add_merge_input_section): Allow
1011         to merge sections if the alignment is more than character size.
1012         * merge.h (Output_merge_string::Output_merge_string): Remove
1013         assert.
1014         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
1015         only not-null strings. Check the alignment of strings.
1016         * stringpool.h
1017         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
1018         alignment as the argument.
1019         (Stringpool_template<Stringpool_char>::addralign_): New class member.
1020         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
1021         Align non-zero length strings according to the addralign_.
1022         (Stringpool_template<Stringpool_char>::set_string_offsets):
1023         Updating offsets according to the given alignment.
1024         * testsuite/Makefile.am (text_section_grouping): Test if string
1025         literals are getting merged.
1026         * testsuite/Makefile.in: Regenerate.
1027         * testsuite/merge_string_literals_1.c: New file.
1028         * testsuite/merge_string_literals_2.c: Ditto.
1029         * testsuite/merge_string_literals.sh: Ditto.
1030
1031 2013-04-26  Ian Lance Taylor  <iant@google.com>
1032
1033         * target-reloc.h (relocate_section): If the reloc offset is out of
1034         range, pass VIEW as NULL to relocate.relocate.
1035         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
1036         * i386.cc (Target_i386::Relocate::relocate): Likewise.
1037         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
1038         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
1039         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
1040         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
1041
1042 2013-04-26  Geoff Pike  <gpike@chromium.org>
1043
1044         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
1045         * layout.cc (Hash_task): New class.
1046         (Layout::queue_build_id_tasks): New function.
1047         (Layout::write_build_id): Handle single-thread portion of build ID
1048         computation.  (In some cases, all of it is single-threaded.)  Replace
1049         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
1050         functionality in fewer lines of code.
1051         * layout.h (Layout::queue_build_id_tasks): New function declaration.
1052         * options.h (General_options): make "--build-id" default to tree
1053         rather than sha1.  Add two new options related to --build-id=tree:
1054         --build-id-chunk-size-for-treehash and
1055         --build-id-min-file-size-for-treehash.
1056         * Makefile.am: add testing of --build-id=tree and related new options
1057         (these tests will be invoked by "make check").
1058         * Makefile.in: Regenerate.
1059
1060 2013-04-25  Alan Modra  <amodra@gmail.com>
1061
1062         * configure.tgt: Add powerpcle and powerpc64le.
1063
1064 2013-04-22  Alan Modra  <amodra@gmail.com>
1065
1066         PR gold/15355
1067         * layout.cc (Layout::segment_precedes): Allow more than one
1068         segment with the same type and flags.
1069
1070 2013-04-15  Cary Coutant  <ccoutant@google.com>
1071
1072         * layout.cc (Layout::set_relocatable_section_offsets): Don't
1073         allocate space in file for BSS sections.
1074
1075 2013-04-15  Cary Coutant  <ccoutant@google.com>
1076
1077         * script-sections.cc (Orphan_output_section): Reset address
1078         to zero after each orphaned section for relocatable links.
1079
1080 2013-04-15  Cary Coutant  <ccoutant@google.com>
1081
1082         * symtab.cc (Symbol_table::sized_write_globals): Subtract
1083         section starting address for relocatable link.
1084         * testsuite/Makefile.am (script_test_11): New test.
1085         * testsuite/Makefile.in: Regenerate.
1086         * testsuite/script_test_11.c: New source file.
1087         * testsuite/script_test_11.t: New linker script.
1088
1089 2013-04-13  Alan Modra  <amodra@gmail.com>
1090
1091         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
1092         owner when sections are not adjacent and exceed group size.
1093         (Target_powerpc::group_sections): Handle corner case.
1094         (Target_powerpc::Branch_info::make_stub): Handle case where
1095         stub table doesn't exist due to branches in non-exec sections.
1096         (Target_powerpc::Relocate::relocate): Likewise.
1097
1098 2013-04-11  Alan Modra  <amodra@gmail.com>
1099
1100         PR gold/15354
1101         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
1102         .branch_lt to match bfd ld.  Adjust comments throughout file.
1103
1104 2013-04-04  Ian Lance Taylor  <iant@google.com>
1105
1106         GCC PR c++/56840
1107         * object.cc (do_layout_deferred_sections): Handle .eh_frame
1108         sections before checking whether they are included in the link.
1109
1110 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
1111
1112         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
1113         object before calling the plugin claim_file handler.  Pass the elf
1114         object of the archive to the plugin. Delete the elf object if the
1115         plugin claims the file.
1116
1117 2013-03-21  Alan Modra  <amodra@gmail.com>
1118
1119         * layout.cc (Layout::set_segment_offsets): Accept writable .text
1120         segment when omagic.
1121
1122 2013-03-21  Alan Modra  <amodra@gmail.com>
1123
1124         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
1125         comparison warning.
1126         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
1127         uninitialized" warning.
1128
1129 2013-03-20  Alan Modra  <amodra@gmail.com>
1130
1131         * symtab.h (Symbol::clear_version): New function.
1132         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
1133         is_needed by weak references.  Clear version for symbols defined
1134         in as-needed objects that are not needed.
1135
1136 2013-03-15  Alan Modra  <amodra@gmail.com>
1137
1138         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
1139         static and public.  Add report_err param.  Return false for data refs.
1140         (Target_powerpc::rela_dyn_section): New overloaded function.
1141         (Target_powerpc::plt_, iplt_): Elucidate.
1142         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
1143         (Output_data_plt_powerpc::do_write): Don't write .iplt.
1144         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
1145         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
1146         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
1147         push_branch and make_plt_entry for ifunc syms when
1148         reloc_needs_plt_for_ifunc.
1149         (Target_powerpc::Relocate::relocate): Don't use plt entry value
1150         for ifunc unless reloc_needs_plt_for_ifunc.
1151
1152 2013-03-15  Alan Modra  <amodra@gmail.com>
1153
1154         * gc.h (gc_process_relocs): Don't look through function descriptors.
1155         * icf.cc (get_section_contents): Do so here instead.
1156
1157 2013-03-13  Alan Modra  <amodra@gmail.com>
1158
1159         * powerpc.cc (is_branch_reloc): Forward declare.
1160         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
1161         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
1162         false for 64-bit, true for 32-bit non-branch relocs.
1163         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
1164         * testsuite/Makefile.am (icf_test): Use linker map file instead of
1165         nm output.
1166         (icf_safe_test): Generate linker map file as well as nm output.
1167         (icf_safe_so_test): Likewise.
1168         * testsuite/Makefile.in: Regenerate.
1169         * testsuite/icf_test.sh: Parse linker map file to determine
1170         section folding.
1171         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
1172         * testsuite/icf_safe_so_test.sh: Likewise.
1173         (X86_32_or_ARM_specific_safe_fold): Merge into..
1174         (arch_specific_safe_fold): ..this.
1175         (X86_64_specific_safe_fold): Delete unused function.
1176
1177 2013-03-12  Alan Modra  <amodra@gmail.com>
1178
1179         * gc.h (gc_process_relocs): Look through function descriptors
1180         to determine shndx, symvalue and addend used by ICF.  Tidy
1181         variable duplication.
1182
1183 2013-03-11  Alan Modra  <amodra@gmail.com>
1184
1185         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
1186         * layout.cc (Layout_task_runner::run): ..to here.
1187         * symtab.h (struct Symbol_location): Extract from..
1188         (class Symbol_table): ..here.
1189         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
1190         * target.h (class Target): Add function_location and
1191         do_function_location functions.
1192         (class Sized_target): Add do_function_location.
1193         * object.h (class Sized_relobj_file): Move find_shdr..
1194         (class Object): ..to here.
1195         * object.cc: Likewise.  Update to suit.  Instantiate.
1196         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
1197         * powerpc.cc (class Powerpc_dynobj): New.
1198         (Target_powerpc::do_function_location): New function.
1199         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
1200         (Powerpc_dynobj::do_read_symbols): New function.
1201         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
1202
1203 2013-03-08  Ian Lance Taylor  <iant@google.com>
1204
1205         * options.cc (General_options::string_to_object_format): Accept
1206         "default".
1207
1208 2013-03-08  Alan Modra  <amodra@gmail.com>
1209
1210         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
1211         pointer to Post_fde.
1212         (struct Post_fde): Move definition to here..
1213         * ehframe.cc (struct Post_fde): ..from here.
1214         (Cie::write): Don't alloc Post_fde.
1215         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
1216
1217 2013-03-07  Alan Modra  <amodra@gmail.com>
1218
1219         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
1220         relocation referencing .LC0.
1221         * testsuite/discard_locals_test.sh: Remove FIXMEs.
1222
1223 2013-03-07  Alan Modra  <amodra@gmail.com>
1224
1225         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
1226         always_inline.  Add assembly for powerpc to avoid GOT.
1227
1228 2013-03-07  Alan Modra  <amodra@gmail.com>
1229
1230         * testsuite/script_test_10.sh: Don't test .bss section
1231         header number.
1232
1233 2013-03-06  Alan Modra  <amodra@gmail.com>
1234
1235         * powerpc.cc (class Powerpc_relobj): Move some member functions.
1236         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
1237         all callers.  Handle folded sections.
1238         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
1239         to Powerpc_relobj.
1240         (Global_symbol_visitor_opd::operator()): Likewise.
1241
1242 2013-03-04  Alan Modra  <amodra@gmail.com>
1243
1244         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
1245         * testsuite/Makefile.in: Regenerate.
1246
1247 2013-03-01  Cary Coutant  <ccoutant@google.com>
1248
1249         Add dwp support for v2 DWARF package file format.
1250         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1251         tu_length parameter.  Adjust all callers.
1252         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1253         * dwp.cc: Include dwarf.h.
1254         (Section_bounds): New struct type.
1255         (Unit_set): New struct type.
1256         (Dwo_file::Dwo_file): Initialize new data member.
1257         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1258         Combine and rename to...
1259         (Dwo_file::read_unit_index): ...this.
1260         (Dwo_file::sized_read_compunit_index)
1261         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1262         (Dwo_file::sized_read_unit_index): ...this.
1263         (Dwo_file::copy_section): Remove section_name, is_str_offsets
1264         parameters; add section_id parameter.
1265         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1266         (Dwo_file::add_unit_set): ...this.
1267         (Dwo_file::shndx_map_): Remove.
1268         (Dwo_file::sect_offsets_): New data member.
1269         (Dwp_output_file::Dwp_output_file): Initialize new data members.
1270         (Dwp_output_file::add_section): Rename to...
1271         (Dwp_output_file::add_contribution): ...this.
1272         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1273         (Dwp_output_file::add_tu_set): Likewise.
1274         (Dwp_output_file::Contribution): New type.
1275         (Dwp_output_file::Section::contributions): New data member.
1276         (Dwp_output_file::Cu_or_tu_set): Remove.
1277         (Dwp_output_file::Section::Section): New ctor.
1278         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1279         (Dwp_output_file::Dwp_index::Section_table): New type.
1280         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1281         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1282         parameter.
1283         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1284         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1285         (Dwp_output_file::Dwp_index::section_table): New member function.
1286         (Dwp_output_file::Dwp_index::section_table_end): New member function.
1287         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1288         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1289         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1290         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1291         (Dwp_output_file::Dwp_index::section_table_): New data member.
1292         (Dwp_output_file::Dwp_index::section_mask_): New data member.
1293         (Dwp_output_file::add_output_section): New member function.
1294         (Dwp_output_file::write_new_section): New member function.
1295         (Dwp_output_file::write_contributions): New member function.
1296         (Dwp_output_file::section_id_map_): New data member.
1297         (class Dwo_id_info_reader): Remove.
1298         (class Unit_reader): New class.
1299         (get_dwarf_section_name): New function.
1300         (Dwo_file::read_executable): Adjust initializations of class data.
1301         (Dwo_file::read): Add support for v2 package file format.
1302         (Dwo_file::read_unit_index): Likewise.
1303         (Dwo_file::sized_read_unit_index): Likewise.
1304         (Dwo_file::copy_section): Likewise.
1305         (Dwo_file::add_unit_set): Likewise.
1306         (Dwp_output_file::add_output_section): Likewise.
1307         (Dwp_output_file::add_contribution): Likewise.
1308         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1309         for empty slot.
1310         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1311         file format.
1312         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1313         slot.
1314         (Dwp_output_file::initialize): Remove unused function.
1315         (Dwp_output_file::finalize): Add support for v2 package file format.
1316         (Dwp_output_file::write_index): Likewise.
1317         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1318         function prototype.
1319
1320 2013-03-01  Cary Coutant  <ccoutant@google.com>
1321
1322         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
1323         function into class definition in header file.
1324         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
1325         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
1326         New function.
1327         (Dwarf_info_reader::check_buffer): Move here from .cc file.
1328
1329 2013-02-28  Alan Modra  <amodra@gmail.com>
1330
1331         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
1332         * target.cc (Target::do_plt_fde_location): New function.
1333         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
1334         accessor function, and constructor param.
1335         (struct Post_fde, Post_fdes): Declare.
1336         (Cie::write): Add post_fdes param.
1337         * ehframe.cc (Fde::write): Use plt_fde_location.
1338         (struct Post_fde): Define.
1339         (Cie::write): Stash FDEs added post merge mapping.
1340         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
1341         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
1342         (Eh_frame::do_sized_write): Arrange to write post map FDES after
1343         other FDEs.
1344         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
1345         (Target_powerpc::has_glink): New function.
1346         (Target_powerpc::do_relax): Add eh_frame info for stubs.
1347         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
1348         glink_eh_frame_fde_32, default_fde): New data.
1349         (Stub_table::eh_frame_added_): New var.
1350         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
1351         Make const.
1352         (Stub_table::add_eh_frame): New function.
1353         (Output_data_glink::add_eh_frame): New function.
1354         (Target_powerpc::make_glink_section): Call add_eh_frame.
1355
1356 2013-02-15  Ian Lance Taylor  <iant@google.com>
1357
1358         * options.h (DEFINE_uint64_alias): Define.
1359         (class General_options): Add -Ttext-segment as an alias for
1360         -Ttext.
1361
1362 2013-02-15  Alan Modra  <amodra@gmail.com>
1363
1364         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
1365         (Stub_table::do_write): ..here, two places.
1366         (Stub_table::plt_call_size): Use it here too.
1367
1368 2013-02-11  Ian Lance Taylor  <iant@google.com>
1369
1370         * descriptors.cc (Descriptors::close_all): New function.
1371         * descriptors.h (class Descriptors): Declare close_all.
1372         (close_all_descriptors): New inline function.
1373         * plugin.cc: Include "descriptors.h".
1374         (Plugin_manager::cleanup): Call close_all_descriptors.
1375
1376 2013-02-06  Alan Modra  <amodra@gmail.com>
1377
1378         * README: Update coding style link.
1379
1380 2013-01-28  Cary Coutant  <ccoutant@google.com>
1381
1382         * dwp.cc (File_list): New typedef.
1383         (Dwo_name_info_reader): New class.
1384         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
1385         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
1386         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
1387         (Dwo_file::read_executable): New function.
1388         (Dwo_file::read): Move common setup code to ...
1389         (Dwo_file::make_object): ... here.
1390         (dwp_options): Add --exec/-e.
1391         (usage): Likewise.
1392         (main): Likewise.
1393
1394 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
1395
1396         * layout.cc (Layout::layout): Check for option text_reorder.
1397         (Layout::make_output_section): Ditto.
1398         * options.h (text_reorder): New option.
1399         * output.cc (Input_section_sort_compare): Remove special ordering
1400         of section names.
1401         (Output_section::
1402          Input_section_sort_section_name_special_ordering_compare::
1403          operator()): New function.
1404         (Output_section::sort_attached_input_sections): Use new sort function
1405         for .text.
1406         * output.h (Input_section_sort_section_name_special_ordering_compare):
1407         New struct.
1408         * testsuite/Makefile.am (text_section_grouping): Test option
1409         --no-text-reorder
1410         * testsuite/Makefile.in: Regenerate.
1411         * testsuite/text_section_grouping.sh: Check order of functions without
1412         default text reordering.
1413
1414 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1415
1416         * options.h (General_options): Change default to true for new_dtags.
1417
1418 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1419
1420         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
1421         when enable_new_dtags is false.  Only add DT_RUNPATH when
1422         enable_new_dtags is true.
1423
1424 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
1425
1426         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
1427         used in declaration and definition consistent.
1428         (Target_powerpc::symval_for_branch): Ditto.
1429
1430 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1431
1432         * testsuite/plugin_final_layout.cc: Fix comment.
1433
1434 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1435
1436         * layout.cc (Layout::layout): Do not do default sorting for
1437         text sections when section ordering is specified.
1438         (make_output_section): Ditto.
1439         * testsuite/plugin_final_layout.cc: Name the function sections
1440         to catch reordering issues.
1441
1442 2013-01-15  Alan Modra  <amodra@gmail.com>
1443
1444         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
1445         plt-thread-safe.
1446
1447 2013-01-15  Alan Modra  <amodra@gmail.com>
1448
1449         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
1450         * testsuite/Makefile.in: Regenerate.
1451
1452 2013-01-14  Alan Modra  <amodra@gmail.com>
1453
1454         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
1455         * testsuite/Makefile.in: Regenerate.
1456
1457 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
1458
1459         PR bfd/14430
1460         Fix mingw gold build with plugins enabled
1461         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
1462         * configure.ac: Export DLOPEN_LIBS and add headers check.
1463         * plugin.cc: Handle non-dlfcn case.
1464         * Makefile.in: Regenerate.
1465         * config.in: Regenerate.
1466         * configure: Regenerate.
1467         * testsuite/Makefile.in: Regenerate.
1468
1469 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
1470
1471         * output.h (sort_attached_input_sections): Change to be public.
1472         * script-sections.cc
1473         (Output_section_definition::set_section_addresses): Sort
1474         attached input sections according to section order before linker
1475         script assigns section addresses.
1476         (Orphan_output_section::set_section_addresses): Sort
1477         attached input sections according to section order before linker
1478         script assigns section addresses.
1479         * Makefile.am (final_layout.sh): Use a simple linker script to
1480         check if section ordering still works.
1481         * Makefile.in: Regenerate.
1482
1483 2013-01-09  Ben Cheng  <bccheng@google.com>
1484
1485         * arm.cc (Target_arm::attributes_accept_div): New function.
1486         (Target_arm::attributes_forbid_div): New function.
1487         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
1488         attribute using the same new functions as what bfd/elf32_arm.c
1489         does.
1490
1491 2013-01-07  Cary Coutant  <ccoutant@google.com>
1492
1493         PR gold/14993
1494         * output.cc (Output_section::add_input_section): For incremental
1495         updates, don't track input sections that are allocated from patch
1496         space.
1497
1498 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1499             Ian Lance Taylor  <iant@google.com>
1500
1501         PR gold/14897
1502         * configure.ac (--enable-ld): Removed.
1503         (install_as_default): Set to yes only for --enable-gold=default
1504         or --disable-ld.
1505         * configure: Regenerated.
1506
1507 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1508
1509         * options.h (General_options): Add -fuse-ld= for GCC linker
1510         option compatibility.
1511
1512 2013-01-04  Cary Coutant  <ccoutant@google.com>
1513
1514         * configure.ac: Fix typo restoring CXXFLAGS.
1515         * configure: Regenerate.
1516
1517 2013-01-04  Cary Coutant  <ccoutant@google.com>
1518
1519         * testsuite/Makefile.am (CXXLINK_S): New macro.
1520         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
1521         * testsuite/Makefile.in: Regenerate.
1522
1523 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
1524
1525         * version.cc (print_version): Update copyright year to 2013.
1526
1527 2012-12-20  Ian Lance Taylor  <iant@google.com>
1528
1529         * layout.cc (Layout::special_ordering_of_input_section): New
1530         function.
1531         (Layout::layout): If input section requires special ordering, must
1532         sort input sections.
1533         (Layout::make_output_section): May sort .text input sections.
1534         (Layout::is_section_name_prefix_grouped): Remove.
1535         * layout.h (class Layout): Declare
1536         special_ordering_of_input_section.  Don't declare
1537         is_section_name_prefix_grouped.
1538         * output.cc (Output_section::add_input_section): Revert last
1539         change.
1540         (Output_section::Input_section_sort::match_file_name): Don't crash
1541         if called on output section data.
1542         (Output_section::Input_section_sort_compare): Sort based on
1543         special ordering.
1544         (Output_section::Input_section_sort_section_order_index_compare):
1545         Revert last patch.
1546         (Output_section::sort_attached_input_sections): Likewise.
1547
1548 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
1549
1550         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
1551         * layout.h (Layout::is_section_name_prefix_grouped): New function.
1552         * output.cc (Output_section::add_input_section): Check if section
1553         name contains special prefix.  Keep input sections to sort such
1554         sections.
1555         (Output_section::Input_section_sort_section_order_index_compare
1556          ::operator()): Group sections according to prefixes.
1557         (Output_section::sort_attached_input_sections): Add condition to
1558         Input_section_entry constructor call.
1559         * testsuite/Makefile.am (text_section_grouping): New test.
1560         * testsuite/Makefile.in: Regenerate.
1561         * testsuite/text_section_grouping.cc: New file.
1562         * testsuite/text_section_grouping.sh: New file.
1563
1564 2012-12-17  Nick Clifton  <nickc@redhat.com>
1565
1566         * Makefile.am: Add copyright notice.
1567         * NEWS: Likewise.
1568         * README: Likewise.
1569         * configure.ac: Likewise.
1570         * ftruncate.c: Likewise.
1571         * Makefile.in: Regenerate.
1572
1573 2012-12-14  Cary Coutant  <ccoutant@google.com>
1574
1575         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
1576         --no-as-needed flag.
1577         (exception_separate_shared_12_test): Likewise.
1578         (incremental_copy_test): Likewise.
1579         * testsuite/Makefile.in: Regenerate.
1580
1581 2012-12-14  Cary Coutant  <ccoutant@google.com>
1582
1583         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
1584         (Dwp_output_file::Dwp_index::enter_set): Add assert.
1585
1586 2012-12-12  Alan Modra  <amodra@gmail.com>
1587
1588         * powerpc.cc (class Track_tls): New.
1589         (class Relocate, class Scan): Inherit Track_tls.
1590         (Target_powerpc::Scan::local, global): Track tls optimization
1591         and avoid creating plt entry for __tls_get_addr if all uses
1592         are optimized away.
1593         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
1594
1595 2012-12-12  Alan Modra  <amodra@gmail.com>
1596
1597         * options.h (General_options): Add --toc-sort/--no-toc-sort.
1598         Replace no_toc_optimize with toc_optimize.
1599         * output.h (Output_section::input_sections): Provide non-const variant.
1600         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
1601         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
1602         accessors.
1603         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
1604         (class Sort_toc_sections): New.
1605         (Target_powerpc::do_finalize_sections): Sort toc sections.
1606         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
1607
1608 2012-12-10  Roland McGrath  <mcgrathr@google.com>
1609
1610         * testsuite/binary_unittest.cc (read_all): New function.
1611         (Sized_binary_test): Use it instead of ::read.
1612         * fileread.cc (do_read): Don't assume pread always reads the whole
1613         amount in a single call.
1614
1615 2012-12-10  Alan Modra  <amodra@gmail.com>
1616
1617         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
1618         Set EM_PPC64 or EM_PPC here.
1619         (Target_selector_powerpc::do_recognize): Delete.
1620
1621 2012-12-10  Alan Modra  <amodra@gmail.com>
1622
1623         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
1624         stub_table_.
1625         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
1626
1627 2012-12-07  Roland McGrath  <mcgrathr@google.com>
1628
1629         * testsuite/binary_unittest.cc (Sized_binary_test):
1630         Use open_descriptor rather than ::open.
1631
1632 2012-12-07  Alan Modra  <amodra@gmail.com>
1633
1634         * powerpc.cc (Stub_table::do_write): Delete redundant Address
1635         typedef and invalid_address constant.
1636         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
1637         instantiate constants.
1638
1639 2012-12-06  Roland McGrath  <mcgrathr@google.com>
1640
1641         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
1642         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
1643         * aclocal.m4: Regenerate.
1644         * configure: Regenerate.
1645         * Makefile.in: Regenerate.
1646         * testsuite/Makefile.in: Regenerate.
1647
1648 2012-12-07  Alan Modra  <amodra@gmail.com>
1649
1650         * options.h (General_options): Add no_toc_optimize.
1651         * powerpc.cc (ok_lo_toc_insn): New function.
1652         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
1653
1654 2012-12-06  Alan Modra  <amodra@gmail.com>
1655
1656         * options.h (General_options): Add plt_align, plt_static_chain,
1657         plt_thread_safe.  Update stub_group_size help text.
1658         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
1659         for new plt_thread_safe_ var.
1660         (use_plt_offset): Correct comments.
1661         (Target_powerpc::do_relax): Look for thread creation symbols to
1662         determine default plt_thread_safe value.  Clear plt call stubs
1663         as well as branch stubs each iteration.
1664         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
1665         insn constants.
1666         (l, hi, ha, write_insn): Move earlier.
1667         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
1668         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
1669         plt stubs too.
1670         (Stub_table::update_size): Adjust.
1671         (Stub_table::prev_size, set_prev_size): Delete.
1672         (Stub_table::stub_align): Let --plt-align affect result.
1673         (Stub_table::plt_call_size): Calculate sizes for various stubs.
1674         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
1675         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
1676         (Stub_table::do_write): Support more stub variants.
1677
1678 2012-12-04  Alan Modra  <amodra@gmail.com>
1679
1680         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
1681         (Target_powerpc::do_define_standard_symbols): New function.
1682
1683 2012-12-03  Alan Modra  <amodra@gmail.com>
1684
1685         * output.h: Formatting, whitespace.
1686
1687 2012-12-03  Alan Modra  <amodra@gmail.com>
1688
1689         * layout.h (Layout::get_executable_sections): Declare.
1690         * layout.cc (Layout::get_executable_sections): New function.
1691         * arm.cc (Target_arm::group_sections): Use it.
1692         (Arm_output_section::group_sections): Delete now redundant test.
1693         * output.cc (Output_reloc::Output_reloc): Add is_relative.
1694         param to handle relative relocs.
1695         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
1696         (Output_data_reloc::add_absolute): Adjust.
1697         (Output_data_reloc::add_relative): New function.
1698         (Output_data::reset_data_size): New function.
1699         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
1700         (Output_section::set_addralign): New function.
1701         (Output_section::checkpoint_set_addralign): New function.
1702         (Output_section::clear_section_offsets_need_adjustment): New function.
1703         (Output_section::input_sections): Make public.
1704         * powerpc.cc (class Output_data_brlt_powerpc): New.
1705         (class Stub_table, class Stub_control): New.
1706         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
1707         stub_table_, set_stub_table, stub_table): New vectors and accessor
1708         functions.
1709         (Target_powerpc::do_may_relax, do_relax, push_branch,
1710         new_stub_table, stub_tables, brlt_section, group_sections,
1711         add_branch_lookup_table, find_branch_lookup_table,
1712         write_branch_lookup_table, make_brlt_section): New functions.
1713         (Target_powerpc::struct Sort_sections, class Branch_info): New.
1714         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
1715         branch_info_): New vars.
1716         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
1717         make call stubs here.
1718         (Output_data_glink): Remove all call stub handling from this class.
1719         (Target_powerpc::Scan::local, global): Save interesting branch
1720         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
1721         (Target_powerpc::do_finalize_sections): Only make reg save/restore
1722         functions on final link.
1723         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
1724         Handle long branch destinations too.
1725         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
1726         do_plt_address_for_local): Adjust lookup of plt call stubs.
1727
1728 2012-11-30  Alan Modra  <amodra@gmail.com>
1729
1730         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
1731         relocs against protected symbols when building 32-bit shared libs.
1732
1733 2012-11-30  Alan Modra  <amodra@gmail.com>
1734
1735         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
1736         param.  Call got_section() to make .got.  Update all callers
1737         and their callers and so on.
1738
1739 2012-11-30  Alan Modra  <amodra@gmail.com>
1740
1741         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
1742         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
1743         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
1744         value if it already exists.
1745
1746 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
1747
1748         PR gold/14858
1749         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
1750
1751 2012-11-14  Roland McGrath  <mcgrathr@google.com>
1752
1753         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
1754         than bfc instruction for data sandboxing.
1755
1756 2012-11-08  Alan Modra  <amodra@gmail.com>
1757
1758         * po/POTFILES.in: Regenerate.
1759
1760 2012-11-05  Alan Modra  <amodra@gmail.com>
1761
1762         * configure.ac: Apply 2012-09-10 change to config.in here.
1763         * configure: Regenerate.
1764
1765 2012-11-05  Alan Modra  <amodra@gmail.com>
1766
1767         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
1768         (struct Opd_ent): Use "Address" rather than "Offset".
1769         (Output_data_got_powerpc::got_base_offset): Return Valtype.
1770         (Target_powerpc::got_section): Make public.
1771         (Target_powerpc::scan_relocs): Move code setting symbols..
1772         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
1773         Create _SDA_BASE_ only when referenced.
1774
1775 2012-11-02  Roland McGrath  <mcgrathr@google.com>
1776
1777         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
1778         from last change.
1779
1780 2012-11-01  Roland McGrath  <mcgrathr@google.com>
1781
1782         * target.h (Sized_target::relocate_relocs): Use Elf_Off
1783         for offset_in_output_section parameter.
1784         (Sized_target::relocate_special_relocatable): Likewise.
1785         * arm.cc (Target_arm::relocate_relocs): Likewise.
1786         (Target_arm::relocate_special_relocatable): Likewise.
1787         * i386.cc (Target_i386::relocate_relocs): Likewise.
1788         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
1789         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
1790         * target-reloc.h (relocate_relocs): Likewise.
1791         * testsuite/testfile.cc (Target_test): Likewise.
1792         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
1793         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
1794
1795         * system.h: Move inclusion of <clocale> to after <libintl.h> in
1796         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
1797
1798         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
1799         parameter, which is unused in the [!F_SETFD] case.
1800
1801         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
1802         SYMNDX to off_t before comparing it to this->data_size().
1803         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
1804         * incremental.cc (Output_section_incremental_inputs::do_write):
1805         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
1806
1807         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
1808
1809 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
1810
1811         * gold.cc (Target_arm::do_adjust_elf_header): Add the
1812         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
1813         in EABI_VER5.
1814
1815 2012-10-29  Cary Coutant  <ccoutant@google.com>
1816
1817         * dwp.cc (usage): Add file and exit status parameters;
1818         add --help and --version options.
1819         (print_version): New function.
1820         (main): Add --help and --version options.
1821
1822 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1823
1824         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
1825         final_layout_sequence.txt.
1826         * testsuite/Makefile.in: Regenerated.
1827
1828 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1829
1830         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
1831         COMPILE generated by automake.
1832         (LINK1): Likewise.
1833         (CXXCOMPILE1): Likewise.
1834         (CXXLINK1): Likewise.
1835         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
1836         (LINK): Likewise.
1837         (CXXCOMPILE): Likewise.
1838         (CXXLINK): Likewise.
1839         * testsuite/Makefile.in: Regenerated.
1840
1841 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1842
1843         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
1844         on bad fwrite return.
1845
1846 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1847
1848         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
1849         on val.
1850
1851 2012-10-23  Cary Coutant  <ccoutant@google.com>
1852
1853         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
1854         * testsuite/Makefile.in: Regenerate.
1855         * testsuite/dwp_test.h: New source file.
1856         * testsuite/dwp_test_1.cc: New source file.
1857         * testsuite/dwp_test_1.s: New source file.
1858         * testsuite/dwp_test_1.sh: New source file.
1859         * testsuite/dwp_test_1b.cc: New source file.
1860         * testsuite/dwp_test_1b.s: New source file.
1861         * testsuite/dwp_test_2.cc: New source file.
1862         * testsuite/dwp_test_2.s: New source file.
1863         * testsuite/dwp_test_2.sh: New source file.
1864         * testsuite/dwp_test_main.cc: New source file.
1865         * testsuite/dwp_test_main.s: New source file.
1866
1867 2012-10-23  Cary Coutant  <ccoutant@google.com>
1868
1869         * dwp.h: New header file.
1870         * dwp.cc: New source file.
1871         * gold.h: Move shared declarations to system.h.
1872         * system.h: New header file.
1873         * Makefile.am: Add dwp.
1874         * Makefile.in: Regenerate.
1875
1876 2012-10-23  Cary Coutant  <ccoutant@google.com>
1877
1878         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
1879         Dwarf_info_reader::read_from_pointer.
1880         (Dwarf_pubnames_table::read_header): Likewise.
1881         (Dwarf_pubnames_table::next_name): Likewise.
1882         (Dwarf_die::read_attributes): Likewise.
1883         (Dwarf_die::skip_attributes): Likewise.
1884         (Dwarf_info_reader::read_from_pointer): New function template.
1885         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
1886         (Dwarf_pubnames_table): Likewise.
1887         (Dwarf_info_reader::read_from_pointer): New function template.
1888         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
1889         Dwarf_pubnames_table ctor.
1890
1891 2012-10-23  Cary Coutant  <ccoutant@google.com>
1892
1893         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
1894         abbrev_shndx.
1895         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
1896         abbrev_shndx_.
1897         (Dwarf_info_reader::set_abbrev_shndx): New method.
1898         (Dwarf_info_reader::abbrev_shndx_): New data member.
1899
1900 2012-10-23  Cary Coutant  <ccoutant@google.com>
1901
1902         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
1903         from object, not parameters.
1904         (Dwarf_info_reader::parse): Likewise.
1905         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
1906         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
1907         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
1908         methods.
1909
1910 2012-10-23  Cary Coutant  <ccoutant@google.com>
1911
1912         * fileread.cc (Input_file::Input_file): New constructor.
1913         * fileread.h (class Input_file): Add new constructor.
1914
1915 2012-10-18  Alan Modra  <amodra@gmail.com>
1916
1917         PR gold/14727
1918         * object.cc (Relobj::is_section_name_included): Also match
1919         .sdata personality section.
1920
1921 2012-10-18  Alan Modra  <amodra@gmail.com>
1922
1923         * target-reloc.h (class Default_comdat_behavior): New, package up..
1924         (get_comdat_behaviour): ..this.
1925         (relocate_section): Add Relocate_comdat_behavior template arg,
1926         adjust code to suit.
1927         * arm.cc (Target_arm::relocate_section): Adjust to suit.
1928         (Target_arm::scan_reloc_section): Likewise.
1929         * i386.cc (Target_i386::relocate_section): Likewise.
1930         * sparc.cc (Target_sparc::relocate_section): Likewise.
1931         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
1932         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
1933         * powerpc.cc (class Relocate_comdat_behavior): New.
1934         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
1935         gold::relocate_section with new template arg.
1936
1937 2012-10-18  Alan Modra  <amodra@gmail.com>
1938
1939         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
1940         dynamic relocs for GOT_TPREL got entries, without symbol if
1941         resolving locally.
1942         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
1943         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
1944         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
1945
1946 2012-10-17  Alan Modra  <amodra@gmail.com>
1947
1948         PR gold/14726
1949         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
1950
1951 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
1952
1953         * layout.cc (Layout::include_section): Keep sections marked
1954         SHF_EXCLUDE when doing relocatable links.
1955
1956 2012-10-16  Alan Modra  <amodra@gmail.com>
1957
1958         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
1959         (Target_powerpc::do_finalize_sections): Call it.
1960         (Output_data_save_res): New class and supporting functions.
1961         (Target_powerpc::symval_for_branch): Only look up .opd entry for
1962         normal symbols defined in object files.
1963
1964 2012-10-12  Alan Modra  <amodra@gmail.com>
1965
1966         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
1967         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
1968         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
1969         section if scan_opd_relocs not yet called.
1970         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
1971
1972 2012-10-12  Alan Modra  <amodra@gmail.com>
1973
1974         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1975         add_local_ifunc_entry): Revert last change.
1976         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
1977
1978 2012-10-05  Alan Modra  <amodra@gmail.com>
1979
1980         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
1981         do_plt_address_for_global): New functions.
1982         (Output_data_got_powerpc::do_write): Don't segfault when linking
1983         statically.
1984         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1985         add_local_ifunc_entry): Return true on adding entry..
1986         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
1987         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
1988         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
1989         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
1990         set up symbols here.
1991         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
1992         syms here.  Do so even when no .iplt.  Don't segfault when linking
1993         statically.
1994         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
1995         new variants without reloc param.
1996         (Glink_sym_ent::Glink_sym_ent): Likewise.
1997         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
1998         reloc when refs will resolve to plt call stub.
1999         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
2000         R_PPC_PLTREL24 to resolve locally.
2001         (Target_powerpc::Scan::global): Correct ifunc handling.
2002         (Target_powerpc::Relocate::relocate): Correct local sym glink
2003         lookup.  Don't destroy "value" when we have a plt call stub,
2004         and when checking plt call validity.
2005         (Target_powerpc::do_dynsym_value): Simplify.
2006
2007 2012-10-05  Alan Modra  <amodra@gmail.com>
2008
2009         * i386.cc (Output_data_plt_i386::address_for_global,
2010         address_for_local): Add plt offset to returned value.  Adjust uses.
2011         * sparc.cc (Output_data_plt_sparc::address_for_global,
2012         address_for_local): Likewise.
2013         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
2014         address_for_local): Likewise.
2015         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
2016         address_for_local): Likewise.
2017         * target.h (Target::plt_address_for_global, plt_address_for_local):
2018         Update comment.
2019         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
2020         (Output_data_got::Got_entry::write): Nor here.
2021         * output.h: Comment fix.
2022
2023 2012-10-02  Jiong Wang  <jiwang@tilera.com>
2024
2025         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
2026         global_offset_table_ value for larget got.
2027         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
2028
2029 2012-09-29  Alan Modra  <amodra@gmail.com>
2030
2031         * powerpc.cc (Target_powerpc::iplt_): New output section.
2032         (Target_powerpc::iplt_section, make_iplt_section,
2033         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
2034         (Target_powerpc::make_plt_entry): Handle ifunc syms.
2035         Target_powerpc::plt_entry_count): Count iplt entries too.
2036         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
2037         reloc section in constructor.  New params.
2038         (Target_powerpc::make_plt_section): Create reloc section here instead.
2039         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
2040         functions.
2041         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
2042         (Output_data_glink::add_entry, find_entry): New functions to
2043         deal with local syms.
2044         (Glink_sym_ent): Add support for local syms.
2045         (Output_data_glink::do_write): Handle ifunc plt entries.
2046         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2047         (Target_powerpc::Scan::local, global): Handle ifunc syms.
2048         (Target_powerpc::Relocate::relocate): Likewise.
2049         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
2050
2051 2012-09-25  Alan Modra  <amodra@gmail.com>
2052
2053         * object.h (Sized_relobj_file::adjust_local_symbol,
2054         do_adjust_local_symbol): New functions.
2055         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
2056         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
2057         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
2058         and irregular opd entry spacing.
2059         (Powerpc_relobj::do_read_relocs): Add opd size checks.
2060         (Global_symbol_visitor_opd): New functor.
2061         (Target_powerpc::do_finalize_sections): Omit global symbols defined
2062         on deleted opd entries.
2063
2064 2012-09-15  Jiong Wang  <jiwang@tilera.com>
2065
2066         * tilegx.cc: New file.
2067         * Makefile.am (TARGETSOURCES): Add tilegx.cc
2068         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
2069         * configure.tgt: Add entries for tilegx*.
2070         * configure.ac: Likewise.
2071         * Makefile.in: Rebuild.
2072         * configure: Likewise.
2073         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
2074         tilegx.
2075
2076 2012-09-13  Alan Modra  <amodra@gmail.com>
2077
2078         * target-reloc.h (scan_relocs): Call scan.local for relocs
2079         against symbols in discarded sections.  Pass is_discarded
2080         param.
2081         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
2082         Add is_discarded param.
2083         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
2084         is_discarded to flag opd entry as discarded.  Don't emit dyn
2085         relocs on such entries.
2086         (Target_powerpc::Scan::global): Similarly detect and handle
2087         such opd entries.
2088         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
2089         opd_ent_.  Update all uses.
2090         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
2091         (Target_powerpc::relocate_section): Zero out discarded opd
2092         entry relocs.
2093
2094 2012-09-12  Ian Lance Taylor  <iant@google.com>
2095
2096         PR gold/14570
2097         * output.cc: Rename Output_data_got template parameter from size
2098         to got_size for all functions.  Compile all variants of
2099         Output_data_got.
2100         (Output_data_got::Got_entry::write): Correct use of size for
2101         symbol value.  Use local_is_tls rather than casting to
2102         Sized_relobj_file.
2103         * object.h (class Object): Add local_is_tls and do_local_is_tls.
2104         (class Sized_relobj_file): Add do_local_is_tls.
2105         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
2106
2107 2012-09-11  Alan Modra  <amodra@gmail.com>
2108
2109         PR gold/14566
2110         * layout.cc (Layout::set_segment_offsets): When using
2111         common-page-size alignment, ensure we are on a new max-page-size
2112         page.
2113         * output.cc (Output_segment::set_section_addresses): Use
2114         abi_pagesize, not common_pagesize for relro boundary.
2115         (Output_segment::set_offset): Likewise.
2116
2117 2012-09-11  Alan Modra  <amodra@gmail.com>
2118
2119         * output.h (Output_data_got::add_global_tls, add_local_tls,
2120         add_local_tls_pair): New functions.
2121         (Output_data_got::add_local_pair_with_rel): Remove second
2122         reloc param.  Expand comment.
2123         (Output_data_got::Got_entry): Rename use_plt_offset_ to
2124         use_plt_or_tls_offset_, similarly for constructor param.
2125         (Output_data_got::Got_entry::write): Add got_index param.
2126         * output.cc (Output_data_got::add_global_tls, add_local_tls,
2127         add_local_tls_pair): New functions.
2128         (Output_data_got::Got_entry::write): Handle tls symbols
2129         with use_plt_or_tls_offset_ set specially.
2130         (Output_data_got::add_local_pair_with_rel): Only one reloc.
2131         (Output_data_got::do_write): Replace iterator with index, pass
2132         index to entry write function.
2133         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
2134         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
2135         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
2136         call.
2137         * i386.cc (Target_i386::Scan::local): Likewise.
2138         * sparc.cc (Target_sparc::Scan::local): Likewise.
2139         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
2140         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
2141         do_tls_offset_for_global): New functions.
2142         (Target_powerpc::Scan::local): Correct TLS relocations and got
2143         entry values.
2144         (Target_powerpc::Scan::global): Don't emit unnecessary
2145         dynamic relocations on TLS GOT entries.
2146
2147 2012-09-10  Matthias Klose  <doko@ubuntu.com>
2148
2149         * config.in: Disable sanity check for kfreebsd.
2150
2151 2012-09-10  Sterling Augustine  <saugustine@google.com>
2152
2153         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
2154         (Gdb_index::pubtypes_read): New parameter.
2155         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
2156         to calls.
2157         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
2158         pubtypes_object_.
2159
2160 2012-09-09  Alan Modra  <amodra@gmail.com>
2161
2162         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
2163         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
2164         * gc.h (gc_process_relocs): Call target gc_add_reference.
2165         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
2166         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
2167         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
2168         unnecessary cast.
2169         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
2170         to cater for when we don't need code offset.  Update use.
2171         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
2172         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
2173         set_opd_valid): New functions.
2174         (Target_powerpc::do_gc_add_reference): New function.
2175         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
2176         stashed refs.
2177         (Target_powerpc::do_gc_mark_symbol): New function.
2178
2179 2012-09-06  Cary Coutant  <ccoutant@google.com>
2180
2181         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
2182         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
2183         (Dwarf_die::skip_attributes): Likewise.
2184         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
2185         * testsuite/gdb_index_test.cc (inline_func_1): New function.
2186         (main): Call it.
2187         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
2188
2189 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
2190
2191         * testsuite/script_test_3.t: Add .got.plt output section
2192         statement.
2193         * testsuite/script_test_4.t: Likewise.
2194
2195 2012-09-05  Alan Modra  <amodra@gmail.com>
2196
2197         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
2198         update all uses and lose "enum" when using type.
2199
2200 2012-09-05  Alan Modra  <amodra@gmail.com>
2201
2202         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
2203         * configure: Regenerate.
2204         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
2205         (plugin_final_layout.stdout): Likewise.
2206         (memory_test): Set page sizes to 0x1000.
2207         * testsuite/Makefile.in: Regenerate.
2208         * testsuite/discard_locals_test.sh: Add FIXME comment.
2209         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
2210         * testsuite/pr14265.t: Add .got output section statement.
2211         * testsuite/script_test_2.t: Likewise.
2212         * testsuite/script_test_3.t: Likewise.
2213         * testsuite/script_test_4.t: Likewise.
2214         * testsuite/script_test_5.t: Likewise.
2215         * testsuite/script_test_6.t: Likewise.
2216         * testsuite/script_test_7.t: Likewise.
2217         * testsuite/script_test_9.t: Likewise.
2218
2219 2012-09-05  Alan Modra  <amodra@gmail.com>
2220
2221         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
2222         (Powerpc_relocate_functions::Status): New typedef.
2223         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2224         (Target_powerpc::Scan::local): Handle REL64.
2225         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
2226         for REL32 and REL64.
2227         (Target_powerpc::symval_for_branch): New function, extracted from..
2228         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
2229         checks.  Report overflow errors.
2230
2231 2012-09-05  Alan Modra  <amodra@gmail.com>
2232
2233         * object.h (Sized_relobj_file::emit_relocs): Delete.
2234         (Sized_relobj_file::emit_relocs_reltype): Delete.
2235         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
2236         relocate_relocs for --emit-relocs.
2237         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
2238         * output.h: Update comment.
2239         (Output_segment::first_section): New function.
2240         (Output_segment::first_section_load_address): Use first_section.
2241         * output.cc (Output_segment::first_section): New function extracted..
2242         (Output_segment::first_section_load_address): ..from here.  Delete.
2243         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
2244         * target.h (Sized_target::relocate_for_relocatable): Likewise.
2245         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
2246         adjust call to target.h function.
2247         * i386.cc (Target_i386): Likewise.
2248         * sparc.cc (Target_sparc): Likewise.
2249         * x86_64.cc (Target_x86_64): Likewise.
2250         * powerpc.cc (Target_powerpc): Likewise.
2251         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
2252         first tls section has section symbol for optimised local dynamic
2253         output relocs.
2254         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
2255         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
2256         optimised tls code.
2257         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
2258         Rename to relocate_relocs.  Update error message.
2259
2260 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
2261
2262         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
2263         --just-symbols.
2264
2265 2012-08-31  Alan Modra  <amodra@gmail.com>
2266
2267         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
2268         (Powerpc_relobj::toc_base_offset): New stub function.
2269         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
2270         got_mod_index_offset to tlsld_got_offset.  Update all refs.
2271         (Target_powerpc::Relocate::enum skip_tls): New.
2272         (Target_powerpc::call_tls_get_addr_): New var.
2273         (Target_powerpc::is_branch_reloc): Move to file scope.
2274         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
2275         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
2276         New functions.
2277         (Target_powerpc::enum Got_type): Delete old values, add new ones.
2278         (powerpc_info): Correct common_pagesize for ppc64.
2279         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
2280         (Powerpc_relocate_functions): Add overflow check enums and functions.
2281         Add non-shift version of rela, rela_ua.  Delete all rel public
2282         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
2283         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
2284         addr16_ha3, addr14 functions.
2285         (Output_data_got_powerpc::add_constant_pair): New function.
2286         (Output_data_got_powerpc::got_base_offset): Likewise.
2287         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
2288         (instruction constants): Sort, add some more.
2289         (Output_data_glink::do_write): Add and use Address typedef.  Use
2290         object->toc_base_offset() stub for 64-bit.
2291         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
2292         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2293         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
2294         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
2295         Always treat .opd relocs as against locally defined symbol.
2296         Correct condition for RELATIVE relocs.
2297         (Target_powerpc::do_finalize_sections): Test for NULL sections.
2298         (Target_powerpc::Relocate::relocate): Use plt call stub as value
2299         for 32-bit syms with a plt entry.  Correct ppc64 toc base
2300         calculations.  Handle TLS relocs, and more.  Add overflow
2301         checking and adjust for Powerpc_relocate_functions changes.
2302         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
2303         Reinstate --emit-relocs code with FIXME.
2304
2305 2012-08-30  Alan Modra  <amodra@gmail.com>
2306
2307         * layout.cc (Layout::set_segment_offsets): Set p_align to
2308         abi_pagesize, not common_pagesize.
2309         (Layout::relaxation_loop_body): Similarly use abi_pagesize
2310         to determine whether file header can go in segment.
2311
2312 2012-08-30  Alan Modra  <amodra@gmail.com>
2313
2314         * output.h (Output_reloc::Output_reloc <output section>): Add
2315         is_relative param.  Adjust calls.
2316         (Output_reloc::add_output_section_relative): New functions.
2317         * output.cc (Output_reloc::Output_reloc <output section>): Handle
2318         is_relative.
2319         (Output_reloc::symbol_value): Handle SECTION_CODE.
2320
2321 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
2322
2323         * gold.cc (queue_middle_tasks): Call layout again when unique
2324         segments for sections is desired.
2325         * layout.cc (Layout::Layout): Initialize new members.
2326         (Layout::get_output_section_flags): New function.
2327         (Layout::choose_output_section): Call get_output_section_flags.
2328         (Layout::layout): Make output section for mapping to a unique segment.
2329         (Layout::insert_section_segment_map): New function.
2330         (Layout::attach_allocated_section_to_segment): Make unique segment for
2331         output sections marked so.
2332         (Layout::segment_precedes): Check for unique segments when sorting.
2333         * layout.h (Layout::Unique_segment_info): New struct.
2334         (Layout::Section_segment_map): New typedef.
2335         (Layout::insert_section_segment_map): New function.
2336         (Layout::get_output_section_flags): New function.
2337         (Layout::is_unique_segment_for_sections_specified): New function.
2338         (Layout::set_unique_segment_for_sections_specified): New function.
2339         (Layout::unique_segment_for_sections_specified_): New member.
2340         (Layout::section_segment_map_): New member.
2341         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
2342         Rename is_gc_pass_one to is_pass_one.
2343         Rename is_gc_pass_two to is_pass_two.
2344         Rename is_gc_or_icf to is_two_pass.
2345         Check for which pass based on whether symbols data is present.
2346         Make it two pass when unique segments for sections is desired.
2347         * output.cc (Output_section::Output_section): Initialize new
2348         members.
2349         * output.h (Output_section::is_unique_segment): New function.
2350         (Output_section::set_is_unique_segment): New function.
2351         (Output_section::is_unique_segment_): New member.
2352         (Output_section::extra_segment_flags): New function.
2353         (Output_section::set_extra_segment_flags): New function.
2354         (Output_section::extra_segment_flags_): New member.
2355         (Output_section::segment_alignment): New function.
2356         (Output_section::set_segment_alignment): New function.
2357         (Output_section::segment_alignment_): New member.
2358         (Output_segment::Output_segment): Initialize is_unique_segment_.
2359         (Output_segment::is_unique_segment): New function.
2360         (Output_segment::set_is_unique_segment): New function.
2361         (Output_segment::is_unique_segment_): New member.
2362         * plugin.cc (allow_unique_segment_for_sections): New function.
2363         (unique_segment_for_sections): New function.
2364         (Plugin::load): Add new functions to transfer vector.
2365         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
2366         * Makefile.in: Regenerate.
2367         * testsuite/plugin_final_layout.sh: Check if unique segment
2368         functionality works.
2369         * testsuite/plugin_section_order.c (onload): Check if new interfaces
2370         are available.
2371         (allow_unique_segment_for_sections): New global.
2372         (unique_segment_for_sections): New global.
2373         (claim_file_hook): Call allow_unique_segment_for_sections.
2374         (all_symbols_read_hook): Call unique_segment_for_sections.
2375
2376 2012-08-22  Cary Coutant  <ccoutant@google.com>
2377
2378         * layout.cc (Layout::include_section): Don't assert on GROUP
2379         sections with --emit-relocs.
2380
2381 2012-08-21  Cary Coutant  <ccoutant@google.com>
2382
2383         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
2384         if --export-dynamic-symbol names an undef symbol.
2385
2386 2012-08-18  Alan Modra  <amodra@gmail.com>
2387
2388         * powerpc.cc: Formatting and white space.
2389         (Powerpc_relobj): Rename got2_section_ to special_.
2390         Add opd_ent_shndx_ and opd_ent_off_ vectors.
2391         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
2392         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
2393         (Target_powerpc): Add Address typedef and invalid_address.  Use
2394         throughout.
2395         (Target_powerpc::is_branch_reloc): New function.
2396         (Powerpc_relocate_functions): Add Address typedef, use throughout.
2397         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
2398         for dst_mask, value and addend.
2399         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
2400         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
2401         (Output_data_glink::do_write): Correct toc base.  Don't try to use
2402         uint16_t for 24-bit offset.  Use get_output_section_offset and
2403         check return.
2404         (Target_powerpc::Scan::local): Handle more relocs.
2405         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
2406         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
2407         Plug in toc restoring insn after plt calls.  Translate branches
2408         to function descriptor symbols to corresponding entry point.
2409         (Target_powerpc::relocate_for_relocatable): Check return from
2410         get_output_section_offset.
2411         * symtab.h: Comment typo.
2412
2413 2012-08-14  Ian Lance Taylor  <iant@google.com>
2414
2415         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
2416         unsupported_relocal_local to call unsupported_reloc_global.
2417
2418 2012-08-14  Nick Clifton  <nickc@redhat.com>
2419
2420         PR ld/14265
2421         * script-sections.cc (Sections_element::output_section_name): Add
2422         keep return parameter.
2423         (Output_section_element::match_name): Add keep return parameter.
2424         Return the value of the keep_ member.
2425         * script-sections.h (class Output_section): Update
2426         output_section_name prototype.
2427         * layout.cc (Layout::keep_input_section): New public member
2428         function.
2429         (Layout::choose_output_section): Pass keep parameter to
2430         output_section_name.
2431         * layout.h (class Layout): Add keep_input_section.
2432         * object.cc (Sized_relobj_file::do_layout): Check for kept input
2433         sections.
2434         * testsuite/Makefile.am: Add a test.
2435         * testsuite/Makefile.in: Regenerate.
2436         * testsuite/pr14265.c: Source file for the test.
2437         * testsuite/pr14265.t: Linker script for the test.
2438         * testsuite/pr14265.sh: Shell script for the test.
2439
2440 2012-08-14  Alan Modra  <amodra@gmail.com>
2441
2442         * target.h (Target::output_section_name): New function.
2443         (Target::do_output_section_name): New function.
2444         * layout.cc (Layout::choose_output_section): Call the above.
2445         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
2446
2447 2012-08-14  Alan Modra  <amodra@gmail.com>
2448
2449         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
2450         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
2451         for replace_constant call.
2452         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
2453         (Output_data_glink::do_print_to_mapfile): New function.
2454         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
2455         (Target_powerpc::Relocate::relocate): Likewise.
2456
2457 2012-08-14  Alan Modra  <amodra@gmail.com>
2458
2459         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
2460         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
2461         (Output_data_glink::add_entry,find_entry): Remove shndx param.
2462         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
2463         all references to shndx_.  Handle special case for R_PPC_PLTREL24
2464         here.
2465         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
2466         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
2467         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
2468         here.
2469         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
2470         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
2471
2472 2012-08-12  Alan Modra  <amodra@gmail.com>
2473
2474         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
2475         (glink insn constants): Use uint32_t.
2476         (Output_data_glink::add_entry): Use insert, not [] operator.
2477
2478 2012-08-11  Alan Modra  <amodra@gmail.com>
2479
2480         * object.h (Sized_relobj_file::find_shdr): New function.
2481         (Sized_relobj_file::find_special_sections): New function.
2482         * object.cc (Sized_relobj_file::find_shdr): New function.
2483         (Sized_relobj_file::find_eh_frame): Use find_shdr.
2484         (Sized_relobj_file::find_special_sections): New function, split out..
2485         (Sized_relobj_file::do_read_symbols): ..from here.
2486         * output.h (Output_data_got::replace_constant): New function.
2487         (Output_data_got::num_entries): New function.
2488         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
2489         (Output_data_got::got_offset): Protected rather than private.
2490         (Output_data_got::replace_got_entry): New function.
2491         * output.cc (Output_data_got::replace_got_entry): New function.
2492         * powerpc.cc (class Powerpc_relobj): New.
2493         (class Powerpc_relocate_functions): Delete all psymval variants or
2494         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
2495         Implement _ha functions using corresponding _hi function.
2496         (Powerpc_relobj::find_special_sections): New function.
2497         (Target_powerpc::do_make_elf_object): New function.
2498         (class Output_data_got_powerpc): New.
2499         (class Output_data_glink): New.
2500         (class Powerpc_scan_relocatable_reloc): New.
2501         Many more changes througout file.
2502
2503 2012-08-09  Nick Clifton  <nickc@redhat.com>
2504
2505         * po/vi.po: Updated Vietnamese translation.
2506
2507 2012-08-07  Ian Lance Taylor  <iant@google.com>
2508
2509         * layout.cc (Layout::add_target_dynamic_tags): If
2510         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
2511         plt_rel.
2512
2513 2012-07-30  Nick Clifton  <nickc@redhat.com>
2514
2515         * po/gold.pot: Updated template.
2516         * po/es.po: Updated Spanish translation.
2517
2518 2012-07-18  Cary Coutant  <ccoutant@google.com>
2519
2520         PR gold/14344
2521         * configure.ac: Add check for -gpubnames support.
2522         * configure: Regenerate.
2523         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
2524         support; force -gno-pubnames.
2525         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
2526         support.
2527         (gdb_index_test_4): New test.
2528         * testsuite/Makefile.in: Regenerate.
2529         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
2530         * testsuite/gdb_index_test_2.sh: Likewise.
2531         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
2532         * testsuite/gdb_index_test_4.sh: New script.
2533         * testsuite/gdb_index_test_comm.sh: New script with common code;
2534         don't look for space after colon.
2535
2536 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
2537
2538         * gold.cc (queue_middle_tasks): Update function order only after
2539         deferred objects due to plugins are processed.
2540
2541 2012-07-11  Ian Lance Taylor  <iant@google.com>
2542
2543         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
2544         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
2545         (Target_arm::scan_reloc_for_stub): Likewise.
2546         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
2547         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
2548         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
2549         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
2550         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
2551
2552 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
2553             Ian Lance Taylor  <iant@google.com>
2554
2555         PR gold/14309
2556         * configure.ac: Test whether std::tr1::hash<off_t> works.
2557         * gold.h: Add a specialization for std::tr1::hash<off_t> if
2558         needed.
2559         * output.h (class Output_fill): Add virtual destructor.
2560         * configure, config.in: Rebuild.
2561
2562 2012-06-22  Roland McGrath  <mcgrathr@google.com>
2563
2564         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
2565
2566 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
2567
2568         * plugin.cc (Plugin::load): Handle position independent executables.
2569
2570 2012-06-06  Cary Coutant  <ccoutant@google.com>
2571
2572         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
2573         add .debug_macro.
2574         (lines_only_debug_sections): Likewise.
2575         (gdb_fast_lookup_sections): New static array.
2576         (is_gdb_debug_section): Rename formal parameter.
2577         (is_lines_only_debug_section): Likewise.
2578         (is_gdb_fast_lookup_section): New function.
2579         (Layout::include_section): Check for ".zdebug_" prefix; pass
2580         section name suffix to is_gdb_debug_section, et al.; check for
2581         fast-lookup sections when building .gdb_index.
2582         * options.h (--strip-debug-gdb): Update GDB version number.
2583
2584 2012-06-06  Cary Coutant  <ccoutant@google.com>
2585
2586         * configure.ac: Add check for fallocate.
2587         * configure: Regenerate.
2588         * config.in: Regenerate.
2589
2590         * options.h (class General_options): Add --mmap-output-file and
2591         --posix-fallocate options.
2592         * output.cc: (posix_fallocate): Remove; replace with...
2593         (gold_fallocate): New function.
2594         (Output_file::map_no_anonymous): Call gold_fallocate.
2595         (Output_file::map): Check --mmap-output-file option.
2596
2597 2012-06-05  Jing Yu  <jingyu@google.com>
2598
2599         * gold.h (textdomain): Add do {} to empty while(0).
2600         (bindtextdomain): Likewise.
2601
2602 2012-06-04  Cary Coutant  <ccoutant@google.com>
2603
2604         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
2605         has_dynsym_index.
2606
2607 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
2608
2609         * symtab.cc (Symbol_table::define_special_symbol):
2610         Initialize *poldsym to prevent uninitialized variable errors.
2611
2612 2012-05-23  Cary Coutant  <ccoutant@google.com>
2613
2614         * layout.cc (Layout::section_name_mapping): Add rules to handle
2615         exact match on .data.rel.ro.local or .data.rel.ro.
2616         (Layout::output_section_name): Check for exact matches.
2617
2618 2012-05-23  Cary Coutant  <ccoutant@google.com>
2619
2620         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
2621         more carefully.
2622
2623 2012-05-22  Cary Coutant  <ccoutant@google.com>
2624
2625         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
2626         object before exporting symbol.
2627
2628 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
2629
2630         * testsuite/tls_test.cc: Include "config.h" first.
2631         * testsuite/tls_test_c.c: Likewise.
2632
2633 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
2634             Nick Clifton  <nickc@redhat.com>
2635
2636         PR 14072
2637         * configure.in: Add check that sysdep.h has been included before
2638         any system header files.
2639         * configure: Regenerate.
2640         * config.in: Regenerate.
2641
2642 2012-05-14  Cary Coutant  <ccoutant@google.com>
2643
2644         * layout.cc (Layout::make_output_section): Mark .tdata section
2645         as RELRO.
2646         * testsuite/relro_test.cc: Add a TLS variable.
2647
2648 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
2649
2650         PR gold/14091
2651         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
2652         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
2653         R_X86_64_64.
2654
2655 2012-05-08  Cary Coutant  <ccoutant@google.com>
2656
2657         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
2658         (lines_only_debug_sections): Likewise.
2659
2660 2012-05-02  Roland McGrath  <mcgrathr@google.com>
2661
2662         * nacl.cc: New file.
2663         * nacl.h: New file.
2664         * Makefile.am (CCFILES, HFILES): Add them.
2665         * Makefile.in: Regenerate.
2666         * i386.cc (Output_data_plt_i386_nacl): New class.
2667         (Output_data_plt_i386_nacl_exec): New class.
2668         (Output_data_plt_i386_nacl_dyn): New class.
2669         (Target_i386_nacl): New class.
2670         (Target_selector_i386_nacl): New class.
2671         (target_selector_i386): Use it instead of Target_selector_i386.
2672         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
2673         (Target_x86_64_nacl): New class.
2674         (Target_selector_x86_64_nacl): New class.
2675         (target_selector_x86_64, target_selector_x32): Use it instead of
2676         Target_selector_x86_64.
2677         * arm.cc (Output_data_plt_arm_nacl): New class.
2678         (Target_arm_nacl): New class.
2679         (Target_selector_arm_nacl): New class.
2680         (target_selector_arm, target_selector_armbe): Use it instead of
2681         Target_selector_arm.
2682
2683         * target-select.cc (select_target): Take new Input_file* and off_t
2684         arguments, pass them on to recognize method of selector.
2685         * object.cc (make_elf_sized_object): Update caller.
2686         * parameters.cc (parameters_force_valid_target): Likewise.
2687         * incremental.cc (make_sized_incremental_binary): Likewise.
2688         * target-select.h: Update decl.
2689         (Target_selector::recognize): Take new Input_file* argument,
2690         pass it on to do_recognize.
2691         (Target_selector::do_recognize): Take new Input_file* argument.
2692         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
2693         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
2694         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
2695         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
2696
2697         * target.h (Target::Target_info): New members isolate_execinstr
2698         and rosegment_gap.
2699         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
2700         * arm.cc (Target_arm::arm_info): Update initializer.
2701         * i386.cc (Target_i386::i386_info): Likewise.
2702         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
2703         * sparc.cc (Target_sparc::sparc_info): Likewise.
2704         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2705         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2706         * layout.cc (Layout::attach_allocated_section_to_segment):
2707         Take new const Target* argument.  If target->isolate_execinstr(), act
2708         like --rosegment.
2709         (Layout::find_first_load_seg): Take new const Target* argument;
2710         if target->isolate_execinstr(), reject PF_X segments.
2711         (Layout::relaxation_loop_body): Update caller.
2712         (Layout::set_segment_offsets): If target->isolate_execinstr(),
2713         reset file offset to zero when we hit LOAD_SEG, and then do a second
2714         loop over the segments before LOAD_SEG to reassign offsets after
2715         addresses have been determined.  Handle target->rosegment_gap().
2716         (Layout::attach_section_to_segment): Take new const Target* argument;
2717         pass it to attach_allocated_section_to_segment.
2718         (Layout::make_output_section): Update caller.
2719         (Layout::attach_sections_to_segments): Take new const Target* argument;
2720         pass it to attach_section_to_segment.
2721         * gold.cc (queue_middle_tasks): Update caller.
2722         * layout.h (Layout): Update method decls with new arguments.
2723
2724         * arm.cc (Target_arm::Target_arm): Take optional argument for the
2725         Target_info pointer to use.
2726         (Target_arm::do_make_data_plt): New virtual method.
2727         (Target_arm::make_data_plt): New method that calls it.
2728         (Target_arm::make_plt_entry): Use it.
2729         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
2730         for the section alignment.
2731         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
2732         method.
2733         (Output_data_plt_arm::first_plt_entry_offset): Call it.
2734         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
2735         method.
2736         (Output_data_plt_arm::get_plt_entry_size): Call it.
2737         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
2738         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
2739         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
2740         method.
2741         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
2742         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
2743         method instead of sizeof(plt_entry).
2744         (Output_data_plt_arm::add_entry): Likewise.
2745         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
2746         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
2747         than static method.
2748         (Target_arm::plt_entry_size): Likewise.
2749         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
2750         Move to ...
2751         (Output_data_plt_arm_standard): ... here, new class.
2752         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
2753         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
2754         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
2755
2756         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2757         Take additional argument for the PLT entry size.
2758         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
2759         Use get_plt_entry_size method rather than plt_entry_size variable.
2760         (Output_data_plt_x86_64::reserve_slot): Likewise.
2761         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
2762         (Output_data_plt_x86_64::add_entry): Likewise.
2763         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
2764         (Output_data_plt_x86_64::address_for_global): Likewise.
2765         (Output_data_plt_x86_64::address_for_local): Likewise.
2766         (Output_data_plt_x86_64::set_final_data_size): Likewise.
2767         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
2768         Make method non-static.
2769         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
2770         method.
2771         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
2772         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
2773         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
2774         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
2775         virtual method.
2776         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
2777         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
2778         virtual method.
2779         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
2780         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
2781         virtual method.
2782         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
2783         (Output_data_plt_x86_64::plt_entry_size)
2784         (Output_data_plt_x86_64::first_plt_entry)
2785         (Output_data_plt_x86_64::plt_entry)
2786         (Output_data_plt_x86_64::tlsdesc_plt_entry)
2787         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
2788         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
2789         (Output_data_plt_x86_64_standard): ... here, new class.
2790         (Target_x86_64::Target_x86_64): Take optional argument for the
2791         Target_info pointer to use.
2792         (Target_x86_64::do_make_data_plt): New virtual method.
2793         (Target_x86_64::make_data_plt): New method to call it.
2794         (Target_x86_64::init_got_plt_for_update): Use that.
2795         Call this->plt_->add_eh_frame method here.
2796         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
2797         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
2798         rather than static method.
2799         (Target_x86_64::plt_entry_size): Likewise.
2800         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
2801         rather than plt_entry_size variable.  Move guts of PLT filling to...
2802         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
2803         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
2804         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
2805
2806         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
2807         additional argument for the section alignment.
2808         Don't do add_eh_frame_for_plt here.
2809         (Output_data_plt_i386::first_plt_entry_offset): Make the method
2810         non-static.  Use get_plt_entry_size method rather than plt_entry_size
2811         variable.
2812         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
2813         method.
2814         (Output_data_plt_i386::get_plt_entry_size): Call it.
2815         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
2816         (Output_data_plt_i386::add_eh_frame): New method to call it.
2817         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
2818         method.
2819         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
2820         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
2821         method.
2822         (Output_data_plt_i386::fill_plt_entry): New method to call it.
2823         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
2824         method instead of plt_entry_size.
2825         (Output_data_plt_i386::plt_entry_size)
2826         (Output_data_plt_i386::plt_eh_frame_fde_size)
2827         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
2828         (Output_data_plt_i386_standard): ... here, new class.
2829         (Output_data_plt_i386_exec): New class.
2830         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
2831         (Output_data_plt_i386_exec::first_plt_entry): ... here.
2832         (Output_data_plt_i386::exec_plt_entry): Move to ...
2833         (Output_data_plt_i386_exec::plt_entry): ... here.
2834         (Output_data_plt_i386_dyn): New class.
2835         (Output_data_plt_i386::first_plt_entry): Move to ...
2836         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
2837         (Output_data_plt_i386::dyn_plt_entry): Move to ...
2838         (Output_data_plt_i386_dyn::plt_entry): ... here.
2839         (Target_i386::Target_i386): Take optional argument for the Target_info
2840         pointer to use.
2841         (Target_i386::do_make_data_plt): New virtual method.
2842         (Target_i386::make_data_plt): New method to call it.
2843         (Target_i386::make_plt_section): Use that.
2844         Call this->plt_->add_eh_frame method here.
2845         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
2846         rather than plt_entry_size variable.
2847         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
2848         (Output_data_plt_i386::address_for_local): Likewise.
2849         (Output_data_plt_i386::do_write): Likewise.
2850         Move guts of PLT filling to...
2851         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
2852         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
2853         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
2854         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
2855
2856 2012-05-01  Cary Coutant  <ccoutant@google.com>
2857
2858         * dwarf_reader.cc (Dwarf_die::read_attributes)
2859         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
2860         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
2861         * reduced_debug_output.cc
2862         (Output_reduced_debug_info_section::get_die_end): Remove
2863         DW_FORM_GNU_ref_index.  Add default case.
2864
2865 2012-04-26  Mark Wielaard  <mjw@redhat.com>
2866
2867         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
2868         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
2869         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
2870         DW_AT_high_pc as offset from DW_AT_low_pc.
2871
2872         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
2873         * testsuite/Makefile.in: Regenerate.
2874         * testsuite/gdb_index_test_3.c: New test source file.
2875         * testsuite/gdb_index_test_3.sh: New test source file.
2876
2877 2012-04-25  Ian Lance Taylor  <iant@google.com>
2878
2879         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
2880         pointer.
2881         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
2882         as a class, not a struct.
2883         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
2884         (Target_arm::apply_cortex_a8_workaround): Likewise.
2885         * gc.h: Declare Reloc_types as a struct, not a class.
2886         * object.h: Declare Symbols_data as a struct.
2887         * reloc.h: Declare Read_relocs_data as a struct.
2888         * target.h: Declare Relocate_info as a struct.
2889
2890 2012-04-24  David S. Miller  <davem@davemloft.net>
2891
2892         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
2893         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
2894         and R_SPARC_WPLT30.
2895
2896 2012-04-24  Cary Coutant  <ccoutant@google.com>
2897
2898         * incremental-dump.cc (find_input_containing_global): Replace
2899         magic number with symbolic constant.
2900         (dump_incremental_inputs): Update version number.
2901         * incremental.cc (Output_section_incremental_inputs): Update version
2902         number; import symbolic constants from Incremental_inputs_reader.
2903         (Incremental_inputs::create_data_sections): Align relocations
2904         section correctly for 64-bit targets.
2905         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
2906         constants; add padding.
2907         (Output_section_incremental_inputs::write_header): Add assert for
2908         header_size.
2909         (Output_section_incremental_inputs::write_input_files): Add assert
2910         for input_entry_size.
2911         (Output_section_incremental_inputs::write_info_blocks): Add padding;
2912         add assert for object_info_size, input_section_entry_size,
2913         global_sym_entry_size.
2914         * incremental.h (Incremental_inputs_reader): Add symbolic constants
2915         for data structure sizes; use them.
2916         (Incremental_input_entry_reader): Import symbolic constants from
2917         Incremental_inputs_reader; use them.
2918
2919 2012-04-23  David S. Miller  <davem@davemloft.net>
2920
2921         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
2922         and elf_flags_set_.
2923         (Target_sparc::Target_sparc): Initialize new fields.
2924         (Target_sparc::do_make_elf_object): New function.
2925         (Target_sparc::do_adjust_elf_header): New function.
2926
2927 2012-04-23  Cary Coutant  <ccoutant@google.com>
2928
2929         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
2930         CU range table of gdb index.
2931
2932 2012-04-20  David S. Miller  <davem@davemloft.net>
2933
2934         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
2935         instead of false.
2936
2937 2012-04-16  David S. Miller  <davem@davemloft.net>
2938
2939         * sparc.cc (Target_sparc::got_address): New function.
2940         (Sparc_relocate_functions::gdop_hix22): New function.
2941         (Sparc_relocate_functions::gdop_lox10): New function.
2942         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
2943         relocs.
2944         (Target_sparc::Scan::local): Likewise if the global symbol is not
2945         preemptible and is not IFUNC.
2946         (Target_sparc::Relocate::relocate): Perform GOTDATA code
2947         transformations for local and non-preemptible non-IFUNC global
2948         symbols.
2949
2950         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
2951         writing out 64-bit part of ranges.
2952
2953         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
2954         -fpic and -fpie respectively.
2955         * Makefile.in: Regenerate.
2956
2957         * sparc.cc (class Target_sparc): Add rela_ifunc_.
2958         (Target_sparc::Target_sparc): Initialize new field.
2959         (Target_sparc::do_plt_section_for_global): New function.
2960         (Target_sparc::do_plt_section_for_local): New function.
2961         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
2962         (Target_sparc::make_plt_section): New function, broken out of
2963         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
2964         (Target_sparc::make_plt_entry): Call make_plt_section.
2965         (Target_sparc::make_local_ifunc_plt_entry): New function.
2966         (Target_sparc::rela_ifunc_section): New function.
2967         (Target_sparc::plt_section): Remove const.
2968         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
2969         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
2970         and ifunc_count_ fields.
2971         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
2972         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
2973         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
2974         (Output_data_plt_sparc::rela_ifunc): New function.
2975         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
2976         (Output_data_plt_sparc::has_ifunc_section): New function.
2977         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
2978         (Output_data_plt_sparc::address_for_global): New function.
2979         (Output_data_plt_sparc::address_for_local): New function.
2980         (Output_data_plt_sparc::plt_index_to_offset): New function.
2981         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
2982         and entry_count.
2983         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
2984         entry_count.
2985         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
2986         R_SPARC_JMP_IREL to switch.
2987         (Target_sparc::Scan::check_non_pic): Likewise.
2988         (Target_sparc::Scan::local): Handle IFUNC symbols.
2989         (Target_sparc::Scan::local): Likewise.
2990         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
2991         and plt_address_for_local.
2992         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
2993         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
2994
2995         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
2996         (class Output_data_reloc): Adjust calls to Output_reloc_type.
2997         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
2998         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
2999         global relocs too.
3000         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
3001         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
3002         calls.
3003         * sparc.cc (Target_sparc::Scan::global): Likewise.
3004         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3005
3006 2012-04-16  Cary Coutant  <ccoutant@google.com>
3007
3008         * archive.cc (Library_base::should_include_member): Check for
3009         --export-dynamic-symbol.
3010         * options.h (class General_options): Add --export-dynamic-symbol.
3011         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
3012         --export-dynamic-symbol.
3013         (Symbol_table::gc_mark_undef_symbols): Likewise.
3014         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
3015
3016 2012-04-12  David S. Miller  <davem@davemloft.net>
3017
3018         * sparc.cc (Reloc::wdisp10): New relocation method.
3019         (Reloc::h34): Likewise.
3020         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
3021         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
3022         R_SPARC_WDISP10.
3023         (Target_sparc::Scan::local): Likewise.
3024         (Target_sparc::Scan::global): Likewise.
3025         (Target_sparc::Relocate::relocate): Likewise.
3026
3027 2012-04-09  Cary Coutant  <ccoutant@google.com>
3028
3029         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
3030         low_pc == 0.
3031
3032 2012-04-06  Ian Lance Taylor  <iant@google.com>
3033
3034         * timer.cc: #include <unistd.h>.
3035
3036 2012-04-06  Roland McGrath  <mcgrathr@google.com>
3037
3038         * configure.in (AC_CHECK_HEADERS): Add locale.h.
3039         * config.in: Regenerate.
3040         * configure: Regenerate.
3041
3042 2012-04-05  Nick Clifton  <nickc@redhat.com>
3043
3044         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
3045         (AM_LC_MESSAGES): Add.
3046         * aclocal.m4: Regenerate.
3047         * config.in: Regenerate.
3048         * configure: Regenerate.
3049
3050 2012-03-21  Cary Coutant  <ccoutant@google.com>
3051
3052         * Makefile.am: Add gdb-index.cc, gdb-index.h.
3053         * Makefile.in: Regenerate.
3054         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
3055         (Sized_elf_reloc_mapper::symbol_section): New function.
3056         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
3057         (make_elf_reloc_mapper): New function.
3058         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
3059         (Dwarf_abbrev_table::do_read_abbrevs): New function.
3060         (Dwarf_abbrev_table::do_get_abbrev): New function.
3061         (Dwarf_ranges_table::read_ranges_table): New function.
3062         (Dwarf_ranges_table::read_range_list): New function.
3063         (Dwarf_pubnames_table::read_section): New function.
3064         (Dwarf_pubnames_table::read_header): New function.
3065         (Dwarf_pubnames_table::next_name): New function.
3066         (Dwarf_die::Dwarf_die): New function.
3067         (Dwarf_die::read_attributes): New function.
3068         (Dwarf_die::skip_attributes): New function.
3069         (Dwarf_die::set_name): New function.
3070         (Dwarf_die::set_linkage_name): New function.
3071         (Dwarf_die::attribute): New function.
3072         (Dwarf_die::string_attribute): New function.
3073         (Dwarf_die::int_attribute): New function.
3074         (Dwarf_die::uint_attribute): New function.
3075         (Dwarf_die::ref_attribute): New function.
3076         (Dwarf_die::child_offset): New function.
3077         (Dwarf_die::sibling_offset): New function.
3078         (Dwarf_info_reader::check_buffer): New function.
3079         (Dwarf_info_reader::parse): New function.
3080         (Dwarf_info_reader::do_parse): New function.
3081         (Dwarf_info_reader::do_read_string_table): New function.
3082         (Dwarf_info_reader::lookup_reloc): New function.
3083         (Dwarf_info_reader::get_string): New function.
3084         (Dwarf_info_reader::visit_compilation_unit): New function.
3085         (Dwarf_info_reader::visit_type_unit): New function.
3086         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
3087         Sized_elf_reloc_mapper.
3088         (Sized_dwarf_line_info::symbol_section): Remove function.
3089         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
3090         (Sized_dwarf_line_info::read_line_mappings): Remove object
3091         parameter, adjust callers.
3092         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
3093         * dwarf_reader.h: Include <sys/types.h>.
3094         (class Track_relocs): Remove forward declaration.
3095         (class Elf_reloc_mapper): New class.
3096         (class Sized_elf_reloc_mapper): New class.
3097         (class Dwarf_abbrev_table): New class.
3098         (class Dwarf_range_list): New class.
3099         (class Dwarf_ranges_table): New class.
3100         (class Dwarf_pubnames_table): New class.
3101         (class Dwarf_die): New class.
3102         (class Dwarf_info_reader): New class.
3103         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
3104         (Sized_dwarf_line_info::symbol_section): Remove member function.
3105         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
3106         base class.
3107         * gdb-index.cc: New source file.
3108         * gdb-index.h: New source file.
3109         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
3110         and .debug_types sections, call Layout::add_to_gdb_index.
3111         (Sized_relobj_incr::do_section_name): Implement.
3112         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
3113         return type; Implement.
3114         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
3115         return type.
3116         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
3117         parameter list and return type.
3118         (Sized_incr_dynobj::do_section_contents): Likewise.
3119         * layout.cc: Include gdb-index.h.
3120         (Layout::Layout): Initialize gdb_index_data_.
3121         (Layout::init_fixed_output_section): Check for .gdb_index section.
3122         (Layout::add_to_gdb_index): New function. Instantiate.
3123         * layout.h: Add forward declaration for class Gdb_index.
3124         (Layout::add_to_gdb_index): New member function.
3125         (Layout::gdb_index_data_): New data member.
3126         * main.cc: Include gdb-index.h.
3127         (main): Print statistics for gdb index.
3128         * object.cc (Object::section_contents): Move code into
3129         do_section_contents.
3130         (need_decompressed_section): Check for sections needed when building
3131         gdb index.
3132         (build_compressed_section_map): Likewise.
3133         (Sized_relobj_file::do_read_symbols): Need local symbols when building
3134         gdb index.
3135         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
3136         sections; call Layout::add_to_gdb_index.
3137         (Sized_relobj_file::do_decompressed_section_contents): Call
3138         do_section_contents directly.
3139         * object.h (Object::do_section_contents): Adjust parameter list and
3140         return type.
3141         (Object::do_decompressed_section_contents): Call do_section_contents
3142         directly.
3143         (Sized_relobj_file::do_section_contents): Adjust parameter list and
3144         return type.
3145         * options.h (class General_options): Add --gdb-index option.
3146         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
3147         list and return type.
3148         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
3149         * reloc.h (Track_relocs::checkpoint): New function.
3150         (Track_relocs::reset): New function.
3151
3152         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
3153         New test cases.
3154         * testsuite/Makefile.in: Regenerate.
3155         * testsuite/gdb_index_test.cc: New test source file.
3156         * testsuite/gdb_index_test_1.sh: New test source file.
3157         * testsuite/gdb_index_test_2.sh: New test source file.
3158
3159 2012-03-19  Doug Kwan  <dougkwan@google.com>
3160
3161         * arm.cc (Target_arm::do_define_standard_symbols): New method.
3162         (Target_arm::do_finalize_sections): Remove code which defines
3163         __exidx_start and __exidx_end.  Make symbol table parameter
3164         anonymous as it is not used.
3165         * gold.cc (queue_middle_tasks): Call target hook to define any
3166         target-specific symbols.
3167         * target.h (Target::define_standard_symbols): New method.
3168         (Target::do_define_standard_symbols): Same.
3169         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
3170         * testsuite/Makefile.in: Regenerate.
3171         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
3172         and __exidx_end.
3173         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
3174         relocations are generated for __exidx_start and __exidx_end.
3175
3176 2012-03-16  Doug Kwan  <dougkwan@google.com>
3177
3178         * testsuite/Makefile.am: Disable test initpri3b.
3179         * testsuite/Makefile.in: Regenerate.
3180
3181 2012-03-15  Doug Kwan  <dougkwan@google.com>
3182
3183         * arm.cc (Target_arm::got_section): Make .got section read-only
3184         if -z now is given.
3185
3186 2012-03-15  Ian Lance Taylor  <iant@google.com>
3187
3188         PR gold/13850
3189         * layout.cc (Layout::make_output_section): Correctly mark
3190         SHT_INIT_ARRAY, et. al., as relro.
3191
3192 2012-03-14  Doug Kwan  <dougkwan@google.com>
3193
3194         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
3195         dynamic relocations for protected symbols in shared objects.
3196
3197 2012-03-13  Ian Lance Taylor  <iant@google.com>
3198
3199         * resolve.cc (Symbol_table::resolve): When merging common symbols,
3200         keep the larger alignment.
3201
3202 2012-03-12  Cary Coutant  <ccoutant@google.com>
3203
3204         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
3205         handling of DW_LNE_define_file.
3206
3207 2012-03-12  Cary Coutant  <ccoutant@google.com>
3208
3209         * reduced_debug_output.cc
3210         (Output_reduced_debug_info_section::get_die_end): Add new FORM
3211         codes to switch.
3212
3213 2012-02-29  Cary Coutant  <ccoutant@google.com>
3214
3215         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
3216
3217 2012-02-29  Cary Coutant  <ccoutant@google.com>
3218
3219         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3220         Call Object::decompressed_section_contents.
3221         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
3222         New dtor.
3223         (Sized_dwarf_line_info::buffer_start_): New data member.
3224         * merge.cc (Output_merge_data::do_add_input_section): Call
3225         Object::decompressed_section_contents.
3226         (Output_merge_string::do_add_input_section): Likewise.
3227         * object.cc (need_decompressed_section): New function.
3228         (build_compressed_section_map): Decompress sections needed later.
3229         (Sized_relobj_file::do_decompressed_section_contents): New function.
3230         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3231         * object.h (Object::decompressed_section_contents): New function.
3232         (Object::discard_decompressed_sections): New function.
3233         (Object::do_decompressed_section_contents): New function.
3234         (Object::do_discard_decompressed_sections): New function.
3235         (Compressed_section_info): New type.
3236         (Compressed_section_map): Include decompressed section contents.
3237         (Sized_relobj_file::do_decompressed_section_contents): New function.
3238         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3239
3240 2012-02-16  Cary Coutant  <ccoutant@google.com>
3241
3242         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
3243         * testsuite/Makefile.in: Regenerate.
3244
3245 2012-02-14  Cary Coutant  <ccoutant@google.com>
3246
3247         * options.cc (General_options::finalize): Disallow -pie and -static.
3248
3249 2012-02-03  Doug Kwan  <dougkwan@google.com>
3250
3251         * arm.cc (Arm_relocate_functions::abs8,
3252         Arm_relocate_functions::abs16): Use
3253         Bits::has_signed_unsigned_overflow32.
3254         (Arm_relocate_functions::thm_abs8): Correct range of
3255         overflow check.
3256         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
3257         in assertions.
3258
3259 2012-02-02  Doug Kwan  <dougkwan@google.com>
3260
3261         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
3262         position independent outputs, not just shared objects.
3263
3264 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
3265
3266         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
3267         * configure: Regenerated.
3268
3269 2012-01-27  Ian Lance Taylor  <iant@google.com>
3270
3271         * reloc.h (Bits): New class with static functions, copied from
3272         namespace utils in arm.cc.
3273         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
3274         instead.
3275
3276 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3277
3278         * incremental.cc (write_info_blocks): Correct relocation offset.
3279
3280 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3281
3282         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
3283         (Relocate::tls_gd_to_le): Likewise.
3284
3285 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3286
3287         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
3288
3289 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3290
3291         * configure.ac: Check if -mcmodel=medium works.
3292         * configure: Regenerated.
3293
3294 2012-01-24  Cary Coutant  <ccoutant@google.com>
3295
3296         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
3297         definition and ...
3298         (read_unsigned_LEB_128_x): ... this new function.
3299         (read_signed_LEB_128): Replaced with inline definition and ...
3300         (read_signed_LEB_128_x): ... this new function.
3301         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
3302         (read_unsigned_LEB_128): Add inline definition.
3303         (read_signed_LEB_128_x): New function.
3304         (read_signed_LEB_128): Add inline definition.
3305         * testsuite/Makefile.am (leb128_unittest): New unit test.
3306         * testsuite/Makefile.in: Regenerate.
3307         * testsuite/leb128_unittest.cc: New unit test.
3308
3309 2012-01-23  Ian Lance Taylor  <iant@google.com>
3310
3311         PR gold/13617
3312         * i386.cc (Target_i386::do_code_fill): When using a jmp
3313         instruction, pad with nop instructions.
3314         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3315
3316 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
3317
3318         * x86_64.cc (gc_process_relocs): Add typename on types used in
3319         template.
3320         (scan_relocs): Likewise.
3321         (relocate_section): Likewise.
3322         (apply_relocation): Likewise.
3323
3324 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
3325
3326         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
3327         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
3328         under x32.
3329
3330 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
3331
3332         * x86_64.cc: Initial support for x32.
3333
3334 2012-01-03  Cary Coutant  <ccoutant@google.com>
3335
3336         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
3337         Use abstract base class for GOT.
3338         * gold/output.h (class Output_data_got_base): New abstract base class.
3339         (class Output_data_got): Derive from new base class, adjust ctors.
3340         (Output_data_got::reserve_slot): Make virtual; rename to
3341         do_reserve_slot; Adjust callers.
3342         * gold/target.h (Sized_target::init_got_plt_for_update): Return
3343         pointer to abstract base class.
3344         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
3345
3346 2011-12-18  Ian Lance Taylor  <iant@google.com>
3347
3348         * object.h (Relobj::local_symbol_value): New function.
3349         (Relobj::local_plt_offset): New function.
3350         (Relobj::local_has_got_offset): New function.
3351         (Relobj::local_got_offset): New function.
3352         (Relobj::set_local_got_offset): New function.
3353         (Relobj::do_local_symbol_value): New pure virtual function.
3354         (Relobj::do_local_plt_offset): Likewise.
3355         (Relobj::do_local_has_got_offset): Likewise.
3356         (Relobj::do_local_got_offset): Likewise.
3357         (Relobj::do_set_local_got_offset): Likewise.
3358         (Sized_relobj::do_local_has_got_offset): Rename from
3359         local_has_got_offset.
3360         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
3361         (Sized_relobj::do_set_local_got_offset): Rename from
3362         set_local_got_offset.
3363         (Sized_relobj_file::do_local_plt_offset): Rename from
3364         local_plt_offset.
3365         (Sized_relobj_file::do_local_symbol_value): New function.
3366         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
3367         local_plt_offset.
3368         * output.cc (Output_data_got::Got_entry::write): Change object to
3369         Relobj.  Use local_symbol_value.
3370         (Output_data_got::add_global_with_rel): Change rel_dyn to
3371         Output_data_reloc_generic*.  Use add_global_generic.
3372         (Output_data_got::add_global_with_rela): Remove.  Change all
3373         callers to use add_global_with_rel.
3374         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
3375         Output_data_reloc_generic*.  Use add_global_generic.
3376         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
3377         callers to use add_global_pair_with_rel.
3378         (Output_data_got::add_local): Change object to Relobj*.
3379         (Output_data_got::add_local_plt): Likewise.
3380         (Output_data_got::add_local_with_rel): Change object to Relobj*,
3381         change rel_dyn to Output_data_reloc_generic*.  Use
3382         add_local_generic.
3383         (Output_data_got::add_local_with_rela): Remove.  Change all
3384         callers to use all_local_with_rel.
3385         (Output_data_got::add_local_pair_with_rel): Change object to
3386         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
3387         add_output_section_generic.
3388         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
3389         callers to use add_local_pair_with_rel.
3390         (Output_data_got::reserve_local): Change object to Relobj*.
3391         * output.h: (class Output_data_reloc_generic): Add pure virtual
3392         declarations for add_global_generic, add_local_generic,
3393         add_output_section_generic.
3394         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
3395         functions for Output_data_reloc_generic.  Update declarations for
3396         changes listed in output.cc.
3397         (class Output_data_got): Change template parameter to got_size.
3398         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
3399         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
3400         function.
3401         (Sized_relobj_incr::do_local_plt_offset): New function.
3402         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
3403         add_global_generic.
3404
3405 2011-12-17  Cary Coutant  <ccoutant@google.com>
3406
3407         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
3408         * resolve.cc (Symbol_table::resolve): Likewise.
3409         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
3410         arrays.
3411         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3412
3413 2011-12-16  Ian Lance Taylor  <iant@google.com>
3414
3415         * output.h (Output_data_reloc_generic::add): Only call
3416         add_dynamic_reloc if this is a dynamic reloc section.
3417
3418 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
3419
3420         PR gold/13505
3421         * target-reloc.h (apply_relocation): Replace <64, false> with
3422         <size, big_endian>.
3423
3424 2011-11-25  Nick Clifton  <nickc@redhat.com>
3425
3426         * po/it.po: New Italian translation.
3427
3428 2011-11-17  Sterling Augustine  <saugustine@google.com>
3429
3430         * script.cc (script_include_directive): Implement.
3431         (read_script_file): New local variables name and search_path. Update
3432         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
3433         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
3434         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
3435
3436 2011-11-11  Sterling Augustine  <saugustine@google.com>
3437
3438         * yyscript.y (section_cmd): Add support for INCLUDE directive.
3439         (file_or_sections_cmd): Likewise.
3440
3441 2011-11-11  Doug Kwan  <dougkwan@google.com>
3442
3443         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
3444         if --just-symbols is given.
3445
3446 2011-11-10  Doug Kwan  <dougkwan@google.com>
3447
3448         PR gold/13362
3449         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
3450         when processing data relocs.
3451         * reloc.h (Relocate_functions::rel_unaligned): New method.
3452         (Relocate_functions::pcrel_unaligned): Ditto.
3453         (Relocate_functions::rel32_unaligned): Ditto.
3454         (Relocate_functions::pcrel32_unaligned): Ditto.
3455
3456 2011-11-09  Doug Kwan  <dougkwan@google.com>
3457
3458         PR gold/13362
3459         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
3460         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
3461         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
3462         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3463         (Relocate_functions::rel_unaligned): New.
3464         (Relocate_functions::rel32_unaligned): New.
3465         * target-reloc.h (relocate_for_relocatable): Add code to handle
3466         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3467         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
3468         arm_unaligned_reloc_r): New targets.
3469         * testsuite/Makefile.in: Regenerate.
3470         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
3471         linking.
3472
3473 2011-11-02  Ian Lance Taylor  <iant@google.com>
3474
3475         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
3476         NATIVE_LINKER.
3477         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
3478         * options.cc (General_options::finalize): Use library search path
3479         from configure script if specified.  If not native and no sysroot,
3480         only search TOOLLIBDIR.
3481         * options.h (Search_directory::Search_directory): Change name to
3482         const std::string&.
3483         (General_options::add_to_library_path_with_sysroot): Change arg to
3484         const std::string&.
3485         * configure, Makefile.in, config.in: Rebuild.
3486
3487 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3488
3489         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
3490         we are working around the ARM1176 Erratum.
3491         * options.h (General_options::fix_arm1176): Add option.
3492         * testsuite/Makefile.am: Add testcases, and keep current ones
3493         working.
3494         * testsuite/Makefile.in: Regenerate.
3495         * testsuite/arm_fix_1176.s: New file.
3496         * testsuite/arm_fix_1176.sh: Likewise.
3497
3498 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3499
3500         * arm.cc (Target_arm::Target_arm): Remove initialisation of
3501         may_use_blx_.
3502         (Target_arm::may_use_blx): Remove method.
3503         (Target_arm::set_may_use_blx): Likewise.
3504         (Target_arm::may_use_v4t_interworking): New method.
3505         (Target_arm::may_use_v5t_interworking): Likewise.
3506         (Target_arm::may_use_blx_): Remove member variable.
3507         (Arm_relocate_functions::arm_branch_common): Check for v5T
3508         interworking.
3509         (Arm_relocate_functions::thumb_branch_common): Likewise.
3510         (Reloc_stub::stub_type_for_reloc): Likewise.
3511         (Target_arm::do_finalize_sections): Correct interworking checks.
3512         * testsuite/Makefile.am: Add new tests.
3513         * testsuite/Makefile.in: Regenerate.
3514         * testsuite/arm_farcall_arm_arm.s: New test.
3515         * testsuite/arm_farcall_arm_arm.sh: Likewise.
3516         * testsuite/arm_farcall_arm_thumb.s: Likewise.
3517         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
3518         * testsuite/arm_farcall_thumb_arm.s: Likewise.
3519         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
3520         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
3521         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
3522
3523 2011-10-31  Cary Coutant  <ccoutant@google.com>
3524
3525         PR gold/13023
3526         * expression.cc (Expression::eval_with_dot): Add
3527         is_section_dot_assignment parameter.
3528         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
3529         absolute and assigning to dot within a section.
3530         * script-sections.cc
3531         (Output_section_element_assignment::set_section_addresses): Pass
3532         dot_section to set_if_absolute.
3533         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
3534         as is_section_dot_assignment flag to eval_with_dot.
3535         (Output_section_element_dot_assignment::set_section_addresses):
3536         Likewise.
3537         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
3538         parameter.  Also set value if relative to dot_section; set the
3539         symbol's output_section.
3540         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
3541         parameter.  Adjust all callers.
3542         (Expression::eval_maybe_dot): Likewise.
3543         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
3544         Adjust all callers.
3545         * testsuite/script_test_2.t: Test assignment of an absolute value
3546         to dot within an output section element.
3547
3548 2011-10-31  Cary Coutant  <ccoutant@google.com>
3549
3550         * options.h (class General_options): Add --[no-]gnu-unique options.
3551         * symtab.cc (Symbol_table::sized_write_globals): Convert
3552         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
3553
3554 2011-10-31  Cary Coutant  <ccoutant@google.com>
3555
3556         PR gold/13359
3557         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
3558         unnecessary assertion.
3559         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
3560
3561 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
3562
3563         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3564         gc_mark_symbol.
3565         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3566         gc_mark_symbol.
3567         Change to just keep the section associated with symbol.
3568         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
3569         they are externally visible and --export-dynamic is turned on.
3570         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
3571
3572 2011-10-19  Ian Lance Taylor  <iant@google.com>
3573
3574         PR gold/13163
3575         * script-sections.cc
3576         (Output_section_element_dot_assignment::needs_output_section): New
3577         function.
3578
3579 2011-10-19  Ian Lance Taylor  <iant@google.com>
3580
3581         PR gold/13204
3582         * layout.cc (Layout::segment_precedes): Don't assert failure if a
3583         --section-start option was seen.
3584         * options.h (General_options::any_section_start): New function.
3585
3586 2011-10-18  David S. Miller  <davem@davemloft.net>
3587
3588         PR binutils/13301
3589         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
3590         member to track relocation locations that have moved during TLS
3591         reloc optimizations.
3592         (Target_sparc::Relocate::Relocate): Initialize to NULL.
3593         (Target_sparc::Relocate::relocate): Adjust view down by 4
3594         bytes if it matches reloc_adjust_addr_.
3595         (Target_sparc::Relocate::relocate_tls): Always move the
3596         __tls_get_addr call delay slot instruction forward 4 bytes when
3597         performing relaxation.
3598
3599 2011-10-18  Cary Coutant  <ccoutant@google.com>
3600
3601         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
3602         (Output_file::map_no_anonymous): Check for non-zero
3603         return code from posix_fallocate.
3604
3605 2011-10-17  Cary Coutant  <ccoutant@google.com>
3606
3607         PR gold/13245
3608         * plugin.cc (is_visible_from_outside): Check for symbols
3609         referenced from dynamic objects.
3610         * resolve.cc (Symbol_table::resolve): Don't count references
3611         from dynamic objects as references from real ELF files.
3612         * testsuite/plugin_test_2.sh: Adjust expected result.
3613
3614 2011-10-17  Cary Coutant  <ccoutant@google.com>
3615
3616         * gold.cc: Include timer.h.
3617         (queue_middle_tasks): Stamp time.
3618         (queue_final_tasks): Likewise.
3619         * main.cc (main): Store timer in parameters.  Print timers
3620         for each pass.
3621         * parameters.cc (Parameters::Parameters): Initialize timer_.
3622         (Parameters::set_timer): New function.
3623         (set_parameters_timer): New function.
3624         * parameters.h (Parameters::set_timer): New function.
3625         (Parameters::timer): New function.
3626         (Parameters::timer_): New data member.
3627         (set_parameters_timer): New function.
3628         * timer.cc (Timer::stamp): New function.
3629         (Timer::get_pass_time): New function.
3630         * timer.h (Timer::stamp): New function.
3631         (Timer::get_pass_time): New function.
3632         (Timer::pass_times_): New data member.
3633
3634 2011-10-17  Cary Coutant  <ccoutant@google.com>
3635
3636         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
3637         task for members of lib groups.
3638
3639 2011-10-17  Cary Coutant  <ccoutant@google.com>
3640
3641         PR gold/13288
3642         * fileread.cc (File_read::find_view): Add assert.
3643         (File_read::make_view): Move bounds check (replace with assert)...
3644         (File_read::find_or_make_view): ... to here.
3645
3646 2011-10-12  Cary Coutant  <ccoutant@google.com>
3647
3648         * output.cc (Output_file::open_base_file): Handle case where
3649         ::read returns less than requested size.
3650
3651 2011-10-10  Cary Coutant  <ccoutant@google.com>
3652
3653         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
3654         Initialize defined_count_.
3655         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
3656         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
3657         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
3658         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
3659         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
3660         * incremental.h (Sized_relobj_incr::defined_count_): New data
3661         member.
3662         (Sized_incr_dynobj::defined_count_): New data member.
3663         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
3664         Return zeroes instead of internal error.
3665
3666 2011-10-10  Cary Coutant  <ccoutant@google.com>
3667
3668         PR gold/13249
3669         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
3670         (Output_reloc::symbol_value): Return PLT offset if flag is set.
3671         * output.h (class Output_reloc): Add use_plt_offset flag.
3672         (Output_reloc::type_): Adjust size of bit field.
3673         (Output_reloc::use_plt_offset_): New bit field.
3674         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
3675         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
3676         flag.  Adjust all callers.
3677         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
3678         creating RELATIVE relocations.
3679
3680 2011-10-10  Nick Clifton  <nickc@redhat.com>
3681
3682         * po/es.po: Updated Spanish translation.
3683         * po/fi.po: Updated Finnish translation.
3684
3685 2011-10-03   Diego Novillo  <dnovillo@google.com>
3686
3687         * options.cc (parse_uint): Fix dereference of RETVAL.
3688
3689 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
3690
3691         * layout.h (section_order_map_): New member.
3692         (get_section_order_map): New member function.
3693         * output.cc (Output_section::add_input_section): Check for patterns
3694         only when --section-ordering-file is specified.
3695         * gold.cc (queue_middle_tasks): Delay updating order of sections till
3696         output_sections have been formed.
3697         * layout.cc (Layout_Layout): Initialize section_order_map_.
3698         * plugin.cc (update_section_order): Store order in order_map. Do not
3699         update the order.
3700         * testsuite/Makefile.am: Add test case for plugin_final_layout.
3701         * testsuite/Makefile.in: Regenerate.
3702         * testsuite/plugin_section_order.c: New file.
3703         * testsuite/plugin_final_layout.cc: New file.
3704         * testsuite/plugin_final_layout.sh: New file.
3705
3706 2011-09-29  Cary Coutant  <ccoutant@google.com>
3707
3708         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3709         Check for NULL.
3710         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
3711         symbols during incremental update.
3712         (Symbol_table::add_from_dynobj): Likewise.
3713
3714 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3715             Ian Lance Taylor  <iant@google.com>
3716
3717         * symtab.cc (Symbol_table::define_special_symbol): Always
3718         canonicalize version string.
3719
3720 2011-09-26  Cary Coutant  <ccoutant@google.com>
3721
3722         * gold.cc (queue_initial_tasks): Move option checks ...
3723         * options.cc (General_options::finalize): ... to here. Disable
3724         some options; make others fatal.
3725
3726 2011-09-26  Cary Coutant  <ccoutant@google.com>
3727
3728         gcc PR lto/47247
3729         * plugin.cc (get_symbols_v2): New function.
3730         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
3731         (is_referenced_from_outside): New function.
3732         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
3733         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
3734         (get_symbols): Pass version parameter.
3735         (get_symbols_v2): New function.
3736         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
3737         parameter.
3738         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
3739         (onload): Add LDPT_GET_SYMBOLS_V2.
3740         (all_symbols_read_hook): Use get_symbols_v2; check for
3741         LDPR_PREVAILING_DEF_IRONLY_EXP.
3742         * testsuite/plugin_test_3.sh: Update expected results.
3743
3744 2011-09-23  Simon Baldwin  <simonb@google.com>
3745
3746         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
3747         configuration options.
3748         * configure: Regenerate.
3749         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
3750         * Makefile.in: Regenerate.
3751         * testsuite/Makefile.in: Regenerate.
3752
3753 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
3754
3755         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
3756
3757 2011-09-19  Cary Coutant  <ccoutant@google.com>
3758
3759         * incremental.cc (can_incremental_update): Fix typo in comment.
3760         * incremental.h (can_incremental_update): Likewise.
3761
3762 2011-09-18  Cary Coutant  <ccoutant@google.com>
3763
3764         * incremental.cc (can_incremental_update): New function.
3765         * incremental.h (can_incremental_update): New function.
3766         * layout.cc (Layout::init_fixed_output_section): Call it.
3767         (Layout::make_output_section): Don't allow patch space in .eh_frame.
3768         * object.cc (Sized_relobj_file::do_layout): Call
3769         can_incremental_update.
3770
3771 2011-09-13  Cary Coutant  <ccoutant@google.com>
3772
3773         * configure.ac: Check for glibc support for gnu_indirect_function
3774         support with static linking, setting automake conditional
3775         IFUNC_STATIC.
3776         * Makefile.in: Regenerate.
3777         * configure: Regenerate.
3778
3779         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
3780         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
3781         for IFUNC_STATIC.
3782         * testsuite/Makefile.in: Regenerate.
3783
3784 2011-09-13  Cary Coutant  <ccoutant@google.com>
3785
3786         * incremental.cc (Sized_relobj_incr::do_layout): Call
3787         report_comdat_group for kept comdat sections.
3788         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
3789         * testsuite/Makefile.in: Regenerate.
3790         * testsuite/incr_comdat_test_1.cc: New source file.
3791         * testsuite/incr_comdat_test_2_v1.cc: New source file.
3792         * testsuite/incr_comdat_test_2_v2.cc: New source file.
3793         * testsuite/incr_comdat_test_2_v3.cc: New source file.
3794
3795 2011-09-13  Ian Lance Taylor  <iant@google.com>
3796
3797         * object.cc (Sized_relobj_file::do_layout): Remove unused local
3798         variable external_symbols_offset.
3799
3800 2011-09-12  Ian Lance Taylor  <iant@google.com>
3801
3802         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
3803         triggered if object has no symbols.
3804
3805 2011-09-09  David S. Miller  <davem@davemloft.net>
3806
3807         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
3808         (Output_fill_debug_line::do_write): Likewise.
3809
3810 2011-08-29  Cary Coutant  <ccoutant@google.com>
3811
3812         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
3813         casts to match formatting specs.
3814         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
3815
3816 2011-08-26  Cary Coutant  <ccoutant@google.com>
3817
3818         * layout.cc (Free_list::allocate): Provide guarantee of minimum
3819         remaining hole size when allocating.
3820         (Layout::make_output_section): Set fill methods for debug sections.
3821         * layout.h (Free_list::Free_list_node): Move from private to
3822         public.
3823         (Free_list::set_min_hole_size): New function.
3824         (Free_list::begin, Free_list::end): New functions.
3825         (Free_list::min_hole_): New data member.
3826         * output.cc: Include dwarf.h.
3827         (Output_fill_debug_info::do_minimum_hole_size): New function.
3828         (Output_fill_debug_info::do_write): New function.
3829         (Output_fill_debug_line::do_minimum_hole_size): New function.
3830         (Output_fill_debug_line::do_write): New function.
3831         (Output_section::Output_section): Initialize new data member.
3832         (Output_section::set_final_data_size): Ensure patch space is larger
3833         than minimum hole size.
3834         (Output_section::do_write): Fill holes in debug sections.
3835         * output.h (Output_fill): New class.
3836         (Output_fill_debug_info): New class.
3837         (Output_fill_debug_line): New class.
3838         (Output_section::set_free_space_fill): New function.
3839         (Output_section::free_space_fill_): New data member.
3840         * testsuite/Makefile.am (incremental_test_3): Add
3841         --incremental-patch option.
3842         (incremental_test_4): Likewise.
3843         (incremental_test_5): Likewise.
3844         (incremental_test_6): Likewise.
3845         (incremental_copy_test): Likewise.
3846         (incremental_common_test_1): Likewise.
3847         * testsuite/Makefile.in: Regenerate.
3848
3849 2011-08-26  Nick Clifton  <nickc@redhat.com>
3850
3851         * po/es.po: Updated Spanish translation.
3852
3853 2011-08-01  Cary Coutant  <ccoutant@google.com>
3854
3855         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
3856         * gold/testsuite/Makefile.in: Regenerate.
3857         * gold/testsuite/justsyms_exec.c: New source file.
3858         * gold/testsuite/justsyms_lib.c: New source file.
3859
3860 2011-08-01  Cary Coutant  <ccoutant@google.com>
3861
3862         * layout.cc (Layout::set_segment_offsets): Don't realign text
3863         segment if -Ttext was specified.
3864         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
3865         file type.
3866         * object.h (Sized_relobj_file::e_type): New function.
3867         (Sized_relobj_file::e_type_): New data member.
3868         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
3869         base address for ET_EXEC files.
3870         * target.cc (Target::do_make_elf_object_implementation): Allow
3871         ET_EXEC files with --just-symbols option.
3872
3873 2011-07-28  Cary Coutant  <ccoutant@google.com>
3874
3875         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
3876         Add thread_number parameter.
3877         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
3878         * workqueue-threads.cc
3879         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
3880         current thread if its thread number is greater than desired thread
3881         count.
3882         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
3883         Add thread_number parameter.
3884         (Workqueue::should_cancel_thread): Likewise.
3885         (Workqueue::find_runnable_or_wait): Pass thread_number to
3886         should_cancel_thread.
3887         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
3888         parameter.
3889
3890 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
3891
3892         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
3893         only after checking if it cannot be forced local.
3894         * symtab.h (is_externally_visible): Check if the symbol is not forced
3895         local.
3896
3897 2011-07-15  Ian Lance Taylor  <iant@google.com>
3898
3899         * options.h (class General_options): Add --print-output-format.
3900         Move -EL next to -EB, for  better --help output.
3901         * target-select.cc: Include <cstdio>, "options.h", and
3902         "parameters.h".
3903         (Target_selector::do_target_bfd_name): New function.
3904         (print_output_format): New function.
3905         * target-select.h (class Target_selector): Update declarations.
3906         (Target_selector::target_bfd_name): New function.
3907         (print_output_format): Declare.
3908         * main.cc: Include "target-select.h".
3909         (main): Handle --print-output-format.
3910         * gold.cc: Include "target-select.h".
3911         (queue_initial_tasks): Handle --print-output-format when there are
3912         no input files.
3913         * parameters.cc (parameters_force_valid_target): Give a better
3914         error message if -EB/-EL does not match target.
3915         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
3916         function.
3917
3918 2011-07-15  Ian Lance Taylor  <iant@google.com>
3919
3920         * i386.cc (class Output_data_plt_i386): Add layout_ field.
3921         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
3922         (Output_data_plt_i386::do_write): Write address of .dynamic
3923         section to first entry in .got.plt section.
3924         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
3925         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3926         Initialize layout_.
3927         (Output_data_plt_x86_64::do_write): Write address of .dynamic
3928         section to first entry in .got.plt section.
3929         * layout.h (Layout::dynamic_section): New function.
3930
3931 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
3932
3933         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
3934         to claim_file call.
3935         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
3936         input_section_position_, and input_section_glob_.
3937         (read_layout_from_file): Call function section_ordering_specified.
3938         * layout.h (is_section_ordering_specified): New function.
3939         (section_ordering_specified): New function.
3940         (section_ordering_specified_): New boolean member.
3941         * main.cc(main): Call load_plugins after layout object is defined.
3942         * output.cc (Output_section::add_input_section): Use
3943         function section_ordering_specified to check if section ordering is
3944         needed.
3945         * output.cc (Output_section::add_relaxed_input_section): Use
3946         function section_ordering_specified to check if section ordering is
3947         needed.
3948         (Output_section::update_section_layout): New function.
3949         (Output_section::sort_attached_input_sections): Check if input section
3950         must be reordered.
3951         * output.h (Output_section::update_section_layout): New function.
3952         * plugin.cc (get_section_count): New function.
3953         (get_section_type): New function.
3954         (get_section_name): New function.
3955         (get_section_contents): New function.
3956         (update_section_order): New function.
3957         (allow_section_ordering): New function.
3958         (Plugin::load): Add the new interfaces to the transfer vector.
3959         (Plugin_manager::load_plugins): New parameter.
3960         (Plugin_manager::all_symbols_read): New parameter.
3961         (Plugin_manager::claim_file): New parameter. Save the elf object for
3962         unclaimed objects.
3963         (Plugin_manager::get_elf_object): New function.
3964         (Plugin_manager::get_view): Change to directly use the bool to check
3965         if get_view is called from claim_file_hook.
3966         * plugin.h (input_objects): New function
3967         (Plugin__manager::load_plugins): New parameter.
3968         (Plugin_manager::claim_file): New parameter.
3969         (Plugin_manager::get_elf_object): New function.
3970         (Plugin_manager::in_claim_file_handler): New function.
3971         (Plugin_manager::in_claim_file_handler_): New member.
3972         (layout): New function.
3973         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
3974         handler with an extra parameter. Make the elf object before calling
3975         claim_file handler.
3976         * testsuite/plugin_test.c (get_section_count): New function pointer.
3977         (get_section_type): New function pointer.
3978         (get_section_name): New function pointer.
3979         (get_section_contents): New function pointer.
3980         (update_section_order): New function pointer.
3981         (allow_section_ordering): New function pointer.
3982         (onload): Check if the new interfaces exist.
3983
3984 2011-07-13  Ian Lance Taylor  <iant@google.com>
3985
3986         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
3987         relro section.
3988         * x86_64.cc (Target_x86_64::got_section): Likewise.
3989         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
3990         (relro_now_test_SOURCES): New variable.
3991         (relro_now_test_DEPENDENCIES): New variable.
3992         (relro_now_test_LDFLAGS): New variable.
3993         (relro_now_test_LDADD): New variable.
3994         (relro_now_test.so): New target.
3995         * testsuite/Makefile.in: Rebuild.
3996
3997 2011-07-12  Ian Lance Taylor  <iant@google.com>
3998
3999         PR gold/12980
4000         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
4001         GLOB_DAT relocation rather than a RELATIVE relocation for a
4002         protected symbol when creating a shared library.
4003         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
4004         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
4005         * testsuite/protected_main_1.cc (main): Test that protected
4006         function has same address.
4007
4008 2011-07-11  Ian Lance Taylor  <iant@google.com>
4009
4010         PR gold/12979
4011         * options.h (class General_options): Add -Bgroup.
4012         * options.cc (General_options::finalize): If -Bgroup is set,
4013         default to --unresolved-symbols=report-all.
4014         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
4015         * target-reloc.h (issue_undefined_symbol_error): Handle
4016         --unresolved-symbols=report-all.
4017
4018 2011-07-08  Ian Lance Taylor  <iant@google.com>
4019
4020         PR gold/11985
4021         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
4022         if linker script discards key sections.
4023         (Layout::create_dynamic_symtab): Likewise.
4024         (Layout::assign_local_dynsym_offsets): Likewise.
4025         (Layout::sized_create_version_sections): Likewise.
4026         (Layout::create_interp): Likewise.
4027         (Layout::finish_dynamic_section): Likewise.
4028         (Layout::set_dynamic_symbol_size): Likewise.
4029
4030 2011-07-08  Ian Lance Taylor  <iant@google.com>
4031
4032         PR gold/12386
4033         * options.h (class General_options): Add --unresolved-symbols.
4034         * target-reloc.h (issue_undefined_symbol_error): Check
4035         --unresolved-symbols.  Add comments.
4036
4037 2011-07-08  Ian Lance Taylor  <iant@google.com>
4038
4039         * testsuite/odr_violation2.cc (Ordering::operator()): Make
4040         expression more complex.
4041
4042 2011-07-08  Ian Lance Taylor  <iant@google.com>
4043
4044         PR gold/11317
4045         * target-reloc.h (issue_undefined_symbol_error): New inline
4046         function, broken out of relocate_section.
4047         (relocate_section): Call issue_undefined_symbol_error.
4048         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4049         there is no TLS segment if we are about to issue an undefined
4050         symbol error.
4051         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4052
4053 2011-07-08  Ian Lance Taylor  <iant@google.com>
4054
4055         PR gold/12279
4056         * resolve.cc (Symbol_table::should_override): Add fromtype
4057         parameter.  Change all callers.  Give error when linking together
4058         TLS and non-TLS symbol.
4059         (Symbol_table::should_override_with_special): Add fromtype
4060         parameter.  Change all callers.
4061         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4062         there is no TLS segment if we have reported some errors.
4063         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4064
4065 2011-07-08  Ian Lance Taylor  <iant@google.com>
4066
4067         PR gold/12372
4068         * target.h (Target::plt_address_for_global): New function.
4069         (Target::plt_address_for_local): New function.
4070         (Target::plt_section_for_global): Remove.
4071         (Target::plt_section_for_local): Remove.
4072         (Target::do_plt_address_for_global): New virtual function.
4073         (Target::do_plt_address_for_local): New virtual function.
4074         (Target::do_plt_section_for_global): Remove.
4075         (Target::do_plt_section_for_local): Remove.
4076         (Target::register_global_plt_entry): Add Symbol_table and Layout
4077         parameters.
4078         * output.cc (Output_data_got::Got_entry::write): Use
4079         plt_address_for_global and plt_address_for_local.
4080         * layout.cc (Layout::add_target_dynamic_tags): Use size and
4081         address of output section.
4082         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
4083         got_irelative_, and irelative_count_ fields.  Update
4084         declarations.
4085         (Output_data_plt_i386::has_irelative_section): New function.
4086         (Output_data_plt_i386::entry_count): Add irelative_count_.
4087         (Output_data_plt_i386::set_final_data_size): Likewise.
4088         (class Target_i386): Add got_irelative_ and rel_irelative_
4089         fields.  Update declarations.
4090         (Target_i386::Target_i386): Initialize new fields.
4091         (Target_i386::do_plt_address_for_global): New function replacing
4092         do_plt_section_for_global.
4093         (Target_i386::do_plt_address_for_local): New function replacing
4094         do_plt_section_for_local.
4095         (Target_i386::got_section): Create got_irelative_.
4096         (Target_i386::rel_irelative_section): New function.
4097         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
4098         fields.  Don't define __rel_iplt_{start,end}.
4099         (Output_data_plt_i386::add_entry): Add symtab and layout
4100         parameters.  Change all callers.  Use different PLT and GOT for
4101         IFUNC symbols.
4102         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
4103         layout parameters.  Change all callers.  Use different PLT and
4104         GOT.
4105         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
4106         (Output_data_plt_i386::rel_irelative): New function.
4107         (Output_data_plt_i386::address_for_global): New function.
4108         (Output_data_plt_i386::address_for_local): New function.
4109         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
4110         IRELATIVE GOT when changing IFUNC GOT entries.
4111         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
4112         reloc.
4113         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
4114         if we didn't create an IRELATIVE GOT.
4115         (Target_i386::Relocate::relocate): Use plt_address_for_global and
4116         plt_address_for_local.
4117         (Target_i386::do_dynsym_value): Use plt_address_for_global.
4118         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
4119         got_irelative_, and irelative_count_ fields.  Update
4120         declarations.
4121         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4122         Initialize new fields.  Remove symtab parameter.  Change all
4123         callers.
4124         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
4125         irelative_count_.
4126         (Output_data_plt_x86_64::has_irelative_section): New function.
4127         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
4128         (class Target_x86_64): Add got_irelative_ and rel_irelative_
4129         fields.  Update declarations.
4130         (Target_x86_64::Target_x86_64): Initialize new fields.
4131         (Target_x86_64::do_plt_address_for_global): New function replacing
4132         do_plt_section_for_global.
4133         (Target_x86_64::do_plt_address_for_local): New function replacing
4134         do_plt_section_for_local.
4135         (Target_x86_64::got_section): Create got_irelative_.
4136         (Target_x86_64::rela_irelative_section): New function.
4137         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
4138         all callers.  Don't create __rel_iplt_{start,end}.
4139         (Output_data_plt_x86_64::add_entry): Add symtab and layout
4140         parameters.  Change all callers.  Use different PLT and GOT for
4141         IFUNC symbols.
4142         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
4143         layout parameters.  Change all callers.  Use different PLT and
4144         GOT.
4145         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
4146         parameters.  Change all callers.  Use different PLT and GOT for
4147         IFUNC symbols.
4148         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
4149         (Output_data_plt_x86_64::rela_irelative): New function.
4150         (Output_data_plt_x86_64::address_for_global): New function.
4151         (Output_data_plt_x86_64::address_for_local): New function.
4152         (Output_data_plt_x86_64::set_final_data_size): Likewise.
4153         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
4154         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
4155         (Target_x86_64::register_global_plt_entry): Add symtab and layout
4156         parameters.
4157         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
4158         reloc.
4159         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
4160         symbols if we didn't create an IRELATIVE GOT.
4161         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
4162         plt_address_for_local.
4163         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
4164         * testsuite/ifuncvar1.c: New test file.
4165         * testsuite/ifuncvar2.c: New test file.
4166         * testsuite/ifuncvar3.c: New test file.
4167         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
4168         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
4169         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
4170         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
4171         * testsuite/Makefile.in: Rebuild.
4172
4173 2011-07-07  Cary Coutant  <ccoutant@google.com>
4174
4175         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
4176         (two_file_test_1_ndebug.o): Likewise.
4177         (two_file_test_1b_ndebug.o): Likewise.
4178         (two_file_test_2_ndebug.o): Likewise.
4179         (two_file_test_main_ndebug.o): Likewise.
4180         (incremental_test_2): Link with no-debug versions.
4181
4182 2011-07-06  Cary Coutant  <ccoutant@google.com>
4183
4184         * gold/incremental.cc
4185         (Output_section_incremental_inputs::write_info_blocks): Check for
4186         hidden and internal symbols.
4187
4188 2011-07-06  Cary Coutant  <ccoutant@google.com>
4189
4190         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
4191         Check disposition for startup file.
4192         (Incremental_inputs::report_command_line): Ignore
4193         --incremental-startup-unchanged option.
4194         * options.cc (General_options::parse_incremental_startup_unchanged):
4195         New function.
4196         (General_options::General_options): Initialize new data member.
4197         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
4198         (General_options): Add --incremental-startup-unchanged option.
4199         (General_options::incremental_startup_disposition): New function.
4200         (General_options::incremental_startup_disposition_): New data member.
4201
4202 2011-07-06  Cary Coutant  <ccoutant@google.com>
4203
4204         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
4205         input file index to Script_info ctor.
4206         (Sized_incremental_binary::do_file_has_changed): Find the
4207         command-line argument for files named in scripts.
4208         * incremental.h (Script_info::Script_info): New ctor
4209         with input file index.
4210         (Script_info::input_file_index): New function.
4211         (Script_info::input_file_index_): New data member.
4212         (Incremental_binary::get_library): Add const.
4213         (Incremental_binary::get_script_info): Add const.
4214         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
4215         * testsuite/Makefile.am (incremental_test_5): New test case.
4216         (incremental_test_6): New test case.
4217         * testsuite/Makefile.in: Regenerate.
4218
4219 2011-07-06  Cary Coutant  <ccoutant@google.com>
4220
4221         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
4222         debug output when command lines differ.
4223
4224 2011-07-06  Cary Coutant  <ccoutant@google.com>
4225
4226         * incremental.cc (Incremental_inputs::report_command_line): Ignore
4227         --incremental-patch option.
4228         * layout.cc (Free_list::allocate): Extend allocation beyond original
4229         end if enabled.
4230         (Layout::make_output_section): Mark sections that should get
4231         patch space.
4232         * options.cc (parse_percent): New function.
4233         * options.h (parse_percent): New function.
4234         (DEFINE_percent): New macro.
4235         (General_options): Add --incremental-patch option.
4236         * output.cc (Output_section::Output_section): Initialize new data
4237         members.
4238         (Output_section::add_input_section): Print section name when out
4239         of patch space.
4240         (Output_section::add_output_section_data): Likewise.
4241         (Output_section::set_final_data_size): Add patch space when
4242         doing --incremental-full.
4243         (Output_section::do_reset_address_and_file_offset): Remove patch
4244         space.
4245         (Output_segment::set_section_list_addresses): Print debug output
4246         only if --incremental-update.
4247         * output.h (Output_section::set_is_patch_space_allowed): New function.
4248         (Output_section::is_patch_space_allowed_): New data member.
4249         (Output_section::patch_space_): New data member.
4250         * parameters.cc (Parameters::incremental_full): New function.
4251         * parameters.h (Parameters::incremental_full): New function
4252         * testsuite/Makefile.am (incremental_test_2): Add test for
4253         --incremental-patch option.
4254         * testsuite/Makefile.in: Regenerate.
4255         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
4256         (t18): Remove function body.
4257
4258 2011-07-05  Doug Kwan  <dougkwan@google.com>
4259
4260         PR gold/12771
4261         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
4262         Arm_Address type for relocation result.
4263         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
4264         overflow check.
4265         (Arm_relocate_functions::abs32): Use unaligned access.
4266         (Arm_relocate_functions::rel32): Ditto.
4267         (Arm_relocate_functions::prel31): Ditto.
4268         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
4269         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
4270         static data relocations.
4271         * testsuite/Makefile.in: Regnerate.
4272         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
4273
4274 2011-07-05  Ian Lance Taylor  <iant@google.com>
4275
4276         PR gold/12392
4277         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
4278         symbols if necessary.
4279         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4280
4281 2011-07-05  Ian Lance Taylor  <iant@google.com>
4282
4283         PR gold/12952
4284         * resolve.cc (Symbol::override_base_with_special): Simply override
4285         version with special symbol version, ignoring previous version.
4286
4287 2011-07-05  Ian Lance Taylor  <iant@google.com>
4288
4289         * object.cc (Sized_relobj_file::include_section_group): Add
4290         information to comment about signature location.
4291
4292 2011-07-02  Ian Lance Taylor  <iant@google.com>
4293
4294         PR gold/12957
4295         * options.h (class General_options): Add -f and -F.
4296         * options.cc (General_options::finalize): Fatal error if -f/-F
4297         are used without -shared.
4298         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
4299
4300 2011-07-02  Ian Lance Taylor  <iant@google.com>
4301
4302         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
4303
4304 2011-07-01  Ian Lance Taylor  <iant@google.com>
4305
4306         PR gold/12525
4307         PR gold/12952
4308         * resolve.cc (Symbol::override_base_with_special): Don't override
4309         the version if the overriding symbol has a different name.
4310         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
4311         all callers.  If we give an error about an undefined version,
4312         define the base version if necessary.
4313         * dynobj.h (class Versions): Update declaration.
4314         * testsuite/weak_alias_test_5.cc: New file.
4315         * testsuite/weak_alias_test.script: New file.
4316         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
4317         and versioned_alias have the right value, and call t2.
4318         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
4319         weak_alias_test_5.so.
4320         (weak_alias_test_LDADD): Likewise.
4321         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
4322         * testsuite/Makefile.in: Rebuild.
4323
4324 2011-07-01  Ian Lance Taylor  <iant@google.com>
4325
4326         PR gold/12525
4327         * options.h (class General_options): Support -z notext.
4328         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
4329         -Wl,-z,notext.
4330         (two_file_shared_nonpic.so): Likewise.
4331         (two_file_shared_mixed.so): Likewise.
4332         (two_file_shared_mixed_1.so): Likewise.
4333         (weak_undef_lib_nonpic.so): Likewise.
4334         (alt/weak_undef_lib_nonpic.so): Likewise.
4335         (tls_test_shared_nonpic.so): Likewise.
4336         * testsuite/Makefile.in: Rebuild.
4337
4338 2011-07-01  Ian Lance Taylor  <iant@google.com>
4339
4340         PR gold/12525
4341         * configure.ac: Test whether static linking works, setting
4342         the automake conditional HAVE_STATIC.
4343         * testsuite/Makefile.am: Disable tests using -static if
4344         HAVE_STATIC is not true.
4345         * configure, testsuite/Makefile.in: Rebuild.
4346
4347 2011-07-01  Ian Lance Taylor  <iant@google.com>
4348
4349         PR gold/12525
4350         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
4351         Assert if we see DW_EH_PE_indirect.
4352         * target.h (Target::ehframe_datarel_base): New function.
4353         (Target::do_ehframe_datarel_base): New target function.
4354         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
4355         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
4356         function.
4357
4358 2011-07-01  Ian Lance Taylor  <iant@google.com>
4359
4360         PR gold/12571
4361         * options.h (class General_options): Add
4362         --ld-generated-unwind-info.
4363         * ehframe.cc (Fde::write): Add address parameter.  Change all
4364         callers.  If associated with PLT, fill in address and size.
4365         (Cie::set_output_offset): Only add merge mapping if there is an
4366         object.
4367         (Cie::write): Add address parameter.  Change all callers.
4368         (Eh_frame::add_ehframe_for_plt): New function.
4369         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
4370         input_offset_ fields into union u_, with new plt field.
4371         (Fde::Fde): Adjust for new union field.
4372         (Fde::Fde) [Output_data version]: New constructor.
4373         (Fde::add_mapping): Only add merge mapping if there is an object.
4374         (class Cie): Update declarations.
4375         (class Eh_frame): Declare add_ehframe_for_plt.
4376         * layout.cc (Layout::layout_eh_frame): Break out code into
4377         make_eh_frame_section, and call it.
4378         (Layout::make_eh_frame_section): New function.
4379         (Layout::add_eh_frame_for_plt): New function.
4380         * layout.h (class Layout): Update declarations.
4381         * merge.cc (Merge_map::add_mapping): Add assertion.
4382         * i386.cc: Include "dwarf.h".
4383         (class Output_data_plt_i386): Make first_plt_entry,
4384         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
4385         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4386         and plt_eh_frame_fde.
4387         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
4388         boundary.  Call add_eh_frame_for_plt if appropriate.
4389         * x86_64.cc: Include "dwarf.h".
4390         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
4391         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
4392         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4393         and plt_eh_frame_fde.
4394         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
4395         appropriate.
4396
4397 2011-06-29  Ian Lance Taylor  <iant@google.com>
4398
4399         PR gold/12629
4400         * object.cc (Sized_relobj_file::layout_section): Change shdr
4401         parameter to be const.
4402         (Sized_relobj_file::layout_eh_frame_section): New function, broken
4403         out of do_layout.
4404         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
4405         appropriate.  Call layout_eh_frame_section.
4406         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
4407         sections.
4408         * object.h (class Sized_relobj_file): Update declarations.
4409
4410 2011-06-29  Ian Lance Taylor  <iant@google.com>
4411
4412         PR gold/12652
4413         * script.cc (Token::integer_value): Accept trailing M/m/K/k
4414         modifier.
4415         (Lex::gather_token): Accept trailing M/m/K/k for integers.
4416
4417 2011-06-29  Ian Lance Taylor  <iant@google.com>
4418
4419         PR gold/12675
4420         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
4421         SHT_X86_64_UNWIND.
4422         * layout.cc (Layout::layout_eh_frame): Likewise.
4423
4424 2011-06-29  Ian Lance Taylor  <iant@google.com>
4425
4426         PR gold/12695
4427         * layout.cc (Layout::symtab_section_shndx): New function.
4428         * layout.h (class Layout): Declare symtab_section_shndx.
4429         * output.cc (Output_section::write_header): Call it.
4430
4431 2011-06-29  Ian Lance Taylor  <iant@google.com>
4432
4433         PR gold/12818
4434         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
4435         symbols which are not used in a relocation.
4436
4437 2011-06-28  Ian Lance Taylor  <iant@google.com>
4438
4439         PR gold/12898
4440         * layout.cc (Layout::segment_precedes): Don't crash if a linker
4441         script create indistinguishable segments.
4442         (Layout::set_segment_offsets): Use stable_sort when sorting
4443         segments.  Pass this to Compare_segments constructor.
4444         * layout.h (class Layout): Make segment_precedes non-static.
4445         (class Compare_segments): Change from struct to class.  Add
4446         layout_ field.  Add constructor.
4447         * script-sections.cc
4448         (Script_sections::attach_sections_using_phdrs_clause): Rename
4449         local orphan to is_orphan.  Don't report failure to put empty
4450         section in segment.  On attachment failure, report name of
4451         section, and attach to first PT_LOAD segment.
4452
4453 2011-06-28  Ian Lance Taylor  <iant@google.com>
4454
4455         PR gold/12934
4456         * target-select.cc (Target_selector::Target_selector): Add
4457         emulation parameter.  Change all callers.
4458         (select_target_by_bfd_name): Rename from select_target_by_name.
4459         Change all callers.
4460         (select_target_by_emulation): New function.
4461         (supported_emulation_names): New function.
4462         * target-select.h (class Target_selector): Add emulation_ field.
4463         Update declarations.
4464         (Target_selector::recognize_by_bfd_name): Rename from
4465         recognize_by_name.  Change all callers.
4466         (Target_selector::supported_bfd_names): Rename from
4467         supported_names.  Change all callers.
4468         (Target_selector::recognize_by_emulation): New function.
4469         (Target_selector::supported_emulations): New function.
4470         (Target_selector::emulation): New function.
4471         (Target_selector::do_recognize_by_bfd_name): Rename from
4472         do_recognize_by_name.  Change all callers.
4473         (Target_selector::do_supported_bfd_names): Rename from
4474         do_supported_names.  Change all callers.
4475         (Target_selector::do_recognize_by_emulation): New function.
4476         (Target_selector::do_supported_emulations): New function.
4477         (select_target_by_bfd_name): Change name in declaration.
4478         (select_target_by_emulation): Declare.
4479         (supported_emulation_names): Declare.
4480         * parameters.cc (parameters_force_valid_target): Try to find
4481         target based on emulation from -m option.
4482         * options.h (class General_options): Change doc string for -m.
4483         * options.cc (help): Print emulations.
4484         (General_options::parse_V): Likewise.
4485         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
4486         Add emulation parameter.  Change all callers.
4487
4488 2011-06-28  Ian Lance Taylor  <iant@google.com>
4489
4490         * target.h (class Target): Add osabi_ field.
4491         (Target::osabi): New function.
4492         (Target::set_osabi): New function.
4493         (Target::Target): Initialize osabi_.
4494         (Target::do_adjust_elf_header): Make pure virtual.
4495         (Sized_target::do_adjust_elf_header): Declare.
4496         * target.cc (Sized_target::do_adjust_elf_header): New function.
4497         (class Sized_target): Instantiate all versions.
4498         * freebsd.h (class Target_freebsd): Remove.
4499         (Target_selector_freebsd::do_recognize): Call set_osabi on
4500         Target.
4501         (Target_selector_freebsd::do_recognize_by_name): Likewise.
4502         (Target_selector_freebsd::set_osabi): Remove.
4503         * i386.cc (class Target_i386): Inherit from Sized_target rather
4504         than Target_freebsd.
4505         * x86_64.cc (class Target_x86_64): Likewise.
4506
4507 2011-06-28  Ian Lance Taylor  <iant@google.com>
4508
4509         * target.h (Target::can_check_for_function_pointers): Rewrite.
4510         Make non-virtual.
4511         (Target::can_icf_inline_merge_sections): Likewise.
4512         (Target::section_may_have_icf_unsafe_poineters): Likewise.
4513         (Target::Target_info): Add can_icf_inline_merge_sections field.
4514         (Target::do_can_check_for_function_pointers): New virtual
4515         function.
4516         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
4517         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
4518         from can_check_for_function_pointers, move in file.
4519         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
4520         section_may_have_icf_unsafe_poineters, move in file.
4521         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
4522         * i386.cc (Target_i386::do_can_check_for_function_pointers):
4523         Rename from can_check_for_function_pointers, move in file.
4524         (Target_i386::can_icf_inline_merge_sections): Remove.
4525         (Target_i386::i386_info): Initialize
4526         can_icf_inline_merge_sections.
4527         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
4528         Initialize can_icf_inline_merge_sections.
4529         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
4530         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
4531         Rename from can_check_for_function_pointers, move in file.
4532         (Target_x86_64::can_icf_inline_merge_sections): Remove.
4533         (Target_x86_64::x86_64_info): Initialize
4534         can_icf_inline_merge_sections.
4535         * testsuite/testfile.cc (Target_test::test_target_info):
4536         Likewise.
4537         * icf.cc (get_section_contents): Correct formatting.
4538
4539 2011-06-27  Ian Lance Taylor  <iant@google.com>
4540
4541         * symtab.cc (Symbol::versioned_name): New function.
4542         (Symbol_table::add_to_final_symtab): Use versioned_name when
4543         appropriate.
4544         (Symbol_table::sized_write_symbol): Likewise.
4545         * symtab.h (class Symbol): Declare versioned_name.
4546         * stringpool.h (class Stringpool_template): Add variant of add
4547         which takes a std::basic_string.
4548         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
4549         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
4550         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
4551         (ver_test_12.o): New target.
4552         * testsuite/Makefile.in: Rebuild.
4553
4554 2011-06-27  Doug Kwan  <dougkwan@google.com>
4555
4556         * arm.cc (Arm_relocate_functions::thm_jump8,
4557         Arm_relocate_functions::thm_jump11): Use a wider signed
4558         type to compute offset.
4559         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
4560         arm_thm_jump8.
4561         * testsuite/Makefile.in: Regenerate.
4562         * testsuite/arm_branch_in_range.sh: Check test results of
4563         arm_thm_jump11 and arm_thm_jump8.
4564         * testsuite/arm_thm_jump11.s: New test source file.
4565         * testsuite/arm_thm_jump11.t: New linker script.
4566         * testsuite/arm_thm_jump8.s: New test source file.
4567         * testsuite/arm_thm_jump8.t: New linker script.
4568
4569 2011-06-24  Ian Lance Taylor  <iant@google.com>
4570
4571         * layout.cc: Include "object.h".
4572         (ctors_sections_in_init_array): New static variable.
4573         (Layout::is_ctors_in_init_array): New function.
4574         (Layout::layout): Add entry to ctors_sections_in_init_array if
4575         appropriate.
4576         * layout.h (class Layout): Declare is_ctors_in_init_array.
4577         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
4578         is_ctors_reverse_view is set.
4579         (Sized_relobj_file::write_sections): Add layout parameter.  Change
4580         all callers.  Set is_ctors_reverse_view field of View_size.
4581         (Sized_relobj_file::reverse_words): New function.
4582         * object.h (Sized_relobj_file::View_size): Add
4583         is_ctors_reverse_view field.
4584         (class Sized_relobj_file): Update declarations.
4585         * testsuite/initpri3.c: New test.
4586         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
4587         initpri3b.
4588         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
4589         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
4590         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
4591         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
4592         * testsuite/Makefile.in: Rebuild.
4593
4594 2011-06-24  Cary Coutant  <ccoutant@google.com>
4595
4596         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
4597         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
4598         (debug_msg_cdebug.err): New targets.
4599         * testsuite/Makefile.in: Regenerate.
4600         * testsuite/debug_msg.sh: Check output of link with compressed debug.
4601         Fix checks for link with shared library.
4602
4603 2011-06-24  Doug Kwan  <dougkwan@google.com>
4604
4605         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
4606         skip empty text sections.
4607         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
4608
4609 2011-06-22  Ian Lance Taylor  <iant@google.com>
4610
4611         PR gold/12910
4612         * options.h (class General_options): Add --ctors-in-init-array.
4613         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
4614         friends as SHT_PROGBITS for merging sections.
4615         (Layout::layout): Remove special handling of .init_array and
4616         friends.  Don't sort if doing relocatable link.  Sort for .ctors
4617         and .dtors if ctors_in_init_array.
4618         (Layout::make_output_section): Force correct section types for
4619         .init_array and friends.  Don't sort if doing relocatable link,
4620         Don't sort .ctors and .dtors if ctors_in_init_array.
4621         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
4622         (Layout::output_section_name): Add relobj parameter.  Change all
4623         callers.  Handle .ctors. and .dtors. in code rather than table.
4624         Handle .ctors and .dtors if ctors_in_init_array.
4625         (Layout::match_file_name): New function, moved from output.cc.
4626         * layout.h (class Layout): Update declarations.
4627         * output.cc: Include "layout.h".
4628         (Input_section_sort_entry::get_priority): New function.
4629         (Input_section_sort_entry::match_file_name): Just call
4630         Layout::match_file_name.
4631         (Output_section::Input_section_sort_init_fini_compare::operator()):
4632         Handle .ctors and .dtors.  Sort by explicit priority rather than
4633         by name.
4634         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
4635         * testsuite/initpri2.c: New test.
4636         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
4637         (check_PROGRAMS): Add initpri2.
4638         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
4639         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
4640         * configure, testsuite/Makefile.in: Rebuild.
4641
4642 2011-06-19  Ian Lance Taylor  <iant@google.com>
4643
4644         PR gold/12880
4645         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
4646         .interp section to a PT_INTERP segment even if we have seen a
4647         --dynamic-linker option.  Don't do it if we have seen a PHDRS
4648         clause in a linker script.
4649         (Layout::finalize): Don't create a .interp section if we've
4650         already create a PT_INTERP segment.
4651         (Layout::create_interp): Always call choose_output_section (revert
4652         patch of 2011-06-17).  Don't create PT_INTERP segment.
4653         * script-sections.cc
4654         (Script_sections::create_note_and_tls_segments): Add a .interp
4655         section to a PT_INTERP segment even if we have seen a
4656         --dynamic-linker option.
4657
4658 2011-06-18  Ian Lance Taylor  <iant@google.com>
4659
4660         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
4661         merely because a non-PT_LOAD segment has a dynamic reloc.
4662
4663 2011-06-18  Ian Lance Taylor  <iant@google.com>
4664
4665         * layout.cc (Layout::finish_dynamic_section): Don't create
4666         DT_FLAGS entry if not needed.
4667
4668 2011-06-18  Ian Lance Taylor  <iant@google.com>
4669
4670         PR gold/12745
4671         * layout.cc (Layout::layout_eh_frame): Correct handling of
4672         writable .eh_frame section.
4673
4674 2011-06-17  Ian Lance Taylor  <iant@google.com>
4675
4676         PR gold/12893
4677         * resolve.cc (Symbol_table::resolve): Don't give an error if a
4678         symbol is redefined with the exact same object and value.
4679
4680 2011-06-17  Ian Lance Taylor  <iant@google.com>
4681
4682         PR gold/12880
4683         * layout.h (class Layout): Add interp_segment_ field.
4684         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
4685         (Layout::attach_allocated_section_to_segment): If making shared
4686         library, put .interp section in PT_INTERP segment.
4687         (Layout::finalize): Also call create_interp if -dynamic-linker
4688         option was used.
4689         (Layout::create_interp): Assert that there is no PT_INTERP
4690         segment.  If not using a SECTIONS clause, use make_output_section.
4691         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
4692         * script-sections.cc
4693         (Script_sections::create_note_and_tls_segments): If making shared
4694         library, put .interp section in PT_INTERP segment.
4695
4696 2011-06-17  Ian Lance Taylor  <iant@google.com>
4697
4698         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
4699         when making a shared library.
4700
4701 2011-06-17  Ian Lance Taylor  <iant@google.com>
4702
4703         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
4704         parameter.  Change all callers.  Don't issue warning about PC32
4705         against locally defined symbol.
4706
4707 2011-06-16  Ian Lance Taylor  <iant@google.com>
4708
4709         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
4710         occurs in same object.
4711
4712 2011-06-14  Alan Modra  <amodra@gmail.com>
4713
4714         * po/POTFILES.in: Regenerate.
4715
4716 2011-06-09  Ian Lance Taylor  <iant@google.com>
4717
4718         * script-sections.cc
4719         (Orphan_output_section::set_section_addresses): For a relocatable
4720         link set address to 0.
4721
4722 2011-06-09  Cary Coutant  <ccoutant@google.com>
4723
4724         PR gold/12804
4725         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
4726         used with --compress-debug-sections.
4727         * gold/object.cc (Sized_relobj_file::do_layout): Report
4728         uncompressed size of compressed input sections.
4729
4730 2011-06-08  Cary Coutant  <ccoutant@google.com>
4731
4732         PR gold/12804
4733         * testsuite/two_file_test_2_v1.cc: Change initialization of
4734         v2 to keep it in .data.
4735
4736 2011-06-07  Cary Coutant  <ccoutant@google.com>
4737
4738         * common.cc (Symbol_table::do_allocate_commons_list): Call
4739         gold_fallback.
4740         * errors.cc (Errors::fatal): Adjust call to gold_exit.
4741         (Errors::fallback): New function.
4742         (gold_fallback): New function.
4743         * errors.h (Errors::fallback): New function.
4744         * gold.cc (gold_exit): Change status parameter to enum; adjust
4745         all callers.
4746         (queue_initial_tasks): Call gold_fallback.
4747         * gold.h: Include cstdlib.
4748         (Exit_status): New enum type.
4749         (gold_exit): Change status parameter to enum.
4750         (gold_fallback): New function.
4751         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
4752         (Layout::create_symtab_sections): Likewise.
4753         (Layout::create_shdrs): Likewise.
4754         * main.cc (main): Adjust call to gold_exit.
4755         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
4756         (Output_data_got::add_got_entry_pair): Likewise.
4757         (Output_section::add_input_section): Likewise.
4758         (Output_section::add_output_section_data): Likewise.
4759         (Output_segment::set_section_list_addresses): Likewise.
4760         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
4761
4762 2011-06-07  Cary Coutant  <ccoutant@google.com>
4763
4764         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
4765         for incremental links.
4766         * output.cc (Output_segment::set_section_list_addresses): Remove
4767         FIXME and test for TLS or BSS.
4768
4769 2011-06-07  Cary Coutant  <ccoutant@google.com>
4770
4771         * testsuite/Makefile.am: Add incremental_copy_test,
4772         incremental_common_test_1.
4773         * testsuite/Makefile.in: Regenerate.
4774         * testsuite/common_test_1_v1.c: New source file.
4775         * testsuite/common_test_1_v2.c: New source file.
4776         * testsuite/copy_test_v1.cc: New source file.
4777
4778 2011-06-07  Cary Coutant  <ccoutant@google.com>
4779
4780         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
4781         update, allocate common from bss section's free list.
4782         * incremental-dump.cc (dump_incremental_inputs): Print flag for
4783         linker-defined symbols.
4784         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4785         Skip GOT and PLT entries that are no longer referenced.
4786         (Output_section_incremental_inputs::write_info_blocks): Mark
4787         linker-defined symbols.
4788         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
4789         * output.cc (Output_section::allocate): New function.
4790         * output.h (Output_section::allocate): New function.
4791         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
4792         linker-defined symbols.
4793         (Symbol::override_base_with_special): Copy is_predefined_ flag.
4794         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
4795         (Symbol::init_base_output_data): Likewise.
4796         (Symbol::init_base_output_segment): Likewise.
4797         (Symbol::init_base_constant): Likewise.
4798         (Sized_symbol::init_output_data): Likewise.
4799         (Sized_symbol::init_output_segment): Likewise.
4800         (Sized_symbol::init_constant): Likewise.
4801         (Symbol_table::do_define_in_output_data): Likewise.
4802         (Symbol_table::do_define_in_output_segment): Likewise.
4803         (Symbol_table::do_define_as_constant): Likewise.
4804         * symtab.h (Symbol::is_predefined): New function.
4805         (Symbol::init_base_output_data): Add is_predefined parameter.
4806         (Symbol::init_base_output_segment): Likewise.
4807         (Symbol::init_base_constant): Likewise.
4808         (Symbol::is_predefined_): New data member.
4809         (Sized_symbol::init_output_data): Add is_predefined parameter.
4810         (Sized_symbol::init_output_segment): Likewise.
4811         (Sized_symbol::init_constant): Likewise.
4812         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
4813
4814 2011-06-07  Cary Coutant  <ccoutant@google.com>
4815
4816         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
4817         instead of emit_copy_reloc.
4818         (Copy_relocs::emit_copy_reloc): Refactor.
4819         (Copy_relocs::make_copy_reloc): New function.
4820         (Copy_relocs::add_copy_reloc): Remove.
4821         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
4822         section.
4823         (Copy_relocs::make_copy_reloc): New function.
4824         (Copy_relocs::add_copy_reloc): Remove.
4825         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
4826         unchanged input files.
4827         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
4828         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
4829         Reserve BSS space for COPY relocations.
4830         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4831         (Output_section_incremental_inputs::write_info_blocks): Record
4832         whether a symbol is copied from a shared object.
4833         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
4834         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
4835         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
4836         (Incremental_input_entry_reader::get_output_symbol_index): Add
4837         is_copy parameter.
4838         (Incremental_binary::emit_copy_relocs): New function.
4839         (Incremental_binary::do_emit_copy_relocs): New function.
4840         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4841         new data member.
4842         (Sized_incremental_binary::add_copy_reloc): New function.
4843         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4844         (Sized_incremental_binary::Copy_reloc): New struct.
4845         (Sized_incremental_binary::Copy_relocs): New typedef.
4846         (Sized_incremental_binary::copy_relocs_): New data member.
4847         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
4848         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
4849         * target.h (Sized_target::emit_copy_reloc): New function.
4850         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
4851
4852 2011-06-02  Cary Coutant  <ccoutant@google.com>
4853
4854         PR gold/12163
4855         * gold/archive.cc (Archive::Archive): Initialize new data member.
4856         (Archive::include_all_members): Return if archive has already been
4857         included.
4858         * gold/archive.h (Archive::include_all_members_): New data member.
4859
4860 2011-06-02  Nick Clifton  <nickc@redhat.com>
4861
4862         * dynobj.h: Fix spelling mistake in comment.
4863         * output.cc: Likewise.
4864
4865 2011-05-31  Doug Kwan  <dougkwan@google.com>
4866             Asier Llano
4867
4868         PR gold/12826
4869         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
4870         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
4871         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
4872         redundant arm_exidx_test.so.
4873         * testsuite/Makefile.in: Regenerate.
4874         (check_SCRIPTS): Add pr12826.sh
4875         (check_DATA): Add pr12826.stdout
4876         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
4877         * testsuite/pr12826.sh: New file.
4878         * testsuite/pr12826_1.s: Ditto.
4879         * testsuite/pr12826_1.s: Ditto.
4880
4881 2011-05-30  Ian Lance Taylor  <iant@google.com>
4882
4883         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
4884         sections.
4885
4886 2011-05-29  Ian Lance Taylor  <iant@google.com>
4887
4888         PR gold/12804
4889         * testsuite/Makefile.am: Use different file name for two_file_test
4890         temporary file for each incremental test.
4891         * testsuite/Makefile.in: Rebuild.
4892
4893 2011-05-29  Ian Lance Taylor  <iant@google.com>
4894
4895         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
4896         binary input file is empty.
4897
4898 2011-05-27  Ian Lance Taylor  <iant@google.com>
4899
4900         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
4901         (ver_test_9.so): Likewise.
4902         * testsuite/Makefile.in: Rebuild.
4903
4904 2011-05-26 Cary Coutant  <ccoutant@google.com>
4905
4906         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
4907         * incremental.cc (Incremental_inputs::report_input_section): Fix
4908         comment, indentation.
4909         (Incremental_inputs::report_comdat_group): New function.
4910         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4911         of data for incremental input file entry.
4912         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
4913         group count, COMDAT group signatures.
4914         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
4915         an unchanged input file.
4916         * incremental.h (Incremental_object_entry::Incremental_object_entry):
4917         Initialize new data member.
4918         (Incremental_object_entry::add_comdat_group): New function.
4919         (Incremental_object_entry::get_comdat_group_count): New function.
4920         (Incremental_object_entry::get_comdat_signature_key): New function.
4921         (Incremental_object_entry::groups_): New data member.
4922         (Incremental_inputs::report_comdat_group): New function.
4923         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
4924         data for incremental input file entry.
4925         (Incremental_input_entry_reader::get_comdat_group_count): New function.
4926         (Incremental_input_entry_reader::get_input_section): Adjust size of
4927         data for incremental input file entry.
4928         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
4929         (Incremental_input_entry_reader::get_comdat_group_signature): New
4930         function.
4931         * object.cc (Sized_relobj::include_section_group): Report kept
4932         COMDAT groups for incremental links.
4933
4934 2011-05-24  David Meyer  <pdox@google.com>
4935
4936         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
4937         with name parameter.  Add found_name parameter.
4938         * fileread.cc (Input_file::find_file): Adjust code accordingly.
4939         * dirsearch.h (class Dirsearch): Update declaration.
4940
4941 2011-05-24  Ian Lance Taylor  <iant@google.com>
4942
4943         * archive.cc (Library_base::should_include_member): Pull in object
4944         from archive if it defines the entry symbol.
4945         * parameters.cc (Parameters::entry): New function.
4946         * parameters.h (class Parameters): Declare entry.
4947         * output.h (class Output_file_header): Remove entry_ field.
4948         * output.cc (Output_file_header::Output_file_header): Remove entry
4949         parameter.  Change all callers.
4950         (Output_file_header::entry): Use parameters->entry.
4951         * gold.cc (queue_middle_tasks): Likewise.
4952         * plugin.cc (Plugin_hook::run): Likewise.
4953
4954 2011-05-24 Cary Coutant  <ccoutant@google.com>
4955
4956         * gold.cc (queue_initial_tasks): Pass incremental base filename
4957         to Output_file::open_base_file; don't print error message.
4958         * incremental-dump.cc (main): Adjust call to
4959         Output_file::open_for_modification.
4960         * incremental-dump.cc (main): Likewise.
4961         * incremental.cc (Incremental_inputs::report_command_line):
4962         Ignore --incremental-base option when comparing command lines.
4963         Ignore parameter when given as separate argument.
4964         * options.h (class General_options): Add --incremental-base.
4965         * output.cc (Output_file::Output_file):
4966         (Output_file::open_base_file): Add base_name and writable parameters;
4967         read base file into new file; print error message here.
4968         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4969         callers.
4970         * output.h (Output_file::open_for_modification): Rename to...
4971         (Output_file::open_base_file): ...this; add base_name and
4972         writable parameters; adjust all callers.
4973         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4974         callers.
4975         * testsuite/Makefile.am (incremental_test_4): Test
4976         --incremental-base.
4977         * testsuite/Makefile.in: Regenerate.
4978
4979 2011-05-24 Cary Coutant  <ccoutant@google.com>
4980
4981         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
4982         incremental_test_4.
4983         * testsuite/Makefile.in: Regenerate.
4984         * testsuite/two_file_test_1_v1.cc: New test source file.
4985         * testsuite/two_file_test_1b_v1.cc: New test source file.
4986         * testsuite/two_file_test_2_v1.cc: New test source file.
4987
4988 2011-05-24 Cary Coutant  <ccoutant@google.com>
4989
4990         * dynobj.h (Dynobj::do_dynobj): New function.
4991         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
4992         flag and soname for shared objects.
4993         * incremental.cc (Incremental_inputs::report_object): Make
4994         either Incremental_object_entry or Incremental_dynobj_entry; add
4995         soname to string table.
4996         (Incremental_inputs::report_input_section): Add assertion.
4997         (Output_section_incremental_inputs::set_final_data_size): Adjust
4998         type of input file entry for shared libraries; adjust size of
4999         shared library info entry.
5000         (Output_section_incremental_inputs::write_input_files): Write
5001         as_needed flag for shared libraries.
5002         (Output_section_incremental_inputs::write_info_blocks): Adjust type
5003         of input file entry for shared libraries; write soname.
5004         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
5005         soname from incremental info.
5006         * incremental.h (enum Incremental_input_flags): Add
5007         INCREMENTAL_INPUT_AS_NEEDED.
5008         (Incremental_input_entry::Incremental_input_entry): Initialize new
5009         data member.
5010         (Incremental_input_entry::set_as_needed): New function.
5011         (Incremental_input_entry::as_needed): New function.
5012         (Incremental_input_entry::do_dynobj_entry): New function.
5013         (Incremental_input_entry::as_needed_): New data member.
5014         (Incremental_object_entry::Incremental_object_entry): Don't check
5015         for shared library.
5016         (Incremental_object_entry::do_type): Likewise.
5017         (class Incremental_dynobj_entry): New class.
5018         (Incremental_input_entry_reader::as_needed): New function.
5019         (Incremental_input_entry_reader::get_soname): New function.
5020         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
5021         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
5022         size of shared library info entry.
5023         * layout.cc (Layout::finish_dynamic_section): Don't test for
5024         incremental link when adding DT_NEEDED entries.
5025         * object.h (Object::Object): Initialize new data member.
5026         (Object::dynobj): New function.
5027         (Object::set_as_needed): New function.
5028         (Object::as_needed): New function.
5029         (Object::do_dynobj): New function.
5030         (Object::as_needed_): New data member.
5031
5032 2011-05-24 Cary Coutant  <ccoutant@google.com>
5033
5034         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
5035         info; adjust display of GOT entries.
5036         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5037         vector of input objects; remove file_status_.
5038         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
5039         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
5040         got_plt reader; call target hooks to reserve GOT entries.
5041         (Output_section_incremental_inputs::set_final_data_size): Adjust size
5042         of input file info header and GOT info entry.
5043         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
5044         relocation info.
5045         (Got_plt_view_info::got_descriptor): Remove.
5046         (Got_plt_view_info::sym_index): New data member.
5047         (Got_plt_view_info::input_index): New data member.
5048         (Local_got_offset_visitor::visit): Write input file index.
5049         (Global_got_offset_visitor::visit): Write 0 for input file index.
5050         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
5051         with sym_index and input_index.
5052         (Output_section_incremental_inputs::write_got_plt): Adjust size of
5053         incremental info GOT entry; replace got_descriptor with input_index.
5054         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
5055         map from input file index to object.
5056         (Sized_relobj_incr::do_layout): Replace direct data member reference
5057         with accessor function.
5058         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
5059         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
5060         Adjust size of input file info header.
5061         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
5062         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
5063         (Incremental_input_entry_reader::get_input_section): Adjust size of
5064         input file info header.
5065         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
5066         of incremental info GOT entry.
5067         (Incremental_got_plt_reader::get_got_desc): Remove.
5068         (Incremental_got_plt_reader::get_got_symndx): New function.
5069         (Incremental_got_plt_reader::get_got_input_index): New function.
5070         (Sized_incremental_binary::Sized_incremental_binary): Remove
5071         file_status_; add input_objects_.
5072         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
5073         (Sized_incremental_binary::set_file_is_unchanged): Remove.
5074         (Sized_incremental_binary::file_is_unchanged): Remove.
5075         (Sized_incremental_binary::set_input_object): New function.
5076         (Sized_incremental_binary::input_object): New function.
5077         (Sized_incremental_binary::file_status_): Remove.
5078         (Sized_incremental_binary::input_objects_): New data member.
5079         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
5080         references.
5081         (Sized_relobj_incr::invalid_address): Move to base class.
5082         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
5083         class.
5084         (Sized_relobj_incr::do_output_section_offset): Likewise.
5085         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
5086         (Sized_relobj_incr::section_offsets_): Likewise.
5087         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
5088         function.
5089         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
5090         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
5091         with accessor function.
5092         (Sized_relobj_file::do_layout): Likewise.
5093         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
5094         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
5095         (Sized_relobj_file::compute_final_local_value): Replace refs to
5096         section_offsets_ with accessor function.
5097         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
5098         * object.h (Relobj::Relobj): Initialize new data members.
5099         (Relobj::add_dyn_reloc): New function.
5100         (Relobj::first_dyn_reloc): New function.
5101         (Relobj::dyn_reloc_count): New function.
5102         (Relobj::first_dyn_reloc_): New data member.
5103         (Relobj::dyn_reloc_count_): New data member.
5104         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
5105         references.
5106         (Sized_relobj::Address): New typedef.
5107         (Sized_relobj::invalid_address): Move here from child class.
5108         (Sized_relobj::Sized_relobj): Initialize new data members.
5109         (Sized_relobj::sized_relobj): New function.
5110         (Sized_relobj::is_output_section_offset_invalid): Move here from
5111         child class.
5112         (Sized_relobj::get_output_section_offset): Likewise.
5113         (Sized_relobj::local_has_got_offset): Likewise.
5114         (Sized_relobj::local_got_offset): Likewise.
5115         (Sized_relobj::set_local_got_offset): Likewise.
5116         (Sized_relobj::do_for_all_local_got_entries): Likewise.
5117         (Sized_relobj::clear_got_offsets): New function.
5118         (Sized_relobj::section_offsets): Move here from child class.
5119         (Sized_relobj::do_output_section_offset): Likewise.
5120         (Sized_relobj::do_set_section_offset): Likewise.
5121         (Sized_relobj::Local_got_offsets): Likewise.
5122         (Sized_relobj::local_got_offsets_): Likewise.
5123         (Sized_relobj::section_offsets_): Likewise.
5124         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
5125         references.
5126         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
5127         class.
5128         (Sized_relobj_file::sized_relobj): New function
5129         (Sized_relobj_file::local_has_got_offset): Move to base class.
5130         (Sized_relobj_file::local_got_offset): Likewise.
5131         (Sized_relobj_file::set_local_got_offset): Likewise.
5132         (Sized_relobj_file::get_output_section_offset): Likewise.
5133         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
5134         (Sized_relobj_file::do_output_section_offset): Likewise.
5135         (Sized_relobj_file::do_set_section_offset): Likewise.
5136         (Sized_relobj_file::Local_got_offsets): Likewise.
5137         (Sized_relobj_file::local_got_offsets_): Likewise.
5138         (Sized_relobj_file::section_offsets_): Likewise.
5139         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
5140         (all constructors).
5141         (set_needs_dynsym_index): Convert relobj to derived class pointer.
5142         (Output_reloc::get_symbol_index): Likewise.
5143         (Output_reloc::local_section_offset): Likewise.
5144         (Output_reloc::get_address): Likewise.
5145         (Output_reloc::symbol_value): Likewise.
5146         (Output_data_got::reserve_slot): Move to class definition.
5147         (Output_data_got::reserve_local): New function.
5148         (Output_data_got::reserve_slot_for_global): Remove.
5149         (Output_data_got::reserve_global): New function.
5150         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
5151         (all constructors, two instantiations).
5152         (Output_reloc::get_relobj): New function (two instantiations).
5153         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
5154         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
5155         (Output_data_reloc::add_global): Adjust type of relobj.
5156         (Output_data_reloc::add_global_relative): Likewise.
5157         (Output_data_reloc::add_symbolless_global_addend): Likewise.
5158         (Output_data_reloc::add_local): Likewise.
5159         (Output_data_reloc::add_local_relative): Likewise.
5160         (Output_data_reloc::add_symbolless_local_addend): Likewise.
5161         (Output_data_reloc::add_local_section): Likewise.
5162         (Output_data_reloc::add_output_section): Likewise.
5163         (Output_data_reloc::add_absolute): Likewise.
5164         (Output_data_reloc::add_target_specific): Likewise.
5165         (Output_data_got::reserve_slot): Move definition here.
5166         (Output_data_got::reserve_local): New function.
5167         (Output_data_got::reserve_global): New function.
5168         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
5169         section_offsets_ with accessor function.
5170         (Sized_relobj_file::write_sections): Likewise.
5171         (Sized_relobj_file::do_relocate_sections): Likewise.
5172         * target.h (Sized_target::reserve_local_got_entry): New function.
5173         (Sized_target::reserve_global_got_entry): New function.
5174         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
5175         (Target_x86_64::reserve_global_got_entry): New function.
5176         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
5177
5178 2011-05-23 Cary Coutant  <ccoutant@google.com>
5179
5180         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
5181         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
5182         bit when checking got_type.
5183         * incremental.cc (Sized_incremental_binary::setup_readers):
5184         Store symbol table and string table locations; initialize bit vector
5185         of file status flags.
5186         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
5187         unchanged files.
5188         (Sized_incremental_binary::do_process_got_plt): New function.
5189         (Sized_incremental_binary::get_symtab_view): Use stored locations.
5190         (Output_section_incremental_inputs::set_final_data_size): Record
5191         file index for each input file.
5192         (Output_section_incremental_inputs::write_got_plt): Store file index
5193         instead of input entry offset for each GOT entry.
5194         * incremental.h
5195         (Incremental_input_entry::Incremental_input_entry): Initialize new
5196         data member.
5197         (Incremental_input_entry::set_offset): Store file index.
5198         (Incremental_input_entry::get_file_index): New function.
5199         (Incremental_input_entry::file_index_): New data member.
5200         (Incremental_binary::process_got_plt): New function.
5201         (Incremental_binary::do_process_got_plt): New function.
5202         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5203         data members.
5204         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
5205         (Sized_incremental_binary::set_file_is_unchanged): New function.
5206         (Sized_incremental_binary::file_is_unchanged): New function.
5207         (Sized_incremental_binary::do_process_got_plt): New function.
5208         (Sized_incremental_binary::file_status_): New data member.
5209         (Sized_incremental_binary::main_symtab_loc_): New data member.
5210         (Sized_incremental_binary::main_strtab_loc_): New data member.
5211         * output.cc (Output_data_got::Got_entry::write): Add case
5212         RESERVED_CODE.
5213         (Output_data_got::add_global): Call add_got_entry.
5214         (Output_data_got::add_global_plt): Likewise.
5215         (Output_data_got::add_global_with_rel): Likewise.
5216         (Output_data_got::add_global_with_rela): Likewise.
5217         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
5218         (Output_data_got::add_global_pair_with_rela): Likewise.
5219         (Output_data_got::add_local): Call add_got_entry.
5220         (Output_data_got::add_local_plt): Likewise.
5221         (Output_data_got::add_local_with_rel): Likewise.
5222         (Output_data_got::add_local_with_rela): Likewise.
5223         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
5224         (Output_data_got::add_local_pair_with_rela): Likewise.
5225         (Output_data_got::reserve_slot): New function.
5226         (Output_data_got::reserve_slot_for_global): New function.
5227         (Output_data_got::add_got_entry): New function.
5228         (Output_data_got::add_got_entry_pair): New function.
5229         (Output_section::add_output_section_data): Edit FIXME.
5230         * output.h
5231         (Output_section_data_build::Output_section_data_build): New
5232         constructor with size parameter.
5233         (Output_data_space::Output_data_space): Likewise.
5234         (Output_data_got::Output_data_got): Initialize new data member; new
5235         constructor with size parameter.
5236         (Output_data_got::add_constant): Call add_got_entry.
5237         (Output_data_got::reserve_slot): New function.
5238         (Output_data_got::reserve_slot_for_global): New function.
5239         (class Output_data_got::Got_entry): Add RESERVED_CODE.
5240         (Output_data_got::add_got_entry): New function.
5241         (Output_data_got::add_got_entry_pair): New function.
5242         (Output_data_got::free_list_): New data member.
5243         * target.h (Sized_target::init_got_plt_for_update): New function.
5244         (Sized_target::register_global_plt_entry): New function.
5245         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
5246         Initialize new data member; call init; add constructor with PLT count.
5247         (Output_data_plt_x86_64::init): New function.
5248         (Output_data_plt_x86_64::add_relocation): New function.
5249         (Output_data_plt_x86_64::reserve_slot): New function.
5250         (Output_data_plt_x86_64::free_list_): New data member.
5251         (Target_x86_64::init_got_plt_for_update): New function.
5252         (Target_x86_64::register_global_plt_entry): New function.
5253         (Output_data_plt_x86_64::add_entry): Allocate from free list for
5254         incremental updates.
5255         (Output_data_plt_x86_64::add_relocation): New function.
5256         * testsuite/object_unittest.cc (Object_test): Set default options.
5257
5258 2011-05-16  Ian Lance Taylor  <iant@google.com>
5259
5260         * options.h (class General_options): Make -i a synonym for -r.
5261
5262 2011-05-16  Ian Lance Taylor  <iant@google.com>
5263
5264         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
5265
5266 2011-05-10 Cary Coutant  <ccoutant@google.com>
5267
5268         * object.cc (Sized_relobj::do_count_local_symbols): Check for
5269         strip_all (-s).
5270
5271 2011-05-06  Ian Lance Taylor  <iant@google.com>
5272
5273         * layout.cc (Layout::layout): If the output section flags change,
5274         update the ordering.
5275
5276 2011-04-25 Cary Coutant  <ccoutant@google.com>
5277
5278         * incremental-dump.cc (dump_incremental_inputs): Print local
5279         symbol info for each input file.
5280         * incremental.cc
5281         (Output_section_incremental_inputs::set_final_data_size): Add local
5282         symbol info to input file entries in incremental info.
5283         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5284         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
5285         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
5286         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
5287         implementation.
5288         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
5289         (Sized_incr_relobj::do_relocate): Write the local symbols.
5290         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
5291         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
5292         Adjust size of input file header.
5293         (Incremental_inputs_reader::get_local_symbol_offset): New function.
5294         (Incremental_inputs_reader::get_local_symbol_count): New function.
5295         (Incremental_inputs_reader::get_input_section): Adjust size of input
5296         file header.
5297         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
5298         (Sized_incr_relobj::This): New typedef.
5299         (Sized_incr_relobj::sym_size): New const data member.
5300         (Sized_incr_relobj::Local_symbol): New struct.
5301         (Sized_incr_relobj::do_output_local_symbol_count): New function.
5302         (Sized_incr_relobj::do_local_symbol_offset): New function.
5303         (Sized_incr_relobj::local_symbol_count_): New data member.
5304         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
5305         (Sized_incr_relobj::local_symbol_index_): New data member.
5306         (Sized_incr_relobj::local_symbol_offset_): New data member.
5307         (Sized_incr_relobj::local_dynsym_offset_): New data member.
5308         (Sized_incr_relobj::local_symbols_): New data member.
5309         * object.h (Relobj::output_local_symbol_count): New function.
5310         (Relobj::local_symbol_offset): New function.
5311         (Relobj::do_output_local_symbol_count): New function.
5312         (Relobj::do_local_symbol_offset): New function.
5313         (Sized_relobj::do_output_local_symbol_count): New function.
5314         (Sized_relobj::do_local_symbol_offset): New function.
5315
5316 2011-04-22  Vladimir Simonov  <sv@sw.ru>
5317
5318         * descriptors.cc (set_close_on_exec): New function.
5319         (Descriptors::open): Use set_close_on_exec.
5320         * output.cc (S_ISLNK): Define if not defined.
5321
5322 2011-04-22 Cary Coutant  <ccoutant@google.com>
5323
5324         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5325         global symbol map.
5326         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5327         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
5328         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
5329         relocations.
5330         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
5331         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
5332         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
5333         * incremental.h
5334         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
5335         function.
5336         (Incremental_binary::apply_incremental_relocs): New function.
5337         (Incremental_binary::do_apply_incremental_relocs): New function.
5338         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5339         data member.
5340         (Sized_incremental_binary::add_global_symbol): New function.
5341         (Sized_incremental_binary::global_symbol): New function.
5342         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5343         (Sized_incremental_binary::symbol_map_): New data member.
5344         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
5345         * target.h (Sized_target::apply_relocation): New function.
5346         * target-reloc.h (apply_relocation): New function.
5347         * x86_64.cc (Target_x86_64::apply_relocation): New function.
5348
5349 2011-04-22  Doug Kwan  <dougkwan@google.com>
5350
5351         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
5352         flag of a SHT_ARM_EXIDX section.
5353         * testsuite/Makefile.am (arm_exidx_test): New test rules.
5354         * testsuite/Makefile.in: Regenerate.
5355         * testsuite/arm_exidx_test.s: New file.
5356         * testsuite/arm_exidx_test.sh: Same.
5357
5358 2011-04-20 Cary Coutant  <ccoutant@google.com>
5359
5360         PR gold/12689
5361         * archive.h (Incremental_archive_entry::Archive_member):
5362         Initialize arg_serial_ (second constructor).
5363
5364 2011-04-17  Ian Lance Taylor  <iant@google.com>
5365
5366         * object.cc (Relocate_info::location): Simplify location string.
5367         * errors.cc (Errors::error_at_location): Don't print program
5368         name.
5369         (Errors::warning_at_location): Likewise.
5370         (Errors::undefined_symbol): Likewise.
5371         * testsuite/debug_msg.sh: Update accordingly.
5372
5373 2011-04-14 Cary Coutant  <ccoutant@google.com>
5374
5375         * gold/layout.cc (Layout::symtab_section_offset): New function.
5376         * gold/layout.h (Layout::symtab_section_offset): New function.
5377         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
5378
5379 2011-04-12  Ian Lance Taylor  <iant@google.com>
5380
5381         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
5382         with MREMAP_MAYMOVE.
5383         * output.h (class Output_file): Add map_is_allocated_ field.
5384         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
5385         not available, provide stubs.  If mremap is not available, #define
5386         it to gold_mremap.
5387         (MREMAP_MAYMOVE): Define if not defined.
5388         (Output_file::Output_file): Initialize map_is_allocated_.
5389         (Output_file::resize): Check map_is_allocated_.
5390         (Output_file::map_anonymous): If mmap fails, use malloc.
5391         (Output_file::unmap): Don't do anything for an anonymous map.
5392         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
5393         is not available, provide stubs.
5394         (File_read::View::~View): Use free rather than delete[].
5395         (File_read::make_view): Use malloc rather than new[].  If mmap
5396         fails, use malloc.
5397         (File_read::find_or_make_view): Use malloc rather than new[].
5398         * gold.h: Remove HAVE_REMAP code.
5399         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
5400         exists.  Rename mremap to gold_mremap.  If mmap is not available
5401         don't do anything.
5402         * configure, config.in: Rebuild.
5403
5404 2011-04-11  Ian Lance Taylor  <iant@google.com>
5405
5406         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
5407         initialize local variable v.
5408
5409 2011-04-11  Cary Coutant  <ccoutant@google.com>
5410
5411         * archive.cc (Archive::include_member): Adjust call to
5412         report_object.
5413         (Add_archive_symbols::run): Track argument serial numbers.
5414         (Lib_group::include_member): Likewise.
5415         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
5416         * archive.h (Incremental_archive_entry::Archive_member):
5417         Initialize arg_serial_.
5418         (Archive_member::arg_serial_): New data member.
5419         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
5420         (Sized_dynobj::do_add_symbols): Track symbols when doing an
5421         incremental link.
5422         (Sized_dynobj::do_for_all_local_got_entries): New function.
5423         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
5424         function.
5425         * fileread.cc (get_mtime): New function.
5426         * fileread.h (get_mtime): New function.
5427         * gold.cc (queue_initial_tasks): Check for incremental update.
5428         (process_incremental_input): New function.
5429         (queue_middle_tasks): Don't force valid target for incremental
5430         update.
5431         * incremental-dump.cc (find_input_containing_global): Adjust
5432         size of symbol info entry.
5433         (dump_incremental_inputs): Dump argument serial number and
5434         in_system_directory flag; bias shndx by 1; print symbol names
5435         when dumping per-file symbol lists; use new symbol info readers.
5436         * incremental.cc
5437         (Output_section_incremental_inputs:update_data_size): New function.
5438         (Sized_incremental_binary::setup_readers): Setup input readers
5439         for each input file; build maps for files added from libraries
5440         and scripts.
5441         (Sized_incremental_binary::check_input_args): New function.
5442         (Sized_incremental_binary::do_check_inputs): Build map of argument
5443         serial numbers to input arguments.
5444         (Sized_incremental_binary::do_file_has_changed): Rename
5445         do_file_is_unchanged to this; compare file modification times.
5446         (Sized_incremental_binary::do_init_layout): New function.
5447         (Sized_incremental_binary::do_reserve_layout): New function.
5448         (Sized_incremental_binary::do_get_input_reader): Remove.
5449         (Sized_incremental_binary::get_symtab_view): New function.
5450         (Incremental_checker::can_incrementally_link_output_file): Remove.
5451         (Incremental_inputs::report_command_line): Exclude --debug options.
5452         (Incremental_inputs::report_archive_begin): Add parameter; track
5453         argument serial numbers; don't put input file entry for archive
5454         before archive members.
5455         (Incremental_inputs::report_archive_end): Put input file entry
5456         for archive after archive members.
5457         (Incremental_inputs::report_object): Add parameter; track argument
5458         serial numbers and in_system_directory flag.
5459         (Incremental_inputs::report_script): Add parameter; track argument
5460         serial numbers.
5461         (Output_section_incremental_inputs::set_final_data_size): Adjust
5462         size of symbol info entry; check for forwarding symbols.
5463         (Output_section_incremental_inputs::write_input_files): Write
5464         in_system_directory flag and argument serial number.
5465         (Output_section_incremental_inputs::write_info_blocks): Map section
5466         indices between incremental info and original input file; store
5467         input section index for each symbol.
5468         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
5469         change operator() to visit().
5470         (class Global_got_offset_visitor): Likewise.
5471         (class Global_symbol_visitor_got_plt):
5472         (Output_section_incremental_inputs::write_got_plt): Use new visitor
5473         classes.
5474         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
5475         (Sized_incr_relobj::do_read_symbols): New function.
5476         (Sized_incr_relobj::do_layout): New function.
5477         (Sized_incr_relobj::do_layout_deferred_sections): New function.
5478         (Sized_incr_relobj::do_add_symbols): New function.
5479         (Sized_incr_relobj::do_should_include_member): New function.
5480         (Sized_incr_relobj::do_for_all_global_symbols): New function.
5481         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
5482         (Sized_incr_relobj::do_section_size): New function.
5483         (Sized_incr_relobj::do_section_name): New function.
5484         (Sized_incr_relobj::do_section_contents): New function.
5485         (Sized_incr_relobj::do_section_flags): New function.
5486         (Sized_incr_relobj::do_section_entsize): New function.
5487         (Sized_incr_relobj::do_section_address): New function.
5488         (Sized_incr_relobj::do_section_type): New function.
5489         (Sized_incr_relobj::do_section_link): New function.
5490         (Sized_incr_relobj::do_section_info): New function.
5491         (Sized_incr_relobj::do_section_addralign): New function.
5492         (Sized_incr_relobj::do_initialize_xindex): New function.
5493         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
5494         (Sized_incr_relobj::do_read_relocs): New function.
5495         (Sized_incr_relobj::do_gc_process_relocs): New function.
5496         (Sized_incr_relobj::do_scan_relocs): New function.
5497         (Sized_incr_relobj::do_count_local_symbols): New function.
5498         (Sized_incr_relobj::do_finalize_local_symbols): New function.
5499         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
5500         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
5501         (Sized_incr_relobj::do_relocate): New function.
5502         (Sized_incr_relobj::do_set_section_offset): New function.
5503         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
5504         (Sized_incr_dynobj::do_read_symbols): New function.
5505         (Sized_incr_dynobj::do_layout): New function.
5506         (Sized_incr_dynobj::do_add_symbols): New function.
5507         (Sized_incr_dynobj::do_should_include_member): New function.
5508         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
5509         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
5510         (Sized_incr_dynobj::do_section_size): New function.
5511         (Sized_incr_dynobj::do_section_name): New function.
5512         (Sized_incr_dynobj::do_section_contents): New function.
5513         (Sized_incr_dynobj::do_section_flags): New function.
5514         (Sized_incr_dynobj::do_section_entsize): New function.
5515         (Sized_incr_dynobj::do_section_address): New function.
5516         (Sized_incr_dynobj::do_section_type): New function.
5517         (Sized_incr_dynobj::do_section_link): New function.
5518         (Sized_incr_dynobj::do_section_info): New function.
5519         (Sized_incr_dynobj::do_section_addralign): New function.
5520         (Sized_incr_dynobj::do_initialize_xindex): New function.
5521         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
5522         (make_sized_incremental_object): New function.
5523         (Incremental_library::copy_unused_symbols): New function.
5524         (Incremental_library::do_for_all_unused_symbols): New function.
5525         * incremental.h (enum Incremental_input_flags): New type.
5526         (class Incremental_checker): Remove.
5527         (Incremental_input_entry::Incremental_input_entry): Add argument
5528         serial number.
5529         (Incremental_input_entry::arg_serial): New function.
5530         (Incremental_input_entry::set_is_in_system_directory): New function.
5531         (Incremental_input_entry::is_in_system_directory): New function.
5532         (Incremental_input_entry::arg_serial_): New data member.
5533         (Incremental_input_entry::is_in_system_directory_): New data member.
5534         (class Script_info): Move here from script.h.
5535         (Script_info::Script_info): Add filename parameter.
5536         (Script_info::filename): New function.
5537         (Script_info::filename_): New data member.
5538         (Incremental_script_entry::Incremental_script_entry): Add argument
5539         serial number.
5540         (Incremental_object_entry::Incremental_object_entry): Likewise.
5541         (Incremental_object_entry::add_input_section): Build list of input
5542         sections with map to original shndx.
5543         (Incremental_object_entry::get_input_section_index): New function.
5544         (Incremental_object_entry::shndx_): New data member.
5545         (Incremental_object_entry::name_key_): Rename; adjust all refs.
5546         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
5547         (Incremental_archive_entry::Incremental_archive_entry): Add argument
5548         serial number.
5549         (Incremental_inputs::report_archive_begin): Likewise.
5550         (Incremental_inputs::report_object): Likewise.
5551         (Incremental_inputs::report_script): Likewise.
5552         (class Incremental_global_symbol_reader): New class.
5553         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
5554         and store flags and input file type.
5555         (Incremental_input_entry_reader::arg_serial): New function.
5556         (Incremental_input_entry_reader::type): Extract type from flags.
5557         (Incremental_input_entry_reader::is_in_system_directory): New function.
5558         (Incremental_input_entry_reader::get_input_section_count): Call
5559         accessor function for type.
5560         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
5561         function for type; adjust size of global symbol entry.
5562         (Incremental_input_entry_reader::get_global_symbol_count): Call
5563         accessor function for type.
5564         (Incremental_input_entry_reader::get_object_count): Likewise.
5565         (Incremental_input_entry_reader::get_object_offset): Likewise.
5566         (Incremental_input_entry_reader::get_member_count): Likewise.
5567         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
5568         (Incremental_input_entry_reader::get_member_offset): Likewise.
5569         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
5570         (Incremental_input_entry_reader::Global_symbol_info): Remove.
5571         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
5572         (Incremental_input_entry_reader::get_global_symbol_reader): New
5573         function.
5574         (Incremental_input_entry_reader::get_output_symbol_index): New
5575         function.
5576         (Incremental_input_entry_reader::type_): Remove.
5577         (Incremental_input_entry_reader::flags_): New data member.
5578         (Incremental_inputs_reader::input_file_offset): New function.
5579         (Incremental_inputs_reader::input_file_index): New function.
5580         (Incremental_inputs_reader::input_file): Call input_file_offset.
5581         (Incremental_inputs_reader::input_file_at_offset): New function.
5582         (Incremental_relocs_reader::get_r_type): Reformat.
5583         (Incremental_relocs_reader::get_r_shndx): Reformat.
5584         (Incremental_relocs_reader::get_r_offset): Reformat.
5585         (Incremental_relocs_reader::data): New function.
5586         (Incremental_binary::Incremental_binary): Initialize new data members.
5587         (Incremental_binary::check_inputs): Add cmdline parameter.
5588         (Incremental_binary::file_is_unchanged): Remove.
5589         (Input_reader::arg_serial): New function.
5590         (Input_reader::get_unused_symbol_count): New function.
5591         (Input_reader::get_unused_symbol): New function.
5592         (Input_reader::do_arg_serial): New function.
5593         (Input_reader::do_get_unused_symbol_count): New function.
5594         (Input_reader::do_get_unused_symbol): New function.
5595         (Incremental_binary::input_file_count): New function.
5596         (Incremental_binary::get_input_reader): Change signature to use
5597         index instead of filename.
5598         (Incremental_binary::file_has_changed): New function.
5599         (Incremental_binary::get_input_argument): New function.
5600         (Incremental_binary::get_library): New function.
5601         (Incremental_binary::get_script_info): New function.
5602         (Incremental_binary::init_layout): New function.
5603         (Incremental_binary::reserve_layout): New function.
5604         (Incremental_binary::output_file): New function.
5605         (Incremental_binary::do_check_inputs): New function.
5606         (Incremental_binary::do_file_is_unchanged): Remove.
5607         (Incremental_binary::do_file_has_changed): New function.
5608         (Incremental_binary::do_init_layout): New function.
5609         (Incremental_binary::do_reserve_layout): New function.
5610         (Incremental_binary::do_input_file_count): New function.
5611         (Incremental_binary::do_get_input_reader): Change signature.
5612         (Incremental_binary::input_args_map_): New data member.
5613         (Incremental_binary::library_map_): New data member.
5614         (Incremental_binary::script_map_): New data member.
5615         (Sized_incremental_binary::Sized_incremental_binary): Initialize
5616         new data members.
5617         (Sized_incremental_binary::output_section): New function.
5618         (Sized_incremental_binary::inputs_reader): Add const.
5619         (Sized_incremental_binary::symtab_reader): Add const.
5620         (Sized_incremental_binary::relocs_reader): Add const.
5621         (Sized_incremental_binary::got_plt_reader): Add const.
5622         (Sized_incremental_binary::get_symtab_view): New function.
5623         (Sized_incremental_binary::Inputs_reader): New typedef.
5624         (Sized_incremental_binary::Input_entry_reader): New typedef.
5625         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
5626         (Sized_incremental_binary::do_file_is_unchanged): Remove.
5627         (Sized_incremental_binary::do_file_has_changed): New function.
5628         (Sized_incremental_binary::do_init_layout): New function.
5629         (Sized_incremental_binary::do_reserve_layout): New function.
5630         (Sized_input_reader::Inputs_reader): Remove.
5631         (Sized_input_reader::Input_entry_reader): Remove.
5632         (Sized_input_reader::do_arg_serial): New function.
5633         (Sized_input_reader::do_get_unused_symbol_count): New function.
5634         (Sized_input_reader::do_get_unused_symbol): New function.
5635         (Sized_incremental_binary::do_input_file_count): New function.
5636         (Sized_incremental_binary::do_get_input_reader): Change signature;
5637         use index instead of filename.
5638         (Sized_incremental_binary::section_map_): New data member.
5639         (Sized_incremental_binary::input_entry_readers_): New data member.
5640         (class Sized_incr_relobj): New class.
5641         (class Sized_incr_dynobj): New class.
5642         (make_sized_incremental_object): New function.
5643         (class Incremental_library): New class.
5644         * layout.cc (Free_list::num_lists): New static data member.
5645         (Free_list::num_nodes): New static data member.
5646         (Free_list::num_removes): New static data member.
5647         (Free_list::num_remove_visits): New static data member.
5648         (Free_list::num_allocates): New static data member.
5649         (Free_list::num_allocate_visits): New static data member.
5650         (Free_list::init): New function.
5651         (Free_list::remove): New function.
5652         (Free_list::allocate): New function.
5653         (Free_list::dump): New function.
5654         (Free_list::print_stats): New function.
5655         (Layout_task_runner::run): Resize output file for incremental updates.
5656         (Layout::Layout): Initialize new data members.
5657         (Layout::set_incremental_base): New function.
5658         (Layout::init_fixed_output_section): New function.
5659         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
5660         incremental updates.
5661         (Layout::create_gold_note): Do not create gold note section for
5662         incremental updates.
5663         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
5664         for incremental updates.
5665         (Layout::set_section_offsets): For incremental updates, allocate space
5666         from free list.
5667         (Layout::create_symtab_sections): Layout with offsets relative to
5668         start of section; for incremental updates, allocate space from free
5669         list.
5670         (Layout::create_shdrs): For incremental updates, allocate space from
5671         free list.
5672         (Layout::finish_dynamic_section): For incremental updates, do not
5673         check --as-needed (fixed in subsequent patch).
5674         * layout.h (class Free_list): New class.
5675         (Layout::set_incremental_base): New function.
5676         (Layout::incremental_base): New function.
5677         (Layout::init_fixed_output_section): New function.
5678         (Layout::allocate): New function.
5679         (Layout::incremental_base_): New data member.
5680         (Layout::free_list_): New data member.
5681         * main.cc (main): Print Free_list statistics.
5682         * object.cc (Relobj::finalize_incremental_relocs): Add
5683         clear_counts parameter; clear counts only when clear_counts is set.
5684         (Sized_relobj::Sized_relobj): Initialize new base class.
5685         (Sized_relobj::do_layout): Don't report special sections.
5686         (Sized_relobj::do_for_all_local_got_entries): New function.
5687         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
5688         symtab_off to all symbol table offsets.
5689         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
5690         * object.h (class Got_offset_list): Move to top of file.
5691         (Object::Object): Allow case where input_file == NULL.
5692         (Object::~Object): Likewise.
5693         (Object::input_file): Assert that input_file != NULL.
5694         (Object::lock): Allow case where input_file == NULL.
5695         (Object::unlock): Likewise.
5696         (Object::is_locked): Likewise.
5697         (Object::token): Likewise.
5698         (Object::release): Likewise.
5699         (Object::is_incremental): New function.
5700         (Object::get_mtime): New function.
5701         (Object::for_all_local_got_entries): New function.
5702         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
5703         (Object::set_is_in_system_directory): New function.
5704         (Object::is_in_system_directory): New function.
5705         (Object::do_is_incremental): New function.
5706         (Object::do_get_mtime): New function.
5707         (Object::do_for_all_local_got_entries): New function.
5708         (Object::is_in_system_directory_): New data member.
5709         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
5710         (class Sized_relobj_base): New class.
5711         (class Sized_relobj): Derive from Sized_relobj_base.
5712         (class Sized_relobj::Symbols): Redeclare from base class.
5713         (class Sized_relobj::local_got_offset_list): Remove.
5714         (class Sized_relobj::Output_sections): Redeclare from base class.
5715         (class Sized_relobj::do_for_all_local_got_entries): New function.
5716         (class Sized_relobj::write_local_symbols): Add offset parameter.
5717         (class Sized_relobj::local_symbol_offset_): Update comment.
5718         (class Sized_relobj::local_dynsym_offset_): Update comment.
5719         * options.cc (Input_arguments::add_file): Remove const.
5720         * options.h (Input_file_argument::Input_file_argument):
5721         Initialize arg_serial_ (all constructors).
5722         (Input_file_argument::set_arg_serial): New function.
5723         (Input_file_argument::arg_serial): New function.
5724         (Input_file_argument::arg_serial_): New data member.
5725         (Input_arguments::Input_arguments): Initialize file_count_.
5726         (Input_arguments::add_file): Remove const.
5727         (Input_arguments::number_of_input_files): New function.
5728         (Input_arguments::file_count_): New data member.
5729         (Command_line::number_of_input_files): Call
5730         Input_arguments::number_of_input_files.
5731         * output.cc (Output_segment_headers::Output_segment_headers):
5732         Set current size.
5733         (Output_section::Input_section::current_data_size): New function.
5734         (Output_section::Output_section): Initialize new data members.
5735         (Output_section::add_input_section): Don't do merge sections for
5736         an incremental link; allocate space from free list for an
5737         incremental update.
5738         (Output_section::add_output_section_data): Allocate space from
5739         free list for an incremental update.
5740         (Output_section::update_data_size): New function.
5741         (Output_section::set_fixed_layout): New function.
5742         (Output_section::reserve): New function.
5743         (Output_segment::set_section_addresses): Remove const.
5744         (Output_segment::set_section_list_addresses): Remove const; allocate
5745         space from free list for an incremental update.
5746         (Output_segment::set_offset): Adjust size of RELRO segment for an
5747         incremental update.
5748         * output.h (Output_data::current_data_size): Move here from
5749         child classes.
5750         (Output_data::pre_finalize_data_size): New function.
5751         (Output_data::update_data_size): New function.
5752         (Output_section_headers::update_data_size): new function.
5753         (Output_section_data_build::current_data_size): Move to Output_data.
5754         (Output_data_strtab::update_data_size): New function.
5755         (Output_section::current_data_size): Move to Output_data.
5756         (Output_section::set_fixed_layout): New function.
5757         (Output_section::has_fixed_layout): New function.
5758         (Output_section::reserve): New function.
5759         (Output_section::update_data_size): New function.
5760         (Output_section::has_fixed_layout_): New data member.
5761         (Output_section::free_list_): New data member.
5762         (Output_segment::set_section_addresses): Remove const.
5763         (Output_segment::set_section_list_addresses): Remove const.
5764         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
5765         New function.
5766         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
5767         New function.
5768         * readsyms.cc (Read_symbols::do_read_symbols): Add library
5769         parameter when calling Add_symbols constructor; store argument
5770         serial number for members of a lib group.
5771         (Add_symbols::locks): Allow case where token == NULL.
5772         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
5773         (Read_member::~Read_member): New function.
5774         (Read_member::is_runnable): New function.
5775         (Read_member::locks): New function.
5776         (Read_member::run): New function.
5777         (Check_script::~Check_script): New function.
5778         (Check_script::is_runnable): New function.
5779         (Check_script::locks): New function.
5780         (Check_script::run): New function.
5781         (Check_library::~Check_library): New function.
5782         (Check_library::is_runnable): New function.
5783         (Check_library::locks): New function.
5784         (Check_library::run): New function.
5785         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
5786         (Add_symbols::library_): New data member.
5787         (class Read_member): New class.
5788         (class Check_script): New class.
5789         (class Check_library): New class.
5790         * reloc.cc (Read_relocs::is_runnable): Allow case where
5791         token == NULL.
5792         (Read_relocs::locks): Likewise.
5793         (Scan_relocs::locks): Likewise.
5794         (Relocate_task::locks): Likewise.
5795         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
5796         to clear counters.
5797         (Sized_relobj::incremental_relocs_scan): Fix comment.
5798         (Sized_relobj::do_relocate): Pass output file offset to
5799         write_local_symbols.
5800         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
5801         from class declaration.
5802         * script.cc (read_input_script): Allocate Script_info; pass
5803         argument serial number to report_script.
5804         * script.h (class Script_info): Move to incremental.h.
5805         * symtab.cc (Symbol_table::add_from_incrobj): New function.
5806         * symtab.h (Symbol_table::add_from_incrobj): New function.
5807         (Symbol_table::set_file_offset): New function.
5808
5809 2011-04-05  Cary Coutant  <ccoutant@google.com>
5810
5811         * incremental-dump.cc (dump_incremental_inputs): Change signature
5812         to take a Sized_incremental_binary; change caller.  Use readers
5813         in Sized_incremental_binary.
5814         * incremental.cc
5815         (Sized_incremental_binary::find_incremental_inputs_sections):
5816         Rename do_find_incremental_inputs_sections to this.
5817         (Sized_incremental_binary::setup_readers): New function.
5818         (Sized_incremental_binary::do_check_inputs): Check
5819         has_incremental_info_ flag; move setup code to setup_readers;
5820         use input readers.
5821         (Sized_incremental_binary::do_file_is_unchanged): New function.
5822         (Sized_incremental_binary::do_get_input_reader): New function.
5823         * incremental.h (class Incremental_binary): Move to end of file.
5824         (Incremental_binary::file_is_unchanged): New function.
5825         (Incremental_binary::do_file_is_unchanged): New function.
5826         (Incremental_binary::Input_reader): New class.
5827         (Incremental_binary::get_input_reader): New function.
5828         (class Sized_incremental_binary): Move to end of file.
5829         (Sized_incremental_binary::Sized_incremental_binary): Setup the
5830         input section reader classes.
5831         (Sized_incremental_binary::has_incremental_info): New function.
5832         (Sized_incremental_binary::inputs_reader): New function.
5833         (Sized_incremental_binary::symtab_reader): New function.
5834         (Sized_incremental_binary::relocs_reader): New function.
5835         (Sized_incremental_binary::got_plt_reader): New function.
5836         (Sized_incremental_binary::do_file_is_unchanged): New function.
5837         (Sized_incremental_binary::Sized_input_reader): New class.
5838         (Sized_incremental_binary::get_input_reader): New function.
5839         (Sized_incremental_binary::find_incremental_inputs_sections):
5840         Rename do_find_incremental_inputs_sections to this.
5841         (Sized_incremental_binary::setup_readers): New function.
5842         (Sized_incremental_binary::has_incremental_info_): New data member.
5843         (Sized_incremental_binary::inputs_reader_): New data member.
5844         (Sized_incremental_binary::symtab_reader_): New data member.
5845         (Sized_incremental_binary::relocs_reader_): New data member.
5846         (Sized_incremental_binary::got_plt_reader_): New data member.
5847         (Sized_incremental_binary::current_input_file_): New data member.
5848
5849 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
5850
5851         PR gold/12640
5852         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
5853         violation.
5854
5855 2011-03-30  Cary Coutant  <ccoutant@google.com>
5856
5857         * archive.cc (Archive::include_member): Adjust call to report_object.
5858         (Add_archive_symbols::run): Add script_info to call to
5859         report_archive_begin.
5860         (Lib_group::include_member): Adjust call to report_object.
5861         (Add_lib_group_symbols::run): Adjust call to report_object.
5862         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
5863         blocks.  Add object count for script input files.
5864         * incremental.cc (Incremental_inputs::report_archive_begin): Add
5865         script_info parameter; change all callers.
5866         (Incremental_inputs::report_object): Add script_info parameter;
5867         change all callers.
5868         (Incremental_inputs::report_script): Store backpointer to
5869         incremental info entry.
5870         (Output_section_incremental_inputs::set_final_data_size): Record
5871         additional information for scripts.
5872         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5873         * incremental.h (Incremental_script_entry::add_object): New function.
5874         (Incremental_script_entry::get_object_count): New function.
5875         (Incremental_script_entry::get_object): New function.
5876         (Incremental_script_entry::objects_): New data member; adjust
5877         constructor.
5878         (Incremental_inputs::report_archive_begin): Add script_info parameter.
5879         (Incremental_inputs::report_object): Add script_info parameter.
5880         (Incremental_inputs_reader::get_object_count): New function.
5881         (Incremental_inputs_reader::get_object_offset): New function.
5882         * options.cc (Input_arguments::add_file): Return reference to
5883         new input argument.
5884         * options.h (Input_argument::set_script_info): New function.
5885         (Input_argument::script_info): New function.
5886         (Input_argument::script_info_): New data member; adjust all
5887         constructors.
5888         (Input_file_group::add_file): Return reference to new input argument.
5889         (Input_file_lib::add_file): Likewise.
5890         (Input_arguments::add_file): Likewise.
5891         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
5892         * script.cc (Parser_closure::Parser_closure): Add script_info
5893         parameter; adjust all callers.
5894         (Parser_closure::script_info): New function.
5895         (Parser_closure::script_info_): New data member.
5896         (read_input_script): Report scripts earlier to incremental info.
5897         (script_add_file): Set script_info in Input_argument.
5898         (script_add_library): Likewise.
5899         * script.h (Script_options::Script_info): Rewrite class.
5900
5901 2011-03-29  Cary Coutant  <ccoutant@google.com>
5902
5903         * archive.cc (Library_base::should_include_member): Move
5904         method here from class Archive.
5905         (Archive::Archive): Initialize base class.
5906         (Archive::should_include_member): Move to base class.
5907         (Archive::do_for_all_unused_symbols): New function.
5908         (Add_archive_symbols::run): Remove redundant access to
5909         incremental_inputs.
5910         (Lib_group::Lib_group): Initialize base class.
5911         (Lib_group::do_filename): New function.
5912         (Lib_group::include_member): Pass pointer to Lib_group to
5913         report_object.
5914         (Lib_group::do_for_all_unused_symbols): New function.
5915         (Add_lib_group_symbols::run): Report archive information for
5916         incremental links.
5917         * archive.h (class Library_base): New base class.
5918         (class Archive): Derive from Library_base.
5919         (Archive::filename): Move to base class.
5920         (Archive::set_incremental_info): Likewise.
5921         (Archive::incremental_info): Likewise.
5922         (Archive::Should_include): Likewise.
5923         (Archive::should_include_member): Likewise.
5924         (Archive::Armap_entry): Remove.
5925         (Archive::Unused_symbol_iterator): Remove.
5926         (Archive::unused_symbols_begin): Remove.
5927         (Archive::unused_symbols_end): Remove.
5928         (Archive::do_filename): New function.
5929         (Archive::do_get_mtime): New function.
5930         (Archive::do_for_all_unused_symbols): New function.
5931         (Archive::task_): Move to base class.
5932         (Archive::incremental_info_): Likewise.
5933         (class Lib_group): Derive from Library_base.
5934         (Lib_group::do_filename): New function.
5935         (Lib_group::do_get_mtime): New function.
5936         (Lib_group::do_for_all_unused_symbols): New function.
5937         (Lib_group::task_): Move to base class.
5938         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
5939         function.
5940         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
5941         function.
5942         * incremental.cc (Incremental_inputs::report_archive_begin):
5943         Use Library_base; call library's get_mtime; add incremental inputs
5944         entry before members.
5945         (class Unused_symbol_visitor): New class.
5946         (Incremental_inputs::report_archive_end): Use Library_base; use
5947         visitor class to record unused symbols; don't add incremental inputs
5948         entry after members.
5949         (Incremental_inputs::report_object): Use Library_base.
5950         * incremental.h
5951         (Incremental_archive_entry::Incremental_archive_entry): Remove
5952         unused Archive parameter.
5953         (Incremental_inputs::report_archive_begin): Use Library_base.
5954         (Incremental_inputs::report_archive_end): Likewise.
5955         (Incremental_inputs::report_object): Likewise.
5956         * object.cc (Sized_relobj::do_for_all_global_symbols): New
5957         function.
5958         * object.h (Object::for_all_global_symbols): New function.
5959         (Object::do_for_all_global_symbols): New function.
5960         (Sized_relobj::do_for_all_global_symbols): New function.
5961         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
5962         function.
5963         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
5964         function.
5965
5966 2011-03-27  Ian Lance Taylor  <iant@google.com>
5967
5968         * archive.cc (Archive::interpret_header): Return -1 if something
5969         goes wrong.  Change callers accordingly.
5970
5971 2011-03-25  Cary Coutant  <ccoutant@google.com>
5972
5973         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
5974         * testsuite/Makefile.in: Regenerate.
5975
5976 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
5977
5978         * plugin.cc (get_view): New.
5979         (Plugin::load): Pass get_view to the plugin.
5980         (Plugin_manager::get_view): New.
5981
5982 2011-03-21  Ian Lance Taylor  <iant@google.com>
5983
5984         * testsuite/final_layout.sh: Rewrite to not use dc.
5985         * testsuite/relro_test.sh: Fail if dc is not present.
5986
5987 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
5988
5989         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
5990         Change == to -eq.
5991         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
5992         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
5993         Change == to -eq.
5994         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
5995         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
5996
5997 2011-03-14  Ian Lance Taylor  <iant@google.com>
5998
5999         * script-sections.cc (Sort_output_sections::script_compare):
6000         Rename from is_before, change return type.
6001         (Sort_output_sections::operator()): Adjust accordingly.
6002
6003 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
6004
6005         PR gold/12572
6006         * testsuite/odr_violation2.cc: Add comment to make all error line
6007         numbers double digits.
6008         * testsuite/debug_msg.sh: Adjust expected errors.
6009
6010 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
6011
6012         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
6013         but mark earlier ones as non-canonical
6014         (offset_to_iterator): Update search target and example
6015         (do_addr2line): Return extra lines in a vector*
6016         (format_file_lineno): Extract from do_addr2line
6017         (one_addr2line): Add vector* out-param
6018         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
6019         when a lineno entry appeared last for its instruction
6020         (Dwarf_line_info): Add vector* out-param
6021         * object.cc (Relocate_info): Pass NULL for the vector* out-param
6022         * symtab.cc (Odr_violation_compare): Include the lineno in the
6023         comparison again.
6024         (linenos_from_loc): New. Combine the canonical line for an
6025         address with its other lines.
6026         (True_if_intersect): New. Helper functor to make
6027         std::set_intersection a query.
6028         (detect_odr_violations): Compare sets of lines instead of just
6029         one line for each function. This became less deterministic, but
6030         has fewer false positives.
6031         * symtab.h: Declarations.
6032         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
6033         mix an optimized and non-optimized object in the same binary
6034         (odr_violation2.so): Same.
6035         * testsuite/Makefile.in: Regenerate from Makefile.am.
6036         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
6037         * testsuite/debug_msg.sh: Update line numbers and add
6038         assertions.
6039         * testsuite/odr_violation1.cc: Use OdrDerived, in a
6040         non-optimized context.
6041         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
6042         isn't inlined, and use OdrDerived in an optimized context.
6043         * testsuite/odr_header1.h: Defines OdrDerived, where
6044         optimization will change the
6045         first-instruction-in-the-destructor's file and line number.
6046         * testsuite/odr_header2.h: Defines OdrBase.
6047
6048 2011-03-09  Ian Lance Taylor  <iant@google.com>
6049
6050         * fileread.cc (File_read::clear_views): Don't delete the whole
6051         file view.
6052
6053 2011-03-08  Ian Lance Taylor  <iant@google.com>
6054
6055         PR gold/12525
6056         * fileread.cc: #include <climits>.
6057         (GOLD_IOV_MAX): Define.
6058         (File_read::read_multiple): Limit number of entries by iov_max.
6059         * fileread.h (class File_read): Always set max_readv_entries to
6060         128.
6061
6062 2011-03-07  Ian Lance Taylor  <iant@google.com>
6063
6064         PR gold/12525
6065         * options.h (class General_options): Add -dy and -dn.
6066
6067 2011-03-02  Cary Coutant  <ccoutant@google.com>
6068
6069         * testsuite/script_test_9.t: Add TLS segment.
6070
6071 2011-03-02  Simon Baldwin  <simonb@google.com>
6072
6073         * configure.ac: Add check for gnu_indirect_function support in
6074         the toolchain building binutils.
6075         * configure: Rebuild.
6076
6077 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
6078
6079         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
6080         plugin only symbols.
6081         (Symbol_table::sized_finalize_symbol) Mark symbol only present
6082         in plugin files as not needed in the symbol table.
6083
6084 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
6085
6086         * output.cc (Output_section::add_input_section): Delay fill
6087         generation for section ordering.
6088
6089 2011-02-09  Ian Lance Taylor  <iant@google.com>
6090
6091         PR gold/12316
6092         * object.h (class Sized_relobj): Remove clear_local_symbols.
6093         * reloc.cc (Sized_relobj::do_relocate): Don't call
6094         clear_local_symbols.
6095
6096 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
6097
6098         * plugin.cc (is_visible_from_outside): Return true for symbols
6099         in the -u option.
6100
6101 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
6102
6103         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
6104         filename.
6105
6106 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
6107
6108         * icf.h (is_section_foldable_candidate): Change type of parameter
6109         to std::string.
6110         * icf.cc (Icf::find_identical_sections): Change type of local variable
6111         section_name to be std::string.
6112         (is_function_ctor_or_dtor): Change type of parameter to std::string.
6113
6114 2011-01-25  Ian Lance Taylor  <iant@google.com>
6115
6116         * script.cc (script_add_extern): Rewrite to use
6117         add_symbol_reference.
6118
6119 2011-01-25  Doug Kwan  <dougkwan@google.com>
6120
6121         * icf.cc (get_section_contents): Always lock section's object.
6122
6123 2011-01-24  Ian Lance Taylor  <iant@google.com>
6124
6125         * options.h (class General_options): Accept
6126         --no-detect-odr-violations.
6127
6128 2011-01-24  Ian Lance Taylor  <iant@google.com>
6129
6130         * version.cc (version_string): Bump to 1.11.
6131
6132 2011-01-24  Ian Lance Taylor  <iant@google.com>
6133
6134         * plugin.cc (class Plugin_rescan): Define new class.
6135         (Plugin_manager::claim_file): Set any_claimed_.
6136         (Plugin_manager::save_archive): New function.
6137         (Plugin_manager::save_input_group): New function.
6138         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
6139         necessary.
6140         (Plugin_manager::new_undefined_symbol): New function.
6141         (Plugin_manager::rescan): New function.
6142         (Plugin_manager::rescannable_defines): New function.
6143         (Plugin_manager::add_input_file): Set any_added_.
6144         * plugin.h (class Plugin_manager): define new fields rescannable_,
6145         undefined_symbols_, any_claimed_, and any_added_.  Declare
6146         Plugin_rescan as friend.  Declare new functions.
6147         (Plugin_manager::Rescannable): Define type.
6148         (Plugin_manager::Rescannable_list): Define type.
6149         (Plugin_manager::Undefined_symbol_list): Define type.
6150         (Plugin_manager::Plugin_manager): Initialize new fields.
6151         * archive.cc (Archive::defines_symbol): New function.
6152         (Add_archive_symbols::run): Pass archive to plugins if any.
6153         * archive.h (class Archive): Declare defines_symbol.
6154         * readsyms.cc (Input_group::~Input_group): New function.
6155         (Finish_group::run): Pass input_group to plugins if any.
6156         * readsyms.h (class Input_group): Declare destructor.
6157         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
6158         any.
6159
6160 2011-01-10  Ian Lance Taylor  <iant@google.com>
6161
6162         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
6163         section as relro.
6164         (Layout::set_segment_offsets): Reset increase_relro before calling
6165         set_section_addresses a second time.
6166
6167 2011-01-04  Cary Coutant  <ccoutant@google.com>
6168
6169         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
6170         sections before NOBITS sections.
6171
6172 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
6173
6174         * version.cc (print_version): Update copyright to 2011.
6175
6176 2010-12-23  Cary Coutant  <ccoutant@google.com>
6177
6178         * output.h (Output_data_reloc::add_output_section): Pass OD instead
6179         of OS to this->add.  Add OD parameter to second form of the function.
6180
6181 2010-12-20  Ian Lance Taylor  <iant@google.com>
6182
6183         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
6184         second of two consecutive entries with same offset.
6185
6186 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6187
6188         * testsuite/Makefile.am (ifuncmain2static_LDADD)
6189         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
6190         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
6191         to avoid unneeded links against $(LDADD).
6192         * testsuite/Makefile.in: Regenerate.
6193
6194 2010-12-15  Ian Lance Taylor  <iant@google.com>
6195
6196         PR gold/12324
6197         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
6198         for R_X86_64_32 and R_X86_64_PC32.
6199         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
6200         ver_matching_def_pic.o.
6201         (ver_matching_def_pic.o): New target.
6202
6203 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6204
6205         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
6206         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
6207         Move definition before File_read::View member definitions.
6208         (File_read::View::~View): Initialize and hold lock before
6209         updating current_mapped_bytes.
6210
6211 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6212
6213         * dwarf_reader.cc: Remove outdated comment.
6214         * gold-threads.cc: Fix typo in error message.
6215         * archive.cc: Fix typos in comments.
6216         * archive.h: Likewise.
6217         * arm-reloc-property.cc: Likewise.
6218         * arm-reloc-property.h: Likewise.
6219         * arm-reloc.def: Likewise.
6220         * arm.cc: Likewise.
6221         * attributes.h: Likewise.
6222         * cref.cc: Likewise.
6223         * ehframe.cc: Likewise.
6224         * fileread.h: Likewise.
6225         * gold.h: Likewise.
6226         * i386.cc: Likewise.
6227         * icf.cc: Likewise.
6228         * incremental.h: Likewise.
6229         * int_encoding.cc: Likewise.
6230         * layout.h: Likewise.
6231         * main.cc: Likewise.
6232         * merge.h: Likewise.
6233         * object.cc: Likewise.
6234         * object.h: Likewise.
6235         * options.cc: Likewise.
6236         * readsyms.cc: Likewise.
6237         * reduced_debug_output.cc: Likewise.
6238         * reloc.cc: Likewise.
6239         * script-sections.cc: Likewise.
6240         * sparc.cc: Likewise.
6241         * symtab.h: Likewise.
6242         * target-reloc.h: Likewise.
6243         * target.cc: Likewise.
6244         * target.h: Likewise.
6245         * timer.cc: Likewise.
6246         * timer.h: Likewise.
6247         * x86_64.cc: Likewise.
6248
6249 2010-12-09  Cary Coutant  <ccoutant@google.com>
6250
6251         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
6252         stack.
6253         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
6254         parameter; change all callers.
6255         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
6256         * options.h (warn_execstack): New option.
6257
6258 2010-12-07  Doug Kwan  <dougkwan@google.com>
6259
6260         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
6261         like function call relocations.
6262
6263 2010-12-07  Ian Lance Taylor  <iant@google.com>
6264
6265         * archive.cc (Archive::get_elf_object_for_member): Permit
6266         punconfigured to be NULL.
6267         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
6268         (Archive::include_member): Pass NULL to get_elf_object_for_member
6269         if we searched for the archive and this is the first included
6270         object.
6271
6272 2010-12-01  Ian Lance Taylor  <iant@google.com>
6273
6274         * dwarf_reader.h (class Sized_dwarf_line_info): Add
6275         track_relocs_type_ field.
6276         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6277         Set track_relocs_type_.
6278         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
6279         contents when using RELA relocs.
6280         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
6281         reloc_map_.
6282         * reloc.cc (Track_relocs::next_addend): New function.
6283         * reloc.h (class Track_relocs): Declare next_addend.
6284
6285 2010-12-01  Ian Lance Taylor  <iant@google.com>
6286
6287         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
6288         virtual destructor.
6289
6290 2010-12-01  Ian Lance Taylor  <iant@google.com>
6291
6292         * README: Update compilers known to work and fail.
6293
6294 2010-11-23  Matthias Klose  <doko@ubuntu.com>
6295
6296         * configure.in: For --enable-gold, handle value `default' instead of
6297         `both*'.  Always install ld as ld.bfd, install as ld if gold is
6298         not the default.
6299         * configure: Regenerate.
6300
6301 2010-11-18  Doug Kwan  <dougkwan@google.com>
6302
6303         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
6304         and right_alignment to be zero.  Store result alignment only if it is
6305         greater than existing alignment.
6306
6307 2010-11-16  Cary Coutant  <ccoutant@google.com>
6308
6309         PR gold/12220
6310         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6311         Check for ".zdebug_line".
6312
6313 2010-11-16  Doug Kwan  <dougkwan@google.com>
6314             Cary Coutant  <ccoutant@google.com>
6315
6316         * output.h (Output_segment::set_section_addresses): Pass increase_relro
6317         by reference; adjust all callers.
6318         * output.cc (Output_segment::set_section_addresses): Adjust references
6319         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
6320         list is empty.
6321         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
6322         end at page boundary.
6323
6324 2010-11-16  Cary Coutant  <ccoutant@google.com>
6325
6326         PR gold/12220
6327         * layout.cc (Layout::choose_output_section): Transform names of
6328         compressed sections even when using a script with a SECTIONS clause.
6329         (Layout::output_section_name): Remove code to transform
6330         compressed debug section names.
6331         * output.cc (Output_section::add_input_section): Use uncompressed
6332         section size when tracking input sections.
6333
6334 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
6335
6336         * symtab.h (Symbol::NON_PIC_REF): Remove.
6337         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
6338         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
6339         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
6340         (Symbol::use_plt_offset): Take a flags argument and pass it
6341         directly to needs_dynamic_reloc.  Restrict check for undefined
6342         weak symbols to function calls.
6343         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
6344         (Target_arm::Scan::global): Use it.
6345         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
6346         (Target_arm::Relocate::relocate): Likewise.
6347         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
6348         parameter with an r_type parameter.  Use get_reference_flags
6349         to get the flags.
6350         (Target_arm::Relocate::relocate): Update accordingly.
6351         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
6352         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
6353         (Target_i386::Scan::global): Likewise.
6354         (Target_i386::Relocate::relocate): Likewise.
6355         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
6356         parameter with an r_type parameter.  Use get_reference_flags
6357         to get the flags.
6358         (Target_i386::Relocate::relocate): Update accordingly.
6359         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
6360         (Target_powerpc::Scan::global): Use it.
6361         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
6362         (Target_powerpc::Relocate::relocate): Likewise.
6363         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
6364         (Target_sparc::Scan::global): Use it.
6365         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
6366         (Target_sparc::Relocate::relocate): Likewise.
6367         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
6368         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
6369         (Target_x86_64::Scan::global): Likewise.
6370         (Target_x86_64::Relocate::relocate): Likewise.
6371
6372 2010-11-08  Doug Kwan  <dougkwan@google.com>
6373             Cary Coutant  <ccoutant@google.com>
6374
6375         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
6376         (Arm_exidx_merge_section::section_contents_): New data member.
6377         (Arm_input_section::Arm_input_section): Initialize original_contents_.
6378         (Arm_input_section::~Arm_input_section): De-allocate memory.
6379         (Arm_input_section::original_contents_): New data member.
6380         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
6381         in parameters instead of calling Object::section_contents without
6382         locking.
6383         (Arm_output_section::group_section): New parameter TASK.  Pass it
6384         to callees that need locking objects.
6385         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
6386         to lock EXIDX input sections.  Fix a formatting issue.  Call
6387         Arm_exidx_merged_section::build_contents to create merged section
6388         contents.
6389         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
6390         to lock object of stub table owner.
6391         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
6392         TEXT_SIZE to initialize data member TEXT_SIZE_.
6393         (Arm_exidx_input_section::addralign): Fix typo in comment.
6394         (Arm_exidx_input_section::text_size): New method.
6395         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
6396         that require locking objects.  Lock objects before scanning for stubs
6397         and updating local symbols.
6398         (Arm_input_section<big_endian>::init): Copy contents of original
6399         input section.
6400         (Arm_input_section<big_endian>::do_write): Use saved contents of
6401         original input section instead of calling Object::section_contents
6402         without locking.
6403         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
6404         size without calling Object::section_size().
6405         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
6406         for size.  Allocate a buffer for merged EXIDX entries.
6407         (Arm_exidx_merged_section::build_contents): New method.
6408         (Arm_exidx_merged_section::do_write): Move merge section contents
6409         building code to Arm_exidx_merged_section::build_contetns.  Write
6410         out contetns in buffer instead of building it on the fly.
6411         (Arm_relobj::make_exidx_input_section): Also pass text section size
6412         to Arm_exidx_input_section constructor.
6413         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
6414         (Arm_dynobj::do_read_symbols): Fix memory leak.
6415         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
6416         * target.h: (class Task): Add forward declaration.
6417         (Target::relax): Add new parameter TASK and pass it to
6418         Target::do_relax().
6419         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
6420
6421 2010-11-05  Cary Coutant  <ccoutant@google.com>
6422
6423         PR gold/10708
6424         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
6425         object when reading from the file.
6426         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
6427         second layout pass.
6428         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
6429         when reading section contents.
6430         (get_section_contents): Likewise.
6431         (icf::find_identical_sections): Likewise.
6432         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
6433         object when reading from the file.
6434         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
6435         the object when doing deferred section layout.
6436
6437 2010-11-03  Nick Clifton  <nickc@redhat.com>
6438
6439         PR gold/12001
6440         * script.h (class Symbol_assignment: name): New member.  Returns
6441         the name of the symbol.
6442         * scrfipt.cc (Script_options::is_pending_assignment): New member.
6443         Returns true if the given symbol name is on the list of
6444         assignments wating to be processed.
6445         * archive.cc (should_incldue_member): If the symbol is undefined,
6446         check to see if it is on the list of symbols pending assignment.
6447
6448 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
6449
6450         * script-sections.cc (Script_sections::find_memory_region): Check
6451         for a NULL output section pointer.
6452
6453 2010-10-29  Doug Kwan  <dougkwan@google.com>
6454
6455         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
6456         Output_section::add_relaxed_input_section.
6457         * output.cc (Output_section::add_relaxed_input_section): Add new
6458         arguments LAYOUT and NAME.  Set section order index.
6459         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6460         Copy section order index.
6461         * output.h (Output_section::add_relaxed_input_section): Add new
6462         arguments LAYOUT and NAME.
6463
6464 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6465
6466         * testsuite/Makefile.am: Move gcctestdir/ld rule to
6467         NATIVE_OR_CROSS_LINKER.
6468         * testsuite/Makefile.in: Regenerate.
6469
6470 2010-10-20  Doug Kwan  <dougkwan@google.com>
6471
6472         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
6473         without SHF_LINK_ORDER flags.
6474         * layout.cc (Layout::choose_output_section): Do not filter
6475         SHF_LINK_ORDER flag in a relocatable link.
6476
6477 2010-10-17  Cary Coutant  <ccoutant@google.com>
6478
6479         * output.h (Output_segment::set_section_addresses): Change function
6480         signature.  Update all callers.
6481         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
6482         sections.
6483         (Output_segment::set_section_addresses): Align after last TLS
6484         section.  Add padding before last relro section instead of after.
6485
6486 2010-10-17  Doug Kwan  <dougkwan@google.com>
6487
6488         * gold/arm.cc (Target_arm::got_section): Use correct order and set
6489         GOT output section to be writable.
6490
6491 2010-10-14  Cary Coutant  <ccoutant@google.com>
6492
6493         * debug.h (DEBUG_INCREMENTAL): New flag.
6494         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
6495         * gold.cc (queue_initial_tasks): Check parameters for incremental link
6496         mode.
6497         * incremental.cc (report_command_line): Ignore all forms of
6498         --incremental.
6499         * layout.cc (Layout::Layout): Check parameters for incremental link
6500         mode.
6501         * options.cc (General_options::parse_incremental): New function.
6502         (General_options::parse_no_incremental): New function.
6503         (General_options::parse_incremental_full): New function.
6504         (General_options::parse_incremental_update): New function.
6505         (General_options::incremental_mode_): New data member.
6506         (General_options::finalize): Check incremental_mode_.
6507         * options.h (General_options): Update help text for --incremental.
6508         Add --no-incremental, --incremental-full, --incremental-update.
6509         (General_options::Incremental_mode): New enum type.
6510         (General_options::incremental_mode): New function.
6511         (General_options::incremental_mode_): New data member.
6512         * parameters.cc (Parameters::incremental_mode_): New data member.
6513         (Parameters::set_options): Set incremental_mode_.
6514         (Parameters::set_incremental_full): New function.
6515         (Parameters::incremental): New function.
6516         (Parameters::incremental_update): New function.
6517         (set_parameters_incremental_full): New function.
6518         * parameters.h (Parameters::set_incremental_full): New function.
6519         (Parameters::incremental): New function.
6520         (Parameters::incremental_update): New function.
6521         (Parameters::incremental_mode_): New data member.
6522         (set_parameters_incremental_full): New function.
6523         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
6524         incremental link mode.
6525         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
6526         (Sized_relobj::do_relocate_sections): Likewise.
6527         * testsuite/Makefile.am (incremental_test): Use --incremental-full
6528         option.
6529         * testsuite/Makefile.in: Regenerate.
6530         * testsuite/incremental_test.sh: Filter all forms of --incremental.
6531
6532 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6533
6534         * script-sections.h (class Script_sections): Make
6535         Sections_elements typedef public.
6536         * script-sections.cc (class Sort_output_sections): Add elements_
6537         field.  Add constructor which sets it; change all callers.
6538         (Sort_output_sections::is_before): New function.
6539         (Sort_output_sections::operator()): Call is_before.
6540         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
6541         conditional.
6542         * testsuite/script_test_10.sh: New test. Test script section
6543         order.
6544         * testsuite/script_test_10.t: Likewise.
6545         * testsuite/script_test_10.s: Likewise.
6546         * testsuite/Makefile.am: Wrap the cross linker tests and the
6547         common tests into NATIVE_OR_CROSS_LINKER.
6548         (check_SCRIPTS): Add script_test_10.sh.
6549         (check_DATA): Add script_test_10.stdout.
6550         (script_test_10.o, script_test_10): New targets.
6551         (script_test_10.stdout): New target.
6552         * configure, testsuite/Makefile.in: Regenerate.
6553
6554 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6555
6556         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
6557         error for the deprecated relocations.
6558         (Target_arm::Scan::global): Likewise.
6559         (Target_arm::Relocate::relocate): Likewise.
6560
6561 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
6562
6563         * fileread.cc (Input_file::find_file): Initialize *found_name
6564         and *namep when using the fallback search for case 4.
6565
6566 2010-10-11  Cary Coutant  <ccoutant@google.com>
6567
6568         * options.h (class General_options): Redefine -z lazy as an alias for
6569         the negation of -z now.
6570
6571 2010-10-11  Ian Lance Taylor  <iant@google.com>
6572
6573         * resolve.cc (symbol_to_bits): Report the value of the unsupported
6574         binding.
6575
6576 2010-10-06  Nick Clifton  <nickc@redhat.com>
6577
6578         * script-sections.cc(class Memory_region): Remove
6579         current_lma_offset_ field.  Rename current_vma_offset_ to
6580         current_offset_.  Add last_section_ field.
6581         (Memory_region::get_current_vma_address): Rename to
6582         get_current_address.
6583         (Memory_region::get_current_lma_address): Delete.
6584         (Memory_region::increment_vma_offset): Rename to
6585         increment_offset.
6586         (Memory_region::increment_lma_offset): Delete.
6587         (Memory_region::attributes_compatible): New method.  Returns
6588         true if the provided section is compatible with the region.
6589         (Memory_region::get_last_section): New method.  Returns the last
6590         section to use the region.
6591         (Memory_region::set_last_section): New method.  Stores the last
6592         section to use the region.
6593         (Script_sections::block_in_region): New method.  Returns true if
6594         a block of memory is contained within a region.
6595         (Script_sections::find_memory_region): New method.  Locates a
6596         memory region to be used to set a VMA or LMA address.
6597         (Output_section_definition::set_section_addresses): Add code to
6598         check for addresses set by memory regions.
6599         (Output_segment::set_section_addresses): Remove memory region
6600         walking code.
6601         (Script_sections::create_segment): Add a warning if a header
6602         segment is created outside of any region.
6603         * script-sections.h (class Script_sections): Add prototypes for
6604         find_memory_region and block_in_region methods.
6605         * testsuite/memory_test.s: Use .long instead of .word.
6606         * testsuite/memory_test.t: Add some more output sections.
6607         * testsuite/memory_test.sh: Update expected output.
6608
6609 2010-10-02  Doug Kwan  <dougkwan@google.com>
6610
6611         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
6612         defintion to symtab.h
6613         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
6614         declaration to defintion.
6615
6616 2010-10-01  Nick Clifton  <nickc@redhat.com>
6617
6618         * expression.cc (eval): Replace dummy argument with NULL.
6619         (eval_maybe_dot): Check for a NULL result section pointer.
6620         (Symbol_expression::value): Likewise.
6621         (Dot_expression::value): Likewise.
6622         (BINARY_EXPRESSION): Likewise.
6623         (Max_expression::value): Likewise.
6624         (Min_expression::value): Likewise.
6625         (Absolute_expression::value): Likewise.
6626         (Addr_expression::value_from_output_section): Likewise.
6627         (Loaddddr_expression::value_from_output_section): Likewise.
6628         (Segment_start_expression::value): Likewise.
6629         * script-sections.cc
6630         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
6631         argument with NULL.
6632         (Sections_elememt_dot_assignment::set_section_addresses):
6633         Likewise.
6634         (Output_data_expression::do_write_to_buffer): Likewise.
6635         (Output_section_definition::finalize_symbols): Likewise.
6636         (Output_section_definition::set_section_addresses): Likewise.
6637
6638 2010-09-30  Doug Kwan  <dougkwan@google.com>
6639
6640         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
6641
6642 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
6643
6644         * target.h (Target::can_icf_inline_merge_sections): New virtual
6645         function.
6646         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
6647         virtual function.
6648         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
6649         virtual function.
6650         * icf.cc (get_section_contents): Inline merge sections only when
6651         target allows it.
6652
6653 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6654
6655         * configure: Regenerate.
6656
6657 2010-09-17  Ian Lance Taylor  <iant@google.com>
6658
6659         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
6660         * testsuite/Makefile.am (memory_test.o): New target.
6661         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
6662         memory_test.t.
6663         * testsuite/Makefile.in: Rebuild.
6664
6665 2010-09-17  Doug Kwan  <dougkwan@google.com>
6666
6667         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
6668         defintion if relocation uses GOT entries of the symbol.
6669         * testsuite/icf_safe_test.sh: Fix test.
6670         * testsuite/icf_safe_so_test.sh: Fix test.
6671
6672 2010-09-16  Cary Coutant  <ccoutant@google.com>
6673
6674         * script_sections.cc (class Memory_region): Remove "NULL" from
6675         vector initializations.
6676
6677 2010-09-15  Cary Coutant  <ccoutant@google.com>
6678
6679         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
6680         Resolve forwarding symbols.
6681
6682 2010-09-15  Doug Kwan  <dougkwan@google.com>
6683
6684         * gold/testsuite/script_test_3.t: Add ARM special sections.
6685         * gold/testsuite/script_test_4.t: Same.
6686         * gold/testsuite/script_test_5.t: Same.
6687         * gold/testsuite/script_test_6.t: Same.
6688         * gold/testsuite/script_test_7.t: Same.
6689         * gold/testsuite/script_test_7.t: Same.
6690         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
6691
6692 2010-09-14  Cary Coutant  <ccoutant@google.com>
6693
6694         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
6695         (Target_x86_64::Relocate::relocate_tls): Replace check for
6696         saw_tls_block_reloc_ with test for executable section.
6697
6698 2010-09-12  Cary Coutant  <ccoutant@google.com>
6699
6700         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
6701         position-independent executables to shared libraries need dynamic
6702         relocations.
6703         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
6704         position-independent executables.
6705         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
6706         * testsuite/Makefile.in: Regenerate.
6707
6708 2010-09-10  Nick Clifton  <nickc@redhat.com>
6709
6710         PR gold/11997
6711         * testsuite/memory_test.t: Discard any sections that are not
6712         needed.
6713
6714 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
6715
6716         PR gold/11996
6717         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
6718         "This::" to work around a bug in gcc 4.2.
6719
6720         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
6721
6722 2010-09-09  Rafael Espindola  <espindola@google.com>
6723
6724         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
6725         sections with different PF_X flags in the same segment.
6726         (Layout::find_first_load_seg): Search all segments to find the first
6727         one.
6728         * options.h (rosegment): New.
6729
6730 2010-09-08  Rafael Espindola  <espindola@google.com>
6731
6732         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
6733
6734 2010-09-08  Doug Kwan  <dougkwan@google.com>
6735
6736         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
6737         (Arm_relobj::do_relocate_sections): Add new parameter for output
6738         file to match the parent.
6739         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
6740         of local symbols instead of input values.  Update code to track
6741         changes in gold::relocate_section.
6742         * object.cc (Sized_relobj::compute_final_local_value): New methods.
6743         (Sized_relobj::compute_final_local_value_internal): New methods.
6744         (Sized_relobj::do_finalize_local_symbols): Move code from loop
6745         body into private version of Sized_relobj::compute_final_local_value.
6746         Call the inline method.
6747         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
6748         merged symbol value if there is one.
6749         (Symbol_value::has_output_value): New method defintiion.
6750         (Sized_relobj::Compute_final_local_value_status): New enum type.
6751         (Sized_relobj::compute_final_local_value): New methods.
6752         (Sized_relobj::compute_final_local_value_internal): New methods.
6753         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
6754         and arm_cortex_a8.sh.
6755         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
6756         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
6757         New tests.
6758         * Makefile.in: Regenerate.
6759         * testsuite/arm_bl_out_of_range.s: Update test.
6760         * testsuite/thumb_bl_out_of_range.s: Ditto.
6761         * testsuite/thumb_blx_out_of_range.s: Ditto.
6762         * testsuite/arm_branch_out_of_range.sh: New file.
6763         * testsuite/arm_cortex_a8.sh: Ditto.
6764         * testsuite/arm_cortex_a8_b.s: Ditto.
6765         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
6766         * testsuite/arm_cortex_a8_b_local.s: Ditto.
6767         * testsuite/arm_cortex_a8_bl.s: Ditto.
6768         * testsuite/arm_cortex_a8_blx.s: Ditto.
6769         * testsuite/arm_cortex_a8_local.s: Ditto.
6770         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
6771         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
6772
6773 2010-09-08  Rafael Espindola  <espindola@google.com>
6774
6775         * Makefile.am (memory_test.stdout): Run readelf with -W.
6776         * Makefile.in: Regenerate.
6777         * testsuite/memory_test.sh: Make the regexps accept both 32 and
6778         64 bit output.
6779
6780 2010-09-08  Rafael Espindola  <espindola@google.com>
6781
6782         * script-sections.cc (Script_sections::add_memory_region): Convert
6783         field precision to int.
6784         * script.cc (script_set_section_region, script_set_section_region):
6785         Convert field precision to int.
6786
6787 2010-09-08  Rafael Espindola  <espindola@google.com>
6788
6789         * arm.cc (do_finalize_sections): Create the __exidx_start and
6790         __exdix_end symbols even when the section is missing.
6791
6792 2010-09-08  Nick Clifton  <nickc@redhat.com>
6793
6794         * README: Remove claim that MEMORY is not supported.
6795         * expression.cc (script_exp_function_origin)
6796         (script_exp_function_length): Move from here to ...
6797         * script.cc: ... here.
6798         (script_set_section_region, script_add_memory)
6799         (script_parse_memory_attr, script_include_directive): New
6800         functions.
6801         * script-sections.cc
6802         (class Memory_region): New class.
6803         (class Output_section_definition): Add set_memory_region,
6804         set_section_vma, set_section_lma and get_section_name methods.
6805         (class Script_Sections): Add add_memory_region,
6806         find_memory_region, find_memory_region_origin,
6807         find_memory_region_length and set_memory_region methods.
6808         Have set_section_addresses method walk the list of set memory
6809         regions.
6810         Extend the print methos to display memory regions.
6811         * script-sections.h: Add prototypes for new methods.
6812         Add enum for MEMORY region attributes.
6813         * yyscript.y: Add support for parsing MEMORY regions.
6814         * script-c.h: Add prototypes for new functions.
6815         * testsuite/Makefile.am: Add test of MEMORY region functionality.
6816         * testsuite/Makefile.in: Regenerate.
6817         * testsuite/memory_test.sh: New script.
6818         * testsuite/memory_test.s: New assembler source file.
6819         * testsuite/memory_test.t: New linker script.
6820
6821 2010-08-27  Doug Kwan  <dougkwan@google.com>
6822
6823         * gold/resolve.cc (Symbol_table::should_override): Let a weak
6824         reference override an existing dynamic weak reference.
6825         * testsuite/Makefile.am: Add new test dyn_weak_ref.
6826         * testsuite/Makefile.in: Regenerate.
6827         * testsuite/dyn_weak_ref.sh: New file.
6828         * testsuite/dyn_weak_ref_1.c: Ditto.
6829         * testsuite/dyn_weak_ref_2.c: Ditto.
6830
6831 2010-08-27  Ian Lance Taylor  <iant@google.com>
6832
6833         * incremental.h (class Incremental_input_entry): Add virtual
6834         destructor.
6835
6836 2010-08-27  Ian Lance Taylor  <iant@google.com>
6837
6838         * testsuite/start_lib_test_3.c: Mark t3 as used.
6839
6840 2010-08-27  Nick Clifton  <nickc@redhat.com>
6841
6842         * options.cc (version_script): Fix small typo in previous
6843         whitespace tidyup.
6844
6845 2010-08-25  Nick Clifton  <nickc@redhat.com>
6846
6847         * archive.cc: Formatting fixes: Remove whitespace between
6848         typename and following asterisk.  Remove whitespace between
6849         function name and opening parenthesis.
6850         * archive.h: Likewise.
6851         * arm.cc: Likewise.
6852         * attributes.cc: Likewise.
6853         * attributes.h: Likewise.
6854         * common.cc: Likewise.
6855         * copy-relocs.cc: Likewise.
6856         * dirsearch.h: Likewise.
6857         * dynobj.cc: Likewise.
6858         * ehframe.cc: Likewise.
6859         * ehframe.h: Likewise.
6860         * expression.cc: Likewise.
6861         * fileread.cc: Likewise.
6862         * fileread.h: Likewise.
6863         * gc.h: Likewise.
6864         * gold-threads.cc: Likewise.
6865         * gold.cc: Likewise.
6866         * i386.cc: Likewise.
6867         * icf.h: Likewise.
6868         * incremental-dump.cc: Likewise.
6869         * incremental.cc: Likewise.
6870         * layout.cc: Likewise.
6871         * layout.h: Likewise.
6872         * main.cc: Likewise.
6873         * merge.cc: Likewise.
6874         * merge.h: Likewise.
6875         * object.cc: Likewise.
6876         * object.h: Likewise.
6877         * options.cc: Likewise.
6878         * options.h: Likewise.
6879         * output.cc: Likewise.
6880         * output.h: Likewise.
6881         * plugin.cc: Likewise.
6882         * plugin.h: Likewise.
6883         * powerpc.cc: Likewise.
6884         * reloc.cc: Likewise.
6885         * script-c.h: Likewise.
6886         * script-sections.cc: Likewise.
6887         * script.cc: Likewise.
6888         * stringpool.cc: Likewise.
6889         * symtab.cc: Likewise.
6890         * symtab.h: Likewise.
6891         * target.cc: Likewise.
6892         * timer.cc: Likewise.
6893         * timer.h: Likewise.
6894         * version.cc: Likewise.
6895         * x86_64.cc: Likewise.
6896
6897 2010-08-24  Nick Clifton  <nickc@redhat.com>
6898
6899         PR 11899
6900         * layout.cc (segment_precedes): Sort segments by their physical
6901         addresses, if they have been set.
6902
6903 2010-08-23  Cary Coutant  <ccoutant@google.com>
6904
6905         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
6906         symbols data.
6907         (Lib_group::include_member): Unlock object after deleting its
6908         symbols data.
6909         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
6910         the bug fixed here.
6911
6912 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
6913             Cary Coutant  <ccoutant@google.com>
6914
6915         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
6916         constructor, and set_blocker.
6917         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
6918         readsyms_blocker_.
6919         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
6920         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
6921         * testsuite/Makefile.am (start_lib_test): New test case.
6922         * testsuite/Makefile.in: Regenerate.
6923         * testsuite/start_lib_test_main.c: New file.
6924         * testsuite/start_lib_test_1.c: New file.
6925         * testsuite/start_lib_test_2.c: New file.
6926         * testsuite/start_lib_test_3.c: New file.
6927
6928 2010-08-19  Ian Lance Taylor  <iant@google.com>
6929
6930         * Makefile.in: Rebuild with automake 1.11.1.
6931         * aclocal.m4: Likewise.
6932         * testsuite/Makefile.in: Likewise.
6933
6934 2010-08-19  Ian Lance Taylor  <iant@google.com>
6935
6936         PR 10893
6937         * i386.cc (class Output_data_plt_i386): Update declarations.
6938         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
6939         local_ifuncs_ fields.
6940         (Target_i386::do_plt_section_for_global): New function.
6941         (Target_i386::do_plt_section_for_local): New function.
6942         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
6943         parameter; change all callers.  Initialize global_ifuncs_ and
6944         local_ifuncs_.  If doing a static link define __rel_iplt_start and
6945         __rel_iplt_end.
6946         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
6947         (Output_data_plt_i386::add_local_ifunc_entry): New function.
6948         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
6949         symbols.
6950         (Target_i386::make_plt_section): New function, broken out of
6951         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
6952         (Target_i386::make_plt_entry): Call make_plt_section.
6953         (Target_i386::make_local_ifunc_plt_entry): New function.
6954         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
6955         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
6956         R_386_IRELATIVE to switch.
6957         (Target_i386::Scan::global): Likewise.
6958         (Target_i386::Relocate::relocate): Likewise.
6959         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
6960         switch.
6961         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
6962         (Target_x86_64::do_plt_section_for_global): New function.
6963         (Target_x86_64::do_plt_section_for_local): New function.
6964         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
6965         parameter; change all callers.  If doing a static link define
6966         __rela_iplt_start and __rela_iplt_end.
6967         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
6968         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
6969         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
6970         to point to .plt.
6971         (Target_x86_64::make_local_ifunc_plt_entry): New function.
6972         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
6973         switch.
6974         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
6975         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
6976         R_X86_64_IRELATIVE to switch.
6977         (Target_x86_64::Scan::global): Likewise.
6978         (Target_x86_64::Relocate::relocate): Likewise.
6979         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
6980         switch.
6981         * target.h (class Target): Add plt_section_for_global and
6982         plt_section_for_local functions.  Add do_plt_section_for_global
6983         and do_plt_section_for_local virtual functions.
6984         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
6985         clarifying comments.
6986         (Symbol::use_plt_offset): Handle IFUNC symbol.
6987         * object.cc (Sized_relobj::Sized_relobj): Initialize
6988         local_plt_offsets_.
6989         (Sized_relobj::local_has_plt_offset): New function.
6990         (Sized_relobj::local_plt_offset): New function.
6991         (Sized_relobj::set_local_plt_offset): New function.
6992         (Sized_relobj::do_count): Handle IFUNC symbol.
6993         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
6994         a bit away from input_shndx_ field.  Add set_is_func_symbol and
6995         is_ifunc_symbol functions.
6996         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
6997         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
6998         local_plt_offsets_ field.
6999         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
7000         * output.h (class Output_section_data): Add non-const
7001         output_section function.
7002         (class Output_data_got): Update declarations.
7003         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
7004         Add use_plt_offset parameter to global and local constructors.
7005         Change all callers.  Change local_sym_index_ field to 31 bits.
7006         Change GSYM_CODE and CONSTANT_CODE accordingly.
7007         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
7008         doing a static link don't set sh_link field.
7009         (Output_data_got::Got_entry::write): Use PLT offset if
7010         appropriate.
7011         (Output_data_got::add_global_plt): New function.
7012         (Output_data_got::add_local_plt): New function.
7013         * target-reloc.h (relocate_section): Handle IFUNC symbol.
7014         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
7015         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
7016         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
7017         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
7018         IFUNC conditional.
7019         * testsuite/ifunc-sel.h: New file.
7020         * testsuite/ifuncmain1.c: New file.
7021         * testsuite/ifuncmain1vis.c: New file.
7022         * testsuite/ifuncmod1.c: New file.
7023         * testsuite/ifuncdep2.c: New file.
7024         * testsuite/ifuncmain2.c: New file.
7025         * testsuite/ifuncmain3.c: New file.
7026         * testsuite/ifuncmod3.c: New file.
7027         * testsuite/ifuncmain4.c: New file.
7028         * testsuite/ifuncmain5.c: New file.
7029         * testsuite/ifuncmod5.c: New file.
7030         * testsuite/ifuncmain6pie.c: New file.
7031         * testsuite/ifuncmod6.c: New file.
7032         * testsuite/ifuncmain7.c: New file.
7033         * configure, testsuite/Makefile.in: Rebuild.
7034
7035 2010-08-18  Ian Lance Taylor  <iant@google.com>
7036
7037         * incremental.cc
7038         (Output_section_incremental_inputs::write_input_files): Add cast
7039         to avoid signed/unsigned comparison warning.
7040         (Output_section_incremental_inputs::write_info_blocks): Likewise.
7041
7042 2010-08-12  Cary Coutant  <ccoutant@google.com>
7043
7044         * common.cc (Sort_commons::operator()): Remove unnecessary code.
7045
7046 2010-08-13  Ian Lance Taylor  <iant@google.com>
7047
7048         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
7049
7050 2010-08-12  Cary Coutant  <ccoutant@google.com>
7051             Doug Kwan  <dougkwan@google.com>
7052
7053         * resolve.cc (Symbol_table::should_override): When a weak dynamic
7054         defintion overrides non-weak undef, remember that the original undef
7055         is not weak.
7056         * symtab.cc (Symbol_table::sized_write_global): For undef without
7057         an original weak binding, set binding to global in output.
7058         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
7059         * testsuite/Makefile.in: Regenerate.
7060         * testsuite/strong_ref_weak_def.sh: New file.
7061         * testsuite/strong_ref_weak_def_1.c: Ditto.
7062         * testsuite/strong_ref_weak_def_2.c: Ditto.
7063
7064 2010-08-12  Cary Coutant  <ccoutant@google.com>
7065
7066         * testsuite/incremental_test.sh: Rewrite.
7067         * testsuite/incremental_test_1.c: Rewrite.
7068         * testsuite/incremental_test_2.c: Rewrite.
7069
7070 2010-08-12  Cary Coutant  <ccoutant@google.com>
7071
7072         * arm.cc (Target_arm::got_size): Add const.
7073         (Target_arm::got_entry_count): New function.
7074         (Target_arm::plt_entry_count): New function.
7075         (Target_arm::first_plt_entry_offset): New function.
7076         (Target_arm::plt_entry_size): New function.
7077         (Output_data_plt_arm::entry_count): New function.
7078         (Output_data_plt_arm::first_plt_entry_offset): New function.
7079         (Output_data_plt_arm::get_plt_entry_size): New function.
7080         * i386.cc (Target_i386::got_size): Add const.
7081         (Target_i386::got_entry_count): New function.
7082         (Target_i386::plt_entry_count): New function.
7083         (Target_i386::first_plt_entry_offset): New function.
7084         (Target_i386::plt_entry_size): New function.
7085         (Output_data_plt_i386::entry_count): New function.
7086         (Output_data_plt_i386::first_plt_entry_offset): New function.
7087         (Output_data_plt_i386::get_plt_entry_size): New function.
7088         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
7089         find_incremental_inputs_sections.  Dump incremental_got_plt section.
7090         * incremental.cc: Include target.h.
7091         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
7092         parameter.  Adjust all callers.  Find incremental_got_plt section.
7093         (Incremental_inputs::create_data_sections): Create incremental_got_plt
7094         section.
7095         (Output_section_incremental_inputs::set_final_data_size): Calculate
7096         size of incremental_got_plt section.
7097         (Output_section_incremental_inputs::do_write): Write the
7098         incremental_got_plt section.
7099         (Got_plt_view_info): New struct.
7100         (Local_got_offset_visitor): New class.
7101         (Global_got_offset_visitor): New class.
7102         (Global_symbol_visitor_got_plt): New class.
7103         (Output_section_incremental_inputs::write_got_plt): New function.
7104         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
7105         Add parameter.  Adjust all callers.
7106         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7107         (Incremental_inputs::got_plt_section): New function.
7108         (Incremental_inputs::got_plt_section_): New data member.
7109         (Incremental_got_plt_reader): New class.
7110         * layout.cc (Layout::create_incremental_info_sections): Add the
7111         incremental_got_plt section.
7112         * object.h (Got_offset_list::get_list): New function.
7113         (Got offset_list::for_all_got_offsets): New function.
7114         (Sized_relobj::local_got_offset_list): New function.
7115         * powerpc.cc (Target_powerpc::got_size): Add const.
7116         (Target_powerpc::got_entry_count): New function.
7117         (Target_powerpc::plt_entry_count): New function.
7118         (Target_powerpc::first_plt_entry_offset): New function.
7119         (Target_powerpc::plt_entry_size): New function.
7120         (Output_data_plt_powerpc::entry_count): New function.
7121         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
7122         (Output_data_plt_powerpc::get_plt_entry_size): New function.
7123         * sparc.cc (Target_sparc::got_size): Add const.
7124         (Target_sparc::got_entry_count): New function.
7125         (Target_sparc::plt_entry_count): New function.
7126         (Target_sparc::first_plt_entry_offset): New function.
7127         (Target_sparc::plt_entry_size): New function.
7128         (Output_data_plt_sparc::entry_count): New function.
7129         (Output_data_plt_sparc::first_plt_entry_offset): New function.
7130         (Output_data_plt_sparc::get_plt_entry_size): New function.
7131         * symtab.h (Symbol::got_offset_list): New function.
7132         (Symbol_table::for_all_symbols): New function.
7133         * target.h (Sized_target::got_entry_count): New function.
7134         (Sized_target::plt_entry_count): New function.
7135         (Sized_target::plt_entry_size): New function.
7136         * x86_64.cc (Target_x86_64::got_size): Add const.
7137         (Target_x86_64::got_entry_count): New function.
7138         (Target_x86_64::plt_entry_count): New function.
7139         (Target_x86_64::first_plt_entry_offset): New function.
7140         (Target_x86_64::plt_entry_size): New function.
7141         (Output_data_plt_x86_64::entry_count): New function.
7142         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
7143         (Output_data_plt_x86_64::get_plt_entry_size): New function.
7144
7145 2010-08-12  Cary Coutant  <ccoutant@google.com>
7146
7147         * archive.cc: Include incremental.h.
7148         (Archive::Archive): Initialize incremental_info_.
7149         (Archive::include_member): Record archive members in incremental info.
7150         (Add_archive_symbols::run): Record begin and end of an archive in
7151         incremental info.
7152         (Lib_group::include_member): Record objects in incremental info.
7153         * archive.h (Incremental_archive_entry): Forward declaration.
7154         (Archive::set_incremental_info): New member function.
7155         (Archive::incremental_info): New member function.
7156         (Archive::Unused_symbol_iterator): New class.
7157         (Archive::unused_symbols_begin): New member function.
7158         (Archive::unused_symbols_end): New member function.
7159         (Archive::incremental_info_): New data member.
7160         * incremental-dump.cc (find_input_containing_global): New function.
7161         (dump_incremental_inputs): Dump new incremental info sections.
7162         * incremental.cc: Include symtab.h.
7163         (Output_section_incremental_inputs): New class.
7164         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
7165         new incremental info sections.
7166         (Sized_incremental_binary::do_check_inputs): Likewise.
7167         (Incremental_inputs::report_archive): Remove.
7168         (Incremental_inputs::report_archive_begin): New function.
7169         (Incremental_inputs::report_archive_end): New function.
7170         (Incremental_inputs::report_object): New function.
7171         (Incremental_inputs::finalize_inputs): Remove.
7172         (Incremental_inputs::report_input_section): New function.
7173         (Incremental_inputs::report_script): Rewrite.
7174         (Incremental_inputs::finalize): Do nothing but finalize string table.
7175         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7176         (Incremental_inputs::sized_create_inputs_section_data): Remove.
7177         (Incremental_inputs::create_data_sections): New function.
7178         (Incremental_inputs::relocs_entsize): New function.
7179         (Output_section_incremental_inputs::set_final_data_size): New function.
7180         (Output_section_incremental_inputs::do_write): New function.
7181         (Output_section_incremental_inputs::write_header): New function.
7182         (Output_section_incremental_inputs::write_input_files): New function.
7183         (Output_section_incremental_inputs::write_info_blocks): New function.
7184         (Output_section_incremental_inputs::write_symtab): New function.
7185         * incremental.h (Incremental_script_entry): Forward declaration.
7186         (Incremental_object_entry): Forward declaration.
7187         (Incremental_archive_entry): Forward declaration.
7188         (Incremental_inputs): Forward declaration.
7189         (Incremental_inputs_header_data): Remove.
7190         (Incremental_inputs_header): Remove.
7191         (Incremental_inputs_header_write): Remove.
7192         (Incremental_inputs_entry_data): Remove.
7193         (Incremental_inputs_entry): Remove.
7194         (Incremental_inputs_entry_write): Remove.
7195         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
7196         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
7197         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7198         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
7199         Likewise.
7200         (Incremental_input_entry): New class.
7201         (Incremental_script_entry): New class.
7202         (Incremental_object_entry): New class.
7203         (Incremental_archive_entry): New class.
7204         (Incremental_inputs::Incremental_inputs): Initialize new data members.
7205         (Incremental_inputs::report_inputs): Remove.
7206         (Incremental_inputs::report_archive): Remove.
7207         (Incremental_inputs::report_archive_begin): New function.
7208         (Incremental_inputs::report_archive_end): New function.
7209         (Incremental_inputs::report_object): Change prototype.
7210         (Incremental_inputs::report_input_section): New function.
7211         (Incremental_inputs::report_script): Change prototype.
7212         (Incremental_inputs::get_reloc_count): New function.
7213         (Incremental_inputs::set_reloc_count): New function.
7214         (Incremental_inputs::create_data_sections): New function.
7215         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7216         (Incremental_inputs::inputs_section): New function.
7217         (Incremental_inputs::symtab_section): New function.
7218         (Incremental_inputs::relocs_section): New function.
7219         (Incremental_inputs::get_stringpool): Add const.
7220         (Incremental_inputs::command_line): Add const.
7221         (Incremental_inputs::inputs): Remove.
7222         (Incremental_inputs::command_line_key): New function.
7223         (Incremental_inputs::input_file_count): New function.
7224         (Incremental_inputs::input_files): New function.
7225         (Incremental_inputs::relocs_entsize): New function.
7226         (Incremental_inputs::sized_create_inputs_section_data): Remove.
7227         (Incremental_inputs::finalize_inputs): Remove.
7228         (Incremental_inputs::Input_info): Remove.
7229         (Incremental_inputs::lock_): Remove.
7230         (Incremental_inputs::inputs_): Change type.
7231         (Incremental_inputs::inputs_map_): Remove.
7232         (Incremental_inputs::current_object_entry_): New data member.
7233         (Incremental_inputs::inputs_section_): New data member.
7234         (Incremental_inputs::symtab_section_): New data member.
7235         (Incremental_inputs::relocs_section_): New data member.
7236         (Incremental_inputs::reloc_count_): New data member.
7237         (Incremental_inputs_reader): New class.
7238         (Incremental_symtab_reader): New class.
7239         (Incremental_relocs_reader): New class.
7240         * layout.cc (Layout::finalize): Move finalization of incremental info
7241         and creation of incremental info sections to follow finalization of
7242         symbol table.  Set offsets for postprocessing sections.
7243         (Layout::create_incremental_info_sections): Call
7244         Incremental_inputs::create_data_sections.  Add incremental symtab
7245         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
7246         sections to layout after input sections.
7247         * layout.h (struct Timespec): Forward declaration.
7248         (Layout::incremental_inputs): Add const.
7249         (Layout::create_incremental_info_sections): Add parameter.
7250         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
7251         * object.cc: Include incremental.h.
7252         (Relobj::finalize_incremental_relocs): New function.
7253         (Sized_relobj::do_layout): Record input sections in incremental info.
7254         * object.h (Object::output_section): New function.
7255         (Object::output_section_offset): Moved from Relobj.
7256         (Object::get_incremental_reloc_base): New function.
7257         (Object::get_incremental_reloc_count): New function.
7258         (Object::do_output_section): New function.
7259         (Object::do_output_section_offset): Moved from Relobj.
7260         (Object::do_get_incremental_reloc_base): New function.
7261         (Object::do_get_incremental_reloc_count): New function.
7262         (Object::Object): Initialize new data members.
7263         (Relobj::output_section): Renamed do_output_section and moved to
7264         protected.
7265         (Relobj::output_section_offset): Moved to Object.
7266         (Relobj::do_get_incremental_reloc_base): New function.
7267         (Relobj::do_get_incremental_reloc_count): New function.
7268         (Relobj::allocate_incremental_reloc_counts): New function.
7269         (Relobj::count_incremental_reloc): New function.
7270         (Relobj::finalize_incremental_relocs): New function.
7271         (Relobj::next_incremental_reloc_index): New function.
7272         (Relobj::reloc_counts_): New data member.
7273         (Relobj::reloc_bases_): New data member.
7274         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
7275         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
7276         (Sized_relobj::incremental_relocs_scan): New function.
7277         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7278         (Sized_relobj::incremental_relocs_write): New function.
7279         (Sized_relobj::incremental_relocs_write_reltype): New function.
7280         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
7281         incremental link.
7282         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
7283         archives and object files elsewhere.
7284         (Add_symbols::run): Report object files here.
7285         (Finish_group::run): Report end of archive at end of group.
7286         * reloc.cc: Include layout.h, incremental.h.
7287         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
7288         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
7289         (Sized_relobj::incremental_relocs_scan): New function.
7290         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7291         (Sized_relobj::do_relocate_sections): Write incremental relocations.
7292         (Sized_relobj::incremental_relocs_write): New function.
7293         (Sized_relobj::incremental_relocs_write_reltype): New function.
7294         * script.cc (read_input_script): Rewrite test for incremental link.
7295         Change call to Incremental_inputs::report_script.
7296         * symtab.h (Symbol_table::first_global_index): New function.
7297         (Symbol_table::output_count): New function.
7298
7299 2010-08-12  Doug Kwan  <dougkwan@google.com>
7300
7301         * arm.cc (Target_arm::merge_object_attributes): Check command line
7302         options --no-wchar-size-warning and --no-enum-size-warning.
7303         * options.h (General_options): Add ld-compatible options
7304         --no-enum-size-warning and --no-wchar-size-warning.
7305
7306 2010-08-04  Ian Lance Taylor  <iant@google.com>
7307
7308         * x86_64.cc (Target_x86_64::Scan::local): Use
7309         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
7310         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
7311         (Target_x86_64::Scan::global): Likewise.
7312         (Target_x86_64::Relocate::relocate): Likewise.
7313         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
7314         Likewise.
7315
7316 2010-08-03  Cary Coutant  <ccoutant@google.com>
7317
7318         * merge.cc (Output_merge_string::do_add_input_section): Count strings
7319         to reserve space in merged_strings vector. Keep total input size
7320         for stats.
7321         (Output_merge_string::do_print_merge_stats): Print total input size.
7322         * merge.h (Output_merge_string): Add input_size_ field.
7323         * stringpool.cc (Stringpool_template::string_length): Move
7324         implementations out of Stringpool_template class and place in
7325         stringpool.h.
7326         * stringpool.h (string_length): Move out of Stringpool_template.
7327
7328 2010-08-03  Ian Lance Taylor  <iant@google.com>
7329
7330         PR 11712
7331         * layout.cc (relaxation_loop_body): If address of load segment is
7332         set, adjust address to include headers if possible.
7333
7334 2010-08-03  Ian Lance Taylor  <iant@google.com>
7335
7336         * version.cc (version_string): Bump to 1.10.
7337
7338 2010-08-03  Ian Lance Taylor  <iant@google.com>
7339
7340         PR 11805
7341         * layout.h (enum Output_section_order): Define.
7342         (class Layout): Update declarations.
7343         * layout.cc (Layout::get_output_section): Add order parameter.
7344         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
7345         is_first_non_relro parameters.  Change all callers.
7346         (Layout::choose_output_section): Likewise.
7347         (Layout::add_output_section_data): Likewise.
7348         (Layout::make_output_section): Likewise.  Set order.
7349         (Layout::default_section_order): New function.
7350         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
7351         * output.cc (Output_section::Output_section): Initialize order_.
7352         Don't initialize deleted fields.
7353         (Output_segment::Output_segment): Don't initialize deleted
7354         fields.
7355         (Output_segment::add_output_section_to_load): New function
7356         replacing add_output_section.  Change all callers to call this or
7357         add_output_section_to_nonload.
7358         (Output_segment::add_output_section_to_nonload): New function.
7359         (Output_segment::remove_output_section): Rewrite.
7360         (Output_segment::add_initial_output_data): Likewise.
7361         (Output_segment::has_any_data_sections): Likewise.
7362         (Output_segment::is_first_section_relro): Likewise.
7363         (Output_segment::maximum_alignment): Likewise.
7364         (Output_segment::has_dynamic_reloc): New function replacing
7365         dynamic_reloc_count.  Change all callers.
7366         (Output_segment::has_dynamic_reloc_list): New function replacing
7367         dynamic_reloc_count_list.  Change all callers.
7368         (Output_segment::set_section_addresses): Rewrite.
7369         (Output_segment::set_offset): Rewrite.
7370         (Output_segment::find_first_and_last_list): Remove.
7371         (Output_segment::set_tls_offsets): Rewrite.
7372         (Output_segment::first_section_load_address): Likewise.
7373         (Output_segment::output_section_count): Likewise.
7374         (Output_segment::section_with_lowest_load_address): Likewise.
7375         (Output_segment::write_section_headers): Likewise.
7376         (Output_segment::print_sections_to_map): Likewise.
7377         * output.h (class Output_data): Remove dynamic_reloc_count_
7378         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
7379         (Output_data::add_dynamic_reloc): Rewrite.
7380         (Output_data::has_dynamic_reloc): New function.
7381         (Output_data::dynamic_reloc_count): Remove.
7382         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
7383         is_last_relro_, is_first_non_relro_, is_interp_,
7384         is_dynamic_linker_section_ fields.  Add order and set_order
7385         functions.  Remove is_relro_local, set_is_relro_local,
7386         is_last_relro, set_is_last_relro, is_first_non_relro,
7387         set_is_first_non_relro functions, is_interp, set_is_interp,
7388         is_dynamic_linker_section, and set_is_dynamic_linker_section
7389         functions.
7390         (class Output_segment): Change Output_data_list from std::list to
7391         std:;vector.  Add output_lists_ field.  Remove output_data_ and
7392         output_bss_ fields.  Update declarations.
7393
7394 2010-08-02  Ian Lance Taylor  <iant@google.com>
7395
7396         * arm.cc (Target_arm::gc_process_relocs): Use typename.
7397         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
7398         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
7399
7400 2010-08-02  Ian Lance Taylor  <iant@google.com>
7401
7402         PR 11855
7403         * script.cc (Script_options::Script_options): Initialize
7404         symbol_definitions_ and symbol_references_.
7405         (Script_options::add_symbol_assignment): Update
7406         symbol_definitions_ and symbol_references_.
7407         (Script_options::add_symbol_reference): New function.
7408         (script_symbol): New function.
7409         * script.h (class Script_options): Add symbol_definitions_ and
7410         symbol_references_ fields.
7411         (Script_options::referenced_const_iterator): New type.
7412         (Script_options::referenced_begin): New function.
7413         (Script_options::referenced_end): New function.
7414         (Script_options::is_referenced): New function.
7415         (Script_options::any_unreferenced): New function.
7416         * script-c.h (script_symbol): Declare.
7417         * yyscript.y (exp): Call script_symbol.
7418         * symtab.cc: Include "script.h".
7419         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
7420         Change all callers.  Check symbols referenced by scripts.
7421         (Symbol_table::add_undefined_symbols_from_command_line): Add
7422         layout parameter.  Change all callers.
7423         (Symbol_table::do_add_undefined_symbols_from_command_line):
7424         Likewise.  Break out loop body.  Check symbols referenced by
7425         scripts.
7426         (Symbol_table::add_undefined_symbol_from_command_line): New
7427         function broken out of
7428         do_add_undefined_symbols_from_command_line.
7429         * symtab.h (class Symbol_table): Update declarations.
7430         * archive.cc: Include "layout.h".
7431         (Archive::should_include_member): Add layout parameter.  Change
7432         all callers.  Check for symbol mentioned in expression.
7433         * archive.h (class Archive): Update declaration.
7434         * object.cc (Sized_relobj::do_should_include_member): Add layout
7435         parameter.
7436         * object.h (Object::should_include_member): Add layout parameter.
7437         Change all callers.
7438         (Object::do_should_include_member): Add layout parameter.
7439         (class Sized_relobj): Update declaration.
7440         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
7441         parameter.
7442         * dynobj.h (class Sized_dynobj): Update declaration.
7443         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
7444         layout parameter.
7445         * plugin.h (class Sized_pluginobj): Update declaration.
7446
7447 2010-08-02  Ian Lance Taylor  <iant@google.com>
7448
7449         PR 11866
7450         * output.cc (Output_segment::set_offset): Search for the first and
7451         last sections rather than assuming that the list is in order.
7452         (Output_segment::find_first_and_last_list): New function.
7453         * output.h (class Output_segment): Update declarations.
7454         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
7455         (relro_strip_test_SOURCES): New variable.
7456         (relro_strip_test_DEPENDENCIES): New variable.
7457         (relro_strip_test_LDFLAGS): New variable.
7458         (relro_strip_test_LDADD): New variable.
7459         (relro_strip_test.so): New target.
7460
7461 2010-08-02  Ian Lance Taylor  <iant@google.com>
7462
7463         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
7464         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
7465         (Target_i386::got_tlsdesc_section): New function.
7466         (Target_i386::got_section): Create space for GOT entries for
7467         TLSDESC relocations.
7468         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
7469         R_386_TLS_GOTDESC.
7470         (Target_i386::Scan::global): Likewise.
7471         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
7472         using TLSDESC GOT.
7473         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
7474         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
7475         (Target_x86_64::got_tlsdesc_section): New function.
7476         (Target_x86_64::got_section): Create space for GOT entries for
7477         TLSDESC relocations.
7478         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
7479         R_386_TLS_GOTDESC.
7480         (Target_x86_64::Scan::global): Likewise.
7481         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
7482         using TLSDESC GOT.
7483
7484 2010-08-02  Ian Lance Taylor  <iant@google.com>
7485
7486         * testsuite/final_layout.sh: Use dc to convert from hex to
7487         decimal.
7488
7489 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
7490
7491         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
7492         paramter to the call to gold::gc_process_relocs.
7493         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
7494         paramter to the call to gold::gc_process_relocs.
7495         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
7496         parameter to the call to gold::gc_process_relocs.
7497         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
7498         template parameter to the call to gold::gc_process_relocs.
7499         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
7500         paramter to the call to gold::gc_process_relocs.
7501         * gc.h (get_embedded_addend_size): New function.
7502         (gc_process_relocs): Save the size of the reloc for use by ICF.
7503         * icf.cc (get_section_contents): Get the addend from the text section
7504         for SHT_REL relocation sections.
7505         * icf.h (Icf::Reloc_addend_size_info): New typedef.
7506         (Icf::Reloc_info): Add new member reloc_addend_size_info.
7507         * int_encoding.h (read_from_pointer): New overloaded function.
7508         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
7509         * testsuite/icf_sht_rel_addend_test.sh: New file.
7510         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
7511         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
7512
7513 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7514
7515         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
7516         * Makefile.in: Regenerate.
7517         * testsuite/Makefile.in: Regenerate.
7518
7519 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
7520
7521         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
7522         * gold/testsuite/debug_msg.cc: Likewise.
7523         * gold/testsuite/odr_violation1.cc
7524         * gold/testsuite/odr_violation2.cc
7525
7526 2010-07-21  Cary Coutant  <ccoutant@google.com>
7527
7528         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
7529         string, and length fields.
7530         (Output_merge_string::Merged_strings_list): New type.
7531         (Output_merge_string::Merged_strings_lists): New typedef.
7532         (Output_merge_string): Replace merged_strings_ with
7533         merged_strings_lists_.
7534         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
7535         Merged_strings_list per input object and section.  Don't store pointer
7536         to the string.  Don't store length with each merged string entry.
7537         (Output_merge_string::finalize_merged_data): Loop over list of merged
7538         strings lists.  Recompute length of each merged string.
7539
7540 2010-07-15  Cary Coutant  <ccoutant@google.com>
7541
7542         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
7543         here.
7544
7545 2010-07-14  Ian Lance Taylor  <iant@google.com>
7546
7547         * descriptors.cc (Descriptors::open): Report correct name in error
7548         message.
7549
7550 2010-07-13  Doug Kwan  <dougkwan@google.com>
7551
7552         * arm.cc (Arm_input_section::Arm_input_section): For a
7553         SHT_ARM_EXIDX section, always keeps the input sections.
7554         (Arm_input_section::set_exidx_section_link): New method.
7555         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
7556         has_errors_ to false.
7557         (Arm_exidx_input_section::has_errors,
7558         Arm_exidx_input_section::set_has_errors): New methods.
7559         (Arm_exidx_input_section::has_errors_): New data member.
7560         (Arm_relobj::get_exidx_shndx_list): New method.
7561         (Arm_output_section::append_text_sections_to_list): Do not skip
7562         section without SHF_EXECINSTR.
7563         (Arm_output_section::fix_exidx_coverage): Skip input sections with
7564         errors.
7565         (Arm_relobj::make_exidx_input_section): Add new parameter for text
7566         section header.  Make error messages more verbose.  Check for
7567         a non-executable section linked to an EXIDX section.
7568         (Arm_relobj::do_read_symbols): Remove error checking, which has been
7569         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
7570         check that there is no deferred EXIDX section if we exit early.
7571         Instead of not making an EXIDX section in case of an error, make one
7572         and set the has_errors flag of it.
7573         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
7574         in a relocatable link.
7575         (Target_arm::do_relax): Look for the EXIDX output section instead of
7576         assuming that it is called .ARM.exidx.
7577         (Target_arm::fix_exidx_coverage): Add a new parameter for input
7578         section list.  Do not check for SHF_EXECINSTR section flags but
7579         skip any input section with errors.
7580         * output.cc (Output_section::Output_section): Initialize
7581         always_keeps_input_sections_ to false.
7582         (Output_section::add_input_section): Check for
7583         always_keeps_input_sections_.
7584         *  output.h (Output_section::always_keeps_input_sections,
7585         Output_section::set_always_keeps_input_sections): New methods.
7586         (Output_section::always_keeps_input_sections): New data member.
7587
7588 2010-07-13  Rafael Espindola  <espindola@google.com>
7589
7590         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
7591         * fileread.h (Input_file): Add try_extra_search_path and find_file.
7592
7593 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
7594             Ian Lance Taylor  <iant@google.com>
7595
7596         * output.h (Output_section_lookup_maps::add_merge_section):
7597         Correct check of whether value was inserted.
7598         (Output_section_lookup_maps::add_merge_input_section): Likewise.
7599         (Output_section_lookup_maps::add_relaxed_input_section):
7600         Likewise.
7601         * arm.cc (Target_arm::got_section): Remove used local os.
7602         * i386.cc (Target_i386::got_section): Likewise.
7603         * x86_64.cc (Target_x86_64::got_section): Likewise.
7604         * sparc.cc (Target_sparc::got_section): Likewise.
7605         (Target_sparc::relocate): Remove unused local have_got_offset.
7606         * powerpc.cc (Target_powerpc::relocate): Likewise.
7607
7608 2010-07-13  Ian Lance Taylor  <iant@google.com>
7609
7610         * compressed_output.cc (zlib_decompress): Fix signature in
7611         !HAVE_ZLIB_H case.
7612
7613         * archive.cc (Archive::include_member): Unlock an external member
7614         of a thin archive.  Don't bother to delete an object we know is
7615         NULL.
7616
7617 2010-07-12  Cary Coutant  <ccoutant@google.com>
7618
7619         * compressed_output.cc (zlib_decompress): New function.
7620         (get_uncompressed_size): New function.
7621         (decompress_input_section): New function.
7622         * compressed_output.h (get_uncompressed_size): New function.
7623         (decompress_input_section): New function.
7624         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
7625         Handle compressed debug sections.
7626         * layout.cc (is_compressed_debug_section): New function.
7627         (Layout::output_section_name): Map compressed section names to
7628         canonical names.
7629         * layout.h (is_compressed_debug_section): New function.
7630         (is_debug_info_section): Recognize compressed debug sections.
7631         * merge.cc: Include compressed_output.h.
7632         (Output_merge_data::do_add_input_section): Handle compressed
7633         debug sections.
7634         (Output_merge_string::do_add_input_section): Handle compressed
7635         debug sections.
7636         * object.cc: Include compressed_output.h.
7637         (Sized_relobj::Sized_relobj): Initialize new data members.
7638         (build_compressed_section_map): New function.
7639         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
7640         * object.h (Object::section_is_compressed): New method.
7641         (Object::do_section_is_compressed): New method.
7642         (Sized_relobj::Compressed_section_map): New type.
7643         (Sized_relobj::do_section_is_compressed): New method.
7644         (Sized_relobj::compressed_sections_): New data member.
7645         * output.cc (Output_section::add_input_section): Handle compressed
7646         debug sections.
7647         * reloc.cc: Include compressed_output.h.
7648         (Sized_relobj::write_sections): Handle compressed debug sections.
7649
7650 2010-07-08  Cary Coutant  <ccoutant@google.com>
7651
7652         * resolve.cc (Symbol_table::resolve): Remember whether undef was
7653         weak when resolving to a dynamic def.
7654         (Symbol_table::should_override): Add adjust_dyndef flag; set it
7655         for weak undef/dynamic def cases. Adjust callers.
7656         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
7657         undef_binding_weak_.
7658         (Symbol_table::sized_write_globals): Adjust symbol binding.
7659         (Symbol_table::sized_write_symbol): Add binding parameter.
7660         * symtab.h (Symbol::set_undef_binding): New method.
7661         (Symbol::is_undef_binding_weak): New method.
7662         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
7663         (Symbol_table::should_override): Add new parameter.
7664         (Symbol_table::sized_write_symbol): Add new parameter.
7665
7666         * testsuite/weak_undef_file1.cc: Add new test case.
7667         * testsuite/weak_undef_file2.cc: Fix header comment.
7668         * testsuite/weak_undef_test.cc: Add new test case.
7669
7670 2010-06-29  Doug Kwan  <dougkwan@google.com>
7671
7672         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
7673         Initialize USE_SYMBOL_.
7674         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
7675         definition.
7676         (Arm_reloc_property::uses_symbol_): New data member declaration.
7677         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
7678         uses symbol value and symbol is undefined but not weakly undefined.
7679
7680 2010-06-28  Rafael Espindola  <espindola@google.com>
7681
7682         * plugin.cc (Plugin::load): Use dlerror.
7683
7684 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
7685
7686         * symtab.cc (detect_odr_violations): When reporting an ODR
7687         violation, report an object where the symbol is defined.
7688
7689 2010-06-25  Doug Kwan  <dougkwan@google.com>
7690
7691         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
7692         (Target_arm::section_may_have_icf_unsafe_pointers): New method
7693         definition.
7694         (Target_arm::Scan::local_reloc_may_be_function_pointer,
7695         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
7696         target hook to detect function points.
7697         (Target_arm::Scan::possible_function_pointer_reloc): New method.
7698         * icf.h (Icf::check_section_for_function_pointers): Change type of
7699         parameter SECTION_NAME to const reference to std::string.  Use
7700         target hook to determine if section may have unsafe pointers.
7701         * target.h (Target::section_may_have_icf_unsafe_pointers): New
7702         method definition.
7703
7704 2010-06-21  Rafael Espindola  <espindola@google.com>
7705
7706         * fileread.cc (Input_file::find_fie): New
7707         (Input_file::open): Use Input_file::find_fie.
7708         * fileread.h (Input_file::find_fie): New
7709         * plugin.cc (set_extra_library_path): New.
7710         (Plugin::load): Add set_extra_library_path to the transfer vector.
7711         (Plugin_manager::set_extra_library_path): New.
7712         (Plugin_manager::add_input_file): Use the extra search path if set.
7713         (set_extra_library_path(): New.
7714         * plugin.h (Plugin_manager): Add set_extra_library_path and
7715         extra_search_path_.
7716
7717 2010-06-19  Cary Coutant  <ccoutant@google.com>
7718
7719         * layout.cc (gdb_sections): Add .debug_types.
7720         (lines_only_debug_sections): Likewise.
7721
7722 2010-06-18  Rafael Espindola  <espindola@google.com>
7723
7724         * plugin.cc (add_input_file,add_input_library)
7725         (Plugin_manager::add_input_file): Make filename arguments const.
7726         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
7727         const.
7728
7729 2010-06-16  Doug Kwan  <dougkwan@google.com>
7730
7731         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
7732         .ARM.attributes section if we have not merged any input
7733         attributes sections.
7734
7735 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7736
7737         * arm.cc: Allow combining objects with no EABI version
7738         information.
7739
7740 2010-06-15  Rafael Espindola  <espindola@google.com>
7741
7742         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
7743
7744 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7745
7746         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
7747         (struct iovec): Correct !HAVE_READV definition.
7748
7749 2010-06-10  Cary Coutant  <ccoutant@google.com>
7750
7751         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
7752         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
7753         reloc sections.
7754         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
7755
7756         PR 11683
7757         * symtab.h (Symbol::is_placeholder): New member function.
7758         * target-reloc.h (relocate_section): Check for placeholder symbols.
7759
7760         * testsuite/Makefile.am (plugin_test_8): New test.
7761         (plugin_test_9): New test.
7762         * testsuite/Makefile.in: Regenerate.
7763
7764 2010-06-09  Nick Clifton  <nickc@redhat.com>
7765
7766         * yyscript.y (input_list_element): Allow strings prefixed with
7767         the '-' character.  Treat these as libraries.
7768         * script.cc (script_add_library): New function.  Adds a library
7769         specified by "-l<name>" found in an input script.
7770         * script-c.h: Add prototype for script_add_library.
7771
7772 2010-06-07  Doug Kwan  <dougkwan@google.com>
7773
7774         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
7775         Restrict stub-group size to be within long conditional branch
7776         range when working around cortex-A8 erratum.
7777
7778 2010-06-07  Damien Diederen  <dd@crosstwine.com>
7779
7780         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
7781         #ifdef typo.
7782
7783 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
7784
7785         PR gold/11658
7786         * output.cc
7787         (Output_section::Input_section_sort_entry::compare_section_ordering):
7788         Change to return non-zero correctly.
7789         (Output_section::Input_section_sort_section_order_index_compare
7790         ::operator()): Change to fix ambiguity in comparisons.
7791
7792 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
7793
7794         * gold.h (is_wildcard_string): New function.
7795         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
7796         (Layout::layout_eh_frame): Ditto.
7797         (Layout::find_section_order_index): New method.
7798         (Layout::read_layout_from_file): New method.
7799         * layout.h (Layout::find_section_order_index): New method.
7800         (Layout::read_layout_from_file): New method.
7801         (Layout::input_section_position_): New private member.
7802         (Layout::input_section_glob_): New private member.
7803         * main.cc (main): Call read_layout_from_file here.
7804         * options.h (--section-ordering-file): New option.
7805         * output.cc (Output_section::input_section_order_specified_): New
7806         member.
7807         (Output_section::Output_section): Initialize new member.
7808         (Output_section::add_input_section): Add new parameter.
7809         Keep input sections when --section-ordering-file is used.
7810         (Output_section::set_final_data_size): Sort input sections when
7811         section ordering file is specified.
7812         (Output_section::Input_section_sort_entry): Add new parameter.
7813         Check sorting type.
7814         (Output_section::Input_section_sort_entry::compare_section_ordering):
7815         New method.
7816         (Output_section::Input_section_sort_compare::operator()): Change to
7817         consider section_order_index.
7818         (Output_section::Input_section_sort_init_fini_compare::operator()):
7819         Change to consider section_order_index.
7820         (Output_section::Input_section_sort_section_order_index_compare
7821         ::operator()): New method.
7822         (Output_section::sort_attached_input_sections): Change to sort
7823         according to section order when specified.
7824         (Output_section::add_input_section<32, true>): Add new parameter.
7825         (Output_section::add_input_section<64, true>): Add new parameter.
7826         (Output_section::add_input_section<32, false>): Add new parameter.
7827         (Output_section::add_input_section<64, false>): Add new parameter.
7828         * output.h (Output_section::add_input_section): Add new parameter.
7829         (Output_section::input_section_order_specified): New
7830         method.
7831         (Output_section::set_input_section_order_specified): New method.
7832         (Input_section::Input_section): Initialize section_order_index_.
7833         (Input_section::section_order_index): New method.
7834         (Input_section::set_section_order_index): New method.
7835         (Input_section::section_order_index_): New member.
7836         (Input_section::Input_section_sort_section_order_index_compare): New
7837         struct.
7838         (Output_section::input_section_order_specified_): New member.
7839         * script-sections.cc (is_wildcard_string): Delete and move modified
7840         method to gold.h.
7841         (Output_section_element_input::Output_section_element_input): Modify
7842         call to is_wildcard_string.
7843         (Output_section_element_input::Input_section_pattern
7844         ::Input_section_pattern): Ditto.
7845         (Output_section_element_input::Output_section_element_input): Ditto.
7846         * testsuite/Makefile.am (final_layout): New test case.
7847         * testsuite/Makefile.in: Regenerate.
7848         * testsuite/final_layout.cc: New file.
7849         * testsuite/final_layout.sh: New file.
7850
7851 2010-06-01  Rafael Espindola  <espindola@google.com>
7852
7853         * plugin.cc (Plugin::load): Pass the output name to the plugin.
7854
7855 2010-06-01  Rafael Espindola  <espindola@google.com>
7856
7857         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
7858         visibility of symbols.
7859
7860 2010-05-27  Doug Kwan  <dougkwan@google.com>
7861
7862         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
7863         from start of output section instead of address for a local symbol
7864         in a merged or relaxed section when doing a relocatable link.
7865
7866 2010-05-26  Rafael Espindola  <espindola@google.com>
7867
7868         PR 11604
7869         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
7870         adding sections the garbage collector removed.
7871         * gold/testsuite/Makefile.am: Add test.
7872         * gold/testsuite/Makefile.in: Regenerate.
7873         * gold/testsuite/plugin_test_7.sh: New.
7874         * gold/testsuite/plugin_test_7_1.c: New.
7875         * gold/testsuite/plugin_test_7_2.c: New.
7876
7877 2010-05-26  Rafael Espindola  <espindola@google.com>
7878
7879         * script-sections.cc (Output_section_definition::set_section_addresses):
7880         Check for --section-start.
7881
7882 2010-05-26  Doug Kwan  <dougkwan@google.com>
7883
7884         * arm.cc (Arm_scan_relocatable_relocs): New class.
7885         (Target_arm::relocate_special_relocatable): New method.
7886         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
7887         (Arm_relocate_functions::thumb_branch_common): Same.
7888         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
7889         instead of Default_scan_relocatable_relocs.
7890         * target-reloc.h (relocate_for_relocatable): Let target handle
7891         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
7892         * target.h (Sized_target::relocate_special_relocatable): New method.
7893
7894 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7895
7896         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
7897
7898 2010-05-23  Doug Kwan  <dougkwan@google.com>
7899
7900         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
7901         instead of a cast.
7902         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
7903         with a direct branch, not a conditional branch, to a stub.
7904         * merge.cc (Output_merge_base::record_input_section): New method
7905         defintion.
7906         (Output_merge_data::do_add_input_section): Record input section if
7907         keeps-input-sections flag is set.
7908         (Output_merge_string::do_add_input_section): Ditto.
7909         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
7910         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
7911         INPUT_SECTIONS_.
7912         (Output_merge_base::keeps_input_sections,
7913         Output_merge_base::set_keeps_input_sections,
7914         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
7915         method definitions.
7916         (Output_merge_base::Input_sections): New type declaration.
7917         (Output_merge_base::input_sections_begin,
7918         Output_merge_base::input_sections_end,
7919         Output_merge_base::do_set_keeps_input_sections): New method definitions.
7920         (Output_merge_base::bool keeps_input_sections_,
7921         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
7922         Output_merge_base::input_sections_): New data members.
7923         (Output_merge_data::do_set_keeps_input_sections): New method
7924         defintion.
7925         (Output_merge_string::do_set_keeps_input_sections): Ditto.
7926         * output.cc (Output_section::Input_section::relobj): Move method
7927         defintion from class declaration to here and handle merge sections.
7928         (Output_section::Input_section::shndx): Ditto.
7929         (Output_section::Output_section): Remove initializations of removed
7930         data members and initialize new data member LOOKUP_MAPS_.
7931         (Output_section::add_input_section): Set keeps-input-sections flag
7932         for a newly created merge output section as appropriate.  Adjust code
7933         to use Output_section_lookup_maps class.
7934         (Output_section::add_relaxed_input_section): Adjst code for lookup
7935         maps code refactoring.
7936         (Output_section::add_merge_input_section): Add a new parameter
7937         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
7938         class.  If adding input section to a newly created merge output
7939         section fails, remove the new merge section.
7940         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
7941         Adjust code for use of the Output_section_lookup_maps class.
7942         (Output_section::find_merge_section): Ditto.
7943         (Output_section::build_lookup_maps): New method defintion.
7944         (Output_section::find_relaxed_input_section): Adjust code to use
7945         Output_section_lookup_maps class.
7946         (Output_section::get_input_sections): Export merge sections.  Adjust
7947         code to use Output_section_lookup_maps class.
7948         (Output_section:::add_script_input_section): Adjust code to use
7949         Output_section_lookup_maps class.  Update lookup maps for merge
7950         sections also.
7951         (Output_section::discard_states): Use Output_section_lookup_maps.
7952         (Output_section::restore_states): Same.
7953         * output.h (Merge_section_properties): Move class defintion out of
7954         Output_section.
7955         (Output_section_lookup_maps): New class.
7956         (Output_section::Input_section::is_merge_section): New method
7957         defintion.
7958         (Output_section::Input_section::relobj): Move defintion out of class
7959         defintion.  Declare method only.
7960         (Output_section::Input_section::shndx): Ditto.
7961         (Output_section::Input_section::output_merge_base): New method defintion.
7962         (Output_section::Input_section::u2_.pomb): New union field.
7963         (Output_section::Merge_section_by_properties_map,
7964         Output_section::Output_section_data_by_input_section_map,
7965         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
7966         Remove types.
7967         (Output_section::add_merge_input_section): Add new parameter
7968         KEEPS_INPUT_SECTIONS.
7969         (Output_section::build_lookup_maps): New method declaration.
7970         (Output_section::merge_section_map_,
7971         Output_section::merge_section_by_properties_map_,
7972         Output_section::relaxed_input_section_map_,
7973         Output_section::is_relaxed_input_section_map_valid_): Remove data
7974         members.
7975         (Output_section::lookup_maps_): New data member.
7976
7977 2010-05-21  Doug Kwan  <dougkwan@google.com>
7978
7979         PR gold/11619
7980         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
7981         avoid a compilation error.
7982
7983 2010-05-19  Rafael Espindola  <espindola@google.com>
7984
7985         * script-sections.cc (Output_section_definition::allocate_to_segment):
7986         Update the phdrs_list even when the output section is NULL.
7987         * testsuite/Makefile.am: Add test.
7988         * testsuite/Makefile.in: Regenerate.
7989         * testsuite/script_test_9.cc: New.
7990         * testsuite/script_test_9.sh: New.
7991         * testsuite/script_test_9.t: New.
7992
7993 2010-05-19  Doug Kwan  <dougkwan@google.com>
7994
7995         * arm.cc (Arm_input_section::original_size): New method.
7996         (Arm_input_section::do_addralign): Add a cast.
7997         (Arm_input_section::do_output_offset): Remove static cast.
7998         (Arm_input_section::original_addralign,
7999          Arm_input_section::original_size_): Change type to uint32_t.
8000         (Arm_input_section::init): Add safe casts for section alignment
8001         and size.
8002         (Arm_input_section::set_final_data_size): Do not set address and
8003         offset of stub table.
8004         (Arm_output_section::fix_exidx_coverage): Change use of of
8005         Output_section::Simple_input_section to that of
8006         Output_section::Input_section.
8007         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
8008         except for the first pass.
8009         * output.cc (Output_section::get_input_sections): Change type of
8010         input_sections to std::list<Input_section>.
8011         (Output_section::add_script_input_section): Rename from
8012         Output_section::add_simple_input_section.  Change type of SIS
8013         parameter from Simple_input_section to Input_section.
8014         * output.h (Output_section::Simple_input_section): Remove class.
8015         (Output_section::Input_section): Change class visibility to public.
8016         (Output_section::Input_section::addralign): Use stored alignments
8017         for special input sections if set.
8018         (Output_section::Input_section::set_addralign): New method.
8019         (Output_section::get_input_sections): Change parameter type from
8020         list of Simple_input_section to list of Input_section.
8021         (Output_section::add_script_input_section): Rename from
8022         Output_section::add_simple_input_section. Change first parameter's
8023         type from Simple_input_section to Input_section and remove the
8024         second and third parameters.
8025         * script-sections.cc (Input_section::Input_section_list): Change
8026         type to list of Output_section::Input_section/
8027         (Input_section_info::Input_section_info): Change parameter type of
8028         INPUT_SECTION to Output_section::Input_section.
8029         (Input_section_info::input_section): Change return type.
8030         (Input_section_info::input_section_): Change type to
8031         Output_section::Input_section.
8032         (Output_section_element_input::set_section_addresses): Adjust code
8033         to use Output_section::Input_section instead of
8034         Output_section::Simple_input_section.  Adjust code for renaming
8035         of Output_section::add_simple_input_section.
8036         (Orphan_output_section::set_section_addresses): Ditto.
8037
8038 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8039
8040         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
8041         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
8042
8043 2010-05-18  Rafael Espindola  <espindola@google.com>
8044
8045         * options.cc (General_options::finalize): Handle -nostdlib.
8046         * options.h (nostdlib): New option.
8047         * script.cc (script_add_search_dir): Handle -nostdlib.
8048
8049 2010-05-12  Doug Kwan  <dougkwan@google.com>
8050
8051         * arm.cc (Target_arm::do_finalize_sections): Create an empty
8052         attributes section only if there no attributes section after merging.
8053         (Target_arm::merge_object_attributes): Move value of
8054         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
8055         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
8056         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
8057         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
8058         and arm_attr_merge_7.stdout.
8059         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
8060         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
8061         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
8062         arm_attr_merge_7b.o): New rules.
8063         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
8064         arm_attr_merge_7
8065         * testsuite/Makefile.in: Regenerate.
8066         * testsuite/arm_attr_merge.sh: New file.
8067         * testsuite/arm_attr_merge_[67][ab].s: Same.
8068
8069 2010-05-05  Nick Clifton  <nickc@redhat.com>
8070
8071         * po/es.po: Updated Spanish translation.
8072
8073 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
8074
8075         * Makefile.am (install-exec-local): Properly install gold as
8076         default cross linker.
8077         * Makefile.in: Regenerated.
8078
8079 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
8080             Nick Clifton  <nickc@redhat.com>
8081
8082         * configure.ac (install_as_default): Define and set to false
8083         unless --enable-gold or --enable-gold=both/gold has been
8084         specified.
8085         * configure: Regenerate.
8086
8087         * Makefile.am (install-exec-local): Install the executable as
8088         'ld.gold'.  If install_as_default is true then also install it as
8089         'ld'.
8090         * Makefile.in: Regenerated.
8091
8092 2010-04-24  Ian Lance Taylor  <iant@google.com>
8093
8094         * layout.cc (Layout::layout_reloc): In relocatable link don't
8095         combine reloc sections for grouped sections.
8096
8097 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
8098
8099         * gc.h (gc_process_relocs): Pass information on relocs pointing to
8100         sections that are not ordinary to icf.
8101         * icf.cc (get_section_contents): Handle relocation pointing to section
8102         with no object or shndx information.
8103         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
8104         * testsuite/Makefile.in: Regenerate.
8105         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
8106         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
8107
8108 2010-04-22  Ian Lance Taylor  <iant@google.com>
8109
8110         * expression.cc (Expression::Expression_eval_info): Add
8111         result_alignment_pointer field.
8112         (Expression::eval_with_dot): Add result_alignment_pointer
8113         parameter.  Change all callers.
8114         (Expression::eval_maybe_dot): Likewise.
8115         (class Binary_expression): Add alignment_pointer parameter to
8116         left_value and right_value.  Change all callers.
8117         (BINARY_EXPRESSION): Set result alignment.
8118         (class Trinary_expression): Add alignment_pointer parameter to
8119         arg2_value and arg3_value.  Change all callers.
8120         (Trinary_cond::value): Set result alignment.
8121         (Max_expression::value, Min_expression::value): Likewise.
8122         (Align_expression::value): Likewise.
8123         * script-sections.cc (class Sections_element): Add dot_alignment
8124         parameter to set_section_addresses virtual function.  Update
8125         instantiations.
8126         (class Output_section_element): Likewise.
8127         (Script_sections::create_segments): Add dot_alignment parameter.
8128         Change all callers.
8129         (Script_sections::create_segments_from_phdrs_clause): Likewise.
8130         (Script_sections::set_phdrs_clause_addresses): Likewise.
8131         * script-sections.h: Update declarations.
8132         * script.h: Update declarations.
8133         * output.h (Output_segment::set_minimum_p_align): Don't decrease
8134         min_p_align.
8135         * testsuite/script_test_3.t: Set large alignment.
8136         * testsuite/script_test_3.sh: Make sure that at least one LOAD
8137         segment has expected alignment.
8138
8139 2010-04-22  Nick Clifton  <nickc@redhat.com>
8140
8141         * po/gold.pot: Updated by the Translation project.
8142         * po/vi.po: Updated Vietnamese translation.
8143
8144 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
8145
8146         * testsuite/Makefile.am (check_PROGRAMS): Add
8147         icf_virtual_function_folding_test.
8148         * testsuite/Makefile.in: Regenerated.
8149
8150 2010-04-15  Andrew Haley  <aph@redhat.com>
8151
8152         * options.h (merge_exidx_entries): New option.
8153         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
8154         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
8155         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
8156         (Target_arm::merge_exidx_entries): New function.
8157         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
8158         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
8159         to Arm_exidx_fixup constructor.
8160         Add new arg, merge_exidx_entries.
8161         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
8162         Arm_output_section::fix_exidx_coverage.
8163
8164 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
8165
8166         * icf.cc (get_section_contents): Check for preemptible functions.
8167         Ignore addend when appropriate.
8168         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
8169         section folded.
8170         (add_from_relobj): Check for section folded.
8171         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
8172         * symtab.h (should_add_dynsym_entry): Add new parameter.
8173         * target-reloc.h (scan_relocs): Check for section folded.
8174         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
8175         Check reloc types for function pointers in shared objects.
8176         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
8177         case.
8178         (icf_preemptible_functions_test): New test case.
8179         (icf_string_merge_test): New test case.
8180         * testsuite.Makefile.in: Regenerate.
8181         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
8182         bar_glob.  Refactor code.
8183         * testsuite/icf_preemptible_functions_test.cc: New file.
8184         * testsuite/icf_preemptible_functions_test.sh: New file.
8185         * testsuite/icf_string_merge_test.cc: New file.
8186         * testsuite/icf_string_merge_test.sh: New file.
8187         * testsuite/icf_virtual_function_folding_test.cc: New file.
8188         * testsuite/icf_virtual_function_folding_test.sh: New file.
8189
8190 2010-04-14  Doug Kwan  <dougkwan@google.com>
8191
8192         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
8193         for local symbol recounting if we remove a section due to ICF.
8194         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
8195         there are no regular objects in input.
8196
8197 2010-04-13  Doug Kwan  <dougkwan@google.com>
8198
8199         * arm.cc (Arm_input_section::set_final_data_size): Compute
8200         accurate final data size instead of using current data size.
8201
8202 2010-04-09  Doug Kwan  <dougkwan@google.com>
8203
8204         * layout.cc (Layout::choose_output_section): Handle script section
8205         types.
8206         (Layout::make_output_section_for_script): Add section type parameter.
8207         Handle script section types.
8208         * layout.h (Layout::make_output_section_for_script): Add section
8209         type parameter.
8210         * output.cc (Output_section::Output_section): Initialize data member
8211         is_noload_.
8212         (Output_section::do_reset_address_and_file_offset): Do not set address
8213         to 0 if section is a NOLOAD section.
8214         * output.h (Output_section::is_noload): New method.
8215         (Output_section::set_is_noload): Ditto.
8216         (Output_section::is_noload_): New data member.
8217         * script-c.h (Script_section_type): New enum type.
8218         (struct Parser_output_section_header): Add new file section_type.
8219         * script-sections.cc (Sections_element::output_section_name): Add
8220         parameter for returning script section type.
8221         (Output_section_definition::output_section_name): Ditto.
8222         (Output_section_definition::section_type)P; New method.
8223         (Output_section_definiton::script_section_type_name): Ditto.
8224         (Output_section_definition::script_section_type_): New data member.
8225         (Output_section_definition::Output_section_definition): Initialize
8226         data member Output_section_definition::script_section_type_.
8227         (Output_section_definition::create_sections): Pass script section type
8228         to Layout::make_output_section_for_script.
8229         (Output_section_definition::output_section_name): Return script
8230         section type to caller.
8231         (Output_section_definition::set_section_address): Do not advance
8232         dot value and load address if section type is NOLOAD.  Set address
8233         of NOLOAD sections regardless of section flags.
8234         (Output_section_definition::print): Print section type if it is
8235         not SCRIPT_SECTION_TYPE_NONE.
8236         (Output_section_definition::section_type): New method.
8237         (Output_section_definition::script_section_type_name): Ditto.
8238         (Script_sections::output_section_name): Add new parameter
8239         PSECTION_TYPE for returning script section type.  Pass it to
8240         section elements.  Handle discard sections.
8241         (Sort_output_sections::operator()): Handle NOLOAD sections.
8242         * script-sections.h (Script_sections::Section_type): New enum type.
8243         (Script_sections::output_section_name): Add a new parameter for
8244         returning script section type.
8245         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
8246         INFO and NOLOAD.
8247         * yyscript.y (union): Add new field SECTION_TYPE.
8248         (COPY, DSECT, INFO, NOLOAD): New tokens.
8249         (opt_address_and_section_type): Change type to output_section_header.
8250         (section_type): New non-terminal
8251         (section_header): Handle section type.
8252         (opt_address_and_section_type): Return section type value.
8253
8254 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
8255
8256         * testsuite/plugin_common_test_1.c (foo): Add prototype.
8257         * testsuite/plugin_common_test_2.c (foo): Likewise.
8258
8259 2010-04-08  Doug Kwan  <dougkwan@google.com>
8260
8261         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
8262         Output_merge_data.
8263         * output.cc (Output_section::add_merge_input_section): Simplify
8264         code and return status of Output_merge_base::add_input_section.
8265         Update merge section map only if Output_merge_base::add_input_section
8266         returns true.
8267
8268 2010-04-07  Doug Kwan  <dougkwan@google.com>
8269
8270         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
8271         if section is marked as containing instructions but has no mapping
8272         symbols.
8273         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
8274         correct section index.
8275         (Arm_relobj::find_linked_text_section): Ditto.
8276
8277 2010-04-07  Cary Coutant  <ccoutant@google.com>
8278
8279         * archive.cc (include_member): Destroy Read_symbols_data object before
8280         releasing file.
8281         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
8282         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
8283         (Read_symbols_data::~Read_symbols_data) New destructor.
8284         (Section_relocs::Section_relocs) New constructor.
8285         (Section_relocs::~Section_relocs) New destructor.
8286         (Read_relocs_data::Read_relocs_data) New constructor.
8287         (Read_relocs_data::~Read_relocs_data) New destructor.
8288         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
8289         pointers to NULL after deleting.
8290
8291 2010-04-07  Doug Kwan  <dougkwan@google.com>
8292
8293         * arm.cc: Replace "endianity" with "endianness" in comments.
8294         (Arm_exidx_cantunwind): Ditto.
8295         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
8296         (Arm_relobj::merge_flags_and_attributes): New method.
8297         (Arm_relobj::merge_flags_and_attributes_): New data member.
8298         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
8299         (Arm_relobj::scan_sections_for_stubs): Ditto.
8300         (Arm_relobj::do_read_symbols): Check to see if we really want to
8301         merge processor-specific flags and attributes.  Exit early if
8302         an object is empty except for section names and the undefined symbol.
8303         (Target_arm::do_finalize_sections): Move check for ELF format to
8304         Arm_relobj::do_read_symbols.  Merge processor specific flags and
8305         attributes from a regular object only when we have determined that
8306         it is aapropriate.  Do not create an .ARM.attributes section in
8307         output if there is no regular input object.
8308         (Target_arm::merge_processor_specific_flags): Check
8309         --warn-mismatch before printing any error.
8310         (Target_arm::merge_object_attributes): Ditto.
8311         * gold.cc (queue_middle_tasks): Handle the case in which there is
8312         no regular object in input.
8313         * options.cc (General_options::parse_EB): New method.
8314         (General_options::parse_EL): Same.
8315         (General_options::General_options): Initialize endianness_.
8316         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
8317         New options.
8318         (General_options::Endianness): New enum.
8319         (General_options::endianness): New method.
8320         (General_options::endianness_): New data member.
8321         * parameters.cc (Parameters::set_options): Check target endianness.
8322         (Parameters::set_target_once): Ditto.
8323         (Parameters::check_target_endianness): New method.
8324         (parameters_force_valid_target): If either -EL or -EB is specified,
8325         use it to define endianness of default target.
8326         * parameters.h (Parameters::check_target_endianness): New method
8327         declaration.
8328         * target.h (class Target): Change "endianity" to "endianness"
8329         in comments.
8330
8331 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8332
8333         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
8334         * configure: Regenerate.
8335         * Makefile.in: Regenerate.
8336         * testsuite/Makefile.in: Regenerate.
8337
8338 2010-04-06  Cary Coutant  <ccoutant@google.com>
8339
8340         gcc PR lto/42757
8341         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
8342         prevailing definitions of common symbols.
8343         * testsuite/plugin_test_6.sh: New test case.
8344         * testsuite/plugin_common_test_1.c: New test case.
8345         * testsuite/plugin_common_test_2.c: New test case.
8346         * testsuite/Makefile.am (plugin_test_6): New test case.
8347         * testsuite/Makefile.in: Regenerate.
8348
8349 2010-04-06  Nick Clifton  <nickc@redhat.com>
8350
8351         * po/vi.po: New Vietnamese translation.
8352
8353 2010-03-30  Doug Kwan  <dougkwan@google.com>
8354
8355         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
8356
8357 2010-03-25  Doug Kwan  <dougkwan@google.com>
8358
8359         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
8360         to avoid a conversion warning on a 32-bit host.
8361
8362 2010-03-24  Ian Lance Taylor  <iant@google.com>
8363
8364         * testsuite/script_test_3.t: Add a TLS segment.
8365         * testsuite/Makefile.am (check_PROGRAMS): Add
8366         tls_phdrs_script_test.
8367         (tls_phdrs_script_test_SOURCES): Define.
8368         (tls_phdrs_script_test_DEPENDENCIES): Define.
8369         (tls_phdrs_script_test_LDFLAGS): Define.
8370         (tls_phdrs_script_test_LDADD): Define.
8371         * testsuite/Makefile.in: Rebuild.
8372
8373 2010-03-23  Cary Coutant  <ccoutant@google.com>
8374
8375         * fileread.cc (find_or_make_view): Fix comment.
8376
8377 2010-03-23  Ian Lance Taylor  <iant@google.com>
8378
8379         * script-sections.cc (class Orphan_section_placement): Define
8380         PLACE_TLS and PLACE_TLS_BSS.
8381         (Orphan_section_placement::Orphan_section_placement): Initialize
8382         new places.
8383         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
8384         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
8385         (tls_script_test_SOURCES): Define.
8386         (tls_script_test_DEPENDENCIES): Define.
8387         (tls_script_test_LDFLAGS): Define.
8388         (tls_script_test_LDADD): Define.
8389         * testsuite/Makefile.in: Rebuild.
8390
8391 2010-03-22  Doug Kwan  <dougkwan@google.com>
8392
8393         * arm.cc (Arm_relocate_functions::abs8,
8394         Arm_relocate_functions::abs16): Use correct check for overflow
8395         specified in the ARM ELF specs.
8396         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
8397         target of a BLX instruction specially.
8398         (Reloc_stub::stub_type_for_reloc): Ditto.
8399         (Relocate::relocate): Use symbolic names instead of numeric relocation
8400         codes to report error.
8401         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
8402         workaround.
8403         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
8404         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
8405         thumb2_blx_out_of_range.stdout
8406         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
8407         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
8408         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
8409         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
8410         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
8411         thumb2_blx_in_range, thumb2_blx_in_range.o,
8412         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
8413         thumb2_blx_out_of_range.o): New rules.
8414         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
8415         thumb2_blx_in_range and thumb2_blx_out_of_range.
8416         * testsuite/Makefile.in: Regenerate.
8417         * arm_branch_in_range.sh: Add tests for THUMB BLX.
8418         * testsuite/thumb_blx_in_range.s: New file.
8419         * testsuite/thumb_blx_out_of_range.s: New file.
8420
8421 2010-03-22  Rafael Espindola  <espindola@google.com>
8422
8423         * archive.cc (Should_include): Move to archive.h.
8424         (should_include_member): Make it a member of Archive.
8425         (Lib_group): New.
8426         (Add_lib_group_symbols): New.
8427         * archive.h: Include options.h.
8428         (Archive_member): Moved from Archive.
8429         (Should_include): Moved from archive.cc.
8430         (Lib_group): New.
8431         (Add_lib_group_symbols): New.
8432         * dynobj.cc (do_should_include_member): New.
8433         * dynobj.h (do_should_include_member): New.
8434         * gold.cc (queue_initial_tasks): Update call to queue.
8435         * main.cc (main): Print lib group stats.
8436         * object.cc (do_should_include_member): New.
8437         * object.h: Include archive.h.
8438         (Object::should_include_member): New.
8439         (Object::do_should_include_member): New.
8440         (Sized_relobj::do_should_include_member): New.
8441         * options.cc (General_options::parse_start_lib): New.
8442         (General_options::parse_end_lib): New.
8443         (Input_arguments::add_file): Handle lib groups.
8444         (Input_arguments::start_group): Check we are not in a lib.
8445         (Input_arguments::start_lib): New.
8446         (Input_arguments::end_lib): New.
8447         * options.h (General_options): Add start_lib and end_lib.
8448         (Input_argument::lib_): New.
8449         (Input_argument::lib): New.
8450         (Input_argument::is_lib): New.
8451         (Input_file_lib): New.
8452         (Input_arguments::in_lib_): New.
8453         (Input_arguments::in_lib): New.
8454         (Input_arguments::start_lib): New.
8455         (Input_arguments::end_lib_): New.
8456         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
8457         in unused members as preempted.
8458         (Sized_pluginobj::do_should_include_member): New.
8459         * plugin.h (Sized_pluginobj::do_should_include_member): New.
8460         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
8461         return the blocker.
8462         (Read_symbols::do_whole_lib_group): New.
8463         (Read_symbols::do_lib_group): New.
8464         (Read_symbols::do_read_symbols): Handle lib groups.
8465         (Read_symbols::get_name): Handle lib groups.
8466         * readsyms.h (Read_symbols): Add an archive member pointer.
8467         (Read_symbols::do_whole_lib_group): New.
8468         (Read_symbols::do_lib_group): New.
8469         (Read_symbols::member_): New.
8470         * script.cc (read_input_script): Update call to queue_soon.
8471
8472 2010-03-19  Doug Kwan  <dougkwan@google.com>
8473
8474         * arm.cc (Stub_table::Stub_table): Initialize new data members
8475         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8476         (Stub_table::add_reloc_stub): Assign stub offset and update
8477         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8478         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
8479         New data members.
8480         (Stub_table::update_data_size_and_addralign): Use
8481         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
8482         instead of going over all reloc stubs.
8483         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
8484         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8485         Stringpool_template::offset_ to size of Stringpool_char.
8486         (Stringpool_template::new_key_offset): Remove code to initialize
8487         Stringpool_template::offset_.
8488         * stringpool.h (Stringpool_template::set_no_zero_null): Set
8489         Stringpool_template::offset_ to zero.
8490
8491 2010-03-15  Doug Kwan  <dougkwan@google.com>
8492
8493         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8494         offset_.
8495         (Stringpool_template::new_key_offset): New method.
8496         (Stringpool_template::add_string): Assign offsets when adding new
8497         strings.
8498         (Stringpool_template::set_string_offsets): Do not set string offsets
8499         when not optimizing.
8500         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
8501         member size_.
8502         (Chunked_vector::clear): Clear size_.
8503         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
8504         (Chunked_vector::size): Return size_.
8505         (Chunked_vector::push_back): Use size_ to find insert position.
8506         (Chunked_vector::size_): New data member.
8507         (Stringpool_template::set_no_zero_null): Assert string set is empty.
8508         (Stringpool_template::new_key_offset): New method declaration.
8509         (Stringpool_template::offset_): New data member.
8510
8511 2010-03-15   Rafael Espindola  <espindola@google.com>
8512
8513         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
8514         Add_symbols' constructor.
8515         * readsyms.h (Add_symbols): Remove the input_group member.
8516
8517 2010-03-10  Ian Lance Taylor  <iant@google.com>
8518
8519         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
8520         target to ask whether a reference to a symbol requires a stack
8521         split.
8522         * target.h (Target::is_call_to_non_split): New function.
8523         (Target::do_is_call_to_non_split): Declare virtual function.
8524         * target.cc: Include "symtab.h".
8525         (Target::do_is_call_to_non_split): New function.
8526         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
8527
8528 2010-03-10  Cary Coutant  <ccoutant@google.com>
8529
8530         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
8531         (File_read::open[1]): Remove initial mapping of whole_file_view_.
8532         (File_read::open[2]): Add whole_file_view_ to list of views.
8533         (File_read::make_view): Remove test of whole_file_view_.
8534         (File_read::find_or_make_view): Create whole_file_view_ if
8535         necessary.
8536         (File_read::clear_views): Replace bool parameter with enum;
8537         adjust all callers.  Don't delete views with permanent data;
8538         do delete cached views and views from archives if
8539         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
8540         if clearing the corresponding view.
8541         * fileread.h (File_read::Clear_views_mode): New enum.
8542         (File_read::View::is_permanent_view): New method.
8543         (File_read::clear_views): Replace bool parameter
8544         with enum; adjust all callers.
8545         * options.h (General_options): Change keep_files_mapped option;
8546         add map_whole_files.
8547         * readsyms.cc (Add_symbols::run): Delete sd_ object before
8548         releasing the file.
8549         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
8550         the file.
8551
8552 2010-03-10  David S. Miller  <davem@davemloft.net>
8553
8554         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
8555
8556 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
8557
8558         * icf.cc (get_section_contents): Add '@' marker after processing the
8559         merge reloc.
8560
8561 2010-03-08  Doug Kwan  <dougkwan@google.com>
8562
8563         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
8564         due to a conversion warning.
8565         (Arm_relobj::update_output_local_symbol_count): Check for local
8566         symbol with unset output index.
8567
8568 2010-03-05  Ian Lance Taylor  <iant@google.com>
8569
8570         * options.h (class General_options): Add --spare-dynamic-tags.
8571         * output.cc (Output_data_dynamic::set_final_data_size): Implement
8572         --spare-dynamic-tags.
8573
8574 2010-03-05  Ian Lance Taylor  <iant@google.com>
8575
8576         * incremental.cc: Include "libiberty.h".
8577
8578 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
8579
8580         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
8581         function, is_info_ member.
8582         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
8583         (Versions::Versions): Update caller.
8584         (Versions::define_base_version): Likewise.
8585         (Versions::add_def): Likewise.
8586
8587 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
8588
8589         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
8590         (Scan::possible_function_pointer_reloc): New function.
8591         (Scan::local_reloc_may_be_function_pointer): Change to call
8592         possible_function_pointer_reloc.
8593         (Scan::global_reloc_may_be_function_pointer): Ditto.
8594         * icf.h (Icf::check_section_for_function_pointers): Change to reject
8595         relocations in ".data.rel.ro._ZTV" section.
8596         * testsuite/icf_safe_so_test.sh: Change to pass i386.
8597         * testsuite/icf_safe_so_test.cc: Ditto.
8598         * testsuite/icf_safe_test.cc: Ditto.
8599         * testsuite/icf_safe_test.sh: Ditto.
8600
8601 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8602             Ian Lance Taylor  <iant@google.com>
8603
8604         * target-reloc.h (relocate_section): Check the symbol table index
8605         for -1U before setting the local symbol index.
8606         (scan_relocatable_relocs): If copying the relocation, record that
8607         the local symbol is required.
8608         * object.h (Symbol_value::is_output_symtab_index_set): New
8609         function.
8610         (Symbol_value::may_be_discarded_from_output_symtab): New
8611         function.
8612         (Symbol_value::has_output_symtab_entry): New function.
8613         (Symbol_value::needs_output_symtab_entry): Remove.
8614         (Symbol_value::output_symtab_index): Make sure the symbol index is
8615         set.
8616         (Symbol_value::set_output_symtab_index): Make sure the symbol
8617         index is not set.  Make sure the new index is valid.
8618         (Symbol_value::set_must_have_output_symtab_entry): New function.
8619         (Symbol_value::has_output_dynsym_entry): New function.
8620         (Symbol_value::set_output_dynsym_index): Make sure the new index
8621         is valid.
8622         (Sized_relobj::set_must_have_output_symtab_entry): New function.
8623         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
8624         local symbol if permitted.
8625         (Sized_relobj::do_finalize_local_symbols): Call
8626         is_output_symtab_index_set rather than needs_output_symtab_entry.
8627         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
8628         rather than needs_output_symtab_entry.  Call
8629         has_output_dynsym_entry rather than needs_output_dynsym_entry.
8630         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
8631         is_output_symtab_index_set rather than needs_output_symtab_entry.
8632         * testsuite/discard_locals_relocatable_test.c: New file.
8633         * testsuite/discard_locals_test.sh: Test -r.
8634         * testsuite/Makefile.am (check_DATA): Add
8635         discard_locals_relocatable_test1.syms,
8636         discard_local_relocatable_test2.syms.
8637         (MOSTLYCLEANFILES): Likewise.  Also add
8638         discard_locals_relocatable_test1.lout and
8639         discard_locals_relocatable_test2.out.
8640         (discard_locals_relocatable_test1.syms): New target.
8641         (discard_locals_relocatable_test.o): New target.
8642         (discard_locals_relocatable_test1.out): New target.
8643         (discard_locals_relocatable_test2.syms): New target.
8644         (discard_locals_relocatable_test2.out): New target.
8645         (various): Add missing ../ld-new dependencies.
8646         * testsuite/Makefile.in: Rebuild.
8647
8648 2010-03-03  Nick Clifton  <nickc@redhat.com>
8649
8650         * po/fi.po: New Finnish translation.
8651
8652 2010-03-01  Doug Kwan  <dougkwan@google.com>
8653
8654         * layout.cc (Layout::Layout): Force section types of .init_array*,
8655         .preinit_array* and .fini_array* sections.
8656         * output.cc (Output_section::Input_section_sort_entry::has_priority):
8657         Fix check of return value of std::string::find.().
8658         (Output_section::Input_section_sort_compare::operator()): Remove
8659         comment about .init_array.
8660         (Output_section::Input_section_sort_init_fini_compare::operator()):
8661         New method.
8662         (Output_section::sort_attached_input_sections): Handle .init_array
8663         and .fini_array specially.
8664         * output.h (Output_section::Inut_section_sort_compare): Update
8665         comment.
8666         (Output_section::Input_section_sort_init_fini_compare): New struct.
8667
8668 2010-02-26  Doug Kwan  <dougkwan@google.com>
8669
8670         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
8671         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
8672         * testsuite/debug_msg.sh: Avoid matching source line number for
8673         use of global variable undef_int.
8674
8675 2010-02-26  Doug Kwan  <dougkwan@google.com>
8676
8677         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
8678         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
8679         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
8680         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
8681         * options.cc (General_options::General_options): Initialize member
8682         fix_v4bx_.
8683         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
8684         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
8685         and rm_no_fix_v4bx.stdout
8686         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
8687         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
8688         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
8689         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
8690         and arm_no_fix_v4bx.
8691         * Makefile.in: Regenerate.
8692         * testsuite/arm_fix_v4bx.s: New file.
8693         * testsuite/arm_fix_v4bx.sh: Ditto.
8694
8695 2010-02-24  Doug Kwan  <dougkwan@google.com>
8696
8697         * arm.cc (Target_arm::got_section): Make the .got section the first
8698         non RELRO section in the data segment.
8699         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
8700         suffixes of section names.
8701
8702 2010-02-24  Doug Kwan  <dougkwan@google.com>
8703
8704         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
8705         flags and attributes merging if an input file is a binary file.
8706         * fileread.cc (Input_file::open): Record format of original file.
8707         * fileread.h (Input_file::Format): New enum type.
8708         (Input_file::Input_file): Initialize data member format_.
8709         (Input_file::format): New method definition.
8710         (Input_file::format_):: New data member.
8711
8712 2010-02-24  Doug Kwan  <dougkwan@google.com>
8713
8714         * arm.cc (Arm_output_data_got): New class.
8715         (ARM_TCB_SIZE): New constant
8716         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
8717         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
8718         If user uses a script with a SECTIONS clause, issue only a warning
8719         for a misplaced EXIDX input section.  Otherwise, issue an error.
8720         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
8721         garbage collection.
8722         (Target_arm::got_mode_index_entry): Handle static linking.
8723         (Target_arm::Scan::local): Ditto.
8724         (Target_arm::Scan::global): Ditto.
8725         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
8726         all incorrectly implemented relocations.
8727         (Target_arm::fix_exidx_coverage): Pass layout to
8728         Arm_output_section::fix_exidx_coverage.
8729         * layout.cc (Layout::section_name_mapping): Remove trailing dots
8730         from ".ARM.exidx." and ".ARM.extab.".
8731
8732 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8733
8734         * arm.cc (Target_arm::do_finalize_sections): Create attribute
8735         section if it does not already exist.
8736         * attributes.cc (Attributes_section_data::Attributes_section_data):
8737         Don't crash if size is zero.
8738
8739 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8740             Ian Lance Taylor  <iant@google.com>
8741
8742         * gold.cc (queue_middle_tasks): If no input files were opened,
8743         exit.
8744         * workqueue.h (Task_function::Task_function): Assert that there is
8745         a blocker.
8746
8747 2010-02-22  Doug Kwan  <dougkwan@google.com>
8748
8749         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
8750         * icf.cc (get_section_contents): Cast snprintf arguments to long long
8751         types to avoid warnings due to different uint64_t implementations
8752         on different hosts.
8753
8754 2010-02-21  Doug Kwan  <dougkwan@google.com>
8755
8756         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
8757         handling of the maximum backward branch offset.
8758         (Arm_relocate_functions::thumb_branch_common): Ditto.
8759         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
8760         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
8761         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
8762         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
8763         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
8764         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
8765         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
8766         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
8767         thumb_bl_out_of_range thumb_bl_out_of_range.o,
8768         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
8769         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
8770         thumb2_bl_out_of_range.o): New rules.
8771         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
8772         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
8773         thumb2_bl_out_of_range
8774         * testsuite/Makefile.in: Regenerate.
8775         * testsuite/arm_bl_in_range.s: New file.
8776         * testsuite/arm_bl_out_of_range.s: Ditto.
8777         * testsuite/arm_branch_in_range.sh: Ditto.
8778         * testsuite/arm_branch_range.t: Ditto.
8779         * testsuite/thumb2_branch_range.t: Ditto.
8780         * testsuite/thumb_bl_in_range.s: Ditto.
8781         * testsuite/thumb_bl_out_of_range.s: Ditto.
8782         * testsuite/thumb_branch_range.t: Ditto.
8783
8784 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
8785
8786         * gc.h (gc_process_relocs): Change vectors to point to the new list.
8787         Add reloc offset information.
8788         * icf.cc (get_section_contents): Change iterators to point to the new
8789         vectors. Add reloc offset information to the contents.
8790         * icf.h (Icf::Sections_reachable_info): New typedef.
8791         (Icf::Sections_reachable_list): New typedef.
8792         (Icf::Offset_info): New typedef.
8793         (Icf::Reloc_info): New struct typedef.
8794         (Icf::Reloc_info_list): New typedef.
8795         (Icf::symbol_reloc_list): Delete method.
8796         (Icf::addend_reloc_list): Delete method.
8797         (Icf::section_reloc_list): Delete method.
8798         (Icf::reloc_info_list): New method.
8799         (Icf::reloc_info_list_): New member.
8800
8801 2010-02-19  Doug Kwan  <dougkwan@google.com>
8802
8803         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
8804         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
8805         * arm.cc (Arm_relocation_functions): New forward declaration.
8806         (Target_arm::Target_arm): Initialize new data members
8807         got_mod_index_offset_ and tls_base_symbol_defined_.
8808         (Target_arm::Relocate::relocate_tls): New method.
8809         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
8810          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
8811         New methods.
8812         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
8813         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
8814         (Target_arm::got_mod_index_offset_,
8815         Target_arm::tls_base_symbol_defined_): New data members.
8816         (Target_arm::Scan::local, Target::Scan::global,
8817         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
8818         relocations.
8819
8820 2010-02-18  Doug Kwan  <dougkwan@google.com>
8821
8822         * arm.cc (Arm_relobj::find_linked_text_section): New method.
8823         (Arm_relobj::make_exidx_input_section): Pass section index of linked
8824         text section as a parameter becuase some broken tools may not set
8825         the link in section header.
8826         (Target_arm::has_got_section): New method.
8827         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
8828         without any mapping symbol as data only.  Remove warning.
8829         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
8830         link in its section header, try to discover the link by inspecting the
8831         REL31 relocation at the beginning of the section.
8832         (Target_arm::Scan::check_non_pic): Report name of offending relocation
8833         in error message.
8834         (Target_arm::Scan::global): Treat any reference to the symbol
8835         _GLOBAL_OFFSET_TABLE_ as a GOT access.
8836
8837 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
8838
8839         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
8840         (Scan::global_reloc_may_be_function_pointer): New function.
8841         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8842         (Scan::global_reloc_may_be_function_pointer): New function.
8843         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8844         (Scan::global_reloc_may_be_function_pointer): New function.
8845         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
8846         (Scan::global_reloc_may_be_function_pointer): New function.
8847         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
8848         (Scan::global_reloc_may_be_function_pointer): New function.
8849         (Scan::possible_function_pointer_reloc): New function.
8850         (Target_x86_64::can_check_for_function_pointers): New function.
8851         * gc.h (gc_process_relocs): Scan relocation types to determine if
8852         function pointers were taken for targets that support it.
8853         * icf.cc (Icf::find_identical_sections): Include functions for
8854         folding in safe ICF whose pointer is not taken.
8855         * icf.h (Secn_fptr_taken_set): New typedef.
8856         (fptr_section_id_): New member.
8857         (section_has_function_pointers): New function.
8858         (set_section_has_function_pointers): New function.
8859         (check_section_for_function_pointers): New function.
8860         * options.h: Fix comment for safe ICF option.
8861         * target.h (can_check_for_function_pointers): New function.
8862         * testsuite/Makefile.am: Add icf_safe_so_test test case.
8863         Modify icf_safe_test for X86-64.
8864         * testsuite/Makefile.in: Regenerate.
8865         * testsuite/icf_safe_so_test.cc: New file.
8866         * testsuite/icf_safe_so_test.sh: New file.
8867         * testsuite/icf_safe_test.cc (kept_func_3): New function.
8868         (main): Change to take pointer to function kept_func_3.
8869         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
8870         folding is done correctly for X86-64.
8871
8872 2010-02-12  David S. Miller  <davem@davemloft.net>
8873
8874         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
8875         is_symbolless parameter.
8876         (Output_reloc<SHT_REL>::is_symbolless): New.
8877         (Output_reloc<SHT_REL>::is_symbolless_): New.
8878         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
8879         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
8880         (Output_reloc<SHT_RELA>::is_symbolless): New.
8881         (Output_data_reloc::add_global): Handle is_symbolless.
8882         (Output_data_reloc::add_global_relative): Likewise.
8883         (Output_data_reloc::add_local): Likewise.
8884         (Output_data_reloc::add_local_relative): Likewise.
8885         (Output_data_reloc::add_symbolless_global_addend): New.
8886         (Output_data_reloc::add_symbolless_local_addend): New.
8887         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
8888         is_symbolless.
8889         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
8890         instead of ->is_relative_
8891         (Output_reloc::write): Likewise.
8892         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
8893         (Output_reloc::write_rel): Simplify.
8894
8895         * sparc.cc (Target_sparc::Scan::local): Use
8896         ->add_symbolless_local_addend as needed.
8897         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
8898         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
8899         based upon relocation offset.
8900
8901 2010-02-11  Doug Kwan  <dougkwan@google.com>
8902
8903         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
8904         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
8905         beginning of function.
8906         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
8907         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
8908         parameter is_32bit in calls to should_apply_static_reloc.
8909         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
8910         (check_DATA): Add arm_abs_global.stdout.
8911         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
8912         arm_abs_global.stdout): New rules.
8913         (MOSTLLYCLEANFILES): Add arm_abs_global
8914         * Makefile.in: Regenerate.
8915         * testsuite/arm_abs_global.s: New file.
8916         * testsuite/arm_abs_global.sh: Ditto.
8917         * testsuite/arm_abs_lib.s: Ditto.
8918
8919 2010-02-11  Ian Lance Taylor  <iant@google.com>
8920
8921         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
8922         Read_relocs task.
8923         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
8924         Allocate_commons_task first.
8925         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
8926         task, rather than symtab_lock_.
8927         (Gc_process_relocs::~Gc_process_relocs): New function.
8928         (Gc_process_relocs::is_runnable): Check this_blocker_.
8929         (Gc_process_relocs::locks): Use next_blocker_ rather than
8930         blocker_.
8931         (Scan_relocs::~Scan_relocs): New function.
8932         (Scan_relocs::is_runnable): Check this_blocker_ rather than
8933         symtab_lock_.
8934         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
8935         next_blocker_.
8936         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
8937         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
8938         constructor accordingly.
8939         (class Gc_process_relocs): Likewise.
8940         (class Scan_relocs): Likewise.
8941         * common.h (class Allocate_commons_task): Remove symtab_lock_
8942         field, and corresponding constructor parameter.
8943         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
8944         symtab_lock_.
8945         (Allocate_commons_task::locks): Likewise.
8946
8947 2010-02-11  Ian Lance Taylor  <iant@google.com>
8948
8949         * gold-threads.h (class Once): Define.
8950         (class Initialize_lock): Rewrite as child of Once.
8951         * gold-threads.cc (class Once_initialize): Define.
8952         (once_pointer_control): New static variable.
8953         (once_pointer, once_arg): New static variables.
8954         (c_run_once): New static function.
8955         (Once::Once, Once::run_once, Once::internal_run): New functions.
8956         (class Initialize_lock_once): Remove.
8957         (initialize_lock_control): Remove.
8958         (initialize_lock_pointer): Remove.
8959         (initialize_lock_once): Remove.
8960         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
8961         (Initialize_lock::initialize): Rewrite.
8962         (Initialize_lock::do_run_once): New function.
8963         * archive.cc (Archive::interpret_header): Only clear name if it is
8964         not already empty.
8965         * fileread.cc: Include "gold-threads.h"
8966         (file_counts_lock): New static variable.
8967         (file_counts_initialize_lock): Likewise.
8968         (File_read::release): Only increment counts when using --stats.
8969         Use a lock around the increment.
8970         * parameters.cc (class Set_parameters_target_once): Define.
8971         (set_parameters_target_once): New static variable.
8972         (Parameters::Parameters): Move here from parameters.h.
8973         (Parameters::set_target): Rewrite.
8974         (Parameters::set_target_once): New function.
8975         (Parameters::clear_target): Move here and rewrite.
8976         * parameters.h (class Parameters): Update declarations.  Add
8977         set_parameters_target_once_ field.
8978         (Parameters::Parameters): Move to parameters.cc.
8979         (Parameters::clear_target): Likewise.
8980         * readsyms.cc (Read_symbols::do_group): Create a Start_group
8981         task.
8982         (Start_group::~Start_group): New function.
8983         (Start_group::is_runnable): New function.
8984         (Start_group::locks, Start_group::run): New functions.
8985         (Finish_group::run): Change saw_undefined to size_t.
8986         * readsyms.h (class Start_group): Define.
8987         (class Finish_group): Change saw_undefined_ field to size_t.
8988         (Finish_group::Finish_group): Remove saw_undefined and
8989         this_blocker parameters.  Change all callers.
8990         (Finish_group::set_saw_undefined): New function.
8991         (Finish_group::set_blocker): New function.
8992         * symtab.h (class Symbol_table): Change saw_undefined to return
8993         size_t.  Change saw_undefined_ field to size_t.
8994         * target-select.cc (Set_target_once::do_run_once): New function.
8995         (Target_selector::Target_selector): Initialize set_target_once_
8996         field.  Don't initialize lock_ and initialize_lock_ fields.
8997         (Target_selector::instantiate_target): Rewrite.
8998         (Target_selector::set_target): New function.
8999         * target-select.h (class Set_target_once): Define.
9000         (class Target_selector): Update declarations.  Make
9001         Set_target_once a friend.  Remove lock_ and initialize_lock_
9002         fields.  Add set_target_once_ field.
9003
9004 2010-02-10  Ian Lance Taylor  <iant@google.com>
9005
9006         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
9007         queueing any tasks.
9008         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
9009         (queue_middle_tasks): Add all blockers before queueing any tasks.
9010         (queue_final_tasks): Likewise.
9011         * token.h (Task_token::add_blockers): New function.
9012         * object.h (Input_objects::number_of_relobjs): New function.
9013
9014 2010-02-10  Ian Lance Taylor  <iant@google.com>
9015
9016         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
9017         shared, not if not position independent.
9018         * x86_64.cc (Relocate::relocate_tls): Likewise.
9019         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
9020         (tls_pie_pic_test): New target.
9021         * testsuite/Makefile.in: Rebuild.
9022
9023         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
9024         (tls_test_main_pie.o, tls_test_pie.o): New targets.
9025         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
9026         * testsuite/Makefile.in: Rebuild.
9027
9028 2010-02-09  David S. Miller  <davem@davemloft.net>
9029
9030         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
9031         R_SPARC_RELATIVE using ->add_local_relative().
9032         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
9033
9034         * output.h (Output_data_dynamic::add_section_size): New method
9035         that takes two Output_data objects.
9036         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
9037         entry param.  Handle it in initializers.
9038         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
9039         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
9040         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
9041         arg.
9042         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
9043         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
9044         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
9045         for dynrel_includes_plt.
9046         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9047         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9048         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
9049         before .rela.plt
9050         (Target_sparc::do_finalize_sections): Update to pass true for
9051         dynrel_includes_plt.
9052         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
9053         output before .rela.plt
9054         (Target_powerpc::do_finalize_sections): Update to pass true for
9055         dynrel_includes_plt when 32-bit.
9056
9057 2010-02-08  Doug Kwan  <dougkwan@google.com>
9058
9059         * arm.cc (Arm_relobj::simple_input_section_output_address): New
9060         method.
9061         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
9062         Arm_relobj::scan_section_for_cortex_a8_stubs,
9063         Arm_relobj::do_relocation_section): Instead of calling
9064         Output_section::output_address, use faster
9065         Arm_relobj::simple_input_section_output_address.
9066
9067 2010-02-08  David S. Miller  <davem@davemloft.net>
9068
9069         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
9070         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
9071         relocation helper function.
9072
9073         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
9074         just like R_SPARC_GOT{10,13,22}.
9075         (Target_sparc::Scan::local): Likewise.
9076         (Target_sparc::Relocate:relocate): Likewise.
9077
9078 2010-02-06  Ian Lance Taylor  <iant@google.com>
9079
9080         * configure.ac: Rewrite targetobjs duplicate removal code to use
9081         only shell constructs.
9082         * configure: Rebuild.
9083
9084 2010-02-05  Doug Kwan  <dougkwan@google.com>
9085
9086         PR 11247
9087         * arm.cc (Arm_relobj::section_is_scannable): New method.
9088         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
9089         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
9090
9091 2010-02-04  Doug Kwan  <dougkwan@google.com>
9092
9093         PR 11247
9094         * arm-reloc-property.cc (cstdio): Include.
9095         * configure.ac (targetobjs): Remove duplicates.
9096         * configure: Regenerate.
9097         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
9098         big and little endian version for a given address size.
9099
9100 2010-02-03  Doug Kwan  <dougkwan@google.com>
9101
9102         * arm-reloc-property.cc
9103         (Arm_reloc_property_table::reloc_name_in_error_message): New method
9104         definition.
9105         * arm-reloc-property.h
9106         (Arm_reloc_property_table::get_implemented_static_reloc_property):
9107         New method definition.
9108         (Arm_reloc_property_table::reloc_name_in_error_message): New method
9109         declaration.
9110         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
9111         overflow to N.
9112         (GOT_PREL): Change implemented to Y.
9113         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
9114         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
9115         (Arm_relocate_functions::movw_abs_nc): Remove method.
9116         (Arm_relocate_functions::movt_abs): Ditto.
9117         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
9118         (Arm_relocate_functions::thm_movt_abs): Ditto.
9119         (Arm_relocate_functions::movw_rel_nc): Ditto.
9120         (Arm_relocate_functions::movw_rel): Ditto.
9121         (Arm_relocate_functions::movt_rel): Ditto.
9122         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
9123         (Arm_relocate_functions:thm_movw_rel): Ditto.
9124         (Arm_relocate_functions:thm_movt_rel): Ditto.
9125         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
9126         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
9127         New method definitions.
9128         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
9129         (Arm_relocation_functions::arm_grp_ldr): Ditto.
9130         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
9131         (Arm_relocation_functions::arm_grp_ldc): Ditto.
9132         (Target_arm::Relocate::relocate): Check for non-static or
9133         unimplemented relocation code and exit early.  Change calls to
9134         Target_arm::reloc_uses_thumb_bit and
9135         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
9136         instead.  Refactor code to handle similar relocations to increase
9137         code sharing.  Remove check for unsupported relocation code in switch
9138         statement.
9139         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
9140         relocation property table to find out size.  Change error message to
9141         print out the name of a relocation code instead of the numeric value.
9142         (Target_arm::scan_reloc_for_stub): Use relocation property table
9143         instead of calling Target_arm::reloc_uses_thumb_bit().
9144
9145 2010-02-02  Doug Kwan  <dougkwan@google.com>
9146
9147         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
9148         types of relaxed input section.
9149
9150 2010-02-02  Doug Kwan  <dougkwan@google.com>
9151
9152         * Makefile.am (HFILES): Add arm-reloc-property.h.
9153         (DEFFILES): New.
9154         (TARGETSOURCES): Add arm-reloc-property.cc
9155         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
9156         (libgold_a_SOURCES): $(DEFFILES)
9157         * Makefile.in: Regenerate.
9158         * arm-reloc-property.cc: New file.
9159         * arm-reloc-property.h: New file.
9160         * arm-reloc.def: New file.
9161         * arm.cc: Update comments.
9162         (arm-reloc-property.h): New included header.
9163         (arm_reloc_property_table): New global variable.
9164         (Target_arm::do_select_as_default_target): New method definition.
9165         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
9166         arm-reloc-property to targ_extra_obj.
9167         * parameters.cc (set_parameters_target): Call
9168         Target::select_as_default_target().
9169         * target.h (Target::select_as_default_target): New method definition.
9170         (Target::do_select_as_default_target): Same.
9171
9172 2010-02-01  Doug Kwan  <dougkwan@google.com>
9173
9174         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
9175         first_output_text_section_.
9176         (Arm_exidx_fixup::first_output_text_section): New method definition.
9177         (Arm_exidx_fixup::first_output_text_section_): New data member.
9178         (Arm_exidx_fixup::process_exidx_section): Record the first text
9179         output section seen.
9180         (Arm_output_section::fix_exidx_coverage): Set correct linked section
9181         and entsize in output section header.
9182
9183 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9184
9185         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
9186         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
9187         (Arm_relocate_functions::thm_alu11): New Method.
9188         (Arm_relocate_functions::thm_pc8): New Method.
9189         (Arm_relocate_functions::thm_pc12): New Method.
9190         (Target_arm::Scan::local): Handle the relocations.
9191         (Target_arm::Scan::global): Likewise.
9192         (Target_arm::Relocate::relocate): Likewise.
9193         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9194
9195 2010-01-29  Doug Kwan  <dougkwan@google.com>
9196
9197         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
9198         of relocation types as ld.
9199
9200 2010-01-29  Doug Kwan  <dougkwan@google.com>
9201
9202         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
9203         to public.
9204         (Arm_relocate_functions::thumb_branch_common): Ditto.
9205         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
9206         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
9207         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
9208         Arm_relocate_functions::jump24): Remove.
9209         (Target_arm::Relocate::relocate): Adjust code to call
9210         Arm_relocation_functions::arm_branch_common and
9211         Arm_relocation_functions::thumb_branch_common instead of their removed
9212         wrappers.  Merge switch-cases together to reduce source code size.
9213
9214 2010-01-29  Doug Kwan  <dougkwan@google.com>
9215
9216         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
9217         output_local_symbol_count_needs_update_.
9218         (Arm_relobj::output_local_symbol_count_needs_update,
9219          Arm_relobj::set_output_local_symbol_count_needs_update,
9220          Arm_relobj::update_output_local_symbol_count): New methods.
9221         (Arm_relobj::output_local_symbol_count_needs_update_): New data
9222         member.
9223         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
9224         of pointed function as in a R_ARM_PREL31 relocation.
9225         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
9226         for output local symbol count updating.
9227         (Target_arm::do_relax): Update output local symbol counts in objects
9228         if necessary.
9229         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
9230
9231 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9232
9233         * arm.cc: Added support for the ARM relocations:
9234         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
9235         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
9236         (Arm_relocate_functions::movw_rel_nc): Renamed (was
9237         movw_prel_nc).
9238         (Arm_relocate_functions::movw_rel): New method.
9239         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
9240         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
9241         thm_movw_prel_nc).
9242         (Arm_relocate_functions::thm_movw_rel): New method.
9243         (Arm_relocate_functions::thm_movt_rel): Renamed (was
9244         thm_movt_prel).
9245         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
9246         relocations.
9247         (Target_arm::Scan::global): Likewise.
9248         (Target_arm::Relocate::relocate): Likewise.
9249         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9250         Likewise.
9251
9252 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9253
9254         * arm.cc: Added support for ARM group relocations.
9255         (Target_arm::reloc_needs_sym_origin): New method.
9256         (Arm_relocate_functions::calc_grp_kn): New method.
9257         (Arm_relocate_functions::calc_grp_residual): New method.
9258         (Arm_relocate_functions::calc_grp_gn): New method.
9259         (Arm_relocate_functions::arm_grp_alu): New Method.
9260         (Arm_relocate_functions::arm_grp_ldr): New Method.
9261         (Arm_relocate_functions::arm_grp_ldrs): New Method.
9262         (Arm_relocate_functions::arm_grp_ldc): New Method.
9263         (Target_arm::Scan::local): Handle the ARM group relocations.
9264         (Target_arm::Scan::global): Likewise.
9265         (Target_arm::Relocate::relocate): Likewise.
9266         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9267         Likewise.
9268
9269 2010-01-26  Doug Kwan  <dougkwan@google.com>
9270
9271         * arm.cc (set): Include.
9272         (class Arm_exidx_fixup): Change type of last_input_section_ to const
9273         pointer type.
9274         (Arm_output_section::Text_section_list): New type.
9275         (Arm_output_section::append_text_sections_to_list): New method.
9276         (Arm_output_section::fix_exidx_coverage): Ditto.
9277         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
9278         (Arm_relobj::convert_input_section_to_relaxed_section): Use
9279         Relobj::set_section_offset() instead of
9280         Sized_relobj::invalidate_section_offset().
9281         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
9282         parameter for section headers. Ignore relocation sections for
9283         unallocated sections and EXIDX sections.
9284         (Target_arm::fix_exidx_coverage): New method.
9285         (Target_arm::output_section_address_less_than): New type.
9286         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
9287         linked text section instead of the EXIDX section.
9288         (Arm_output_section::create_stub_group): Add an assertion to check
9289         that this is not an EXIDX output section.
9290         (Arm_output_section::append_text_sections_to_list): New method.
9291         (Arm_output_section::fix_exidx_coverage): Ditto.
9292         (Arm_relobj::scan_sections_for_stubs): Adjust call to
9293         Arm_relobj::section_needs_reloc_stub_scanning.
9294         (Target_arm::do_relax): Fix EXIDX output section coverage in the
9295         first pass.
9296         (Target_arm::fix_exidx_coverage): New method.
9297         * object.h (Relobj::set_output_section): New method.
9298         (Sized_relobj::invalidate_section_offset): Remove method.
9299         (Sized_relobj::do_invalidate_section_offset): Remove method.
9300         (Sized_relobj::do_set_section_offset): Handle offset value -1.
9301
9302 2010-01-25  Doug Kwan  <dougkwan@google.com>
9303
9304         * arm.cc (Arm_exidx_merged_section::do_output_offset):
9305         Fix warning due to signed and unsigned comparison on a 32-bit host.
9306
9307 2010-01-22  Doug Kwan  <dougkwan@google.com>
9308
9309         * arm.cc (Target_arm::do_relax): Record an output section for section
9310         offset adjustment it contains any stub table that has changed.
9311         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
9312         offsets in an output section if necessary.
9313         * output.cc (Output_section::Output_section): Initialize
9314         section_offsets_need_adjustments_.
9315         (Output_section::add_input_section_for_script): Renamed to
9316         Output_section::add_simple_input_section.
9317         (Output_section::save_states): Add a comment.
9318         (Output_section::discard_states): New method defintion.
9319         (Output_section::adjust_section_offsets): Same.
9320         * output.h (Output_section::add_input_section_for_script): Renamed to
9321         Output_section::add_simple_input_section.
9322         (Output_section::discard_states): New method declaration.
9323         (Output_section::adjust_section_offsets): Same.
9324         (Output_section::section_offsets_need_adjustment,
9325         Output_section::set_section_offsets_need_adjustment): New method
9326         definitions.
9327         (Output_section::section_offsets_need_adjustment_): New data member.
9328         * script-sections.cc
9329         (Output_section_element_input::set_section_address): Adjust code for
9330         renaming of Output_section::add_input_section_for_script.
9331         (Orphan_output_section::set_section_address): Same.
9332
9333 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9334
9335         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
9336         Fix_v4bx enum values .
9337         * gold/options.h (General_options): New option definitions.
9338         (General_options::fix_v4bx): New method.
9339         (General_options::Fix_v4bx): New enum.
9340         * gold/options.cc (General_options::parse_fix_v4bx): New method.
9341         (General_options::parse_fix_v4bx_interworking): New method.
9342
9343 2010-01-22  Doug Kwan  <dougkwan@google.com>
9344
9345         * arm.cc (Arm_exidx_fixup): New class.
9346
9347 2010-01-21  Doug Kwan  <dougkwan@google.com>
9348
9349         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
9350         classes.
9351         (Arm_exidx_section_offset_map): New type.
9352
9353 2010-01-21  Doug Kwan  <dougkwan@google.com>
9354
9355         * arm.cc (Arm_exidx_input_section): New class.
9356         (Arm_relobj::exidx_input_section_by_link,
9357         Arm_relobj::exidx_input_section_by_shndx,
9358         Arm_relobj::make_exidx_input_section): New methods.
9359         (read_arm_attributes_section): Remove.
9360         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
9361         information about them.
9362         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
9363         to here.
9364
9365 2010-01-20  Doug Kwan  <dougkwan@google.com>
9366
9367         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
9368         Input_section_specifier to Section_id.
9369         (Target_arm::new_arm_input_section: Adjust code for change of key
9370         type.
9371         (Target_arm::find_arm_input_section): Ditto.
9372         * gc.h (object.h): Include for Section_id nand Section_id_hash.
9373         (Section_id): Remove.
9374         (Garbage_collection::Section_id_hash): Remove.
9375         * icf.h (object.h): Include for Section_id nand Section_id_hash.
9376         (Section_id): Remove.
9377         (Icf::Section_id_hash): Remove.
9378         * object.h (Section_id, Const_section_id, Section_id_hash,
9379         Const_section_id_hash): New type definitions.
9380         * output.cc (Output_section::add_relaxed_input_section): Change to
9381         use Const_section_id instead of Input_section_specifier as key type.
9382         (Output_section::add_merge_input_section): Ditto.
9383         (Output_section::build_relaxation_map): Change to use Section_id
9384         instead of Input_section_specifier as key type.
9385         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9386         Ditto.
9387         (Output_section::convert_input_sections_to_relaxed_sections): Change
9388         to use Const_section_id instead of Input_section_specifier as key type.
9389         (Output_section::find_merge_section): Ditto.
9390         (Output_section::find_relaxed_input_section): Ditto.
9391         * output.h (Input_section_specifier): Remove class.
9392         (Output_section::Output_section_data_by_input_section_map): Change
9393         key type to Const_section_id.
9394         (Output_section::Output_relaxed_input_section_by_input_section_map):
9395         Ditto.
9396         (Output_section::Relaxation_map): Change key type to Section_id.
9397
9398 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9399
9400         * gold/arm.cc: Added support for R_ARM_V4BX relocation
9401         (class Arm_v4bx_stub): New class.
9402         (DEF_STUBS): Updated definition to support v4_veneer_bx.
9403         (Stub_factory::make_arm_v4bx_stub): New method.
9404         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
9405         (Stub_table::empty): Handle v4bx stubs.
9406         (Stub_table::add_arm_v4bx_stub): New method.
9407         (Stub_table::find_arm_v4bx_stub): New method.
9408         (Arm_relocate_functions::v4bx): New method.
9409         (Target_arm::fix_v4bx): New method.
9410         (Target_arm::Target_arm): Handle R_ARM_V4BX.
9411         (Stub_table::relocate_stubs): Likewise.
9412         (Stub_table::do_write): Likewise.
9413         (Stub_table::update_data_size_and_addralign): Likewise.
9414         (Stub_table::finalize_stubs):  Likewise.
9415         (Target_arm::Scan::local): Likewise.
9416         (Target_arm::Scan::global): Likewise.
9417         (Target_arm::do_finalize_sections): Likewise.
9418         (Target_arm::Relocate::relocate): Likewise.
9419         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9420         Likewise.
9421         (Target_arm::scan_reloc_for_stub): Likewise.
9422         (Target_arm::scan_reloc_section_for_stubs): Likewise.
9423
9424 2010-01-19  Ian Lance Taylor  <iant@google.com>
9425
9426         * output.cc (Output_section_headers::do_sized_write): Write large
9427         segment count to sh_info field.
9428         (Output_file_header::do_sized_write): For large segment count,
9429         write PN_XNUM to e_phnum field.
9430
9431 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9432
9433         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
9434         (Arm_relocate_functions::thm_jump8): New function.
9435         (Arm_relocate_functions::thm_jump11): New function.
9436         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
9437         R_ARM_THM_JUMP11.
9438         (Target_arm::Scan::global): Likewise.
9439         (Target_arm::Relocate::relocate): Likewise.
9440         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9441         Likewise.
9442
9443 2010-01-14  Doug Kwan  <dougkwan@google.com>
9444
9445         * arm.cc (map, utility): Include headers.
9446         (Target_arm::apply_cortex_a8_workaround): New method.
9447         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
9448         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
9449         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
9450         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
9451         the --[no-]fix-cortex-a8 command line options.
9452         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
9453         (Target_arm::relocate_stub): Use addend in instruction template.
9454         * options.h (DEFINE_bool): Set the user-set flag.
9455         (General_options): Add --[no-]-fix-cortex options.
9456         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
9457         : Update fast look-up map after conversion.
9458
9459 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
9460
9461         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
9462         in the first pass of do_layout.
9463
9464 2010-01-13  Doug Kwan  <dougkwan@google.com>
9465
9466         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9467         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
9468         apparent compiler problem of not folding static constant integral
9469         data members of elfcpp::Elf_sizes<32>.
9470
9471 2010-01-13  Doug Kwan  <dougkwan@google.com>
9472
9473         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9474         Arm_relobj::section_needs_cortex_a8_stub_scanning,
9475         Arm_relobj::scan_section_for_cortex_a8_erratum,
9476         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
9477         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
9478         sections to scan for relocation stubs into a new method
9479         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
9480         relocation and Cortex-A8 stub scanning.
9481         (Target_arm::do_relax): Force stubs to be after stubbed sections
9482         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
9483         the beginning of a new relaxation pass.  Update a comment.
9484         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
9485
9486 2010-01-12  Ian Lance Taylor  <iant@google.com>
9487
9488         * target-reloc.h (visibility_error): New inline function.
9489         (relocate_section): Call visibility_error.
9490         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
9491         (MOSTLYCLEANFILES): Likewise.
9492         (protected_4_pic.o, protected_3.err): New targets.
9493         * testsuite/protected_4.cc: New file.
9494
9495 2010-01-12  Doug Kwan  <dougkwan@google.com>
9496
9497         * arm.cc (Cortex_a8_reloc): New class.
9498         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
9499         and cortex_a8_relocs_info_.
9500         (Target_arm::fix_cortex_a8): New method definition.
9501         (Target_arm::Cortex_a8_relocs_info): New type.
9502         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
9503         New data member declarations.
9504         (Target_arm::scan_reloc_for_stub): Record information about
9505         relocations for THUMB branches that might be exempted from the
9506         Cortex-A8 workaround.
9507         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
9508         at the beginning of a relaxation pass.
9509
9510 2010-01-12  Doug Kwan  <dougkwan@google.com>
9511
9512         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
9513         (Arm_relobj::Mapping_symbol_position,
9514          Arm_reloj::Mapping_symbol_position_less,
9515          Arm_relobj::Mapping_symbols_info): New types.
9516         (Target_arm::is_mapping_symbol_name): New method definition.
9517         (Arm_relobj::do_count_local_symbols): Save information about mapping
9518         symbols.
9519
9520 2010-01-11  Doug Kwan  <dougkwan@google.com>
9521
9522         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
9523         Arm_relocate_functions::thumb32_branch_upper,
9524         Arm_relocate_functions::thumb32_branch_lower,
9525         Arm_relocate_functions::thumb32_cond_branch_offset,
9526         Arm_relocate_functions::thumb32_cond_branch_upper,
9527         Arm_relocate_functions::thumb32_cond_branch_lower,
9528         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
9529         branch offset encoding.
9530         (Arm_relocate_functions::thumb_branch_common): Use new branch
9531         offset encoding methods to avoid code duplication.
9532         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
9533         (Stub_addend_reader::operator()): Use new branch encoding method
9534         to avoid code duplication.
9535
9536 2010-01-11  Doug Kwan  <dougkwan@google.com>
9537
9538         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
9539         (Target_arm::do_finalize_sections): Define special EXIDX section
9540         symbols only if referenced.
9541         * gc.h (Garbage_collection::add_reference): New method.
9542         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
9543         code duplication.
9544
9545 2010-01-11  Ian Lance Taylor  <iant@google.com>
9546
9547         * script.cc (Version_script_info::build_expression_list_lookup):
9548         Change complaing about duplicate wildcard match from error to
9549         warning.
9550
9551         * script.cc (class Lazy_demangler): Recreate--revert part of patch
9552         of 2009-12-30.
9553         (Version_script_info::Version_script_info): Initialize globs_,
9554         default_version_, default_is_global_, and exact_.  Don't
9555         initialize globals_ or locals_.
9556         (Version_script_info::build_lookup_tables): Build local symbols
9557         first.
9558         (Version_script_info::unquote): New function.
9559         (Version_script_info::add_exact_match): New function.
9560         (Version_script_info::build_expression_list_lookup): Remove lookup
9561         parameter.  Add is_global parameter.  Change all callers.  Handle
9562         wildcard pattern specially.  Unquote pattern.  Call
9563         add_exact_match.
9564         (Version_script_info::get_name_to_match): New function.
9565         (Version_script_info::get_symbol_version): New function.
9566         (Version_script_info::get_symbol_version_helper): Remove.
9567         (Version_script_info::check_unmatched_names): Call unquote.
9568         * script.h (class Version_script_info): Change get_symbol_version
9569         to be non-inline and add is_global parameter; change all callers.
9570         Rewrite symbol_is_local.  Update declarations.  Define struct
9571         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
9572         Remove globals_ and locals_ members.  Add exact_, globs_,
9573         default_version_, is_global_.
9574         (Version_script_info::Glob): Remove pattern, add expression and
9575         is_global.  Update constructor.  Change all callers.
9576         * dynobj.cc (Versions::finalize): Mark the version symbol as the
9577         default version.
9578         (Versions::symbol_section_contents): If a symbol is undefined, or
9579         defined in a dynamic object, set the version index to
9580         VER_NDX_LOCAL.
9581         * symtab.cc (Symbol_table::add_from_relobj): Don't call
9582         symbol_is_local.
9583         (Symbol_table::add_from_pluginobj): Likewise.
9584         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
9585
9586 2010-01-11  Doug Kwan  <dougkwan@google.com>
9587
9588         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
9589         (incremental_dump_LDADD): Add linking option for libintl.
9590         * Makefile.in: Regenerate.
9591
9592 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
9593
9594         PR gold/11144
9595         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
9596         instead of -Ds.
9597         * testsuite/Makefile.in: Regenerated.
9598
9599 2010-01-10  Doug Kwan  <dougkwan@google.com>
9600
9601         * options.h (DEFINE_var): Use parentheses around argument varname__
9602         in macro body to avoid any unintended subsequent substitutions.
9603
9604 2010-01-10  Ian Lance Taylor  <iant@google.com>
9605
9606         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
9607         candidates before doing symbol resolution.
9608
9609         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
9610         ODR candidates if only one is weak.
9611
9612 2010-01-08  Ian Lance Taylor  <iant@google.com>
9613
9614         * script.cc (Version_script_info::build_expression_list_lookup):
9615         Don't warn about ambiguous version, just record the ambiguity.
9616         (Version_script_info::get_symbol_version_helper): Give error if
9617         version is ambiguous.
9618
9619 2010-01-08  Doug Kwan  <dougkwan@google.com>
9620
9621         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
9622         prev_data_size_ and prev_addralign_.  Remove initializer for
9623         deleted data member has_been_changed_.
9624         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
9625         to determine if the table is empty.
9626         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
9627         Remove.
9628         (Stub_table::add_reloc_stub): Define method in class definition
9629         instead of just declaring it there.
9630         (Stub_table::add_cortex_a8_stub): New method definition.
9631         (Stub_table::update_data_size_and_addralign): Ditto.
9632         (Stub_table::finalize_stubs): Ditto.
9633         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
9634         (Stub_table::do_addralign_): Return address alignment in the
9635         (Stub_table::do_reset_address_and_file_offset): Define method in
9636         class definition instead of declaring it there.  Set current data
9637         size to be the data size of the previous pass.
9638         (Stub_table::set_final_data_size): Use current data size as the
9639         final data size.
9640         (Stub_table::relocate_stub): Change parameter type of stub from
9641         Reloc_stub pointer to Stub pointer.
9642         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
9643         (Stub_table::Cortex_a8_stub_list): New typedef.
9644         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
9645          Stub_table::prev_addralign_): New data member.
9646         (Arm_relobj::Arm_relobj): Initialize data member
9647         section_has_cortex_a8_workaround_.
9648         (Arm_relobj::section_has_cortex_a8_workaround,
9649          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
9650          definitions.
9651         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
9652         declarations.
9653         (Target_arm::relocate_stub): Change parameter type of stub from
9654         Reloc_stub pointer to Stub pointer.
9655         (Insn_template::size, Insn_template::alignment): Handle
9656         THUMB16_SPECIAL_TYPE.
9657         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
9658          Stub_table::update_data_size_and_addralign,
9659          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
9660         definitions.
9661         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
9662         (Stub_table::do_write): Ditto.
9663         (Target_arm::do_relax): Adjust code for changes in Stub_table.
9664
9665 2010-01-08  Ian Lance Taylor  <iant@google.com>
9666
9667         PR 11108
9668         * symtab.h (class Symbol): Remove fields is_target_special_ and
9669         has_plt_offset_.  Add field is_defined_in_discarded_section_.
9670         (Symbol::is_defined_in_discarded_section): New function.
9671         (Symbol::set_is_defined_in_discarded_section): New function.
9672         (Symbol::has_plt_offset): Rewrite.
9673         (Symbol::set_plt_offset): Verify that new offset is not -1U.
9674         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
9675         Don't initialize is_target_special_ or has_plt_offset_.
9676         Initialize is_defined_in_discarded_section_.
9677         (Symbol_table::add_from_relobj): If appropriate, set
9678         is_defined_in_discarded_section.
9679         * resolve.cc (Symbol::override_base_with_special): Don't test
9680         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
9681         * target-reloc.h (relocate_section): Do special handling for
9682         symbols defined in discarded sections for global symbols as well
9683         as local symbols.
9684
9685 2010-01-08  Ian Lance Taylor  <iant@google.com>
9686
9687         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
9688         the SHT_SYMTAB case.
9689
9690 2010-01-08  Ian Lance Taylor  <iant@google.com>
9691
9692         * object.cc (Sized_relobj::do_layout): Don't get confused if
9693         layout_eh_frame returns NULL.
9694
9695 2010-01-08  Ian Lance Taylor  <iant@google.com>
9696
9697         PR 11084
9698         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
9699         dynamic symbol table, use the normal symbol table.
9700         (Sized_dynobj::do_read_symbols): Remove assertion about type of
9701         symbol table.
9702
9703 2010-01-08  Ian Lance Taylor  <iant@google.com>
9704
9705         PR 11072
9706         * layout.cc (Layout::include_section): Remove .gnu_debuglink
9707         sections.
9708
9709 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
9710
9711         * version.cc (print_version): Change to "Copyright 2010".
9712
9713 2010-01-08  Ian Lance Taylor  <iant@google.com>
9714
9715         PR 10287
9716         PR 11063
9717         * i386.cc (class Target_i386): Change return type of plt_section
9718         to be non-const.
9719         (class Output_data_plt_i386): Add tls_desc_rel_ field.
9720         (Output_data_plt_i386::Output_data_plt_i386): Initialize
9721         tls_desc_rel_ field.
9722         (Output_data_plt_i386::rel_tls_desc): New function.
9723         (Target_i386::rel_tls_desc_section): New function.
9724         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
9725         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
9726         R_386_TLS_DESC reloc in rel_tls_desc_section.
9727         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
9728         Define struct Tlsdesc_info.
9729         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
9730         (Target_x86_64::do_reloc_symbol_index): New function.
9731         (Target_x86_64::add_tlsdesc_info): New function.
9732         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
9733         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
9734         tlsdesc_rel_ field.
9735         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
9736         all callers.
9737         (Output_data_plt_x86_64::rela_tlsdesc): New function.
9738         (Target_x86_64::rela_tlsdesc_section): New function.
9739         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
9740         handling.
9741         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
9742         (Target_x86_64::do_reloc_addend): New function.
9743         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
9744         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
9745         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
9746         (Output_reloc::type): New function.
9747         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
9748         (Output_reloc::is_target_specific): New function.
9749         (Output_reloc::target_arg): New function.
9750         (class Output_reloc) [SHT_RELA]: Add four new constructors for
9751         absolute relocs and target specific relocs.
9752         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
9753         add_target_specific.
9754         (class Output_data_reloc) [SHT_RELA]: Likewise.
9755         * output.cc (Output_reloc::Output_reloc): Add four new versions
9756         for absolute relocs and target specific relocs.
9757         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
9758         (Output_reloc::get_symbol_index): Likewise.
9759         (Output_reloc::local_section_offset): Check that local_sym_index_
9760         is not TARGET_CODE or 0.
9761         (Output_reloc::symbol_value): Likewise.
9762         (Output_reloc::write) [SHT_RELA]: Call target for target specific
9763         reloc.
9764         * target.h (class Target): Add reloc_symbol_index and reloc_addend
9765         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
9766         functions.
9767         * layout.cc (add_target_dynamic_tags): Use output section for
9768         DT_PLTRELSZ and DT_JMPREL.
9769
9770 2010-01-07  Ian Lance Taylor  <iant@google.com>
9771
9772         PR 11061
9773         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
9774         function.
9775         (class Output_data_reloc_generic): Define.
9776         (class Output_data_reloc_base): Change base class to
9777         Output_data_reloc_generic.  Change add() method to call
9778         bump_relative_reloc_count for a relative reloc.  Remove
9779         sort_relocs_ field.
9780         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
9781         to sort_relocs().
9782         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
9783         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
9784         appropriate.
9785         * layout.h (class Layout): Update declaration.
9786
9787 2010-01-07  Ian Lance Taylor  <iant@google.com>
9788
9789         * output.h (class Output_data): Add const version of
9790         output_section and do_output_section.
9791         (class Output_section_data): Add const version of
9792         do_output_section.
9793         (class Output_section): Likewise.
9794         * layout.cc (Layout::add_target_dynamic_tags): New function.
9795         * layout.h (class Layout): Update declarations.
9796         * arm.cc (Target_arm::do_finalize_sections): Use
9797         add_target_dynamic_tags.
9798         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9799         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9800         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9801         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9802
9803 2010-01-07  Ian Lance Taylor  <iant@google.com>
9804
9805         PR 11042
9806         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
9807         object as needed.
9808
9809 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
9810             Ian Lance Taylor  <iant@google.com>
9811
9812         PR 11019
9813         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
9814         Xindex::read_symtab_xindex.
9815
9816 2010-01-07  Doug Kwan  <dougkwan@google.com>
9817
9818         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
9819         (Insn_template::thumb16_bcond_insn): New method declaration.
9820         (Insn_template): Fix spelling.
9821         (Stub::thumb16_special): New method declaration.
9822         (Stub::do_write): Define virtual method which was previously pure
9823         virtual.
9824         (Stub::do_thumb16_special): New method declaration.
9825         (Stub::do_fixed_endian_write): New template member.
9826         (Reloc_stub::do_write): Remove.
9827         (Reloc_stub::do_fixed_endian_write): Remove.
9828         (Cortex_a8_stub): New class definition.
9829         (Stub_factory::make_cortex_a8_stub): New method definition.
9830         (Stub_factory::Stub_factory): Add missing static storage class
9831         qualifier for elf32_arm_stub_a8_veneer_blx.
9832
9833 2010-01-07  Ian Lance Taylor  <iant@google.com>
9834
9835         PR 10980
9836         * options.h (class General_options): Add --warn-unresolved-symbols
9837         and --error-unresolved-symbols.
9838         * errors.cc (Errors::undefined_symbol): Implement
9839         --warn-unresolved-symbols.
9840
9841         * options.h (class General_options): Add -z text and -z textoff.
9842         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
9843
9844 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
9845
9846         * gc.h (Garbage_collection::Cident_section_map): New typedef.
9847         (Garbage_collection::cident_sections): New function.
9848         (Garbage_collection::add_cident_section): New function.
9849         (Garbage_collection::cident_sections_): New member.
9850         (gc_process_relocs): Add references to sections whose names are C
9851         identifiers.
9852         * gold.h (cident_section_start_prefix): New constant.
9853         (cident_section_stop_prefix): New constant.
9854         (is_cident): New function.
9855         * layout.cc (Layout::define_section_symbols): Replace string constants
9856         with the newly defined constants.
9857         * object.cc (Sized_relobj::do_layout): Track sections whose names are
9858         C identifiers.
9859         * testsuite/Makefile.am: Add gc_orphan_section_test.
9860         * testsuite/Makefile.in: Regenerate.
9861         * testsuite/gc_orphan_section_test.cc: New file.
9862         * testsuite/gc_orphan_section_test.sh: New file.
9863
9864 2010-01-06  Ian Lance Taylor  <iant@google.com>
9865
9866         PR 10980
9867         * options.h (class General_options): Add --warn-shared-textrel.
9868         * layout.cc (Layout::finish_dynamic_section): Implement
9869         --warn-shared-textrel.
9870
9871         PR 10980
9872         * options.h (class General_options): Add --warn-multiple-gp.
9873
9874 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9875
9876         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
9877         $(THREADSLIB) and $(LIBDL).
9878         * Makefile.in: Rebuild.
9879
9880 2010-01-06  Ian Lance Taylor  <iant@google.com>
9881
9882         PR 10980
9883         * options.cc (General_options::parse_section_start): New function.
9884         (General_options::section_start): New function.
9885         (General_options::General_options): Initialize all members.
9886         * options.h: Include <map>
9887         (class General_options): Add --section-start.  Add section_starts_
9888         member.
9889         * layout.cc (Layout::attach_allocated_section_to_segment): If
9890         --section-start was used, set the address of the segment.  Remove
9891         local sort_sections.
9892         (Layout::relaxation_loop_body): If the address of the load segment
9893         has been set by --section-start, don't use it.
9894         * output.h (Output_segment::update_flags_for_output_section): New
9895         function.
9896         * output.cc (Output_segment::add_output_section): Call
9897         update_flags_for_output_section.
9898
9899 2010-01-05  Ian Lance Taylor  <iant@google.com>
9900
9901         PR 10980
9902         * options.h (class General_options): Add --undefined-version.
9903         * script.cc (struct Version_expression): Add was_matched_by_symbol
9904         field.
9905         (Version_script_info::matched_symbol): New function.
9906         (Version_script_info::get_symbol_version_helper): Call
9907         matched_symbol.
9908         (Version_script_info::check_unmatched_names): New function.
9909         * script.h (class Version_script_info): Update declarations.
9910         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
9911
9912         * options.h (class General_options): Use DEFINE_bool_alias for
9913         allow_multiple_definition.
9914         * resolve.cc (Symbol_table::should_override): Don't test
9915         allow_multiple_definition.
9916
9917         PR 10980
9918         * options.h (class General_options): Add --cref.
9919         * main.cc (main): Print cref table if --cref.  Don't close mapfile
9920         until after printing cref table.
9921         * cref.cc: Include "symtab.h".
9922         (class Cref_inputs): Define Cref_table_compare and Cref_table.
9923         (Cref_table_compare::operator()): New function.
9924         (Cref_inputs::gather_cref): New function.
9925         (filecol): New static const.
9926         (Cref_inputs::print_cref): New function.
9927         (Cref::print_cref): New function.
9928         * cref.h: Include <cstdio>.
9929         (class Cref): Update declarations.
9930         * mapfile.h (Mapfile::file): New function.
9931         * object.h (class Object): Define Symbols.  Declare virtual
9932         do_get_global_symbols.
9933         (Object::get_global_symbols): New function.
9934         * object.cc (Input_objects::add_object): Pass object to cref_ if
9935         --cref.
9936         (Input_objects::archive_start): Likewise.
9937         (Input_objects::archive_stop): Likewise.
9938         (Input_objects::print_cref): New function.
9939         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
9940         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
9941         --cref.
9942         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
9943         function.
9944         * plugin.h (class Sized_pluginobj): Update declarations.
9945
9946 2010-01-05  Ian Lance Taylor  <iant@google.com>
9947
9948         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
9949         to is_default_version.  Rename insdef to insdefault.
9950         (Symbol_table::add_from_relobj): Rename def to is_default_version
9951         and local to is_forced_local.
9952         (Symbol_table::add_from_pluginobj): Likewise.
9953         (Symbol_table::add_from_dynobj): Likewise.
9954         (Symbol_table::define_special_symbol): Rename insdef to
9955         insdefault.
9956
9957 2010-01-04  Ian Lance Taylor  <iant@google.com>
9958
9959         PR 10980
9960         * options.h (class General_options): Add
9961         --allow-multiple-definition and -z muldefs.
9962         * resolve.cc (Symbol_table::should_override): Don't warn about a
9963         multiple symbol definition if --allow-multiple-definition or -z
9964         muldefs.
9965
9966         PR 10980
9967         * options.h (class General_options): Add --add-needed and
9968         --copy-dt-needed-entries.  Tweak --as-needed help entry.
9969         * object.cc (Input_objects::check_dynamic_dependencies): Give an
9970         error if --copy-dt-needed-entries aka --add-needed is used and
9971         would cause a change in behaviour.
9972
9973         PR 10980
9974         * options.h (class General_options): Add -G as a short version of
9975         --shared.  Add no-op options -assert, -g, and -i.
9976
9977 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
9978
9979         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
9980         check for .text or .gnu.linkonce.t sections.
9981         * icf.cc (Icf::find_identical_sections): Ditto.
9982         Change the detection for mangled function name within the section
9983         name.
9984         * icf.h (is_section_foldable_candidate): New function.
9985
9986 2009-12-30  Ian Lance Taylor  <iant@google.com>
9987
9988         PR 10980
9989         * options.h (class General_options): Permit two dashes with
9990         --retain-symbols-file.
9991
9992 2009-12-30  Ian Lance Taylor  <iant@google.com>
9993
9994         PR 10979
9995         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
9996         don't put the file header and segment headers in the text
9997         segment.
9998
9999         PR 10979
10000         * common.cc (Sort_commons::operator()): Stabilize sort when both
10001         entries are NULL.
10002         (Symbol_table::do_allocate_commons_list): When allocating common
10003         symbols, skip a symbol which is no longer common.
10004         * symtab.h (Symbol::is_common): Test whether the symbol comes from
10005         an object before checking its type.
10006         * testsuite/common_test_2.c: New file.
10007         * testsuite/common_test_3.c: New file.
10008         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
10009         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
10010         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
10011         (common_test_2_pic.o, common_test_2.so): New targets.
10012         (common_test_3_pic.o, common_test_3.so): New targets.
10013         * testsuite/Makefile.in: Rebuild.
10014
10015         PR 10979
10016         * script.cc (read_input_script): If we see a new SECTIONS clause,
10017         and we have added an input section, give an error.
10018         * layout.h (class Layout): Add have_added_input_section function.
10019         Add have_added_input_section_ field.
10020         * layout.cc (Layout::Layout): Initialize
10021         have_added_input_section_.
10022         (Layout::layout): Set have_added_input_section_.
10023         (Layout::layout_eh_frame): Likewise.
10024
10025 2009-12-30  Ian Lance Taylor  <iant@google.com>
10026
10027         PR 10931
10028         * options.h (class General_options): Add --sort-common option.
10029         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
10030         * common.cc (Sort_common): Add sort_order parameter to
10031         constructor.  Add sort_order_ field.
10032         (Sort_commons::operator): Check sort_order_.
10033         (Symbol_table::allocate_commons): Determine the sort order.
10034         (Symbol_table::do_allocate_commons): Add sort_order parameter.
10035         Change all callers.
10036         (Symbol_table::do_allocate_commons_list): Likewise.
10037
10038 2009-12-30  Ian Lance Taylor  <iant@google.com>
10039
10040         PR 10916
10041         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
10042         symbols from this object, don't change the visibility of an
10043         undefined symbol.
10044         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
10045
10046 2009-12-30  Ian Lance Taylor  <iant@google.com>
10047
10048         PR 10861
10049         * script.h (class Version_script_info): Define Language enum.
10050         Update declarations.  Define Glob, Exact, and Lookup types.  Add
10051         new fields globals_, locals_, and is_finalized_.
10052         * script.cc: Various formatting fixes.
10053         (class Parser_closure): Change language_stack_ from a vector of
10054         std::string to one of Version_script_info::Language.  Adjust all
10055         uses accordingly.
10056         (class Lazy_demangler): Remove.
10057         (struct Version_expression): Change language from std::string to
10058         Version_script_info::Language.
10059         (Version_script_info::Version_script_info): New function.
10060         (Version_script_info::~Version_script_info): Don't call clear.
10061         (Version_script_info::finalize): New function.
10062         (Version_script_info::build_lookup_tables): New function.
10063         (Version_script_info::build_expression_list_lookup): New
10064         function.
10065         (Version_script_info::get_symbol_version_helper): Rewrite to use
10066         lookup tables.
10067         (Version_script_info::print_expression_list): Adjust to use
10068         Version_script_info::Language.
10069         (script_push_lex_into_version_mode): Check that the version script
10070         has not been finalized.
10071         (version_script_push_lang): Change language string to
10072         Version_script_info::Language.
10073         * options.cc (Command_line::version_script): New function.
10074         * options.h (class General_options): Add finalize_dynamic_list
10075         function.  Change version_script from declaration to definition.
10076         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
10077         * testsuite/version_script.map: Remove duplicate def of foo.
10078         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
10079         version_script.map.
10080         * testsuite/Makefile.in: Rebuild.
10081
10082 2009-12-30  Ian Lance Taylor  <iant@google.com>
10083
10084         PR 10843
10085         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
10086         if the input symbol index is 0, make the output symbol index 0.
10087
10088 2009-12-30  Ian Lance Taylor  <iant@google.com>
10089
10090         PR 10670
10091         * options.h (class General_options): Add -x/--discard-all.
10092         * object.cc (Sized_relobj::do_count_local_symbols): Handle
10093         --discard-all.  If the local symbol needs a dynamic entry, check
10094         that before handling --discard-locals.
10095
10096 2009-12-30  Ian Lance Taylor  <iant@google.com>
10097
10098         PR 10450
10099         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
10100         flags to PF_R.
10101         (Output_segment::add_output_section): Don't change the flags if
10102         the type is PT_TLS.
10103
10104         PR 10450
10105         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
10106         GNU hash table if they need a dynamic value.  Otherwise, don't add
10107         them if they are defined in a dynamic object or are forced local.
10108
10109 2009-12-29  Ian Lance Taylor  <iant@google.com>
10110
10111         PR 10450
10112         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
10113         .gnu.hash table for a 32-bit target.
10114
10115         PR 10450
10116         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
10117         regular and a dynamic object only needs a dynamic symbol table
10118         entry if it is externally visible.
10119
10120         PR 10450
10121         * i386.cc (class Target_i386): Initialize global_offset_table_ in
10122         constructor.  Add global_offset_table_ field.
10123         (Target_i386::got_section): Set global_offset_table_.
10124         (Target_i386::do_finalize_sections): Set global_offset_table_
10125         size.
10126         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
10127         in constructor.  Add global_offset_table_ field.
10128         (Target_x86_64::got_section): Set global_offset_table_.
10129         (Target_x86_64::do_finalize_sections): Set global_offset_table_
10130         size.
10131
10132         * layout.cc (Layout::Layout): Initialize increase_relro_.
10133         (Layout::get_output_section): Add is_relro, is_last_relro, and
10134         is_first_non_relro parameters.  Change all callers.
10135         (Layout::choose_output_section): Likewise.
10136         (Layout::add_output_section_data): Likewise.
10137         (Layout::make_output_section): Likewise.
10138         (Layout::set_segment_offsets): Clear increase_relro when using a
10139         linker script.
10140         * layout.h (class Layout): Add increase_relro method.  Add
10141         increase_relro_ field.  Update declarations.
10142         * output.cc (Output_section::Output_section): Initialize
10143         is_last_relro_ and is_first_non_relro_.
10144         (Output_segment::add_output_section): Group relro sections is
10145         do_sort is true.  Handle is_last_relro and is_first_non_relro.
10146         (Output_segment::maximum_alignment): Remove relro handling.
10147         (Output_segment::set_section_addresses): Add increase_relro
10148         parameter.  Change all callers.  Add initial alignment to align
10149         relro sections on separate page.  Remove old relro handling.
10150         (Output_segment::set_section_list_addresses): Remove in_relro
10151         parameter.  Change all callers.
10152         (Output_segment::set_offset): Add increase parameter.  Change all
10153         callers.  Remove old relro handling.
10154         * output.h (class Output_section): Add new methods: is_last_relro,
10155         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
10156         Add is_last_relro_ and is_first_non_relro_ fields.
10157         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
10158         Create separate .got.plt section.  Call increase_relro.
10159         * x86_64.cc (Target_x86_64::got_section): Likewise.
10160         * testsuite/relro_script_test.t: Add .got.plt.
10161
10162         PR 10450
10163         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
10164         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
10165         (Layout::finalize): Call set_dynamic_symbol_size.
10166         (Layout::set_dynamic_symbol_size): New function.
10167         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
10168         set_dynamic_symbol_size.
10169
10170         PR 10450
10171         * output.h (class Output_section): Add is_entsize_zero_ field.
10172         * output.cc (Output_section::Output_section): Initialize
10173         is_entsize_zero_.
10174         (Output_section::set_entsize): If two different entsizes are
10175         requested, force it to zero.
10176         (Output_section::add_input_section): Set flags for .debug_str
10177         before updating section flags.  Set entsize.
10178         (Output_section::update_flags_for_input_section): Set SHF_MERGE
10179         and SHF_STRING if all input sections have those flags.
10180
10181 2009-12-29   Rafael Espindola  <espindola@google.com>
10182
10183         * main.cc (main): Fix the sys time reporting.
10184         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
10185         reporting.
10186
10187 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
10188
10189         * options.cc (General_options::parse_version): Allow -v to exit
10190         without an error if there is nothing to link.
10191
10192 2009-12-29  Ian Lance Taylor  <iant@google.com>
10193
10194         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
10195         using a version of gcc before 4.1.
10196         * configure: Rebuild.
10197
10198 2009-12-28  Chris Demetriou  <cgd@google.com>
10199
10200         * attributes.cc (Output_attributes_section_data::do_write): Use
10201         std::vector::front rather than std::vector::data.
10202
10203 2009-12-28  Ian Lance Taylor  <iant@google.com>
10204
10205         * symtab.h (class Symbol_table): Add enum Defined.
10206         * resolve.cc (Symbol_table::should_override): Add defined
10207         parameter.  Change all callers.  Test whether object is NULL
10208         before calling a method on it.
10209         (Symbol_table::report_resolve_problem): Add defined parameter.
10210         Change all callers.
10211         (Symbol_table::should_override_with_special): Likewise.
10212         * symtab.cc (Symbol_table::define_in_output_data): Add defined
10213         parameter.  Change all callers.
10214         (Symbol_table::do_define_in_output_data): Likewise.
10215         (Symbol_table::define_in_output_segment): Likewise.
10216         (Symbol_table::do_define_in_output_segment): Likewise.
10217         (Symbol_table::define_as_constant): Likewise.
10218         (Symbol_table::do_define_as_constant): Likewise.
10219         * script.h (class Symbol_assignment): Add is_defsym parameter to
10220         constructor; change all callers.
10221         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
10222         parameter.  Change all callers.  Add is_defsym_ field.
10223         (class Parser_closure): Add parsing_defsym parameter to
10224         constructor; change all callers.  Add parsing_defsym accessor
10225         function.  Add parsing_defsym_ field.
10226
10227 2009-12-28  Ian Lance Taylor  <iant@google.com>
10228
10229         * gold.cc (queue_middle_tasks): Fix formatting.
10230         * object.cc (Relobj::is_section_name_included): Likewise.
10231
10232 2009-12-23  Ian Lance Taylor  <iant@google.com>
10233
10234         * i386.cc (Target_i386::do_calls_non_split): Recognize
10235         -fsplit-stack prologue for a function with a static chain.
10236         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
10237         -fsplit-stack prologue when using %r11.
10238
10239 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
10240
10241         * options.cc (General_options::parse_version): Make -v continue and do
10242         the link like GNU ld does.
10243
10244 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
10245
10246         * Makefile.am (CCFILES): Add timer.cc.
10247         (HFILES): Add timer.h.
10248         * configure.ac: Check for sysconf and times.
10249         * main.cc: include timer.h.
10250         (main): Use Timer instead of get_run_time.
10251         * timer.cc: New.
10252         * timer.h: New.
10253         * workqueue.cc: include timer.h.
10254         (Workqueue::find_and_run_task):
10255         Report user, sys and wall time.
10256         * Makefile.in: Regenerate.
10257         * config.in: Regenerate.
10258         * configure: Regenerate.
10259
10260 2009-12-16  Doug Kwan  <dougkwan@google.com>
10261
10262         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
10263         sections.
10264         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
10265         relaxed input sections.
10266         * output.cc (Output_section::find_relaxed_input_section): Change
10267         return type to Output_relaxed_input_section pointer.  Adjust code
10268         for new type of relaxed_input_section_map_.
10269         * output.h (Output_section::find_relaxed_input_section): Change
10270         return type to Output_relaxed_input_section pointer.
10271         (Output_section::Output_relaxed_input_section_by_input_section_map):
10272         New type.
10273         (Output_section::relaxed_input_section_map_): Change type to
10274         Output_section::Output_relaxed_input_section_by_input_section_map.
10275         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
10276         input section.
10277
10278 2009-12-15  Ian Lance Taylor  <iant@google.com>
10279
10280         * layout.cc (Layout::create_shstrtab): Only write out after input
10281         sections if we are compressing debug sections.
10282
10283 2009-12-15  Ian Lance Taylor  <iant@google.com>
10284
10285         * archive.cc (Archive::add_symbols): Only look up a symbol without
10286         a version if there is, in fact, a version.
10287
10288 2009-12-14  Ian Lance Taylor  <iant@google.com>
10289
10290         Revert -Wshadow changes, all changes from:
10291         2009-12-11  Doug Kwan  <dougkwan@google.com>
10292         2009-12-11  Nick Clifton  <nickc@redhat.com>
10293         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
10294
10295 2009-12-11  Doug Kwan  <dougkwan@google.com>
10296
10297         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
10298         due to -Wshadow.
10299         * attributes.cc (Object_attribute::size): Ditto.
10300         (Attributes_section_data::size): Ditto.
10301         (Attributes_section_data::Attributes_section_data): Ditto.
10302         (Output_attributes_section_data::do_write): Ditto.
10303         * attributes.h (Object_attribute::set_type): Ditto.
10304         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
10305
10306 2009-12-11  Nick Clifton  <nickc@redhat.com>
10307
10308         * archive.cc: Fix shadowed variable warnings.
10309         * arm.cc: Likewise.
10310         * compressed_output.cc: Likewise.
10311         * compressed_output.h: Likewise.
10312         * configure: Likewise.
10313         * dwarf_reader.cc: Likewise.
10314         * dynobj.cc: Likewise.
10315         * dynobj.h: Likewise.
10316         * ehframe.cc: Likewise.
10317         * ehframe.h: Likewise.
10318         * errors.cc: Likewise.
10319         * expression.cc: Likewise.
10320         * fileread.cc: Likewise.
10321         * fileread.h: Likewise.
10322         * freebsd.h: Likewise.
10323         * i386.cc: Likewise.
10324         * icf.cc: Likewise.
10325         * incremental.h: Likewise.
10326         * layout.cc: Likewise.
10327         * layout.h: Likewise.
10328         * mapfile.cc: Likewise.
10329         * merge.cc: Likewise.
10330         * merge.h: Likewise.
10331         * object.cc: Likewise.
10332         * object.h: Likewise.
10333         * options.h: Likewise.
10334         * output.cc: Likewise.
10335         * output.h: Likewise.
10336         * parameters.cc: Likewise.
10337         * plugin.cc: Likewise.
10338         * powerpc.cc: Likewise.
10339         * reduced_debug_output.cc: Likewise.
10340         * reduced_debug_output.h: Likewise.
10341         * reloc.cc: Likewise.
10342         * reloc.h: Likewise.
10343         * resolve.cc: Likewise.
10344         * script-sections.cc: Likewise.
10345         * script.cc: Likewise.
10346         * script.h: Likewise.
10347         * sparc.cc: Likewise.
10348         * symtab.cc: Likewise.
10349         * symtab.h: Likewise.
10350         * target-select.cc: Likewise.
10351         * target-select.h: Likewise.
10352         * token.h: Likewise.
10353         * workqueue.cc: Likewise.
10354         * workqueue.h: Likewise.
10355         * x86_64.cc: Likewise.
10356
10357 2009-12-10  Doug Kwan  <dougkwan@google.com>
10358
10359         * arm.cc (attributes.h): New include.
10360         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
10361         (Arm_relobj::~Arm_relobj): Delete object pointed by
10362         attributes_section_data_.
10363         (Arm_relobj::attributes_section_data): New method definition.
10364         (Arm_relobj::attributes_section_data_): New data member declaration.
10365         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
10366         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
10367         attributes_section_data_.
10368         (Arm_dynobj::attributes_section_data): New method definition.
10369         (Arm_dynobj::attributes_section_data_): New data member declaration.
10370         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
10371         initialization value of may_use_blx_ to false.
10372         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
10373         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
10374         object attributes to compute results instead of hard-coding.
10375         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
10376         Target_arm::get_secondary_compatible_arch,
10377         Target_arm::set_secondary_compatible_arch
10378         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10379         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
10380         New method declarations.
10381         (Target_arm::get_aeabi_object_attribute): New method definition.
10382         (Target_arm::attributes_section_data_): New data member declaration.
10383         (read_arm_attributes_section): New template definition.
10384         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
10385         (Arm_dynobj::do_read_symbols): Ditto.
10386         (Target_arm::do_finalize_sections): Merge attributes sections from
10387         input.  Check for BLX use after attributes section merging.
10388         Fix __exidx_start and __exidx_end visibility.  Create an
10389         .ARM.attributes section if necessary.
10390         (Target_arm::get_secondary_compatible_arch,
10391         Target_arm::set_secondary_compatible_arch,
10392         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10393         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
10394         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
10395         New method definitions.
10396
10397 2009-12-09  Ian Lance Taylor  <iant@google.com>
10398
10399         * plugin.cc (Plugin::load): Don't cast from void* to a function
10400         pointer.
10401
10402 2009-12-09  Ian Lance Taylor  <iant@google.com>
10403
10404         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
10405         information fields.
10406
10407 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
10408
10409         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
10410         Replace two_file_shared_1.so with two_file_shared_2.so.
10411         * testsuite/Makefile.in: Regenerated.
10412
10413 2009-12-08  Doug Kwan  <dougkwan@google.com>
10414
10415         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
10416         (HFILES): Add attributes.h and int_encoding.h.
10417         * Makefile.in: Regenerate.
10418         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
10419         function definitions to int_encoding.cc
10420         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
10421         prototypes to int_encoding.h
10422         * reduced_debug_output.cc (int_encoding.h): New include.
10423         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
10424         function definitions to int_encoding.cc
10425         (insert_into_vector, read_from_pointer): Move template definitions to
10426         int_encoding.h
10427         * attributes.cc: New file.
10428         * attributes.h: New file.
10429         * int_encoding.cc: New file.
10430         * int_encoding.h: New file.
10431
10432 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
10433
10434         PR gold/11055
10435         * incremental-dump.cc (dump_incremental_inputs): New.
10436         (main): Use dump_incremental_inputs.
10437
10438 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
10439
10440         PR gold/10893
10441         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
10442         checking elfcpp::STT_FUNC.
10443         (Target_i386::Relocate::relocate): Likewise.
10444         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
10445
10446         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
10447         symbols from shared libraries into normal FUNC symbols.
10448
10449         * symtab.h (Symbol): Add is_func and use it.
10450
10451 2009-12-05  Doug Kwan  <dougkwan@google.com>
10452
10453         * arm.cc (Target_arm::arm_info): Initialize new fields
10454         attributes_section and attributes_vendor.
10455         * i386.cc (Target_i386::i386_info): Same.
10456         * object.cc (Sized_relobj::do_layout): Skip attribute section.
10457         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
10458         fields attributes_section and attributes_vendor.
10459         * sparc.cc (Target_sparc::sparc_info): Same.
10460         * target.h (Target::attributes_section, Target::attributes_vendor,
10461         Target::is_attributes_section, Target::attribute_arg_type,
10462         Target::attributes_order): New method definitions.
10463         (Target::Target_info::attributes_section,
10464         Target::Target_info::attributes_vendor): New fields.
10465         (Target::do_attribute_arg_type, Target::do_attributes_order): New
10466         virtual method definitions.
10467         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
10468         attributes_section and attributes_vendor.
10469         * testsuite/testfile.cc (Target_test::test_target_info): Same.
10470
10471 2009-12-05  Doug Kwan  <dougkwan@google.com>
10472
10473         * arm.cc: Update comments about interworking and stub generation.
10474         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
10475         considered as non-PIC.
10476         (Arm_relocate_functions::base_abs): Fix formatting.
10477         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
10478         of function to use GOT entry address instead of offset.
10479         (Target_arm::Scan::global): Issue an error if a symbol would need a
10480         PLT does not get one because it is untyped.  Remove code to create
10481         dynamic symbols for relative branches.
10482         (Target_arm::Relocate::relocate: Use 0 instead of false since function
10483         takes unsigned integer instead of boolean.
10484
10485 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
10486
10487         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
10488         (two_file_test_LDADD): Likewise.
10489         (common_test_1_LDADD): Likewise.
10490         (exception_test_LDADD) Likewise.
10491         (weak_test_LDADD): Likewise.
10492         (many_sections_test_LDADD): Likewise.
10493         (initpri1_LDADD): Likewise.
10494         (script_test_1_LDADD): Likewise.
10495         (script_test_2_LDADD): Likewise.
10496         (justsyms_LDADD): Likewise.
10497         (binary_test_LDADD): Likewise.
10498         (large_LDADD): Likewise.
10499         * testsuite/Makefile.in: Regenerated.
10500
10501 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
10502
10503         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
10504         (Symbol_table::override_with_special): Likewise.
10505         (Symbol_table::add_from_object): Likewise.
10506
10507 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10508
10509         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10510         Don't set the data_offset twice.
10511
10512 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10513
10514         * testsuite/Makefile.in: Regenerate.
10515
10516 2009-12-03  Doug Kwan  <dougkwan@google.com>
10517
10518         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
10519         (Target_arm::do_finalize_sections): Add parameter for symbol table
10520         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
10521         * i386.cc (Target_i386::do_finalize_sections): Add an additional
10522         parameter for symbol table pointer.
10523         * layout.cc (Layout::finalize): Call Target::finalize_sections with
10524         an additional parameter for a pointer to symbol table.
10525         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
10526         parameter for a symbol table pointer.
10527         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
10528         * target.h (Target::finalize_sections, Target::do_finalize_sections):
10529         Ditto.
10530         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
10531         parameter for a symbol table pointer.
10532
10533 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
10534
10535         * incremental.cc (Incremental_inputs_header)
10536         (Incremental_inputs_header_write, Incremental_inputs_entry)
10537         (Incremental_inputs_entry_write): Move ...
10538         * incremental.h (Incremental_inputs_header)
10539         (Incremental_inputs_header_write, Incremental_inputs_entry)
10540         (Incremental_inputs_entry_write): here.
10541
10542 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10543
10544         * incremental.cc (make_sized_incremental_binary): Set the target.
10545         Error if it is incompatible.
10546         * output.h (Output_file): Add filename method.
10547
10548 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10549
10550         * incremental.cc (Incremental_inputs_entry): Remove unused argument
10551         from the get_* methods.
10552
10553 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10554
10555         * incremental-dump.cc (main): Check that the offeset of a script is 0.
10556         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10557         Write 0 for the data_offset of scripts.
10558
10559 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10560
10561         * testsuite/Makefile.am: Add the incremental_test.sh test.
10562         * testsuite/incremental_test.sh: New.
10563         * testsuite/incremental_test_1.c: New.
10564         * testsuite/incremental_test_2.c: New.
10565
10566 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
10567
10568         * incremental-dump.cc (main): Fix typos.
10569
10570 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
10571
10572         PR gold/11025
10573         * incremental-dump.cc (main): Use llu to print 64 bit values.
10574
10575 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
10576             H.J. Lu  <hongjiu.lu@intel.com>
10577
10578         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
10579         $(LIBDL).
10580         (incremental_dump_LDADD): Likewise.
10581         * Makefile.in: Regenerated.
10582
10583 2009-11-25  Doug Kwan  <dougkwan@google.com>
10584
10585         Revert:
10586
10587         2009-11-25  Doug Kwan  <dougkwan@google.com>
10588
10589                 * arm.cc (Target_arm::Target_arm): Move method definition
10590                 outside of class definition.  Add code to handle
10591                 --target1-rel, --target1-abs and --target2= options.
10592                 (Target_arm::get_reloc_reloc_type): Change method to be
10593                 non-static and const.
10594                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
10595                 New data member declaration.
10596                 (Target_arm::Scan::local, Target_arm::Scan::global,
10597                 Target_arm::Relocate::relocate,
10598                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10599                 Adjust call to Target_arm::get_real_reloc_type.
10600                 (Target_arm::get_real_reloc_type): Use command line options
10601                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10602                 * options.h (--target1-rel, --target1-abs, --target2): New
10603                 ARM-only options.
10604
10605 2009-11-25  Doug Kwan  <dougkwan@google.com>
10606
10607         * arm.cc (Target_arm::Target_arm): Move method definition outside of
10608         class definition.  Add code to handle --target1-rel, --target1-abs
10609         and --target2= options.
10610         (Target_arm::get_reloc_reloc_type): Change method to be non-static
10611         and const.
10612         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
10613         member declaration.
10614         (Target_arm::Scan::local, Target_arm::Scan::global,
10615         Target_arm::Relocate::relocate,
10616         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
10617         call to Target_arm::get_real_reloc_type.
10618         (Target_arm::get_real_reloc_type): Use command line options to
10619         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10620         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
10621         options.
10622
10623 2009-11-25  Doug Kwan  <dougkwan@google.com>
10624
10625         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
10626         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
10627         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
10628         formatting.
10629         (Arm_relocate_functions::thm_call): Replace body with a call to
10630         Arm_relocate_functions::thumb_branch_common.
10631         (Arm_relocate_functions::thm_jump24,
10632         Arm_relocate_functions::thm_xpc22): New method definitions.
10633         (Arm_relocate_functions::thumb_branch_common): New method definition.
10634         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
10635         operator.
10636         (Target_arm::Relocate::relocate): Adjust call to thm_call.
10637         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
10638
10639 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10640
10641         * Makefile.am: Build incremental-dump
10642         * Makefile.in: Regenerate.
10643         * incremental-dump.cc: New.
10644         * incremental.cc (Incremental_inputs_header_data,
10645         Incremental_inputs_entry_data): Move to incremental.h
10646         * incremental.h: (Incremental_inputs_header_data,
10647         Incremental_inputs_entry_data): Move from incremental.cc
10648
10649 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10650
10651         * incremental.cc (Incremental_inputs_header,
10652         Incremental_inputs_header_write, Incremental_inputs_entry,
10653         Incremental_inputs_entry_write): Add a typedef with the data type.
10654
10655 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10656
10657         * incremental.cc (Incremental_inputs_header,
10658         Incremental_inputs_header_write, Incremental_inputs_entry,
10659         Incremental_inputs_entry_write): Update comment about which
10660         type has the filed descriptions.
10661
10662 2009-11-15  Doug Kwan  <dougkwan@google.com>
10663
10664         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
10665         (Arm_relocate_functions::arm_branch_common): Change method defintion
10666         in class definition to a method declaration and update list of formal
10667         parameters.
10668         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
10669         Arm_relocation_functions::jump24): Adjust call to
10670         Arm_relocate_functions::arm_branch_common.  Update list of formal
10671         parameters.
10672         (Arm_relocate_functions::xpc25): New method definition.
10673         (Arm_relocate_functions::arm_branch_common): Move method defintion
10674         out from class definition.  Use stubs for mode-switching and extending
10675         branch ranges.
10676         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
10677         specially.  Change code to enable use of stubs in ARM branches.
10678
10679 2009-11-10  Doug Kwan  <dougkwan@google.com>
10680
10681         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
10682         in method declaration.
10683         (Target_arm::relocate_stub): New method declaration.
10684         (Target_arm::default_target): Change to return a pointer instead of
10685         a const reference.
10686         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
10687         Target_arm::default_target.
10688         (Arm_Relobj::do_relocate_sections): Remove options paramater in
10689         method definition.
10690         (Target_arm::relocate_section): Adjust view.
10691         (Target_arm::relocate_stub): New method definition.
10692
10693 2009-11-10  Doug Kwan  <dougkwan@google.com>
10694
10695         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
10696         a format warning.
10697         * incremental.cc (open_incremental_binary): Initialized local
10698         variables to avoid warnings.
10699         * object.cc (make_elf_object): Ditto.
10700         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
10701         a format warning.
10702
10703 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
10704
10705         PR gold/10930
10706         * testsuite/plugin_test.c: Include "config.h".
10707
10708 2009-11-09  Doug Kwan  <dougkwan@google.com>
10709
10710         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
10711         (arm_symbol_value): Remove.
10712         (Arm_relocate_functions::arm_branch_common,
10713         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
10714         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
10715         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
10716         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
10717         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
10718         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
10719         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
10720         Arm_relocate_functions::thm_mobw_abs_nc,
10721         Arm_relocate_functions::thm_mov_abs,
10722         Arm_relocate_functions::movw_prel_nc,
10723         Arm_relocate_functions::thm_movt_abs,
10724         Arm_relocate_functions::movt_prel,
10725         Arm_relocate_functions::thm_movw_prel_nc,
10726         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
10727         (Target_arm::Relocate::relocate): Only decompose address into two
10728         parts if relocation type uses the thumb-bit and pass the actual
10729         bit instead of a flag indicating that the thumb-bit is used.  Adjust
10730         calls to methods in Arm_relocate_functions for this change.
10731
10732 2009-11-08  Ian Lance Taylor  <iant@google.com>
10733
10734         PR 10925
10735         * reloc.cc: Instantiate
10736         Sized_relobj::initialize_input_to_output_maps and
10737         Sized_relobj:free_input_to_output_maps.
10738
10739 2009-11-06  Ian Lance Taylor  <iant@google.com>
10740
10741         PR 10876
10742         * defstd.cc (in_segment): Set only_if_ref true for "end".
10743
10744 2009-11-06  Doug Kwan  <dougkwan@google.com>
10745
10746         * arm.cc (class Reloc_stub): Correct a comment.
10747         (Target_arm::Target_arm): Initialize arm_input_section_map_.
10748         (Target_arm::scan_section_for_stubs): New method declaration.
10749         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
10750         Change methods from private to protected.
10751         (Target_arm::do_may_relax): New method definition.
10752         (Target_arm::do_relax, Target_arm::group_sections,
10753         Target_arm::scan_reloc_for_stub,
10754         Target_arm::scan_reloc_section_for_stubs): New method declarations.
10755         (Target_arm::arm_input_section_map_): New data member declaration.
10756         (Target_arm::scan_reloc_for_stub,
10757         Target_arm::scan_reloc_section_for_stubs,
10758         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
10759         Target_arm::do_relax): New method definitions.
10760
10761 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
10762
10763         * configure.ac: Check for (struct stat)::st_mtim
10764         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
10765         * config.in: Regenerate.
10766         * configure: Regenerate.
10767
10768 2009-11-05  Ian Lance Taylor  <iant@google.com>
10769
10770         PR 10910
10771         * output.cc (Output_segment::add_output_section): Add missing
10772         return statement.
10773
10774 2009-11-04  Ian Lance Taylor  <iant@google.com>
10775
10776         PR 10880
10777         * object.h (class Object): Add is_needed and set_is_needed
10778         methods.  Add is_needed_ field.  Make bool fields into bitfields.
10779         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
10780         defined in a dynamic object and referenced by a regular object,
10781         set is_needed for the dynamic object.
10782         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
10783         if the file is marked with as_needed and it is not needed.
10784
10785 2009-11-04  Ian Lance Taylor  <iant@google.com>
10786
10787         PR 10887
10788         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
10789         tags if data is discarded by linker script.
10790         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10791         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10792         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10793         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10794
10795 2009-11-04  Ian Lance Taylor  <iant@google.com>
10796
10797         * layout.cc (Layout::get_output_section): Add is_interp and
10798         is_dynamic_linker_section parameters.  Change all callers.
10799         (Layout::choose_output_section): Likewise.
10800         (Layout::make_output_section): Likewise.
10801         (Layout::add_output_section_data): Add is_dynamic_linker_section
10802         parameter.  Change all callers.
10803         * layout.h (class Layout): Update declarations.
10804         * output.h (class Output_section): Add is_interp, set_is_interp,
10805         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
10806         Add is_interp_, is_dynamic_linker_section_ fields.  Change
10807         generate_code_fills_at_write_ to a bitfield.
10808         * output.cc (Output_section::Output_sections): Initialize new
10809         fields.
10810         (Output_segment::add_output_section): Add do_sort parameter.
10811         Change all callers.
10812
10813 2009-11-03  Ian Lance Taylor  <iant@google.com>
10814
10815         PR 10860
10816         * options.h (class General_options): Add --warn-common.
10817         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
10818         merging two common symbols.
10819         (Symbol_table::should_override): Handle --warn-common when merging
10820         a common symbol with a defined symbol.  Use report_resolve_problem
10821         for multiple definitions.
10822         (Symbol_table::report_resolve_problem): New function.
10823         * symtab.h (class Symbol_table): Declare report_resolve_problem.
10824
10825 2009-11-03  Doug Kwan  <dougkwan@google.com>
10826
10827         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
10828         stub_factory_.
10829         (Target_arm::stub_factory): New method definition.
10830         (Target_arm::new_arm_input_section,
10831         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
10832         Target_arm::reloc_uses_thumb_bit): New method declarations.
10833         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
10834         New type definitions.
10835         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
10836         member declarations.
10837         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
10838         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
10839         New method definitions.
10840
10841 2009-11-03  Ian Lance Taylor  <iant@google.com>
10842
10843         * options.h (class General_options): Add --warn_constructors.
10844
10845 2009-11-03  Ian Lance Taylor  <iant@google.com>
10846
10847         PR 10893
10848         * defstd.cc (in_section): Add entries for __rel_iplt_start,
10849         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
10850
10851 2009-11-03  Ian Lance Taylor  <iant@google.com>
10852
10853         PR 10895
10854         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
10855         --msgid-bugs-address.
10856         (install-pdf): New target.
10857         (install-data_yes): Look up one directory to find mkinstalldirs.
10858
10859 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
10860
10861         * po/Make-in (.po.gmo): Don't generate .gmo files in source
10862         tree.
10863
10864 2009-10-30  Doug Kwan  <dougkwan@google.com>
10865
10866         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
10867
10868 2009-10-30  Doug Kwan  <dougkwan@google.com>
10869
10870         * arm.cc (Stub_addend_reader): New struct template definition
10871         and partial specializations.
10872         (Stub_addend_reader::operator()): New method definition for a
10873         partially specialized template.
10874
10875 2009-10-30  Doug Kwan  <dougkwan@google.com>
10876
10877         * arm.cc (Arm_relobj::processor_specific_flags): New method
10878         definition.
10879         (Arm_relobj::do_read_symbols): New method declaration.
10880         (Arm_relobj::processor_specific_flags_): New data member declaration.
10881         (Arm_dynobj): New class definition.
10882         (Target_arm::do_finalize_sections): Add input_objects parameter.
10883         (Target_arm::do_adjust_elf_header): New method declaration.
10884         (Target_arm::are_eabi_versions_compatible,
10885         (Target_arm::merge_processor_specific_flags): New method declaration.
10886         (Target_arm::do_make_elf_object): New overloaded method definitions
10887         and declaration.
10888         (Arm_relobj::do_read_symbols): New method definition.
10889         (Arm_dynobj::do_read_symbols): Ditto.
10890         (Target_arm::do_finalize_sections): Add input_objects parameters.
10891         Merge processor-specific flags from all input objects.
10892         (Target_arm::are_eabi_versions_compatible,
10893         Target_arm::merge_processor_specific_flags,
10894         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
10895         New method definitions.
10896         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
10897         Input_objects pointer type parameter.
10898         * layout.cc (Layout::finalize): Pass input objects to target's.
10899         finalize_sections function.
10900         * output.cc (Output_file_header::do_sized_write): Set ELF file
10901         header's processor-specific flags.
10902         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
10903         Input_objects pointer type parameter.
10904         * sparc.cc (Target_sparc::do_finalize_sections): Same.
10905         * target.h (Input_objects): New forward class declaration.
10906         (Target::processor_specific_flags,
10907         Target::are_processor_specific_flags_sect): New method definitions.
10908         (Target::finalize_sections): Add input_objects parameter.
10909         (Target::Target): Initialize processor_specific_flags_ and
10910         are_processor_specific_flags_set_.
10911         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
10912         parameter.
10913         (Target::set_processor_specific_flags): New method definition.
10914         (Target::processor_specific_flags_,
10915         Target::are_processor_specific_flags_set_): New data member
10916         declarations.
10917         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
10918         Input_objects pointer type parameter.
10919
10920 2009-10-30  Doug Kwan  <dougkwan@google.com>
10921
10922         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
10923
10924 2009-10-28  Ian Lance Taylor  <iant@google.com>
10925
10926         * object.h (class Relobj): Drop options parameter from
10927         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
10928         do_scan_relocs, do_relocate.  Change all callers.
10929         (class Sized_relobj): Drop options parameters from
10930         do_gc_process_relocs, do_scan_relocs, do_relocate,
10931         do_relocate_sections, relocate_sections, emit_relocs_scan,
10932         emit_relocs_scan_reltype.  Change all callers.
10933         (struct Relocate_info): Remove options field and all references to
10934         it.
10935         * reloc.h (class Read_relocs): Remove options constructor
10936         parameter and options_ field.  Change all callers.
10937         (class Gc_process_relocs, class Scan_relocs): Likewise.
10938         (class Relocate_task): Likewise.
10939         * target-reloc.h (scan_relocs): Remove options parameter.  Change
10940         all callers.
10941         (scan_relocatable_relocs): Likewise.
10942         * target.h (class Sized_target): Remove options parameter from
10943         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
10944         all callers.
10945         * gc.h (gc_process_relocs): Remove options parameter.  Change all
10946         callers.
10947         * arm.cc: Update functions to remove options parameters.
10948         * i386.cc: Likewise.
10949         * powerpc.cc: Likewise.
10950         * sparc.cc: Likewise.
10951         * x86_64.cc: Likewise.
10952         * testsuite/testfile.cc: Likewise.
10953
10954 2009-10-28  Doug Kwan  <dougkwan@google.com>
10955
10956         * arm.cc (Arm_relobj): New class definition.
10957         (Arm_relobj::scan_sections_for_stubs,
10958         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
10959         New method definitions.
10960
10961 2009-10-28  Cary Coutant  <ccoutant@google.com>
10962
10963         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
10964         (Plugin::cleanup_done_): New member.
10965         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
10966         (Plugin_manager::cleanup_done_): Remove.
10967         (Plugin_manager::add_input_file): Edit error message.
10968         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
10969         (Plugin_manager::cleanup): Remove use of cleanup_done_.
10970
10971 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
10972
10973         * fileread.cc: (File_read::View::~View): Use the new
10974         data_ownership_ filed.
10975         (File_read::~File_read): Dispose the new whole_file_view_.
10976         (File_read::open): Mmap the whole file if needed.
10977         (File_read::open): Use whole_file_view_ instead of contents_.
10978         (File_read::find_view): Use whole_file_view_ if applicable.
10979         (File_read::do_read): Use whole_file_view_ instead of contents_.
10980         (File_read::make_view): Use whole_file_view_ instead of contents_,
10981         update File_read::View::View call.
10982         (File_read::find_or_make_view): Update File_read::View::View
10983         call.
10984         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
10985         remove contents_
10986         (File_read::View::Data_ownership): New enum.
10987         (File_read::View::View): Replace bool mapped_ with Data_ownership
10988         argument.
10989         (File_read::View::mapped_): Remove (replaced by data_ownership_).
10990         (File_read::View::data_ownership_): New field.
10991         (File_read::contents_): Remove (replaced by whole_file_view_).
10992         (File_read::whole_file_view_): New field.
10993         * options.h (class General_options): Add --keep-files-mapped.
10994
10995 2009-10-27  Cary Coutant  <ccoutant@google.com>
10996
10997         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
10998         * testsuite/Makefile.am (plugin_test_5): New test case.
10999         * testsuite/Makefile.in: Regenerate.
11000
11001 2009-10-25  Doug Kwan  <dougkwan@google.com>
11002
11003         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
11004         from private to protected to allow access by child class.
11005         (Sized_relobj::do_relocate_sections): New method declaration.
11006         (Sized_relobj::relocate_sections): Virtualize.
11007         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
11008         Sized_relobj::relocate_sections.  Instantiate template explicitly
11009         for different target sizes and endianity.
11010
11011 2009-10-24  Doug Kwan  <dougkwan@google.com>
11012
11013         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
11014         (Arm_input_section::as_arm_input_section): New method.
11015         (Arm_output_section): New class definition.
11016         (Arm_output_section::create_stub_group,
11017         Arm_output_section::group_sections): New method definitions.
11018
11019 2009-10-22  Doug Kwan  <dougkwan@google.com>
11020
11021         * arm.cc (Arm_input_section): New class definition.
11022         (Arm_input_section::init, Arm_input_section:do_write,
11023         Arm_input_section::set_final_data_size,
11024         Arm_input_section::do_reset_address_and_file_offset): New method
11025         definitions.
11026
11027 2009-10-21  Doug Kwan  <dougkwan@google.com>
11028
11029         * arm.cc (Stub_table, Arm_input_section): New forward class
11030         declarations.
11031         (Stub_table): New class defintion.
11032         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
11033         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
11034         New method definition.
11035
11036 2009-10-21  Doug Kwan  <dougkwan@google.com>
11037
11038         * arm.cc: Update copyright comments.
11039         (Target_arm): New forward class template declaration.
11040         (Arm_address): New type.
11041         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
11042         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
11043         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
11044         constants.
11045         (Insn_template): Same.
11046         (DEF_STUBS): New macro.
11047         (Stub_type): New enum type.
11048         (Stub_template): New class definition.
11049         (Stub): Same.
11050         (Reloc_stub): Same.
11051         (Stub_factory): Same.
11052         (Target_arm::Target_arm): Initialize may_use_blx_ and
11053         should_force_pic_veneer_.
11054         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
11055         Target_arm::should_force_pic_veneer,
11056         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
11057         Target_arm::using_thumb_only, Target_arm:;default_target): New
11058         method defintions.
11059         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
11060         New data member declarations.
11061         (Insn_template::size, Insn_template::alignment): New method defintions.
11062         (Stub_template::Stub_template): New method definition.
11063         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
11064         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
11065         (Stub_factory::Stub_factory): New method definition.
11066         * gold.h (string_hash): New template.
11067         * output.h (Input_section_specifier::hash_value): Use
11068         gold::string_hash.
11069         (Input_section_specifier::string_hash): Remove.
11070         * stringpool.cc (Stringpool_template::string_hash): Use
11071         gold::string_hash.
11072
11073 2009-10-20  Doug Kwan  <dougkwan@google.com>
11074
11075         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
11076         symbols of relaxed input sections.
11077         * output.h (Output_section::find_relaxed_input_section): Make
11078         method public.
11079
11080 2009-10-16  Doug Kwan  <dougkwan@google.com>
11081
11082         * dynobj.cc (Versions::Versions): Initialize version_script_.
11083         Only insert base version symbol definition for a shared object
11084         if version script defines any version versions.
11085         (Versions::define_base_version): New method definition.
11086         (Versions::add_def): Check that base version is not needed.
11087         (Versions::add_need): Define base version lazily.
11088         * dynobj.h (Versions::define_base_version): New method declaration.
11089         (Versions::needs_base_version_): New data member declaration.
11090         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
11091         (check_DATA): Add no_version_test.stdout.
11092         (libno_version_test.so, no_version_test.o no_version_test.stdout):
11093         New make rules.
11094         * testsuite/Makefile.in: Regenerate.
11095         * testsuite/no_version_test.c: New file.
11096         * testsuite/no_version_test.sh: Ditto.
11097
11098 2009-10-16  Doug Kwan  <dougkwan@google.com>
11099
11100         * expression.cc (class Segment_start_expression): New class definition.
11101         (Segment_start_expression::value): New method definition.
11102         (script_exp_function_segment_start): Return a new
11103         Segment_start_expression.
11104         * gold/script-c.h (script_saw_segment_start_expression): New function
11105         prototype.
11106         * script-sections.cc (Script_sections::Script_sections): Initialize
11107         SAW_SEGMENT_START_EXPRESSION_ to false.
11108         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
11109         and -Tbbs options to specify section addresses if given in
11110         command line and no SEGMENT_START expression is seen in a script.
11111         * script-sections.h (Script_sections::saw_segment_start_expression,
11112         Script_sections::set_saw_segment_start_expression): New method
11113         definition.
11114         (Script_sections::saw_segment_start_expression_): New data member
11115         declaration.
11116         * script.cc (script_saw_segment_start_expression): New function.
11117         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
11118         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
11119         script_test_7.sh and script_test_8.sh.
11120         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
11121         script_test_8.stdout.
11122         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
11123         (script_test_6, script_test_6.stdout, script_test_7,
11124         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
11125         * Makefile.in: Regenerate.
11126         * testsuite/script_test_6.sh: New file.
11127         * testsuite/script_test_6.t: Same.
11128         * testsuite/script_test_7.sh: Same.
11129         * testsuite/script_test_7.t: Same.
11130         * testsuite/script_test_8.sh: Same.
11131
11132 2009-10-16  Doug Kwan  <dougkwan@google.com>
11133
11134         * output.cc (Output_segment::set_section_list_address): Cast
11135         expressions to unsigned long long type to avoid format warnings.
11136
11137 2009-10-15  Ian Lance Taylor  <iant@google.com>
11138
11139         * script.cc (Script_options::add_symbol_assignment): Always add a
11140         dot assignment to script_sections_.
11141         * script-sections.cc (Script_sections::add_dot_assignment):
11142         Initialize if necessary.
11143
11144         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
11145         program headers with no load segment if there is a linker script.
11146
11147         * layout.cc (Layout::set_segment_offsets): Align the file offset
11148         to the segment aligment for -N or -n with no load segment.
11149         * output.cc (Output_segment::add_output_section): Don't crash if
11150         the first section is a TLS section.
11151         (Output_segment::set_section_list_addresses): Print an error
11152         message if the address moves backward in a linker script.
11153         * script-sections.cc
11154         (Output_section_element_input::set_section_addresses): Don't
11155         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
11156         (Orphan_output_section::set_section_addresses): Likewise.
11157
11158 2009-10-15  Doug Kwan  <dougkwan@google.com>
11159
11160         * layout.cc (Layout::finish_dynamic_section): Generate tags
11161         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
11162         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
11163         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
11164
11165 2009-10-14  Ian Lance Taylor  <iant@google.com>
11166
11167         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
11168         fields.
11169         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
11170         data_shdr fields of relinfo.
11171         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
11172         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
11173         R_386_TLS_LDO_32, adjust based on section flags.
11174         (Target_i386::Relocate::fix_up_ldo): Remove.
11175
11176 2009-10-13  Ian Lance Taylor  <iant@google.com>
11177
11178         Add support for -pie.
11179         * options.h (class General_options): Add -pie and
11180         --pic-executable.
11181         (General_options::output_is_position_independent): Test -pie.
11182         (General_options::output_is_executable): Return true if not shared
11183         and not relocatable.
11184         (General_options::output_is_pie): Remove.
11185         * options.cc (General_options::finalize): Reject incompatible uses
11186         of -pie.
11187         * gold.cc (queue_middle_tasks): A -pie link is not static.
11188         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
11189         * symtab.cc (Symbol::final_value_is_known): Return false if
11190         output_is_position_independent.
11191         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
11192         output_is_position_independent.
11193         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
11194         output_is_position_independent.
11195         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
11196         output_is_position_independent.
11197         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
11198         two_file_pie_test.
11199         (basic_pie_test.o, basic_pie_test): New targets.
11200         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
11201         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
11202         (two_file_pie_test): New target.
11203         * testsuite/Makefile.in: Rebuild.
11204         * README: Remove note saying that -pie is not supported.
11205
11206 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
11207
11208         * options.h (class General_options): Add -init and -fini.
11209         * layout.cc (Layout::finish_dynamic_section): Emit
11210         given init and fini functions.
11211
11212 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
11213
11214         * gc.h (gc_process_relocs): Check if icf is enabled using new
11215         function.
11216         * gold.cc (queue_initial_tasks): Likewise.
11217         (queue_middle_tasks): Likewise.
11218         * object.cc (do_layout): Likewise.
11219         * symtab.cc (is_section_folded): Likewise.
11220         * main.cc (main): Likewise.
11221         * reloc.cc (Read_relocs::run): Likewise.
11222         (Sized_relobj::do_scan_relocs): Likewise.
11223         * icf.cc (is_function_ctor_or_dtor): New function.
11224         (Icf::find_identical_sections): Check if function is ctor or dtor when
11225         safe icf is chosen.
11226         * options.h (General_options::icf): Change option to be an enum.
11227         (Icf_status): New enum.
11228         (icf_enabled): New method.
11229         (icf_safe_folding): New method.
11230         (set_icf_status): New method.
11231         (icf_status_): New variable.
11232         * (options.cc) (General_options::finalize): Set icf_status_.
11233         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
11234         icf_test and icf_keep_unique_test to use the --icf enum flag.
11235         * testsuite/icf_safe_test.sh: New file.
11236         * testsuite/icf_safe_test.cc: New file.
11237
11238 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
11239
11240         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
11241         includes to gc.h and icf.h.
11242         * arm.cc: Include gc.h.
11243         * gold.cc: Likewise.
11244         * i386.cc: Likewise.
11245         * powerpc.cc: Likewise.
11246         * sparc.cc: Likewise.
11247         * x86_64.cc: Likewise.
11248         * gc.h: Include icf.h.
11249
11250 2009-10-11  Ian Lance Taylor  <iant@google.com>
11251
11252         * plugin.cc: Include "gold.h" before other header files.
11253
11254 2009-10-10  Chris Demetriou  <cgd@google.com>
11255
11256         * options.h (Input_file_argument::Input_file_type): New enum.
11257         (Input_file_argument::is_lib_): Replace with...
11258         (Input_file_argument::type_): New member.
11259         (Input_file_argument::Input_file_argument): Take Input_file_type
11260         'type' rather than boolean 'is_lib' as second argument.
11261         (Input_file_argument::is_lib): Use type_.
11262         (Input_file_argument::is_searched_file): New function.
11263         (Input_file_argument::may_need_search): Handle is_searched_file.
11264         * options.cc (General_options::parse_library): Support -l:filename.
11265         (General_options::parse_just_symbols): Update for Input_file_argument
11266         changes.
11267         (Command_line::process): Likewise.
11268         * archive.cc (Archive::get_file_and_offset): Likewise.
11269         * plugin.cc (Plugin_manager::release_input_file): Likewise.
11270         * script.cc (read_script_file, script_add_file): Likewise.
11271         * fileread.cc (Input_file::Input_file): Likewise.
11272         (Input_file::will_search_for): Handle is_searched_file.
11273         (Input_file::open): Likewise.
11274         * readsyms.cc (Read_symbols::get_name): Likewise.
11275         * testsuite/Makefile.am (searched_file_test): New test.
11276         * testsuite/Makefile.in: Regenerate.
11277         * testsuite/searched_file_test.cc: New file.
11278         * testsuite/searched_file_test_lib.cc: New file.
11279
11280 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11281             Ian Lance Taylor  <iant@google.com>
11282
11283         * descriptor.cc: Include <cstdio> and "binary-io.h".
11284         (Descriptors::open): Open the files in binary mode always.
11285         * script.cc (Lex::get_token): Treat \r as whitespace.
11286
11287 2009-10-09  Ian Lance Taylor  <iant@google.com>
11288
11289         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
11290
11291 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11292             Ian Lance Taylor  <iant@google.com>
11293
11294         * configure.ac: Check for readv function also.
11295         * fileread.cc (readv): Define if not HAVE_READV.
11296         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
11297         does not exist.
11298         * config.in: Regenerate.
11299         * configure: Regenerate.
11300
11301 2009-10-09  Doug Kwan  <dougkwan@google.com>
11302
11303         * layout.cc (Layout::make_output_section): Call target hook to make
11304         ordinary output section.
11305         (Layout::finalize): Adjust parameter list of call the
11306         Target::may_relax().
11307         * layout.h (class Layout::section_list): New method.
11308         * merge.h (Output_merge_base::entsize): Change visibility to public.
11309         (Output_merge_base::is_string, Output_merge_base::do_is_string):
11310         New methods.
11311         (Output_merge_string::do_is_string): New method.
11312         * object.cc (Sized_relobj::do_setup): renamed from
11313         Sized_relobj::set_up.
11314         * object.h (Sized_relobj::adjust_shndx,
11315         Sized_relobj::initializ_input_to_output_maps,
11316         Sized_relobj::free_input_to_output_maps): Change visibilities to
11317         protected.
11318         (Sized_relobj::setup): Virtualize.
11319         (Sized_relobj::do_setup): New method declaration.
11320         (Sized_relobj::invalidate_section_offset,
11321         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
11322         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
11323         * options.cc (parse_int): New function.
11324         * options.h (parse_int): New declaration.
11325         (DEFINE_int): New macro.
11326         (stub_group_size): New option.
11327         * output.cc (Output_section::Output_section): Initialize memebers
11328         merge_section_map_, merge_section_by_properties_map_,
11329         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
11330         (Output_section::add_input_section): Handled deferred code-fill
11331         generation and remove an old comment.
11332         (Output_section::add_relaxed_input_section): New method definition.
11333         (Output_section::add_merge_input_section): Use merge section by
11334         properties map to speed to search.  Update merge section maps
11335         as appropriate.
11336         (Output_section::build_relaxation_map): New method definition.
11337         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11338         Same.
11339         (Output_section::relax_input_section): Renamed to
11340         Output_section::convert_input_sections_to_relaxed_sections and change
11341         interface to take a vector of pointers to relaxed sections.
11342         (Output_section::find_merge_section,
11343         Output_section::find_relaxed_input_section): New method definitions.
11344         (Output_section::is_input_address_mapped,
11345         Output_section::output_offset, Output_section::output_address):
11346         Use output section data maps to speed up searching.
11347         (Output_section::find_starting_output_address): Add comments.
11348         (Output_section::do_write,
11349         Output_section::write_to_postprocessing_buffer): Do code-fill
11350         generation as appropriate.
11351         (Output_section::get_input_sections): Invalidate relaxed input section
11352         map.
11353         (Output_section::restore_states): Adjust type of checkpoint .
11354         Invalidate relaxed input section map.
11355         * output.h (Output_merge_base): New class declaration.
11356         (Input_section_specifier): New class defintion.
11357         (class Output_relaxed_input_section) Change base class to
11358         Output_section_data_build.
11359         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
11360         base class initializer.
11361         (Output_section::add_relaxed_input_section): New method declaration.
11362         (Output_section::Input_section): Change visibility to protected.
11363         (Output_section::Input_section::relobj,
11364         Output_section::Input_section::shndx): Handle relaxed input sections.
11365         Output_section::input_sections) Change visibility to protected.  Also
11366         define overload to return a non-const pointer.
11367         (Output_section::Merge_section_properties): New class defintion.
11368         (Output_section::Merge_section_by_properties_map,
11369         Output_section::Output_section_data_by_input_section_map,
11370         Output_section::Relaxation_map): New types.
11371         (Output_section::relax_input_section): Rename method to
11372         Output_section::convert_input_sections_to_relaxed_sections and change
11373         interface to take a vector of relaxed section pointers.
11374         (Output_section::find_merge_section,
11375         Output_section::find_relaxed_input_section,
11376         Output_section::build_relaxation_map,
11377         Output_section::convert_input_sections_in_list_to_relaxed_sections):
11378         New method declarations.
11379         (Output_section::merge_section_map_
11380         Output_section::merge_section_by_properties_map_,
11381         Output_section::relaxed_input_section_map_,
11382         Output_section::is_relaxed_input_section_map_valid_,
11383         Output_section::generate_code_fills_at_write_): New data members.
11384         * script-sections.cc
11385         (Output_section_element_input::set_section_addresses): Call
11386         current_data_size and addralign methods of relaxed input sections.
11387         (Orphan_output_section::set_section_addresses): Call current_data_size
11388         and addralign methods of relaxed input sections.
11389         * symtab.cc (Symbol_table::compute_final_value): Extract template
11390         from the body of Symbol_table::sized_finalize_symbol.
11391         (Symbol_table::sized_finalized_symbol): Call
11392         Symbol_table::compute_final_value.
11393         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
11394         (Symbol_table::compute_final_value): New templated method declaration.
11395         * target.cc (Target::do_make_output_section): New method defintion.
11396         * target.h (Target::make_output_section): New method declaration.
11397         (Target::relax): Add more parameters for input objects, symbol table
11398         and layout.  Adjust call to do_relax.
11399         (Target::do_make_output_section): New method declaration.
11400         (Target::do_relax): Add parameters for input objects, symbol table
11401         and layout.
11402
11403 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11404
11405         * pread.c: Include stdio.h.
11406
11407 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11408
11409         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
11410         defined.
11411
11412 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11413
11414         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
11415         Change read_shndx type to unsigned int.
11416         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11417         int.
11418         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11419         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
11420         Change read_shndx type to unsigned int.
11421         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11422         int.
11423         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11424         * layout.cc (Layout::create_symtab_sections): Cast the result of
11425         local_symcount * symsize to off_t in the gold_assert.
11426
11427 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11428
11429         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
11430         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
11431         R_ARM_BASE_ABS.
11432         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
11433         (Arm_relocate_functions::thm_abs5): New function.
11434         (Arm_relocate_functions::abs12): New function.
11435         (Arm_relocate_functions::abs16): New function.
11436         (Arm_relocate_functions::base_abs): New function.
11437         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
11438         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
11439         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
11440         R_ARM_BASE_ABS.
11441         (Scan::global): Likewise.
11442         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
11443         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
11444         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
11445         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
11446         R_ARM_BASE_ABS.
11447
11448 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11449
11450         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
11451         (Arm_relocate_functions::movt_prel): New function.
11452         (Arm_relocate_functions::thm_movw_prel_nc): New function.
11453         (Arm_relocate_functions::thm_movt_prel): New function.
11454         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
11455         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
11456         (Scan::global, Relocate::relocate): Likewise.
11457         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11458
11459 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11460
11461         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
11462         Incremental_checker.
11463         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
11464         unsigned int.
11465         (class Incremental_inputs_header): New class.
11466         (Incremental_inputs_header_writer): Edit comment.
11467         (Incremental_inputs_entry): New class.
11468         (Incremental_inputs_entry_writer): Edit comment.
11469         (Sized_incremental_binary::do_find_incremental_inputs_section):
11470         Add *strtab_shndx parameter, fill it.
11471         (Sized_incremental_binary::do_check_inputs): New method.
11472         (Incremental_checker::can_incrementally_link_output_file): Use
11473         Sized_incremental_binary::check_inputs.
11474         (Incremental_inputs::report_command_line): Save command line in
11475         command_line_.
11476         * incremental.h:
11477         (Incremental_binary::find_incremental_inputs_section): New
11478         method.
11479         (Incremental_binary::do_find_incremental_inputs_section): Add
11480         strtab_shndx parameter.
11481         (Incremental_binary::do_check_inputs): New pure virtual method.
11482         (Sized_incremental_binary::do_check_inputs): Declare.
11483         (Incremental_checker::Incremental_checker): Add incremental_inputs
11484         parameter, use it to initialize incremental_inputs_.
11485         (Incremental_checker::incremental_inputs_): New field.
11486         (Incremental_checker::command_line): New method.
11487         (Incremental_checker::inputs): New method.
11488         (Incremental_checker::command_line_): New field.
11489
11490 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11491
11492         * incremental.cc: Include <cstdarg> and "target-select.h".
11493         (vexplain_no_incremental): New function.
11494         (explain_no_incremental): New function.
11495         (Incremental_binary::error): New method.
11496         (Sized_incremental_binary::do_find_incremental_inputs_section): New
11497         method.
11498         (make_sized_incremental_binary): New function.
11499         (open_incremental_binary): New function.
11500         (can_incrementally_link_file): Add checks if output is ELF and has
11501         inputs section.
11502         * incremental.h: Include "elfcpp_file.h" and "output.h".
11503         (Incremental_binary): New class.
11504         (Sized_incremental_binary): New class.
11505         (open_incremental_binary): Declare.
11506         * object.cc (is_elf_object): Use
11507         elfcpp::Elf_recognizer::is_elf_file.
11508         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
11509         * output.h (Output_file::filesize): New method.
11510
11511 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11512
11513         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
11514         New function.
11515         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
11516         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
11517         function.
11518         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
11519         function.
11520         (Arm_relocate_functions::movw_abs_nc): New function.
11521         (Arm_relocate_functions::movt_abs): New function.
11522         (Arm_relocate_functions::thm_movw_abs_nc): New function.
11523         (Arm_relocate_functions::thm_movt_abs): New function.
11524         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
11525         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
11526         (Scan::global): Likewise.
11527         (Relocate::relocate): Likewise.
11528         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11529
11530 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11531
11532         * arm.cc (Arm_relocate_functions::got_prel) New function.
11533         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
11534         (Relocate::relocate): Likewise.
11535         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11536
11537 2009-10-06  Ian Lance Taylor  <iant@google.com>
11538
11539         * options.h (class General_options): Define
11540         split_stack_adjust_size parameter.
11541         * object.h (class Object): Add uses_split_stack_ and
11542         has_no_split_stack_ fields.  Add uses_split_stack and
11543         has_no_split_stack accessor functions.  Declare
11544         handle_split_stack_section.
11545         (class Reloc_symbol_changes): Define.
11546         (class Sized_relobj): Define Function_offsets.  Declare
11547         split_stack_adjust, split_stack_adjust_reltype, and
11548         find_functions.
11549         * object.cc (Object::handle_split_stack_section): New function.
11550         (Sized_relobj::do_layout): Call handle_split_stack_section.
11551         * dynobj.cc (Sized_dynobj::do_layout): Call
11552         handle_split_stack_section.
11553         * reloc.cc (Sized_relobj::relocate_sections): Call
11554         split_stack_adjust for executable sections in split_stack
11555         objects.  Pass reloc_map to relocate_section.
11556         (Sized_relobj::split_stack_adjust): New function.
11557         (Sized_relobj::split_stack_adjust_reltype): New function.
11558         (Sized_relobj::find_functions): New function.
11559         * target-reloc.h: Include "object.h".
11560         (relocate_section): Add reloc_symbol_changes parameter.  Change
11561         all callers.
11562         * target.h (class Target): Add calls_non_split method.  Declare
11563         do_calls_non_split virtual method.  Declare match_view and
11564         set_view_to_nop.
11565         * target.cc: Include "elfcpp.h".
11566         (Target::do_calls_non_split): New function.
11567         (Target::match_view): New function.
11568         (Target::set_view_to_nop): New function.
11569         * gold.cc (queue_middle_tasks): Give an error if mixing
11570         split-stack and non-split-stack objects with -r.
11571         * i386.cc (Target_i386::relocate_section): Add
11572         reloc_symbol_changes parameter.
11573         (Target_i386::do_calls_non_split): New function.
11574         * x86_64.cc (Target_x86_64::relocate_section): Add
11575         reloc_symbol_changes parameter.
11576         (Target_x86_64::do_calls_non_split): New function.
11577         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
11578         parameter.
11579         * powerpc.cc (Target_powerpc::relocate_section): Add
11580         reloc_symbol_changes parameter.
11581         * sparc.cc (Target_sparc::relocate_section): Add
11582         reloc_symbol_changes parameter.
11583         * configure.ac: Call AM_CONDITIONAL for the default target.
11584         * configure: Rebuild.
11585         * testsuite/Makefile.am (TEST_AS): New variable.
11586         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
11587         (check_DATA): Add split_i386 and split_x86_64 files.
11588         (SPLIT_DEFSYMS): Define.
11589         (split_i386_[1234n].o): New targets.
11590         (split_i386_[124]): New targets.
11591         (split_i386_[1234r].stdout): New targets.
11592         (split_x86_64_[1234n].o): New targets.
11593         (split_x86_64_[124]): New targets.
11594         (split_x86_64_[1234r].stdout): New targets.
11595         (MOSTLYCLEANFILES): Add new executables.
11596         * testsuite/split_i386.sh: New file.
11597         * testsuite/split_x86_64.sh: New file.
11598         * testsuite/split_i386_1.s: New file.
11599         * testsuite/split_i386_2.s: New file.
11600         * testsuite/split_i386_3.s: New file.
11601         * testsuite/split_i386_4.s: New file.
11602         * testsuite/split_i386_n.s: New file.
11603         * testsuite/split_x86_64_1.s: New file.
11604         * testsuite/split_x86_64_2.s: New file.
11605         * testsuite/split_x86_64_3.s: New file.
11606         * testsuite/split_x86_64_4.s: New file.
11607         * testsuite/split_x86_64_n.s: New file.
11608         * testsuite/testfile.cc (Target_test): Update relocation_section
11609         function.
11610         * testsuite/Makefile.in: Rebuild.
11611
11612 2009-10-06  Ian Lance Taylor  <iant@google.com>
11613
11614         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
11615         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
11616         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
11617         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
11618         the address on ldo_addrs_.
11619         (Target_i386::Relocate::fix_up_ldo): New function.
11620
11621 2009-10-06   Rafael Espindola  <espindola@google.com>
11622
11623         * plugin.cc (add_input_library): New.
11624         (Plugin::load): Add add_input_library to tv.
11625         (Plugin_manager::add_input_file): Add the is_lib argument.
11626         (add_input_file): Update call to Plugin_manager::add_input_file.
11627         (add_input_library): New.
11628         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
11629
11630 2009-09-30  Doug Kwan  <dougkwan@google.com>
11631
11632         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
11633         symbol and call Symbol::may_need_copy_reloc to determine if
11634         a copy reloc is needed.
11635         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
11636         nocopyreloc is given in command line.
11637         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
11638         given in command line.
11639         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
11640         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
11641         of the removed Target_i386::may_need_copy_reloc.
11642         * options.h (copyreloc): New option with default value false.
11643         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11644         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
11645         instead of the removed Target_powerpc::may_need_copy_reloc.
11646         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11647         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
11648         instead of the removed Target_sparc::may_need_copy_reloc.
11649         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
11650         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
11651         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
11652         instead of the removed Target_x86_64::may_need_copy_reloc.
11653
11654 2009-09-30  Ian Lance Taylor  <iant@google.com>
11655
11656         * object.h (class Object): Remove target_ field, and target,
11657         sized_target, and set_target methods.
11658         (Object::sized_target): Remove.
11659         (class Sized_relobj): Update declarations.  Remove sized_target.
11660         * object.cc (Sized_relobj::setup): Remove target parameter.
11661         Change all callers.
11662         (Input_objects::add_object): Don't do anything with the target.
11663         (make_elf_sized_object): Add punconfigured parameter.  Change all
11664         callers.  Set or test parameter target.
11665         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
11666         Change all callers.
11667         * parameters.cc (Parameters::set_target): Change parameter type to
11668         be non-const.
11669         (Parameters::default_target): Remove.
11670         (set_parameters_target): Change parameter type to be non-const.
11671         (parameters_force_valid_target): New function.
11672         (parameters_clear_target): New function.
11673         * parameters.h (class Parameters): Update declarations.  Remove
11674         default_target method.  Add sized_target and clear_target
11675         methods.  Change target_ to be non-const.
11676         (set_parameters_target): Update declaration.
11677         (parameters_force_valid_target): Declare.
11678         (parameters_clear_target): Declare.
11679         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
11680         as NULL if we aren't searching.
11681         (Add_symbols::run): Don't check for compatible target.
11682         * fileread.cc (Input_file::open_binary): Call
11683         parameters_force_valid_target.
11684         * gold.cc (queue_middle_tasks): Likewise.
11685         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
11686         set_target on object.
11687         * dynobj.h (class Sized_dynobj): Update declarations.
11688         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
11689         make_elf_object returns NULL.
11690         (Archive::include_member): Don't check whether object target is
11691         compatible.
11692         * output.cc (Output_section::add_input_section): Get target from
11693         parameters.
11694         (Output_section::relax_input_section): Likewise.
11695         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
11696         parameters.
11697         (Sized_relobj::do_scan_relocs): Likewise.
11698         (Sized_relobj::relocate_sections): Likewise.
11699         * resolve.cc (Symbol_table::resolve): Likewise.
11700         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
11701         parameter.  Change all callers.
11702         (Symbol_table::add_from_object): Get target from parameters.
11703         (Symbol_table::add_from_relobj): Don't check object target.
11704         (Symbol_table::add_from_dynobj): Likewise.
11705         (Symbol_table::define_special_symbol): Get target from
11706         parameters.
11707         * symtab.h (class Symbol_table): Update declaration.
11708         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
11709         parameter.  Change all callers.  Clear parameter target.
11710         (Binary_test): Test target here.
11711         * testsuite/object_unittest.cc (gold_testsuite): Remove
11712         target_test_pointer parameter.  Change all callers.
11713         (Object_test): Test target here.
11714
11715 2009-09-26  Ian Lance Taylor  <iant@google.com>
11716
11717         * testsuite/initpri1.c: Don't try to use constructor priorities if
11718         compiling with gcc before 4.3.
11719
11720 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
11721
11722         * testsuite/retain_symbols_file_test.sh (check_present): Change
11723         output file name to retain_symbols_file_test.stdout.
11724         (check_absent): Likewise.
11725
11726 2009-09-18  Craig Silverstein  <csilvers@google.com>
11727
11728         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
11729         * options.cc: Include <cerrno> and <fstream>.
11730         (General_options::finalize): Parse -retain-symbols-file tag.
11731         * options.h: New flag.
11732         (General_options): New method should_retain_symbol, new
11733         variable symbols_to_retain.
11734         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
11735         should_retain_symbol map.
11736         * testsuite/Makefile.am (retain_symbols_file_test): New test.
11737         * testsuite/Makefile.in: Regenerate.
11738         * testsuite/retain_symbols_file_test.sh: New file.
11739
11740 2009-09-18  Nick Clifton  <nickc@redhat.com>
11741
11742         * po/es.po: Updated Spanish translation.
11743
11744 2009-09-17  Doug Kwan  <dougkwan@google.com>
11745
11746         * debug.h (DEBUG_RELAXATION): New constant.
11747         (DEBUG_ALL): Add DEBUG_RELAXATION.
11748         (debug_string_to_enum): Add relaxation debug option.
11749         * layout.cc
11750         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
11751         Layout::Relaxation_debug_check::read_sections,
11752         Layout::Relaxation_debug_check::read_sections): New method definitions.
11753         (Layout::Layout): Initialize data members
11754         record_output_section_data_from_scrips_,
11755         script_output_section_data_list_ and relaxation_debug_check_.
11756         (Layout::save_segments, Layout::restore_segments,
11757         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11758         Layout::relaxation_loop_body): New method definitions.
11759         (Layout::finalize): Support relaxation.  Move section layout code to
11760         Layout::relaxation_loop_body.
11761         (Layout::set_asection_address_from_script): Move code for orphan
11762         section placement out.
11763         (Layout::place_orphan_sections_in_script): New method definition.
11764         * layout.h (Output_segment_headers, Output_file_header):
11765         New forward class declarations.
11766         (Layout::~Layout): Define.
11767         (Layout::new_output_section_data_from_script): New method definition.
11768         (Layout::place_orphan_sections_in_script): New method declaration.
11769         (Layout::Segment_states): New type declaration.
11770         (Layout::save_segments, Layout::restore_segments,
11771         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11772         Layout::relaxation_loop_body): New method declarations.
11773         (Layout::Output_section_data_list): New type declaration.
11774         (Layout::Relaxation_debug_check): New class definition.
11775         (Layout::record_output_section_data_from_script_,
11776         Layout::script_output_section_data_list_, Layout::segment_states_,
11777         Layout::relaxation_debug_check_): New data members.
11778         * output.cc: (Output_section_headers::do_size): New method definition.
11779         (Output_section_headers::Output_section_headers): Move size
11780         computation to Output_section_headers::do_size.
11781         (Output_segment_headers::do_size): New method definition.
11782         (Output_file_header::Output_file_header): Move size computation to
11783         Output_file_header::do_size and call it.
11784         (Output_file_header::do_size): New method definition.
11785         (Output_data_group::Output_data_group): Adjust call to
11786         Output_section_data.
11787         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
11788         (Output_symtab_xindex::do_write): Add array bound check.
11789         (Output_section::Input_section::print_to_mapfile): Handle
11790         RELAXED_INPUT_SECTION_CODE.
11791         (Output_section::Output_section): Initialize data member checkpoint_.
11792         (Output_section::~Output_section): Delete checkpoint object pointed
11793         by checkpoint_.
11794         (Output_section::add_input_section): Always add an Input_section if
11795         relaxing.
11796         (Output_section::add_merge_input_section): Add assert.
11797         (Output_section::relax_input_section): New method definition.
11798         (Output_section::set_final_data_size): Set load address to zero for
11799         an unallocated section.
11800         (Output_section::do_address_and_file_offset_have_reset_values):
11801         New method definition.
11802         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
11803         Handle relaxed input section.
11804         (Output_section::sort_attached_input_sections): Checkpoint input
11805         section list lazily.
11806         (Output_section::get_input_sections): Change type of input_sections to
11807         list of Simple_input_section pointers.  Checkpoint input section list
11808         lazily.  Also handle relaxed input sections.
11809         (Output_section::add_input_section_for_script): Take a reference to
11810         a Simple_input_section object instead of Relobj pointer and section
11811         index as parameter.  Handle relaxed input sections.
11812         (Output_section::save_states, Output_section::restore_states): New
11813         method definitions.
11814         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
11815         (Output_data::is_data_size_fixed): New method definition.
11816         (Output_data::reset_addresss_and_file_offset): Do not reset data size
11817         if it is fixed.
11818         (Output_data::address_and_file_offset_have_reset_values): New method
11819         definition.
11820         (Output_data::do_address_and_file_offset_have_reset_values): New method
11821         definition.
11822         (Output_data::set_data_size): Check that data size is not fixed.
11823         (Output_data::fix_data_size): New method definition.
11824         (Output_data::is_data_size_fixed_): New data member.
11825         (Output_section_headers::set_final_data_size): New method definition.
11826         (Output_section_headers::do_size): New method declaration.
11827         (Output_segment_headers::set_final_data_size): New method definition.
11828         (Output_segment_headers::do_size): New method declaration.
11829         (Output_file_header::set_final_data_size)::New method definition.
11830         (Output_file_header::do_size)::New method declaration.
11831         (Output_section_data::Output_section_data): Add new parameter
11832         is_data_size_fixed and use it to fix data size.
11833         (Output_data_const::Output_data_const): Adjust call to base class
11834         constructor and fix data size.
11835         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
11836         base class constructor and fix data size.
11837         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
11838         base class constructor and fix data size.
11839         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
11840         class constructor and fix data size.
11841         (Output_data_group::set_final_data_size): New method definition.
11842         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
11843         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
11844         class constructor and fix data size.
11845         (Output_relaxed_input_section): New class definition.
11846         (Output_section::Simple_input_section): New class definition.
11847         (Output_section::get_input_sections): Adjust parameter list.
11848         (Output_section::add_input_section_for_script): Same.
11849         (Output_section::save_states, Output_section::restore_states,
11850         Output_section::do_address_and_file_offset_have_reset_values,
11851         (Output_section::Input_section::Input_section): Handle
11852         RELAXED_INPUT_SECTION_CODE.  Add new overload for
11853         Output_relaxed_input_section.
11854         (Output_section::Input_section::is_input_section,
11855         Output_section::Input_section::set_output_section): Handle relaxed
11856         input section.
11857         (Output_section::Input_section::is_relaxed_input_section,
11858         Output_section::Input_section::output_section_data,
11859         Output_section::Input_section::relaxed_input_section): New method
11860         definitions.
11861         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
11862         value.
11863         (Output_section::Input_section::u1_): Update comments.
11864         (Output_section::Input_section::u2_): Add new union member poris.
11865         (Output_section::Checkpoint_output_section): New classs definition.
11866         (Output_section::relax_input_section): New method declaration.
11867         (Output_section::checkpoint_): New data member.
11868         (Output_segment): Update comments.
11869         (Output_segment::Output_segment): Un-privatize copy constructor.
11870         (Output_segment::operator=): Un-privatize.
11871         * script-sections.cc (Output_section_element::Input_section_list):
11872         Change element type to Output_section::Simple_input_section.
11873         (Output_section_element_dot_assignment::set_section_addresses):
11874         Register output section data for relaxation clean up.
11875         (Output_data_exression::Output_data_expression): Adjust call to base
11876         constructor to fix data size.
11877         (Output_section_element_data::set_section_addresses): Register
11878         Output_data_expression object for relaxation clean up.
11879         (struct Input_section_info): Replace Relobj pointer and section index
11880         pair with Output_section::Simple_input_section and Convert struct to a
11881         class.
11882         (Input_section_sorter::operator()): Adjust access to
11883         Input_section_info data member to use accessors.
11884         (Output_section_element_input::set_section_addresses): Use layout
11885         parameter.  Adjust code to use Output_section::Simple_input_section
11886         and Input_secction_info classes.  Register filler for relaxation
11887         clean up.
11888         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
11889         and section index pair with Output_section::Simple_input_section
11890         class.  Adjust code accordingly.
11891         (Phdrs_element::release_segment): New method definition.
11892         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
11893         segment list.
11894         (Script_sections::release_segments): New method definition.
11895         * gold/script-sections.h (Script_sections::release_segments): New
11896         method declaration.
11897         * gold/target.h (Target::may_relax, Target::relax,
11898         Target::do_may_relax, Target::do_relax): New method definitions.
11899
11900 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11901
11902         * arm.cc (has_signed_unsigned_overflow): New function.
11903         (Arm_relocate_functions::abs8): New function.
11904         (Target_arm::Scan::local): Handle R_ARM_ABS8.
11905         (Target_arm::Scan::global): Likewise.
11906         (Target_arm::relocate::relocate): Likewise.
11907         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11908         Likewise.
11909
11910 2009-09-16  Cary Coutant  <ccoutant@google.com>
11911
11912         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
11913         * testsuite/Makefile.in: Regenerate.
11914
11915 2009-09-11  Nick Clifton  <nickc@redhat.com>
11916
11917         * po/gold.pot: Updated by the Translation project.
11918
11919 2009-09-08  Cary Coutant  <ccoutant@google.com>
11920
11921         * output.cc (Output_file::open): Add execute permission to empty file.
11922         * testsuite/Makefile.am (permission_test): New test.
11923         * testsuite/Makefile.in: Regenerate.
11924
11925 2009-09-02  Ian Lance Taylor  <iant@google.com>
11926
11927         * output.cc (Output_file::resize): Call map_no_anonymous rather
11928         than map.
11929
11930 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
11931
11932         * gold.cc: Include "incremental.h".
11933         (queue_initial_tasks): Call Incremental_checker methods.
11934         * incremental.cc: Include "output.h".
11935         (Incremental_checker::can_incrementally_link_output_file): New
11936         method.
11937         * incremental.h (Incremental_checker): New class.
11938
11939         * output.cc (Output_file::open_for_modification): New method.
11940         (Output_file::map_anonymous): Changed return type to bool.  Record
11941         map in base_ field.
11942         (Output_file::map_no_anonymous): New method, broken out of map.
11943         (Output_file::map): Use map_no_anonymous and map_anonymous.
11944         * output.h (class Output_file): Update declarations.
11945
11946 2009-08-24  Cary Coutant  <ccoutant@google.com>
11947
11948         * options.h (Command_line::Pre_options): New class.
11949         (Command_line::pre_options): New member.
11950         * options.cc (gold::options::ready_to_register): New variable.
11951         (One_option::register_option): Do nothing if not registering options.
11952         Assert if same short option registered twice.
11953         (General_options::General_options): Turn off option registration when
11954         done constructing.
11955         (Command_line::Pre_options::Pre_options): New constructor.
11956
11957 2009-08-24  Cary Coutant  <ccoutant@google.com>
11958
11959         * options.h (General_options::no_keep_memory): Remove incorrect
11960         short option.
11961
11962 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11963
11964         * Makefile.am (am__skiplex, am__skipyacc): New.
11965         * Makefile.in: Regenerate.
11966
11967 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11968
11969         * Makefile.am (AM_CPPFLAGS): Renamed from ...
11970         (INCLUDES): ... this.
11971         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
11972         (AM_CPPFLAGS): Renamed from ...
11973         (INCLUDE): ... this.
11974         * Makefile.in, testsuite/Makefile.in: Regenerate.
11975
11976         * Makefile.in: Regenerate.
11977         * aclocal.m4: Likewise.
11978         * config.in: Likewise.
11979         * configure: Likewise.
11980         * testsuite/Makefile.in: Likewise.
11981
11982         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11983         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11984         * Makefile.in: Regenerate.
11985         * testsuite/Makefile.in: Regenerate.
11986
11987 2009-08-19  Cary Coutant  <ccoutant@google.com>
11988
11989         * resolve.cc (Symbol_table::resolve): Don't complain about defined
11990         symbols in shared libraries overridden by hidden or internal symbols
11991         in the main program.
11992
11993 2009-08-19  Chris Demetriou  <cgd@google.com>
11994
11995         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
11996         checking source file names in error messages.
11997
11998 2009-08-18  Doug Kwan  <dougkwan@google.com>
11999
12000         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
12001         an elcpp::Ehdr as parameter.  Adjust call to set_target.
12002         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
12003         an elfcpp::Ehdr as parameter.
12004         * object.cc (Object::set_target): Remove the version that looks up
12005         a target and sets it.
12006         (Sized_relobj::setup): Take a Target object instead of
12007         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
12008         (make_elf_sized_object): Find target and ask target to
12009         make an ELF object.
12010         * object.h: (Object::set_target): Remove the version that looks up
12011         a target and sets it.
12012         (Sized_relobj::setup): Take a Target object instead of
12013         an elfcpp:Ehdr as parameter.
12014         * target.cc: Include dynobj.h.
12015         (Target::do_make_elf_object_implementation): New.
12016         (Target::do_make_elf_object): New.
12017         * target.h (Target::make_elf_object): New template declaration.
12018         (Target::do_make_elf_object): New method declarations.
12019         (Target::do_make_elf_object_implementation): New template declaration.
12020
12021 2009-08-14  Ian Lance Taylor  <iant@google.com>
12022
12023         * gold.h (FUNCTION_NAME): Define.
12024         (gold_unreachable): Use FUNCTION_NAME.
12025
12026 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
12027
12028         * icf.cc (Icf::find_identical_sections): Issue a warning when a
12029         symbol in the --keep-unique list is not found.
12030
12031 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
12032
12033         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
12034         been maked as --keep-unique.
12035         (Icf::unfold_section): New function.
12036         * icf.h (Icf::unfold_section): New function.
12037         * options.h (General_options::keep_unique): New option.
12038         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
12039         * testsuite/Makefile.in: Regenerate.
12040         * testsuite/icf_keep_unique_test.sh: New file.
12041         * testsuite/icf_keep_unique_test.cc: New file.
12042
12043 2009-08-12  Cary Coutant  <ccoutant@google.com>
12044
12045         PR 10471
12046         * resolve.cc (Symbol_table::resolve): Check for references from
12047         dynamic objects to hidden and internal symbols.
12048         * testsuite/Makefile.am (hidden_test.sh): New test.
12049         * testsuite/Makefile.in: Regenerate.
12050         * testsuite/hidden_test.sh: New script.
12051         * testsuite/hidden_test_1.c: New test source.
12052         * testsuite/hidden_test_main.c: New test source.
12053
12054 2009-08-11  Doug Kwan  <dougkwan@google.com>
12055
12056         * arm.cc: Update comments.
12057         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
12058         segment to locate the .ARM.exidx section if present.
12059
12060 2009-08-09  Doug Kwan  <dougkwan@google.com>
12061
12062         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
12063         patch.
12064
12065 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
12066         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
12067         compiler warnings.
12068
12069 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
12070
12071         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
12072         valid tls_segment only for non-debug-section relocations.
12073         * testsuite/Makefile.am: Add gc_tls_test.
12074         * testsuite/Makefile.in: Regenerate.
12075         * testsuite/gc_tls_test.cc: New file.
12076         * testsuite/gc_tls_test.sh: New file.
12077
12078 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
12079
12080         * icf.cc: New file.
12081         * icf.h: New file.
12082         * Makefile.am (CCFILES): Add icf.cc.
12083         (HFILES): Add icf.h
12084         * Makefile.in: Regenerate.
12085         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
12086         * gc.h (gc_process_relocs): Populate lists used by icf to contain
12087         section, symbol and addend information for the relocs.
12088         * gold.cc (queue_middle_tasks): Call identical code folding.
12089         * gold.h: Add defines for multimap.
12090         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
12091         to the call of finalize_local_symbols.
12092         * main.cc (main): Create object of class Icf.
12093         * object.cc (Sized_relobj::do_layout): Allow this function to be
12094         called twice during icf.
12095         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
12096         to sections marked as identical by icf.
12097         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
12098         when available.
12099         (Sized_relobj::do_section_entsize): New function.
12100         * object.h (Object::section_entsize): New function.
12101         (Object::do_section_entsize): New pure virtual function.
12102         (Relobj::finalize_local_symbols): Add new parameter.
12103         (Relobj::do_section_entsize): New function.
12104         * options.h (General_options::icf): New option.
12105         (General_options::icf_iterations): New option.
12106         (General_options::print_icf_sections): New option.
12107         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
12108         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
12109         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
12110         icf.
12111         * symtab.cc (Symbol_table::is_section_folded): New function.
12112         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
12113         to sections marked as identical by icf.
12114         * symtab.h (Symbol_table::set_icf): New function.
12115         (Symbol_table::icf): New function.
12116         (Symbol_table::is_section_folded): New function.
12117         (Symbol_table::icf_): New data member.
12118         * target-reloc.h (relocate_section): Ignore sections folded by icf.
12119         * testsuite/Makefile.am: Add commands to build icf_test.
12120         * testsuite/Makefile.in: Regenerate.
12121         * testsuite/icf_test.sh: New file.
12122         * testsuite/icf_test.cc: New file.
12123
12124 2009-07-24  Chris Demetriou  <cgd@google.com>
12125
12126         * layout.cc (is_compressible_debug_section): Fix incorrect
12127         comment about compressed section names.
12128
12129 2009-07-20  Ian Lance Taylor  <ian@airs.com>
12130
12131         PR 10419
12132         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
12133
12134 2009-07-16  Ian Lance Taylor  <iant@google.com>
12135
12136         PR 10400
12137         * layout.h: #include <map>.
12138         (class Kept_section): Change from struct to class.  Add accessors
12139         and setters.  Add section size to Comdat_group mapping.  Change
12140         Comdat_group to std::map.  Add is_comdat_ field.  Add
12141         linkonce_size field in union.
12142         (class Layout): Update declaration of find_or_add_kept_section.
12143         Don't declare find_kept_object.
12144         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
12145         parameter.  Add object, shndx, is_comdat, and is_group_name
12146         parameters.  Change all callers.  Adjust for new Kept_section.
12147         (Layout::find_kept_object): Remove.
12148         * object.cc (Sized_relobj::include_section_group): Update use of
12149         Kept_section.  Rename secnum to shndx.  Only record
12150         Kept_comdat_section if sections are the same size.
12151         (Sized_relobj::include_linkonce_section): Update use of
12152         Kept_section.  Only record Kept_comdat_section if sections are the
12153         same size.  Set size of linkonce section.
12154         (Sized_relobj::map_to_kept_section): Update call to
12155         get_kept_comdat_section.
12156         * object.h (class Sized_relobj): Rename fields in
12157         Kept_comdat_section to drop trailing underscores; change object
12158         field to Relobj*.  Change Kept_comdat_section_table to store
12159         struct rather than pointer.
12160         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
12161         Add kept_object and kept_shndx parameters.  Change all callers.
12162         (Sized_relobj::get_kept_comdat_section): Change return type to
12163         bool.  Add kept_object and kept_shndx parameters.  Change all
12164         callers.
12165         * plugin.cc (Pluginobj::include_comdat_group): Update call to
12166         Layout::find_or_add_kept_section.
12167
12168 2009-07-09  Ian Lance Taylor  <iant@google.com>
12169
12170         * merge.cc (Object_merge_map::initialize_input_to_output_map):
12171         Reserve space in the hash table.
12172
12173 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
12174
12175         * fileread.cc (File_read::get_mtime): New method.
12176         * fileread.h (Timespec): New structure.
12177         (File_read::get_mtime): New method.
12178         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
12179         Renamed from timestamp_nsec.
12180         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
12181         Elf_Xword.
12182         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
12183         timestamp_nsec.
12184         (Incremental_inputs::report_archive): Save mtime; style fix.
12185         (Incremental_inputs::report_obejct): Save mtime; style fix.
12186         (Incremental_inputs::report_script): Save mtime; style fix.
12187         (Incremental_inputs::finalize_inputs): Style fix.
12188         (Incremental_inputs::finalize): Style fix.
12189         (Incremental_inputs::create_input_section_data): Store inputs
12190         mtime.
12191         * incremental.h (Incremental_inputs::report_script): Add mtime
12192         argument.
12193         (Incremental_inputs::Input_info::Input_info): Intialize only one
12194         union member.
12195         (Incremental_inputs::Input_info::archive): Move to nameless
12196         union.
12197         (Incremental_inputs::Input_info::obejct): Move to nameless union.
12198         (Incremental_inputs::Input_info::script): Move to nameless union.
12199         (Incremental_inputs::mtime): New field.
12200         * script.cc (read_input_script): Pass file mtime to
12201         Incremental_input.
12202         * script.h (Script_info::inputs): Style fix.
12203
12204 2009-07-01  Ian Lance Taylor  <ian@airs.com>
12205
12206         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
12207         instead of 32.
12208
12209 2009-06-24  Ian Lance Taylor  <iant@google.com>
12210
12211         PR 10156
12212         * layout.cc (Layout::choose_output_section): If we find an
12213         existing section, update the flags.
12214         (Layout::create_notes): New function, broken out of
12215         Layout::finalize.
12216         (Layout::finalize): Don't create note sections.
12217         (Layout::create_note): Don't crash if linker script discards
12218         section.
12219         (Layout::create_gold_note): Likewise.
12220         (Layout::create_build_id): Likewise.  Don't set
12221         after_input_sections on the section.
12222         (Layout::create_executable_stack_info): Remove target parameter.
12223         Change caller.
12224         * layout.h (class Layout): Declare create_notes.  Update
12225         declaration of create_executable_stack_info.
12226         * gold.cc (queue_middle_tasks): Call create_notes.
12227         * output.cc (Output_section::update_flags_for_input_section): Move
12228         here from output.h.  If SHF_ALLOC flag is newly set, mark address
12229         invalid.
12230         * output.h (Output_data::mark_address_invalid): New function.
12231         (class Output_section): Only declare, not define,
12232         update_flags_for_input_section.  Remove set_flags.
12233
12234 2009-06-24  Ian Lance Taylor  <iant@google.com>
12235
12236         * script-sections.cc (Output_section_definition::
12237         set_section_addresses): Rename shadowing local load_address to
12238         laddr.
12239
12240 2009-06-24  Ian Lance Taylor  <iant@google.com>
12241
12242         PR 10244
12243         * reloc.cc (relocate_sections): Skip empty relocation sections.
12244
12245 2009-06-23  Ian Lance Taylor  <iant@google.com>
12246
12247         PR 10156
12248         * layout.cc (Layout::create_note): Use choose_output_section
12249         rather than make_output_section.
12250
12251 2009-06-23  Ian Lance Taylor  <iant@google.com>
12252
12253         PR 10237
12254         * options.cc (General_options::parse_V): Set printed_version_.
12255         (General_options::General_options): Initialize printed_version_.
12256         * options.h (class General_options): Add printed_version_ field.
12257         * gold.cc (queue_initial_tasks): If there are no input files,
12258         don't give a fatal error if we printed the version information.
12259         (queue_middle_tasks): If using -r with a shared object, give a
12260         fatal error rather than an ordinary error.
12261
12262 2009-06-23  Ian Lance Taylor  <iant@google.com>
12263
12264         PR 10219
12265         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
12266         (Layout::make_output_section): Set have_stabstr_section_ if we see
12267         a .stab*str section.
12268         (Layout::finalize): Call link_stabs_sections.
12269         (Layout::link_stabs_sections): New file.
12270         * layout.h (class Layout): Add have_stabstr_section_ field.
12271         Declare link_stabs_sections.
12272
12273 2009-06-23  Doug Kwan  <dougkwan@google.com>
12274
12275         * Makefile.am (libgold_a_LIBADD): New.
12276         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
12277         * Makefile.in: Regenerate.
12278         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
12279         * configure: Regenerate.
12280         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
12281         * fileread.cc: Include sys/state.h
12282         * gold.h: Declare memmem and strndup if found missing.
12283         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
12284
12285 2009-06-23  Ian Lance Taylor  <iant@google.com>
12286
12287         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
12288         * configure: Rebuild.
12289
12290 2009-06-23  Ian Lance Taylor  <iant@google.com>
12291
12292         PR 10147
12293         * object.cc (Object::section_contents): Don't try to get a view if
12294         the section has length zero.
12295         (Object::handle_gnu_warning_section): If the section is empty, use
12296         the name of the section as the warning.
12297
12298 2009-06-23  Ian Lance Taylor  <iant@google.com>
12299
12300         PR 10133
12301         * stringpool.h (class Stringpool_template): Add optimize_ field.
12302         (Stringpool_template::set_optimize): New function.
12303         * stringpool.cc (Stringpool_template::Stringpool_template):
12304         Initialize optimize_ field.
12305         (Stringpool_template::set_string_offsets): Test local optimize
12306         fild rather than parameter.
12307         * layout.cc (Layout::Layout): Call set_optimize on the section
12308         name stringpool.
12309
12310 2009-06-22  Ian Lance Taylor  <iant@google.com>
12311
12312         PR 10030
12313         * yyscript.y: Parse TARGET.
12314         * script.cc (script_set_target): New function.
12315         * script-c.h (script_set_target): Declare.
12316         * options.cc (General_options::string_to_object_format): Rename
12317         from string_to_object_format in anonymous namespace.  Change
12318         callers.
12319         * options.h (class General_options): Declare
12320         string_to_object_format.
12321
12322 2009-06-22  Ian Lance Taylor  <iant@google.com>
12323
12324         * script-sections.cc (Script_sections::create_segments): Don't put
12325         program headers in a PT_LOAD segment if -n or -N.
12326
12327 2009-06-22  Ian Lance Taylor  <iant@google.com>
12328
12329         PR 10141
12330         * options.h (class General_options): Add -z lazy and -z now.  Sort
12331         -z options into alphabetical order.
12332         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
12333
12334 2009-06-21  Ian Lance Taylor  <iant@google.com>
12335
12336         * layout.cc (Layout::make_output_section): Call
12337         Target::new_output_section.
12338         (Layout::attach_allocated_section_to_segment): Put large section
12339         sections in a separate load segment with the large segment flag
12340         set.
12341         (Layout::segment_precedes): Sort large data segments after other
12342         load segments.
12343         (align_file_offset): New static function.
12344         (Layout::set_segment_offsets): Use align_file_offset.
12345         * output.h (class Output_section): Add is_small_section_ and
12346         is_large_section_ fields.
12347         (Output_section::is_small_section): New function.
12348         (Output_section::set_is_small_section):  New function.
12349         (Output_section::is_large_section): New function.
12350         (Output_section::set_is_large_section): New function.
12351         (Output_section::is_large_data_section): New function.
12352         (class Output_segment): Add is_large_data_segment_ field.
12353         (Output_segment::is_large_data_segment): New function.
12354         (Output_segment::set_is_large_data_segment): New function.
12355         * output.cc (Output_section::Output_section): Initialize new
12356         fields.
12357         (Output_segment::Output_segment): Likewise.
12358         (Output_segment::add_output_section): Add assertion that large
12359         data sections always go in large data segments.  Force small data
12360         sections to the end of the list of data sections.  Force small BSS
12361         sections to the start of the list of BSS sections.  For large BSS
12362         sections to the end of the list of BSS sections.
12363         * symtab.h (class Symbol): Declare is_common_shndx.
12364         (Symbol::is_defined): Check Symbol::is_common_shndx.
12365         (Symbol::is_common): Likewise.
12366         (class Symbol_table): Define enum Commons_section_type.  Update
12367         declarations.  Add small_commons_ and large_commons_ fields.
12368         * symtab.cc (Symbol::is_common_shndx): New function.
12369         (Symbol_table::Symbol_table): Initialize new fields.
12370         (Symbol_table::add_from_object): Put small and large common
12371         symbols in the right list.
12372         (Symbol_table::sized_finalized_symbol): Check
12373         Symbol::is_common_shndx.
12374         (Symbol_table::sized_write_globals): Likewise.
12375         * common.cc (Symbol_table::do_allocate_commons): Allocate new
12376         common symbol lists.  Don't call do_allocate_commons_list if the
12377         list is empty.
12378         (Symbol_table::do_allocate_commons_list): Remove is_tls
12379         parameter.  Add comons_section_type parameter.  Change all
12380         callers.  Handle small and large common symbols.
12381         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
12382         Symbol::is_common_shndx.
12383         * resolve.cc (symbol_to_bits): Likewise.
12384         * target.h (Target::small_common_shndx): New function.
12385         (Target::small_common_section_flags): New function.
12386         (Target::large_common_shndx): New function.
12387         (Target::large_common_section_flags): New function.
12388         (Target::new_output_section): New function.
12389         (Target::Target_info): Add small_common_shndx, large_common_shndx,
12390         small_common_section_flags, and large_common_section_flags
12391         fields.
12392         (Target::do_new_output_section): New virtual function.
12393         * arm.cc (Target_arm::arm_info): Initialize new fields.
12394         * i386.cc (Target_i386::i386_info): Likewise.
12395         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
12396         Likewise.
12397         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
12398         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12399         (Target_x86_64::do_new_output_section): New function.
12400         * configure.ac: Define conditional MCMODEL_MEDIUM.
12401         * testsuite/Makefile.am (check_PROGRAMS): Add large.
12402         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
12403         (large_LDFLAGS): Define.
12404         * testsuite/large.c: New file.
12405         * testsuite/testfile.cc (Target_test::test_target_info):
12406         Initialize new fields.
12407         * configure, testsuite/Makefile.in: Rebuild.
12408
12409 2009-06-05  Doug Kwan  <dougkwan@google.com>
12410
12411         * Makefile.am (CCFILES): Add target.cc.
12412         * Makefile.in: Regenerate.
12413         * i386.cc (class Target_i386): Define new virtual method to
12414         override do_is_local_label_name in parent.
12415         * object.cc (Sized_relobj::do_count_local_symbols): Discard
12416         local symbols if --discard-locals or -X is given.
12417         * options.h (class General_options): Declare new options
12418         '--discard-locals' and '-X' for discarding locals.
12419         * target.h (class Target): Define new methods is_local_label_name.
12420         Declare new virtual method do_is_local_label_name.
12421         * target.cc: New file.
12422         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
12423         (check_SCRIPTS): Add discard_locals_test.sh.
12424         (check_DATA): Add discard_local_tests.syms.
12425         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
12426         (discard_local_tests.syms, discard_locals_test.o): New make rules.
12427         * testsuite/Makefile.in: Regenerate.
12428         * testsuite/discard_locals_test.c: New file.
12429         * testsuite/discard_locals_test.sh: Same.
12430
12431 2009-06-05  Doug Kwan  <dougkwan@google.com>
12432
12433         * object.cc (Sized_relobj::Sized_relobj): Initialize
12434         discarded_eh_frame_shndx_ to -1U.
12435         (Sized_relobj::do_layout): Record index of a discard .eh_frame
12436         section.
12437         (Sized_relobj::do_count_local_symbols): Skip local symbols in
12438         a discarded .eh_frame section.
12439         (Sized_relobj::do_finalize_local_symbols): Ditto.
12440         * object.h (class Sized_relobj): Declare new member
12441         discarded_eh_frame_shndx_.
12442         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
12443         (local_labels_test.o, local_labels_test): New rules.
12444         * testsuite/Makefile.in: Regenerate.
12445
12446 2009-06-04  Doug Kwan  <dougkwan@google.com>
12447
12448         * layout.cc (Layout::section_name_mapping): Add mapping for
12449         special ARM sections.
12450
12451 2009-06-03  Doug Kwan  <dougkwan@google.com>
12452
12453         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
12454         (utils::has_overflow): Same.
12455
12456 2009-06-03  Ian Lance Taylor  <iant@google.com>
12457
12458         * layout.cc (Layout::section_name_mapping): New array, replacing
12459         Layout::linkonce_mapping.
12460         (Layout::section_name_mapping_count): New variable, replacing
12461         Layout::linkonce_mapping_count.
12462         (Layout::linkonce_output_name): Remove.
12463         (Layout::output_section_name): Rewrite.
12464         * layout.h (class Layout): Rename Linkonce_mapping to
12465         Section_name_mapping, linkonce_mapping to section_name_mapping,
12466         linkonce_mapping_count to section_name_mapping_count.  Don't
12467         declare linkonce_output_name.
12468
12469 2009-06-03  Doug Kwan  <dougkwan@google.com>
12470
12471         * gold/arm.cc (namespace utils): New.
12472         (Target_arm::reloc_is_non_pic): Define new method.
12473         (class Arm_relocate_functions): New.
12474         (Target_arm::Relocate::relocate): Handle relocation types used by
12475         Android.
12476
12477 2009-06-03  Ian Lance Taylor  <iant@google.com>
12478
12479         * arm.cc (Target_arm::scan::global): Use || instead of |.
12480
12481 2009-06-02  Doug Kwan  <dougkwan@google.com>
12482
12483         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
12484         issued_non_pic_error_.
12485         (class Target_arm::Scan): Declare new method check_non_pic.
12486         Define new method symbol_needs_plt_entry.
12487         Declare new data member issued_non_pic_error_.
12488         (class Target_arm::Relocate): Declare new method
12489         should_apply_static_reloc.
12490         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
12491         (Target_arm::Scan::check_non_pic): Define new method.
12492         (Target_arm::Scan::local): Handle a small subset of reloc types used
12493         by Android.
12494         (Target_arm::Scan::local): Same.
12495         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
12496
12497 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
12498
12499         * incremental.cc (Incremental_inputs::report_command_line): Filter
12500         out --incremental-* options.
12501
12502 2009-05-29  Doug Kwan  <dougkwan@google.com>
12503
12504         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
12505         template class.
12506         (class Target_arm): Update comment.
12507         (Target_arm::Target_arm): Initialize new data members GOT_,
12508         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
12509         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
12510         and Target_arm::rel_dyn_section.
12511         Declare new_enum Target_arm::Got_type.
12512         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
12513         and DYNBSS_.
12514         Update commments for member do_dynsym_value.
12515         (Target_arm::got_size, Target_arm::plt_section,
12516         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
12517         new methods inside class defintion.
12518         (Target_arm::got_section): Define new method.
12519         (Target_arm::rel_dyn_section): Same.
12520         (Output_data_plt_arm): New template class.
12521         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
12522         (Output_data_plt_arm:do_adjust_output_section): Define new method.
12523         (Output_data_plt_arm::add_entry): Same.
12524         (Output_data_plt_arm::first_plt_entry): Define new
12525         static data member for PLT instruction template.
12526         (Output_data_plt_arm::plt_entry): Same.
12527         (Output_data_plt_arm::do_write): Define new method.
12528         (Target_arm::make_plt_entry): Same.
12529         (Target_arm::do_finalize_sections): Same.
12530         (Target_arm::do_dynsym_value): Same.
12531
12532 2009-05-28  Doug Kwan  <dougkwan@google.com>
12533
12534         * Makefile.am (TARGETSOURCES): Add arm.cc.
12535         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
12536         * Makefile.in: Regenerate.
12537         * arm.cc: New file.
12538         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
12539
12540 2009-05-26  Doug Kwan  <dougkwan@google.com>
12541
12542         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
12543         (General_options::check_excluded_libs): Strip off directories in
12544         archive name before matching like GNU ld does.
12545         * testsuite/Makefile.am (MOSTLYCLEANFILES,
12546         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
12547         (exclude_libs_test_LDFLAGS): Add linker option
12548         -Wl,--exclude-libs,libexclude_libs_test_3
12549         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
12550         an explicit archive without using -l.
12551         (alt/libexclude_libs_test_3.a): New make rule.
12552         * testsuite/Makefile.in: Regenerate.
12553         * testsuite/exclude_libs_test.c : Declare lib3_default().
12554         (main): Call it.
12555         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
12556         * exclude_libs_test_3.c: New file.
12557
12558 2009-05-26  Nick Clifton  <nickc@redhat.com>
12559
12560         * po/id.po: New Indonesian translation.
12561         * po/gold.pot: Updated template file.
12562
12563 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
12564
12565         * testsuite/Makefile.am: Add -ffunction-sections to compile
12566         gc_comdat_test files.  Add -Wl,--gc-sections to build
12567         gc_comdat_test.
12568         * testsuite/Makefile.in: Regenerate.
12569         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
12570
12571 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
12572
12573         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
12574         kept comdat section was garbage collected.
12575         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
12576         * testsuite/Makefile.in: Regenerate.
12577         * testsuite/gc_comdat_test.sh: New file.
12578         * testsuite/gc_comdat_test_1.cc: New file.
12579         * testsuite/gc_comdat_test_2.cc: New file.
12580
12581 2009-05-19  Doug Kwan  <dougkwan@google.com>
12582
12583         * archive.cc (Archive::Archive): Move constructor from archive.h
12584         to here.  Initialize no_export_.
12585         (Archive::get_elf_object_for_member): Set no_export flag of object.
12586         * archive.h (Archive::Archive): Move constructor body to
12587         archive.cc.
12588         (Archive::no_export): New method.
12589         (Archive::no_export_): New field.
12590         * object.h (Object::Object): Initialize no_export_ to false.
12591         (Object::no_export, Object::set_no_export): New methods.
12592         (Object::no_export_): New field.
12593         * options.cc (General_options::parse_exclude_libs): New method.
12594         (General_options::check_excluded_libs) Same.
12595         * options.h (exclude_libs): New option.
12596         (General_options::check_excluded_libs): New method declaration.
12597         (General_options::excluded_libs_): New field.
12598         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
12599         default or protected visibility if an object has no-export flag set.
12600         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
12601         (check_SCRIPTS): Add exclude_libs_test.sh.
12602         (check_DATA): Add exclude_libs_test.syms.
12603         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
12604         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
12605         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
12606         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
12607         (exclude_libs_test.syms, libexclude_libs_test_1.a,
12608         libexclude_libs_test_2.a): New rules.
12609         * testsuite/Makefile.in: Regenerate.
12610         * testsuite/exclude_libs_test.c: New file.
12611         * testsuite/exclude_libs_test.sh: Ditto.
12612         * testsuite/exclude_libs_test_1.c: Ditto.
12613         * testsuite/exclude_libs_test_2.c: Ditto.
12614
12615 2009-05-15  Ian Lance Taylor  <iant@google.com>
12616
12617         * configure.ac: Check for declarations for cases where libiberty.h
12618         checks HAVE_DECL_xxx.
12619         * configure, config.in: Rebuild.
12620
12621 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
12622
12623         * gold.h (Incremental_argument_list): Remove (invalid) forward
12624         declaration.
12625         * incremental.cc (Incremental_inputs::report_achive): New method.
12626         (Incremental_inputs::report_object): New method.
12627         (Incremental_inputs::report_script): New method.
12628         (Incremental_inputs::finalize_inputs): New method.
12629         (Incremental_inputs::finalize): Call finalize_inputs().
12630         (Incremental_inputs::sized_create_incremental_inputs_section_data):
12631         Create inputs entries.
12632         * incremental.h (Incremental_input_type): New enum.
12633         (Incremental_inputs::Incremental_input): Initialize new fields.
12634         (Incremental_inputs::report_inputs): New method.
12635         (Incremental_inputs::report_achive): New method.
12636         (Incremental_inputs::report_object): New method.
12637         (Incremental_inputs::report_script): New method.
12638         (Incremental_inputs::finalize_inputs): New method.
12639         (Incremental_inputs::Input_info): New struct.
12640         (Incremental_inputs::Input_info_map): New typedef.
12641         (Incremental_inputs::lock_): New field.
12642         (Incremental_inputs::Inputs_): New field.
12643         (Incremental_inputs::Inputs_map): New field.
12644         * main.cc (main): Call Incremental_input::report_inputs.
12645         * options.h (Input_argument_list): Typedef moved from
12646         Input_arguments.
12647         (Input_file_group::Files): Remove, use ::Input_argument_list.
12648         (Input_file_group::Input_argument_list): Remove, use
12649         ::Input_argument_list.
12650         * plugin.cc (Plugin_manager::add_input_file): Add error in
12651         incremental build.
12652         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
12653         functions.
12654         * script.cc (read_input_script): Call
12655         Incremental_input::report_script.
12656         * script.h (Script_info): New class.
12657
12658 2009-04-27  Ian Lance Taylor  <iant@google.com>
12659
12660         * x86_64.cc (do_adjust_output_section): Set entsize to
12661         plt_entry_size.
12662
12663 2009-04-23  Elliott Hughes  <enh@google.com>
12664
12665         * output.cc (Output_file::close): After short writes, continue
12666         writing from the correct offset in the buffer being written.
12667
12668 2009-04-23  Chris Demetriou  <cgd@google.com>
12669
12670         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
12671         * configure: Regenerate.
12672         * config.in: Regenerate.
12673         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
12674         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
12675
12676 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
12677
12678         * incremental.cc (Incremental_inputs_header_data): Renamed from
12679         Incremental_input_header_data.
12680         (Incremental_inputs_header_data::data_size): New field.
12681         (Incremental_inputs_header_data::put_input_file_count): Renamed
12682         from input_file_count.
12683         (Incremental_inputs_header_data::put_command_line_offset): Renamed
12684         from command_line_offset.
12685         (Incremental_inputs_header_data::put_reserved): Renamed from
12686         put_reserved.
12687         (Incremental_inputs_entry_data): Renamed from
12688         Incremental_input_entry_data.
12689         (Incremental_inputs_entry_data::data_size): New field.
12690         (Incremental_inputs::report_command_line): New method.
12691         (Incremental_inputs::finalize): New method.
12692         (Incremental_inputs::create_incremental_inputs_data): New method.
12693         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
12694         * incremental.h: New file.
12695         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
12696         (Layout::finalize): Create incremental inputs section in
12697         incremental builds.
12698         (Layout::create_incremental_info_sections): New method.
12699         * layout.h (Layout::incremental_inputs): New method.
12700         (Layout::create_incremental_info_sections): New method.
12701         (Layout::incremental_inputs_): New field.
12702         * main.cc (main): Notify Incremental_input of the command line.
12703
12704 2009-04-01  Ian Lance Taylor  <iant@google.com>
12705             Mikolaj Zalewski  <mikolajz@google.com>
12706
12707         * gold.h (reserve_unordered_map): Define, three versions, one for
12708         each version of Unordered_map.
12709         * layout.cc (Layout::Layout): Remove options parameter.  Add
12710         number_of_input_files parameter.  Don't initialize options_.
12711         Initialize number_of_input_files_ and resized_signatures_.  Move
12712         sections_are_attached_.
12713         (Layout::layout_group): Reserve space for group_signatures_.
12714         (Layout::find_or_add_kept_section): Change name parameter to be a
12715         reference.  Resize signatures_ map when it gets large enough.
12716         (Layout::layout_eh_frame): Use parameters->options() instead of
12717         this->options_.
12718         (Layout::make_output_section): Likewise.
12719         (Layout::attach_allocated_section_to_segment): Likewise.
12720         (Layout::finalize, Layout::create_executable_stack): Likewise.
12721         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
12722         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
12723         * layout.h (class Layout): Update declarations.  Remove options_
12724         field.  Add number_of_input_files_ and resized_signatures_
12725         fields.  Move sections_are_attached_ field.
12726         * main.cc (main): Pass number of input files to Layout
12727         constructor.  Don't pass options.
12728
12729 2009-03-30  Ian Lance Taylor  <iant@google.com>
12730
12731         * ffsll.c (ffsll): Correct implementation.
12732
12733 2009-03-27  Ian Lance Taylor  <iant@google.com>
12734
12735         * ffsll.c: New file.
12736         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
12737         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
12738         * ftruncate.c (ftruncate): Declare before definition.
12739         * mremap.c (mremap): Likewise.
12740         * pread.c (pread): Likewise.
12741         * configure, Makefile.in, config.in: Rebuild.
12742
12743         * mremap.c: New file.
12744         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
12745         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
12746         (mremap): Declare if HAVE_MREMAP is not defined.
12747         * configure, Makefile.in, config.in: Rebuild.
12748
12749 2009-03-27  Cary Coutant  <ccoutant@google.com>
12750
12751         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
12752         position independent.
12753         * sparc.cc (Target_sparc::check_non_pic): Likewise.
12754         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
12755
12756 2009-03-24  Cary Coutant  <ccoutant@google.com>
12757
12758         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
12759         an executable.
12760         (needs_dynamic_reloc): Likewise.
12761
12762 2009-03-24  Ian Lance Taylor  <iant@google.com>
12763
12764         * yyscript.y (file_cmd): Recognize EXTERN.
12765         (extern_name_list, extern_name_list_body): New nonterminals.
12766         * script.cc (script_add_extern): Define.
12767         * script-c.h (script_add_extern): Declare.
12768
12769 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
12770
12771         * object.cc (is_elf_object): Define.
12772         * object.h (is_elf_object): Declare.
12773         * archive.cc (Archive::get_elf_object_for_member): Call
12774         is_elf_object.
12775         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
12776
12777 2009-03-24  Elliott Hughes  <enh@google.com>
12778
12779         * output.cc (Output_file::map_anonymous): Define.
12780         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
12781         try an anonymous one.  Report the size if the mmap fails.
12782         * output.h (class Output_file): Declare map_anonymous.
12783
12784 2009-03-24  Ian Lance Taylor  <iant@google.com>
12785
12786         * target-select.cc (instantiate_target): Don't acquire the lock if
12787         the instantiated_target_ field has already been set.
12788
12789 2009-03-23  Ian Lance Taylor  <iant@google.com>
12790
12791         * gold-threads.h (class Initialize_lock): Define.
12792         * gold-threads.cc (class Initialize_lock_once): Define.
12793         (initialize_lock_control): New static variable.
12794         (initialize_lock_pointer): New static variable.
12795         (initialize_lock_once): New static function.
12796         (Initialize_lock::Initialize_lock): Define.
12797         (Initialize_lock::initialize): Define.
12798         * target-select.h: Include "gold-threads.h".
12799         (class Target_selector): Add lock_ and initialize_lock_ fields.
12800         Don't define instantiate_target, just declare it.
12801         * target-select.cc (Target_selector::Target_selector): Initialize
12802         new fields.
12803         (Target_selector::instantiate_target): Define.
12804         * descriptors.h: Include "gold-threads.h".
12805         (class Descriptors): Add initialize_lock_ field.
12806         * descriptors.cc (Descriptors::Descriptors): Initialize new
12807         field.
12808         (Descriptors::open): Use initialize_lock_ field
12809         * errors.h (class Errors): Add initialize_lock_ field.
12810         * errors.cc (Errors::Errors): Initialize new field.
12811         (Errors::initialize_lock): Use initialize_lock_ field.
12812         * powerpc.cc (class Target_selector_powerpc): Remove
12813         instantiated_target_ field.  In do_recognize call
12814         instantiate_target rather than do_instantiate_target.  In
12815         do_instantiate_target just allocate a new target.
12816         * sparc.cc (class Target_selector_sparc): Likewise.
12817
12818         * freebsd.h: New file.
12819         * i386.cc: Include "freebsd.h".
12820         (Target_i386): Derive from Target_freebsd rather than
12821         Sized_target.
12822         (Target_selector_i386): Derive from Target_selector_freebsd rather
12823         than Target_selector.
12824         * x86_64.cc: Include "freebsd.h".
12825         (Target_x86_64): Derive from Target_freebsd rather than
12826         Sized_target.
12827         (Target_selector_x86_64): Derive from Target_selector_freebsd
12828         rather than Target_selector.
12829         * target.h (class Target): Add adjust_elf_header and
12830         do_adjust_elf_header.
12831         * output.cc (Output_file_header:: do_sized_write): Call target
12832         adjust_elf_header routine.
12833         * configure.tgt: Set targ_osabi.
12834         * configure.ac: Define GOLD_DEFAULT_OSABI.
12835         * parameters.cc (Parameters::default_target): Pass
12836         GOLD_DEFAULT_OSABI to select_target.
12837         * target-select.h (class Target_selector): Make instantiate_target
12838         protected rather than private.
12839         * Makefile.am (HFILES): Add freebsd.h.
12840         * configure, Makefile.in, config.in: Rebuild.
12841
12842         * merge.cc (do_add_input_section): Correct pend value.  Change
12843         message about last entry not being null terminated from error to
12844         warning.
12845
12846 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
12847
12848         * incremental.cc: New file.
12849         * Makefile.am (CCFILES): Add incremental.cc.
12850         * Makefile.in: Rebuild.
12851
12852 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
12853
12854         * layout.cc (Layout::output_section_name): Preserve names
12855         of '.note.' sections.
12856
12857 2009-03-19  Ian Lance Taylor  <iant@google.com>
12858
12859         * descriptors.cc (Descriptors::open): Check that the options are
12860         valid before using them.
12861
12862 2009-03-18  Ian Lance Taylor  <iant@google.com>
12863
12864         * script-sections.h: Include <list>.
12865         (class Script_sections): Change Sections_elements from std::vector
12866         to std::list.  Typedef public Elements_iterator.  Add
12867         orphan_section_placement_, data_segment_align_start_, and
12868         saw_data_segment_align_ fields.  Remove data_segment_align_index_
12869         field.
12870         * script-sections.cc (class Orphan_section_placement): New class.
12871         (class Sections_element): Add virtual functions is_relro and
12872         orphan_section_init.  Remove virtual function place_orphan_here.
12873         (class Output_section_definition): Add is_relro and
12874         orphan_section_init.  Remove place_orphan_here.
12875         (class Orphan_output_section): Likewise.
12876         (Script_sections::Script_sections): Update for field changes.
12877         (Script_sections::data_segment_align): Set saw_data_segment_align_
12878         and data_segment_align_start_, not data_segment_align_index.
12879         (Script_sections::data_segment_relro_end): Check
12880         saw_data_segment_align_.  Use data_segment_align_start_ rather
12881         than data_segment_align_index_.
12882         (Script_sections::place_orphan): Rewrite to use
12883         Orphan_section_placement.
12884
12885 2009-03-17  Ian Lance Taylor  <iant@google.com>
12886
12887         * archive.cc (Archive::add_symbols): Check for a version attached
12888         to the symbol name in the archive map.
12889         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
12890         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
12891         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
12892         (ver_test_11.a): New target.
12893         * testsuite/Makefile.in: Rebuild.
12894
12895         * configure.ac: Check for chsize and posix_fallocate.  Replace
12896         ftruncate.
12897         * ftruncate.c: New file, from gnulib.
12898         * output.cc (posix_fallocate): Define dummy version if not
12899         HAVE_POSIX_FALLOCATE.
12900         (Output_file::map): Call posix_fallocate rather than lseek and
12901         write.
12902         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
12903         * configure, Makefile.in, config.in: Rebuild.
12904
12905 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
12906
12907         * layout.h (Layout::create_note): Add section_name parameter.
12908         * layout.cc (Layout::create_note): Likewise.
12909         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
12910
12911 2009-03-17  Ian Lance Taylor  <iant@google.com>
12912
12913         * descriptors.cc: Include "options.h".
12914         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
12915         (Descriptors::open): Always use O_CLOEXEC when opening a new
12916         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
12917         then set FD_CLOEXEC.
12918
12919         * sparc.cc (class Target_sparc): Add has_got_section.
12920         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
12921         make sure we have a GOT section.
12922
12923         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
12924         (Target_sparc::Scan::local): Likewise.
12925         (Target_sparc::Scan::global): Likewise.
12926         (Target_sparc::Relocate::relocate): Likewise.
12927         (Target_sparc::Relocate::relocate_tls): Likewise.
12928
12929         * symtab.cc (Symbol_table::define_default_version): New function,
12930         broken out of add_from_object.
12931         (Symbol_table::add_from_object): Call define_default_version.
12932         (Symbol_table::define_special_symbol): Add resolve_oldsym
12933         parameter.  Change all callers.  If the version for a symbol comes
12934         from a version script, resolve it with the symbol with the same
12935         name with no version.  Also add the symbol without a version if
12936         appropriate.
12937         (do_define_in_output_data): If resolving with oldsym, don't delete
12938         sym.
12939         (do_define_in_output_segment): Likewise.
12940         (do_define_as_constant): Likewise.
12941         * symtab.h (class Symbol_table): Update declarations.
12942
12943 2009-03-13  Ian Lance Taylor  <iant@google.com>
12944
12945         * readsyms.cc (Read_symbols::incompatible_warning): New function.
12946         (Read_symbols::requeue): New function.
12947         (Read_symbols::do_read_symbols): If make_elf_object fails because
12948         the target type is not configured, and the file was searched for,
12949         issue a warning and retry with the next directory.
12950         (Add_symbols::run): If the file has an incompatible format, and
12951         it was searched for, requeue the Read_symbols task.  On error,
12952         release the object.
12953         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
12954         dirindex parameter to constructor.  Change all callers.  Declare
12955         incompatible_warning and requeue.
12956         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
12957         input_argument_ and input_group_ fields.  Add them to
12958         constructor.  Change all callers.
12959         (class Read_script): Add dirindex_ field.  Add it to constructor.
12960         Change all callers.
12961         * archive.cc (Archive::setup): Remove input_objects parameter.
12962         Change all callers.
12963         (Archive::get_file_and_offset): Likewise.
12964         (Archive::read_all_symbols): Likewise.
12965         (Archive::read_symbols): Likewise.
12966         (Archive::get_elf_object_for_member): Remove input_objects
12967         parameter.  Add punconfigured parameter.  Change all callers.
12968         (Archive::add_symbols): Change return type to bool.  Check return
12969         value of include_member.
12970         (Archive::include_all_members): Likewise.
12971         (Archive::include_member): Change return type to bool.  Return
12972         false if first included object has incompatible target.  Set
12973         included_member_ field.
12974         (Add_archive_symbols::run): If add_symbols returns false, requeue
12975         Read_symbols task.
12976         * archive.h (class Archive): Add included_member_ field.
12977         Initialize it in constructor.  Add input_file and searched_for
12978         methods.  Update declarations.
12979         (class Add_archive_symbols): Add dirpath_, dirindex_, and
12980         input_argument_ fields.  Add them to constructor.  Change all
12981         callers.
12982         * script.cc: Include "target-select.h".
12983         (class Parser_closure): Add skip_on_incompatible_target_ and
12984         found_incompatible_target_ fields.  Add
12985         skip_on_incompatible_target parameter to constructor.  Change all
12986         callers.  Add methods skip_on_incompatible_target,
12987         clear_skip_on_incompatible_target, found_incompatible_target, and
12988         set_found_incompatible_target.
12989         (read_input_script): Add dirindex parameter.  Change all callers.
12990         If parser finds an incompatible target, requeue Read_symbols
12991         task.
12992         (script_set_symbol): Clear skip_on_incompatible_target in
12993         closure.
12994         (script_add_assertion, script_parse_option): Likewise.
12995         (script_start_sections, script_add_phdr): Likewise.
12996         (script_check_output_format): New function.
12997         * script.h (read_input_script): Update declaration.
12998         * script-c.h (script_check_output_format): Declare.
12999         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
13000         (ignore_cmd): Remove OUTPUT_FORMAT.
13001         * fileread.cc (Input_file::Input_file): Add explicit this.
13002         (Input_file::will_search_for): New function.
13003         (Input_file::open): Add pindex parameter.  Change all callers.
13004         * fileread.h (class Input_file): Add input_file_argument method.
13005         Declare will_search_for.  Update declarations.
13006         * object.cc (make_elf_object): Add punconfigured parameter.
13007         Change all callers.
13008         * object.h (class Object): Make input_file public.  Add
13009         searched_for method.
13010         (make_elf_object): Update declaration.
13011         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
13012         restart search.
13013         * dirsearch.h (class Dirsearch): Update declaration.
13014         * options.h (class General_options): Add --warn-search-mismatch.
13015         * parameters.cc (Parameters::is_compatible_target): New function.
13016         * parameters.h (class Parameters): Declare is_compatible_target.
13017         * workqueue.cc (Workqueue::add_blocker): New function.
13018         * workqueue.h (class Workqueue): Declare add_blocker.
13019
13020         * fileread.cc (Input_file::open): Remove options parameter.
13021         Change all callers.
13022         (Input_file::open_binary): Likewise.
13023         * script.cc (read_input_script): Likewise.
13024         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
13025         options parameter from constructor.  Change all callers.
13026         (class Read_script): Likewise.
13027         * fileread.h (class Input_file): Update declarations.
13028         * script.h (read_input_script): Update declaration.
13029
13030 2009-03-10  Nick Clifton  <nickc@redhat.com>
13031
13032         * po/es.po: New Spanish translation.
13033
13034 2009-03-06  Cary Coutant  <ccoutant@google.com>
13035
13036         * options.cc (parse_short_option): Keep dash_z from registering itself.
13037
13038 2009-03-03  Ian Lance Taylor  <iant@google.com>
13039
13040         PR 9918
13041         * target-reloc.h (relocate_section): Pass output_section to
13042         relocate.
13043         * i386.cc (Target_i386::should_apply_static_reloc): Add
13044         output_section parameter.  Change all callers.
13045         (Target_i386::Relocate::relocate): Add output_section parameter.
13046         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13047         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
13048         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
13049         * testsuite/two_file_shared.sh: New script.
13050         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
13051         (check_DATA): Add two_file_shared.dbg.
13052         (two_file_shared.dbg): New target.
13053         * testsuite/Makefile.in: Rebuild.
13054
13055 2009-03-01  Ian Lance Taylor  <iant@google.com>
13056
13057         * configure.ac: Check for byteswap.h.
13058         * configure: Rebuild.
13059         * config.in: Rebuild.
13060
13061 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
13062
13063         * layout.cc (Layout::find_or_add_kept_section): New function.
13064         (Layout::add_comdat): Removed.
13065         * layout.h (struct Kept_section): Move out of class Layout.
13066         Remove trailing underscores from field names.  Add group_sections
13067         field.  Rename group_ field to is_group.  Change all uses.
13068         (class Layout): Declare find_or_add_kept_section, not add_comdat.
13069         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
13070         comdat_groups_ field.
13071         (Sized_relobj::include_section_group): Use
13072         find_or_add_kept_section and Kept_section::group_sections.
13073         (Sized_relobj::include_linkonce_section): Likewise.
13074         * object.cc (class Sized_relobj): Don't define Comdat_group or
13075         Comdat_group_table.  Remove find_comdat_group and
13076         add_comdat_group.  Remove comdat_groups_ field.
13077         * plugin.cc (include_comdat_group): Use
13078         Layout::find_or_add_kept_section.
13079
13080 2009-02-28  Ian Lance Taylor  <iant@google.com>
13081
13082         * README: --gc-sections and map files are now supported.  Document
13083         some build requirements.
13084
13085         PR 6992
13086         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
13087         relocatable link set the value of the section symbol to zero.
13088         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
13089         relocatable link don't include the section address in the local
13090         symbol value.
13091
13092 2009-02-27  Ian Lance Taylor  <iant@google.com>
13093
13094         PR 6811
13095         * options.h (class Search_directory): Add is_system_directory.
13096         (class General_options): Declare is_in_system_directory.
13097         * options.cc (get_relative_sysroot): Make static.
13098         (get_default_sysroot): Make static.
13099         (General_optoins::is_in_system_directory): New function.
13100         * fileread.cc (Input_file::is_in_system_directory): New function.
13101         * fileread.h (class Input_file): Declare is_in_system_directory.
13102         * object.h (class Object): Add is_in_system_directory.
13103         (class Input_objects): Remove system_library_directory_ field.
13104         * object.cc (Input_objects::add_object): Don't set
13105         system_library_directory_.
13106         (input_objects::found_in_system_library_directory): Remove.
13107         * symtab.cc (Symbol_table::write_globals): Remove input_objects
13108         parameter.  Change all callers.
13109         (Symbol_table::sized_write_globals): Likewise.
13110         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
13111         Call Object::is_in_system_directory.
13112         * symtab.h (class Symbol_table): Update declarations.
13113
13114         PR 5990
13115         * descriptors.h (Open_descriptor): Add is_on_stack field.
13116         * descriptors.cc (Descriptors::open): If the descriptor is on the
13117         top of the stack, remove it.  Initialize is_on_stack field.
13118         (Descriptors::release): Only add pod to stack if it is not on the
13119         stack already.
13120         (Descriptors::close_some_descriptor): Clear stack_next and
13121         is_on_stack fields.
13122
13123         PR 7091
13124         * output.cc (Output_section::find_starting_output_address): Rename
13125         from starting_output_address; add PADDR parameter; change return
13126         type.
13127         * output.h (class Output_section): Declare
13128         find_starting_output_address instead of starting_output_address.
13129         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
13130         section symbol for which we can't find a merge section.
13131
13132         PR 9836
13133         * symtab.cc (Symbol_table::add_from_object): If the visibility is
13134         hidden or internal, force the symbol to be local.
13135         * resolve.cc (Symbol::override_visibility): Define.
13136         (Symbol::override_base): Use override_visibility.
13137         (Symbol_table::resolve): Likewise.
13138         (Symbol::override_base_with_special): Likewise.
13139         (Symbol_table::override_with_special): If the visibility is hidden
13140         or internal, force the symbol to be local.
13141         * symtab.h (class Symbol): Add set_visibility and
13142         override_visibility.
13143         * testsuite/ver_test_1.sh: New file.
13144         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
13145         (check_DATA): Add ver_test_1.syms.
13146         (ver_test_1.syms): New target.
13147         * testsuite/Makefile.in: Rebuild.
13148
13149 2009-02-25  Cary Coutant  <ccoutant@google.com>
13150
13151         * layout.cc (Layout::choose_output_section): Don't rename sections
13152         when using a linker script that has a SECTIONS clause.
13153         * Makefile.in: Regenerate.
13154
13155         * testsuite/Makefile.am (script_test_5.sh): New test case.
13156         * testsuite/Makefile.in: Regenerate.
13157         * testsuite/script_test_5.cc: New file.
13158         * testsuite/script_test_5.sh: New file.
13159         * testsuite/script_test_5.t: New file.
13160
13161 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
13162
13163         * archive.cc (Archive::include_member): Update calls to add_symbols.
13164         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
13165         the Layout argument.
13166         * dynobj.h (do_add_symbols): Add the Layout argument.
13167         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
13168         Layout argument.
13169         * object.h (Object::add_symbols): Add the Layout argument.
13170         (Object::do_add_symbols): Add the Layout argument.
13171         (Sized_relobj::do_add_symbols): Add the Layout argument.
13172         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
13173         Unify the two versions.
13174         (Add_plugin_symbols): Remove.
13175         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
13176         (Sized_pluginobj::do_add_symbols): Unify the two versions.
13177         (Add_plugin_symbols): Remove.
13178         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
13179         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
13180         (Add_symbols::run): Make it work with Pulginobj.
13181
13182 2009-02-06  Ian Lance Taylor  <iant@google.com>
13183
13184         * object.cc (Sized_relobj::do_layout): Make info message start
13185         with lower case letter.
13186
13187 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
13188
13189         * binary.cc: Fix file comment.
13190
13191         * options.h (enum Incremental_disposition): Define.
13192         (class General_options): Add new options: --incremental,
13193         --incremental_changed, --incremental_unchanged,
13194         --incremental_unknown.  Add incremental_disposition_ and
13195         implicit_incremental_ fields.
13196         (General_options::incremental_disposition): New function.
13197         (class Position_dependent_options): Add incremental_disposition
13198         option.
13199         (Position_dependent_options::copy_from_options): Set incremental
13200         dispositions.
13201         * options.cc (General_options::parse_incremental_changed): New
13202         function.
13203         (General_options::parse_incremental_unchanged): New function.
13204         (General_options::parse_incremental_unknown): New function.
13205         (General_options::General_options): Initialize new fields
13206         incremental_disposition_ and implicit_incremental_.
13207         (General_options::finalize): Check for uasge of --incremental-*
13208         without --incremental.
13209
13210 2009-02-06  Chris Demetriou  <cgd@google.com>
13211
13212         * gold.h (gold_undefined_symbol): Change to take only a Symbol
13213         pointer and to report location as the file name associated with
13214         the symbol.
13215         (gold_undefined_symbol_at_location): New function to replace the
13216         old gold_undefined_symbol functionality.
13217         * target-reloc.h (relocate_section): Update to use
13218         gold_undefined_symbol_at_location.
13219         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13220         Call gold_undefined_symbol function rather than gold_error.
13221         * errors.h (Errors::undefined_symbol): Take location as a
13222         string, rather than calculating it from a relocation.
13223         * errors.cc (Errors::fatal): Print "fatal error:" before the
13224         formatted message.
13225         (Errors::error, Errors::error_at_location): Print "error: "
13226         before the formatted message.
13227         (Errors::undefined_symbol): Take location as a string, rather
13228         than calculating it from a relocation.
13229         (gold_undefined_symbol_at_location): New function akin to
13230         old gold_undefined_symbol, calculates location from relocation.
13231         (gold_undefined_symbol): Change to take only a Symbol pointer
13232         and to report location as the file name associated with the symbol.
13233         * testsuite/debug_msg.sh: Update for changed error messages.
13234         * testsuite/undef_symbol.sh: Likewise.
13235
13236 2009-02-04  Duncan Sands  <baldrick@free.fr>
13237
13238         PR 9812
13239         * reduced_debug_output.h
13240         (Output_reduced_debug_abbrev_section::failed): Use format for
13241         gold_warning.
13242         (Output_reduced_debug_info_section::faild): Likewise.
13243
13244 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
13245
13246         * script.cc (Lazy_demangler): New class.
13247         (Version_script_info::get_symbol_version_helper): Demangle a
13248         symbol only once.
13249
13250 2009-01-29  Cary Coutant  <ccoutant@google.com>
13251
13252         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
13253         to __tls_get_addr.
13254         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13255
13256 2009-01-28  Ian Lance Taylor  <iant@google.com>
13257
13258         * version.cc (version_string): Bump to 1.9.
13259
13260         * gold.h: Include <cstring> and <stdint.h>.
13261         * version.cc: Include <cstdio>.
13262         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
13263         warning.
13264         * reduced_debug_output.cc (insert_into_vector): Rename from
13265         Insert_into_vector; change all callers.  Use Swap_unaligned to
13266         avoid aliasing issue; remove union since it is unnecessary.
13267
13268 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
13269
13270         * Makefile.am (CCFILES): Add gc.cc.
13271         (HFILES): Add gc.h.
13272         * Makefile.in: Regenerate.
13273         * gold.cc (Gc_runner): New class.
13274         (queue_initial_tasks): Call garbage collection related tasks
13275         when corresponding options are invoked.
13276         (queue_middle_gc_tasks): New function.
13277         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
13278         processed early before laying out sections during garbage collection.
13279         * gold.h (queue_middle_gc_tasks): New function.
13280         (is_prefix_of): Move from "layout.cc".
13281         * i386.cc (Target_i386::gc_process_relocs): New function.
13282         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
13283         * main.cc (main): Create object of class "Garbage_collection".
13284         * object.cc (Relobj::copy_symbols_data): New function.
13285         (Relobj::is_section_name_included): New function.
13286         (Sized_relobj::do_layout): Allow this function to be called twice
13287         during garbage collection and defer layout of section during the
13288         first call.
13289         * object.h (Relobj::get_symbols_data): New function.
13290         (Relobj::is_section_name_included): New function.
13291         (Relobj::copy_symbols_data): New function.
13292         (Relobj::set_symbols_data): New function.
13293         (Relobj::get_relocs_data): New function.
13294         (Relobj::set_relocs_data): New function.
13295         (Relobj::is_output_section_offset_invalid): New pure virtual function.
13296         (Relobj::gc_process_relocs): New function.
13297         (Relobj::do_gc_process_relocs): New pure virtual function.
13298         (Relobj::sd_): New data member.
13299         (Sized_relobj::is_output_section_offset_invalid): New function.
13300         (Sized_relobj::do_gc_process_relocs): New function.
13301         * options.h (General_options::gc_sections): Modify to not be a no-op.
13302         (General_options::print_gc_sections): New option.
13303         * plugin.cc (Plugin_finish::run): Remove function call to
13304         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
13305         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
13306         * reloc.cc (Read_relocs::run): Add task to process relocs and
13307         determine unreferenced sections when doing garbage collection.
13308         (Gc_process_relocs): New class.
13309         (Sized_relobj::do_gc_process_relocs): New function.
13310         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
13311         sections that are garbage collected.
13312         * reloc.h (Gc_process_relocs): New class.
13313         * sparc.cc (Target_sparc::gc_process_relocs): New function.
13314         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
13315         symbols whose corresponding sections are garbage collected.
13316         (Symbol_table::Symbol_table): Add new parameter for the garbage
13317         collection object.
13318         (Symbol_table::gc_mark_undef_symbols): New function.
13319         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13320         (Symbol_table::gc_mark_dyn_syms): New function.
13321         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
13322         as garbage.
13323         (Symbol_table::add_from_object): Likewise.
13324         (Symbol_table::add_from_relobj): When building shared objects, do not
13325         treat externally visible symbols as garbage.
13326         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
13327         table information for static and relocatable links.
13328         * symtab.h (Symbol_table::set_gc): New function.
13329         (Symbol_table::gc): New function.
13330         (Symbol_table::gc_mark_undef_symbols): New function.
13331         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13332         (Symbol_table::gc_mark_dyn_syms): New function.
13333         (Symbol_table::gc_): New data member.
13334         * target.h (Sized_target::gc_process_relocs): New pure virtual
13335         function.
13336         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
13337         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
13338
13339 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
13340
13341         * options.h (General_options::gc_sections): Define as a no-op for now.
13342         (General_options::no_keep_memory): Ditto.
13343         (General_options::Bshareable): Define.
13344         * options.cc (General_options::finalize): Honor -Bshareable.
13345
13346 2009-01-20  Andreas Schwab  <schwab@suse.de>
13347
13348         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
13349         read the value in the contents, since we don't use it.  Use the
13350         template endianness when writing.
13351         (Relocate::relocate): Use it for R_PPC_REL16_HA.
13352
13353 2009-01-19  Andreas Schwab  <schwab@suse.de>
13354
13355         * configure.tgt (powerpc64-*): Fix targ_obj.
13356
13357 2009-01-15  Ian Lance Taylor  <iant@google.com>
13358
13359         * object.cc (Sized_relobj::write_local_symbols): Don't write out
13360         local symbols when stripping all symbols.
13361
13362 2009-01-14  Cary Coutant  <ccoutant@google.com>
13363
13364         * output.cc (Output_reloc): Add explicit instantiations.
13365
13366 2009-01-14  Cary Coutant  <ccoutant@google.com>
13367
13368         * archive.cc (Archive::get_elf_object_for_member): Remove call
13369         to File_read::claim_for_plugin.
13370         * descriptors.cc (Descriptors::open): Remove reference to
13371         is_claimed.
13372         (Descriptors::claim_for_plugin): Remove.
13373         * descriptors.h (Descriptors::claim_for_plugin): Remove.
13374         (Descriptors::is_claimed): Remove.
13375         (claim_descriptor_for_plugin): Remove.
13376         * fileread.cc (File_read::claim_for_plugin): Remove.
13377         * fileread.h (File_read::claim_for_plugin): Remove.
13378         (File_read::descriptor): Reopen descriptor if necessary.
13379         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
13380         (Plugin_manager::all_symbols_read): Add task parameter. Change
13381         all callers.
13382         (Plugin_manager::get_input_file): New function.
13383         (Plugin_manager::release_input_file): New function.
13384         (Pluginobj::Pluginobj): Add filesize parameter and initialize
13385         corresponding data member.
13386         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
13387         and pass to base constructor. Change all callers.
13388         (get_input_file, release_input_file): New functions.
13389         (make_sized_plugin_object): Add filesize parameter. Change all callers.
13390         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
13391         (Plugin_manager::all_symbols_read): Add task parameter.
13392         (Plugin_manager::get_input_file): New function.
13393         (Plugin_manager::release_input_file): New function.
13394         (Plugin_manager::task_): New data member.
13395         (Pluginobj::Pluginobj): Add filesize parameter.
13396         (Pluginobj::filename): New function.
13397         (Pluginobj::descriptor): New function.
13398         (Pluginobj::filesize): New function.
13399         (Pluginobj::filesize_): New data member.
13400         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
13401         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
13402         File_read::claim_for_plugin; use Object::unlock to unlock the file.
13403
13404         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
13405         with archive libraries.
13406         * testsuite/Makefile.in: Regenerate.
13407         * testsuite/plugin_test.c (struct sym_info): New type.
13408         (get_input_file, release_input_file): New static variables.
13409         (onload): Capture new transfer vector entries.
13410         (claim_file_hook): Stop reading at end of file according to filesize.
13411         Factor out parsing of readelf output into separate function.
13412         (all_symbols_read_hook): Exercise get_input_file and release_input_file
13413         APIs and get the source file name from the symbol table.  Convert
13414         source file name to corresponding object file name.  Print info
13415         message when adding new input files.
13416         (parse_readelf_line): New function.
13417         * testsuite/plugin_test_1.sh: Add checks for new info messages.
13418         * testsuite/plugin_test_2.sh: Likewise.
13419         * testsuite/plugin_test_3.sh: Likewise.
13420         * testsuite/plugin_test_4.sh: New test case.
13421
13422 2009-01-07  Ian Lance Taylor  <iant@google.com>
13423
13424         * version.cc (version_string): Bump to 1.8.
13425
13426 2008-12-23  Cary Coutant  <ccoutant@google.com>
13427
13428         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
13429         * plugin.cc (Plugin_manager::finish): Rename as
13430         layout_deferred_objects.  Move cleanup to separate function.
13431         (Plugin_manager::cleanup): New function.
13432         (Plugin_finish::run): Call layout_deferred_objects and cleanup
13433         separately.
13434         * plugin.h (Plugin_manager::finish): Rename as
13435         layout_deferred_objects.
13436         (Plugin_manager::cleanup): New function.
13437         (Plugin_manager::cleanup_done): New field.
13438
13439 2008-12-23  Cary Coutant  <ccoutant@google.com>
13440
13441         * plugin.cc (is_visible_from_outside): New function.
13442         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
13443         so we don't return "IR only" status for exported symbols or -r links.
13444
13445         * testsuite/Makefile.am (plugin_test_3): New test case.
13446         * testsuite/Makefile.in: Regenerate.
13447         * testsuite/plugin_test_3.sh: New file.
13448
13449 2008-12-22  Cary Coutant  <ccoutant@google.com>
13450
13451         * object.cc (Sized_relobj::layout_section): New function.
13452         (Sized_relobj::do_layout): Defer layout of input sections until after
13453         plugin has provided replacement files.
13454         (Sized_relobj::do_layout_deferred_sections): New function.
13455         * object.h (Relobj::set_section_offset): Remove virtual keyword.
13456         (Relobj::layout_deferred_sections): New function.
13457         (Relobj::do_layout_deferred_sections): New function.
13458         (Sized_relobj::do_layout_deferred_sections): New function.
13459         (Sized_relobj::layout_section): New function.
13460         (Sized_relobj::Deferred_layout): New structure.
13461         (Sized_relobj::deferred_layout_): New field.
13462         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
13463         Change all callers.  Layout deferred sections.
13464         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
13465         references.
13466         (Plugin_hook::run): Move code from do_plugin_hook inline.
13467         (Plugin_hook::do_plugin_hook): Remove.
13468         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
13469         (Plugin_manager::finish): Renamed, was cleanup.
13470         (Plugin_manager::should_defer_layout): New function.
13471         (Plugin_manager::add_deferred_layout_object): New function.
13472         (Plugin_manager::Deferred_layout_list): New type.
13473         (Plugin_manager::deferred_layout_objects_): New field.
13474         (Plugin_hook::do_plugin_hook): Remove.
13475
13476 2008-12-17  Ian Lance Taylor  <iant@google.com>
13477
13478         * options.h (class General_options): Add --no case for
13479         --export-dynamic.
13480
13481 2008-12-16  Cary Coutant  <ccoutant@google.com>
13482
13483         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
13484         vector.
13485         (Plugin_manager::claim_file): Create plugin object even if
13486         plugin did not call the add_symbols callback.
13487         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
13488         asking for more symbols than were added.
13489         * testsuite/Makefile.am (plugin_test_1): Add test case with
13490         no global symbols.
13491         (empty.syms): New target.
13492         * testsuite/Makefile.in: Regenerate.
13493         * testsuite/plugin_test.c (claim_file_hook): Add new debug
13494         message. Don't call add_symbols if no globals.
13495         (all_symbols_read_hook): Don't provide replacement for empty
13496         claimed file.
13497
13498 2008-12-12  Ian Lance Taylor  <iant@google.com>
13499
13500         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
13501         r_type == 0 for a local symbol with r_sym == 0.
13502         (scan_relocatable_relocs): Pass r_sym to
13503         local_non_section_strategy.
13504         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
13505         r_sym parameter.
13506
13507         * configure.ac: Update test for TLS descriptors: they are
13508         supported as of glibc 2.9.
13509         * configure: Rebuild.
13510
13511 2008-12-11  Ian Lance Taylor  <iant@google.com>
13512
13513         PR 7091
13514         * target-reloc.h (Default_scan_relocatable_relocs): For each
13515         function, map r_type == 0 to RELOC_DISCARD.
13516
13517 2008-12-10  Cary Coutant  <ccoutant@google.com>
13518
13519         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
13520         object to override a kept COMDAT group from a plugin object.
13521
13522 2008-12-09  Ian Lance Taylor  <iant@google.com>
13523
13524         PR 7088
13525         * yyscript.y (file_cmd): Handle INPUT.
13526
13527         * testsuite/initpri1.c: Change all declarations to be full
13528         prototypes by adding void, to avoid compiler warnings.
13529
13530 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
13531
13532         * options.cc (General_options::parse_plugin_opt): New.
13533         (General_options::add_plugin): The argument now is just the filename.
13534         (General_options::add_plugin_option): New.
13535         * options.h (plugin_opt): New.
13536         (add_plugin): Change argument name.
13537         (add_plugin_option): New.
13538         * plugin.cc (Plugin::load): Don't parse the plugin option.
13539         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
13540         (Plugin::add_option): New.
13541         (Plugin::args_): Change type.
13542         (Plugin::filename_): New.
13543         (Plugin_manager::add_plugin_option): New.
13544         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
13545         * testsuite/Makefile.in: Regenerate.
13546
13547 2008-12-05  Cary Coutant  <ccoutant@google.com>
13548
13549         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
13550         Handle --strip-lto-sections option.
13551         * options.h (strip_lto_sections): New option.
13552
13553 2008-12-01  Cary Coutant  <ccoutant@google.com>
13554
13555         * plugin.cc (ld_plugin_message): Change format parameter to const.
13556         Fix mismatch between new[] and delete.
13557
13558 2008-11-14  Cary Coutant  <ccoutant@google.com>
13559
13560         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
13561         instead of -1U.
13562
13563 2008-11-05  Craig Silverstein  <csilvers@google.com>
13564
13565         * options.cc (General_options::parse_dynamic_list): New function.
13566         * options.h (General_options): New flags dynamic_list,
13567         dynamic_list_data, dynamic_list_cpp_new, and
13568         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
13569         (General_options::in_dynamic_list): New function.
13570         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
13571         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
13572         (Lex::can_continue_name): Likewise.
13573         (yylex): Likewise.
13574         (read_script_file): New parameter script_options.
13575         (read_dynamic_list): New function.
13576         (Script_options::define_dynamic_list): New function.
13577         (dynamic_list_keyword_parsecodes): New variable.
13578         (dynamic_list_keywords): New variable.
13579         * script.h (Script_options::define_dynamic_list): New function
13580         prototype.
13581         (read_dynamic_list): New function prototype.
13582         * symtab.cc (strprefix): New macro.
13583         (Symbol::should_add_dynsym_entry): Support dynamic_list,
13584         dynamic_list_data, dynamic_list_cpp_new, and
13585         dynamic_list_cpp_typeinfo.
13586         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
13587         (dynamic_list_expr): New rule.
13588         (dynamic_list_nodes): Likewise.
13589         (dynamic_list_node): Likewise.
13590         * testsuite/Makefile.am (dynamic_list): New test.
13591         * testsuite/Makefile.in: Regenerated.
13592         * testsuite/dynamic_list.t: New file.
13593         * testsuite/dynamic_list.sh: New file.
13594
13595 2008-11-05  Craig Silverstein  <csilvers@google.com>
13596
13597         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
13598         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
13599         (t11_last): Likewise.
13600         * testsuite/ver_test_6.c (main): Likewise.
13601
13602 2008-10-07  Cary Coutant  <ccoutant@google.com>
13603
13604         * options.c (General_options::finalize): Add check for -static and
13605         -shared.
13606         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
13607         is not empty.
13608
13609 2008-10-02  Cary Coutant  <ccoutant@google.com>
13610
13611         * plugin.cc (make_sized_plugin_object): Fix conditional
13612         compilation to work when not all targets are enabled.
13613
13614 2008-09-29  Cary Coutant  <ccoutant@google.com>
13615
13616         * archive.cc (Archive::get_file_and_offset): Use filename instead
13617         of name to get library path.
13618         (Archive::include_member): Unlock external member of a thin archive.
13619
13620         * testsuite/Makefile.am (TEST_AR): New variable.
13621         (thin_archive_test_1): New test.
13622         (thin_archive_test_2): New test.
13623         * testsuite/Makefile.in: Regenerate.
13624         * testsuite/thin_archive_main.cc: New file.
13625         * testsuite/thin_archive_test_1.cc: New file.
13626         * testsuite/thin_archive_test_2.cc: New file.
13627         * testsuite/thin_archive_test_3.cc: New file.
13628         * testsuite/thin_archive_test_4.cc: New file.
13629
13630 2008-09-29  Cary Coutant  <ccoutant@google.com>
13631
13632         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
13633         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
13634         instead of -1U.
13635         (Sized_relobj::do_finalize_local_symbols): Likewise.
13636         (Sized_relobj::map_to_kept_section): Likewise.
13637         * object.h (Sized_relobj::invalid_address): New constant.
13638         (Sized_relobj::do_output_section_offset): Check for invalid_address
13639         and return -1ULL.
13640         * output.cc (Output_reloc::local_section_offset): Use constant
13641         invalid_address instead of -1U.
13642         (Output_reloc::get_address): Likewise.
13643         (Output_section::output_address): Change -1U to -1ULL.
13644         * output.h (Output_reloc::invalid_address): New constant.
13645         * reloc.cc (Sized_relobj::write_sections): Use constant
13646         invalid_address instead of -1U.
13647         (Sized_relobj::relocate_sections): Likewise.
13648         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
13649         values for merge sections.
13650         * target-reloc.h (relocate_for_relocatable): Use constant
13651         invalid_address instead of -1U.
13652
13653 2008-09-19  Cary Coutant  <ccoutant@google.com>
13654
13655         Add plugin functionality for link-time optimization (LTO).
13656         * configure.ac (plugins): Add --enable-plugins option.
13657         * configure: Regenerate.
13658         * config.in: Regenerate.
13659         * Makefile.am (LIBDL): New variable.
13660         (CCFILES): Add plugin.cc.
13661         (HFILES): Add plugin.h.
13662         (ldadd_var): Add LIBDL.
13663         * Makefile.in: Regenerate.
13664
13665         * archive.cc: Include "plugin.h".
13666         (Archive::setup): Don't preread archive symbols when using a plugin.
13667         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
13668         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
13669         files.
13670         (Archive::include_member): Add symbols from plugin objects.
13671         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
13672         * descriptors.cc (Descriptors::open): Check for file descriptors
13673         abandoned by plugins.
13674         (Descriptors::claim_for_plugin): New function.
13675         * descriptors.h (Descriptors::claim_for_plugin): New function.
13676         (Open_descriptor::is_claimed): New field.
13677         (claim_descriptor_for_plugin): New function.
13678         * fileread.cc (File_read::claim_for_plugin): New function.
13679         * fileread.h (File_read::claim_for_plugin): New function.
13680         (File_read::descriptor): New function.
13681         * gold.cc: Include "plugin.h".
13682         (queue_initial_tasks): Add task to call plugin hooks for generating
13683         new object files.
13684         * main.cc: Include "plugin.h".
13685         (main): Load plugin libraries.
13686         * object.h (Pluginobj): Declare.
13687         (Object::pluginobj): New function.
13688         (Object::do_pluginobj): New function.
13689         (Object::set_target): New function.
13690         * options.cc: Include "plugin.h".
13691         (General_options::parse_plugin): New function.
13692         (General_options::General_options): Initialize plugins_ field.
13693         (General_options::add_plugin): New function.
13694         * options.h (Plugin_manager): Declare.
13695         (General_options): Add --plugin option.
13696         (General_options::has_plugins): New function.
13697         (General_options::plugins): New function.
13698         (General_options::add_plugin): New function.
13699         (General_options::plugins_): New field.
13700         * plugin.cc: New file.
13701         * plugin.h: New file.
13702         * readsyms.cc: Include "plugin.h".
13703         (Read_symbols::do_read_symbols): Check for archive before checking
13704         for ELF file.  Call plugin hooks to claim files.
13705         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
13706         from a real object file; force override when processing replacement
13707         files.
13708         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
13709         (Symbol::init_base_object): Likewise.
13710         (Symbol::init_base_output_data): Likewise.
13711         (Symbol::init_base_output_segment): Likewise.
13712         (Symbol::init_base_constant): Likewise.
13713         (Symbol::init_base_undefined): Likewise.
13714         (Symbol::output_section): Assert that object is not a plugin.
13715         (Symbol_table::add_from_pluginobj): New function.
13716         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
13717         undefined.
13718         (Symbol_table::sized_write_globals): Likewise.
13719         (Symbol_table::add_from_pluginobj): Instantiate template.
13720         * symtab.h (Sized_pluginobj): Declare.
13721         (Symbol::in_real_elf): New function.
13722         (Symbol::set_in_real_elf): New function.
13723         (Symbol::in_real_elf_): New field.
13724         (Symbol_table::add_from_pluginobj): New function.
13725
13726         * testsuite/Makefile.am (AM_CFLAGS): New variable.
13727         (LIBDL): New variable.
13728         (LDADD): Add LIBDL.
13729         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
13730         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
13731         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
13732         (MOSTLYCLEANFILES): Likewise.
13733         * testsuite/Makefile.in: Regenerate.
13734         * testsuite/plugin_test.c: New file.
13735         * testsuite/plugin_test_1.sh: New file.
13736         * testsuite/plugin_test_2.sh: New file.
13737
13738 2008-09-16  Ian Lance Taylor  <iant@google.com>
13739
13740         * target-reloc.h (relocate_section): Check whether a symbol is
13741         defined by the ABI before reporting an undefined symbol error.
13742         * target.h (Target::is_defined_by_abi): Make parameter const.
13743         (Target::do_is_defined_by_abi): Likewise.
13744         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
13745         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
13746         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
13747         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
13748         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
13749         * testsuite/Makefile.in: Rebuild.
13750
13751         * fileread.cc (make_view): Add casts to avoid warning.
13752
13753 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13754
13755         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
13756         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13757
13758 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13759
13760         * options.h (General_options::output_is_executable): New.
13761         (General_options::output_is_pie): New.
13762         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
13763         for shared libraries.
13764         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13765
13766 2008-09-11  Chris Demetriou  <cgd@google.com>
13767
13768         * options.h (origin): New -z option.
13769         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
13770         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
13771         in DT_FLAGS_1.
13772
13773 2008-09-05  Cary Coutant  <ccoutant@google.com>
13774
13775         * fileread.cc (File_read::make_view): Add check for attempt to map
13776         beyond end of file.
13777
13778 2008-09-05  Cary Coutant  <ccoutant@google.com>
13779
13780         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
13781         explicit instantiations.
13782
13783 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
13784
13785         PR gold/6858
13786         * options.cc (General_options::finalize): Allow undefined symbols
13787         in shlibs if linking -shared.
13788
13789         PR gold/6859
13790         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
13791         symbols as not needing a dynsym entry.
13792
13793 2008-08-20  Craig Silverstein  <csilvers@google.com>
13794
13795         * fileread.cc (File_read::open): Do not lock the file unless it
13796         was successfully opened.
13797
13798 2008-08-14  Cary Coutant  <ccoutant@google.com>
13799
13800         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
13801         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
13802         * testsuite/tls_test.cc (struct int128): 128-bit struct
13803         for testing TLS relocs with non-zero addend.
13804         (v12): New TLS variable.
13805         (t12): New test.
13806         (t_last): Add check for v12.
13807         * testsuite/tls_test.h (t12): New function.
13808         * testsuite/tls_test_main.cc (thread_routine): Call new test.
13809
13810 2008-08-13  Ian Lance Taylor  <iant@google.com>
13811
13812         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
13813         set tls_segment_ or relro_segment_.
13814         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
13815         when appropriate.
13816         * output.h (Output_section::clear_is_relro): New function.
13817         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
13818         sections specially even when output_data_ is empty.
13819         (Output_segment::maximum_alignment): When first section is relro,
13820         only force alignment for PT_LOAD segments.
13821         * script.cc (script_data_segment_align): New function.
13822         (script_data_segment_relro_end): New function.
13823         * script-c.h (script_data_segment_align): Declare.
13824         (script_data_segment_relro_end): Declare.
13825         * script-sections.h (class Script_sections): Declare
13826         data_segment_align and data_segment_relro_end.  Add fields
13827         segment_align_index_ and saw_relro_end_.
13828         * script-sections.cc (class Sections_element): Add set_is_relro
13829         virtual function.  Add new bool* parameter to place_orphan_here.
13830         Add get_output_section virtual function.
13831         (class Output_section_definition): Add set_is_relro.  Add new
13832         bool* parameter to place_orphan_here.  Add get_output_section.
13833         Add is_relro_ field.
13834         (Output_section_definition::Output_section_definition): Initialize
13835         evaluated_address_, evaluated_load_address, evaluated_addralign_,
13836         and is_relro_ fields.
13837         (Output_section_definition::place_orphan_here): Add is_relro
13838         parameter.
13839         (Output_section_definition::set_section_addresses): Set relro for
13840         output section.
13841         (Output_section_definition::alternate_constraint): Likewise.
13842         (class Orphan_output_section): Add new bool* parameter to
13843         place_orphan_here.  Add get_output_section.
13844         (Orphan_output_section::place_orphan_here): Add is_relro
13845         parameter.
13846         (Script_sections::Script_sections): Initialize
13847         data_segment_align_index_ and saw_relro_end_.
13848         (Script_sections::data_segment_align): New function.
13849         (Script_sections::data_segment_relro_end): New function.
13850         (Script_sections::place_orphan): Set or clear is_relro.
13851         (Script_sections::set_section_addresses): Force alignment of first
13852         TLS section.
13853         * yyscript.y (exp): Call script_data_segment_align and
13854         script_data_segment_relro_end.
13855         * testsuite/relro_script_test.t: New file.
13856         * testsuite/relro_test.cc (using_script): Declare.
13857         (t1, t2): Test using_script.
13858         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
13859         (relro_script_test_SOURCES): Define.
13860         (relro_script_test_DEPENDENCIES): Define.
13861         (relro_script_test_LDFLAGS): Define.
13862         (relro_script_test_LDADD): Define.
13863         (relro_script_test.so): New target.
13864         * testsuite/Makefile.in: Rebuild.
13865
13866 2008-08-06  Cary Coutant <ccoutant@google.com>
13867
13868         * archive.cc (Archive::total_archives, Archive::total_members)
13869         (Archive::total_members_loaded): New variables.
13870         (Archive::setup): Add parameter.  Add option to preread
13871         archive symbols.
13872         (Archive::read_armap): Add counter.
13873         (Archive::get_file_and_offset): New function.
13874         (Archive::get_elf_object_for_member): New function.
13875         (Archive::read_all_symbols): New function.
13876         (Archive::read_symbols): New function.
13877         (Archive::add_symbols): Add counters.
13878         (Archive::include_all_members): Use armap to find members if it's
13879         already built.
13880         (Archive::include_member): Skip reading symbols if already read.
13881         Factored code into Archive::get_file_and_offset and
13882         Archive::get_elf_object_for_member.  Changed call to
13883         Mapfile::report_include_archive_member.
13884         (Archive::print_stats): New function.
13885         * archive.h: Declare Object and Read_symbols_data classes.
13886         (Archive::Archive): Add initializers for new members.
13887         (Archive::setup): Add parameter.
13888         (Archive::print_stats): New function.
13889         (Archive::total_archives, Archive::total_members)
13890         (Archive::total_members_loaded): New variables.
13891         (Archive::get_file_and_offset): New function.
13892         (Archive::get_elf_object_for_member): New function.
13893         (Archive::read_all_symbols): New function.
13894         (Archive::read_symbols): New function.
13895         (Archive::Archive_member): New class.
13896         (Archive::members_): New member.
13897         (Archive::num_members_): New member.
13898         * main.cc: Include archive.h.
13899         (main): Call Archive::print_stats.
13900         * mapfile.cc (Mapfile::report_include_archive_member): Delete
13901         archive parameter; member_name is now the fully-decorated name.
13902         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
13903         * options.h: (General_options): Add --preread-archive-symbols option.
13904         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
13905         Archive::setup.
13906
13907 2008-08-04  Ian Lance Taylor  <iant@google.com>
13908
13909         * symtab.h (Symbol::use_plt_offset): New function.
13910         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
13911         * powerpc.cc (Relocate::relocate): Likewise.
13912         * sparc.cc (Relocate::relocate): Likewise.
13913         * x86_64.cc (Relocate::relocate): Likewise.
13914         * testsuite/weak_plt.sh: New test.
13915         * testsuite/weak_plt_main.cc: New test.
13916         * testsuite/weak_plt_shared.cc: New test.
13917         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
13918         (check_PROGRAMS): Add weak_plt.
13919         (check_DATA): Add weak_plt_shared.so.
13920         (weak_plt_main_pic.o, weak_plt): New targets.
13921         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
13922         * testsuite/Makefile.in: Rebuild.
13923
13924         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
13925         gcctestdir/ld.
13926         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
13927         * testsuite/Makefile.in: Rebuild.
13928
13929 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
13930
13931         * Makefile.am (POTFILES.in): Set LC_ALL=C.
13932         * Makefile.in: Regenerate.
13933         * po/POTFILES.in: Regenerate.
13934
13935 2008-07-29  Ian Lance Taylor  <iant@google.com>
13936
13937         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
13938         symbols before other symbols.
13939         * testsuite/script_test_2.cc (test_addr): Declare.
13940         (test_addr_alias): Declare.
13941         (main): Check that test_addr and test_addr_alias have the right
13942         values.
13943         * testsuite/script_test_2.t: Define test_addr_alias and
13944         test_addr.
13945
13946 2008-07-24  Ian Lance Taylor  <iant@google.com>
13947
13948         PR 5990
13949         * descriptors.cc: New file.
13950         * descriptors.h: New file.
13951         * gold-threads.h (class Hold_optional_lock): New class.
13952         * fileread.cc: Include "descriptors.h".
13953         (File_read::~File_read): Release descriptor rather than closing
13954         it.
13955         (File_read::open) [file]: Call open_descriptor rather than open.
13956         Set is_descriptor_opened_.
13957         (File_read::open) [memory]: Assert that descriptor is not open.
13958         (File_read::reopen_descriptor): New function.
13959         (File_read::release): Release descriptor.
13960         (File_read::do_read): Make non-const.  Reopen descriptor.
13961         (File_read::read): Make non-const.
13962         (File_read::make_view): Reopen descriptor.
13963         (File_read::do_readv): Likewise.
13964         * fileread.h (class File_read): Add is_descriptor_opened_ field.
13965         Update declarations.
13966         * layout.cc: Include "descriptors.h".
13967         (Layout::create_build_id): Use open_descriptor rather than open.
13968         * output.cc: Include "descriptors.h".
13969         (Output_file::open): Use open_descriptor rather than open.
13970         * archive.cc (Archive::const_iterator): Change Archive to be
13971         non-const.
13972         (Archive::begin, Archive::end): Make non-const.
13973         (Archive::count_members): Likewise.
13974         * archive.h (class Archive): Update declarations.
13975         * object.h (Object::read): Make non-const.
13976         * Makefile.am (CCFILES): Add descriptors.cc.
13977         (HFILES): Add descriptors.h.
13978         * Makefile.in: Rebuild.
13979
13980         PR 6716
13981         * gold.h: Always include <clocale>.  Add Solaris workarounds
13982         following code in binutils/sysdep.h.
13983
13984         PR 6048
13985         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
13986         this->eh_frame_hdr_ is NULL before using it.
13987
13988         * dynobj.cc (Versions::Versions): Update comment.
13989
13990         * dynobj.cc (Versions::Versions): If there is an soname, use it as
13991         the base version name.
13992
13993         * stringpool.cc (Stringpool_template::add_with_length): Set key to
13994         array size plus one.
13995         (Stringpool_template::set_string_offsets): Subtract one from key
13996         before using it as an array index.
13997         (Stringpool_template::get_offset_with_length): Likewise.
13998         (Stringpool_template::write_to_buffer): Likewise.
13999         * stringpool.h (Stringpool_template::get_offset_from_key):
14000         Likewise.
14001
14002 2008-07-23  Ian Lance Taylor  <iant@google.com>
14003
14004         PR 6658
14005         * object.h (Merged_symbol_value::value): Do our best to handle a
14006         negative addend.
14007
14008         PR 6647
14009         * script.cc (Version_script_info::get_versions): Don't add empty
14010         version tag to return value.
14011         (Version_script_info::get_symbol_version_helper): Change return
14012         type to bool.  Add pversion parameter.  Change all callers.
14013         (script_register_vers_node): Don't require a non-NULL tag.
14014         * script.h (class Version_script_info): Update declarations.
14015         (Version_script_info::get_symbol_version): Change return type to
14016         bool.  Add version parameter.  Change all callers.
14017         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
14018         handling.  Handle an empty version from a version script.
14019         (Symbol_table::define_special_symbol): Likewise.
14020         * testsuite/ver_test_10.script: New file.
14021         * testsuite/ver_test_10.sh: New file.
14022         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
14023         (check_DATA): Add ver_test_10.syms.
14024         (ver_test_10.syms, ver_test_10.so): New target.
14025         * testsuite/Makefile.in: Rebuild.
14026
14027 2008-07-23  Simon Baldwin  <simonb@google.com>
14028
14029         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
14030         to zero for undefined symbols from dynamic libraries.
14031
14032 2008-07-23  Ian Lance Taylor  <iant@google.com>
14033
14034         * symtab.cc (Symbol_table::resolve): Remove version parameter.
14035         Change all callers.
14036         * symtab.h (class Symbol_table): Update declaration.
14037         * testsuite/ver_test_9.cc: New file.
14038         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
14039         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
14040         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
14041         (ver_test_9.so, ver_test_9.o): New targets.
14042         * testsuite/Makefile.in: Rebuild.
14043
14044 2008-07-22  Ian Lance Taylor  <iant@google.com>
14045
14046         * options.h (class General_options): Define --check-sections.
14047         * layout.cc (Layout::set_segment_offsets): Handle
14048         --check-sections.
14049
14050         * options.h (class General_options): Define -n/--nmagic and
14051         -N/--omagic.
14052         * options.cc (General_options::finalize): For -n/--nmagic or
14053         -N/--omagic, set -static.
14054         * layout.cc (Layout::attach_allocated_section_to_segment): If
14055         -N/--omagic, don't put read-only and read-write sections in
14056         different segments.
14057         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
14058         finding a read-only segment.
14059         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
14060         don't set the minimum segment alignment to the common page size,
14061         and don't set the file offset to the address modulo the page size.
14062         * script-sections.cc (Script_sections::create_segments): If
14063         -n/--omagic, don't put read-only and read-write sections in
14064         different segments.
14065
14066         * cref.cc: New file.
14067         * cref.h: New file.
14068         * options.h (class General_options): Add --print-symbol-counts.
14069         * main.cc (main): Issue defined symbol report if requested.
14070         * archive.cc (Archive::interpret_header): Make into a const member
14071         function.
14072         (Archive::add_symbols): Call Input_objects::archive_start and
14073         archive_stop.
14074         (Archive::const_iterator): Define new class.
14075         (Archive::begin, Archive::end): New functions.
14076         (Archive::include_all_members): Rewrite to use iterator.
14077         (Archive::count_members): New function.
14078         * archive.h (class Archive): Update declarations.
14079         (Archive::filename): New function.
14080         * object.cc: Include "cref.h".
14081         (Sized_relobj::Sized_relobj): Initialize defined_count_.
14082         (Sized_relobj::do_get_global_symbol_counts): New function.
14083         (Input_objects::add_object): Add object to cross-referencer.
14084         (Input_objects::archive_start): New function.
14085         (Input_objects::archive_stop): New function.
14086         (Input_objects::print_symbol_counts): New function.
14087         * object.h: Declare Cref and Archive.
14088         (Object::get_global_symbol_counts): New function.
14089         (Object::do_get_global_symbol_counts): New pure virtual function.
14090         (class Sized_relobj): Add defined_count_ field.  Update
14091         declarations.
14092         (class Input_objects): Add cref_ field.  Update constructor.
14093         Update declarations.
14094         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
14095         defined_count_.
14096         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
14097         symbol counts.
14098         (Sized_dynobj::do_get_global_symbol_counts): New function.
14099         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
14100         defined_count_.  Update declarations.  Define Symbols typedef.
14101         * symtab.cc (Symbol_table::add_from_relobj): Add defined
14102         parameter.  Change all callers.
14103         (Symbol_table::add_from_dynobj): Add sympointers and defined
14104         parameters.  Change all callers.
14105         * symtab.h (class Symbol_table): Update declarations.
14106         * Makefile.am (CCFILES): Add cref.cc.
14107         (HFILES): Add cref.h.
14108         * Makefile.in: Rebuild.
14109
14110 2008-07-22  Simon Baldwin  <simonb@google.com>
14111
14112         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
14113         to zero when writing undefined symbols.
14114
14115 2008-07-22  Ian Lance Taylor  <iant@google.com>
14116
14117         * output.cc (Output_section::add_input_section): Don't try to
14118         merge empty merge sections.
14119
14120 2008-07-21  Craig Silverstein  <csilvers@google.com>
14121
14122         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
14123         Include symbol version in error message.
14124
14125 2008-07-20  Chris Demetriou  <cgd@google.com>
14126
14127         * configure.ac (gold_cv_c_random_seed): New configured variable.
14128         (RANDOM_SEED_CFLAGS): New substituted variable.
14129         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
14130         * configure: Rebuild.
14131         * Makefile.in: Likewise.
14132         * testsuite/Makefile.in: Likewise.
14133
14134 2008-07-18  Ian Lance Taylor  <iant@google.com>
14135
14136         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
14137         where we see NAME/NULL and NAME/VERSION  as separate symbols.
14138         * testsuite/ver_test_main.cc (main): Call t4.
14139         (t4, t4_2a): Define.
14140         * testsuite/ver_test_2.cc (t4_2): Define.
14141         * testsuite/ver_test_2.script: Put t4_2a in VER2.
14142         * testsuite/ver_test_4.cc (t4_2a): Define.
14143         * testsuite/ver_test_4.script: Put t4_2a in VER2.
14144         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
14145
14146 2008-07-17  Ian Lance Taylor  <iant@google.com>
14147
14148         * dynobj.cc (Versions::add_def): If we give an error about a
14149         missing version, go ahead and create the version anyhow.
14150
14151 2008-07-10  Ian Lance Taylor  <iant@google.com>
14152
14153         Handle output sections with more than 0x7fffffff bytes.
14154         * object.h (class Relobj): Change map_to_output_ to
14155         output_sections_, and just keep a section pointer.  Change all
14156         uses.  Move comdat group support to Sized_relobj.
14157         (Relobj::is_section_specially_mapped): Remove.
14158         (Relobj::output_section): Remove poff parameter.  Change all
14159         callers.
14160         (Relobj::output_section_offset): New function.
14161         (Relobj::set_section_offset): Rewrite.
14162         (Relobj::map_to_output): Remove.
14163         (Relobj::output_sections): New function.
14164         (Relobj::do_output_section_offset): New pure virtual function.
14165         (Relobj::do_set_section_offset): Likewise.
14166         (class Sized_relobj): Add section_offsets_ field.  Add comdat
14167         group support from Relobj.  Update declarations.
14168         (Sized_relobj::get_output_section_offset): New function.
14169         (Sized_relobj::do_output_section_offset): New function.
14170         (Sized_relobj::do_set_section_offset): New function.
14171         * object.cc (Relobj::output_section_address): Remove.
14172         (Sized_relobj::Sized_relobj): Initialize new fields.
14173         (Sized_relobj::include_section_group): Cast find_kept_object to
14174         Sized_relobj.
14175         (Sized_relobj::include_linkonce_section): Likewise.
14176         (Sized_relobj::do_layout): Use separate arrays for output section
14177         and output offset.
14178         (Sized_relobj::do_count_local_symbols): Change map_to_output to
14179         output_sections.
14180         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
14181         output_sections and section_offsets.
14182         (Sized_relobj::write_local_symbols): Likewise.
14183         (map_to_kept_section): Compute output address directly.
14184         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
14185         output_sections and section_offsets.
14186         (Sized_relobj::write_sections): Likewise.
14187         (Sized_relobj::relocate_sections): Likewise.
14188         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
14189         * output.h (class Output_reloc): Update declarations.  Change
14190         u2_.relobj to Sized_relobj*.
14191         (class Output_data_reloc): Change add functions to use
14192         Sized_relobj*.
14193         * output.cc (Output_reloc::Output_reloc): Change relobj to
14194         Sized_relobj*.
14195         (Output_reloc::local_section_offset): Change return type to
14196         Elf_Addr.  Use get_output_section_offset.
14197         (Output_reloc::get_address): Likewise.
14198         (Output_section::is_input_address_mapped): Don't call
14199         is_section_specially_mapped.
14200         (Output_section::output_offset): Likewise.
14201         (Output_section::output_address): Likewise.
14202         (Output_section::starting_output_address): Likewise.
14203         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
14204         parameter to Sized_relobj*.
14205         (Copy_relocs::need_copy_reloc): Likewise.
14206         (Copy_relocs::save): Likewise.
14207         * copy-relocs.h (class Copy_relocs): Update declarations.
14208         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
14209         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
14210         * target-reloc.h (relocate_for_relocatable): Change
14211         offset_in_output_section type to Elf_Addr.  Change code that uses
14212         it as well.
14213         * layout.cc (Layout::layout): Always set *off.
14214         * mapfile.cc (Mapfile::print_input_section): Use
14215         output_section_offset.
14216         * i386.cc (Target_i386::copy_reloc): Change object parameter to
14217         Sized_relobj*.
14218         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
14219         * sparc.cc (Target_sparc::copy_reloc): Likewise.
14220         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
14221
14222 2008-07-03  Ian Lance Taylor  <iant@google.com>
14223
14224         * layout.cc (Layout::include_section): Do not discard unrecognized
14225         SHT_STRTAB sections.
14226
14227 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
14228
14229         * script.cc (Lex::can_continue_name): Make '?' allowable in
14230         version-script names.
14231         * testsuite/version_script.map: Change glob pattern to use '?'
14232
14233 2008-06-30  Manish Singh  <yosh@gimp.org>
14234
14235         PR 6585
14236         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
14237         Correct typo.
14238
14239 2008-06-30  Ian Lance Taylor  <iant@google.com>
14240
14241         PR 6660
14242         PR 6682
14243         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
14244         versions]: Don't try to read the value in the contents, since we
14245         don't use it.  Use the template endianness when writing.
14246
14247 2008-06-25  Cary Coutant  <ccoutant@google.com>
14248
14249         * fileread.cc (File_read::make_view): Assert on zero-length view.
14250         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
14251         symbol table when there are no symbols to read.
14252
14253 2008-06-23  Craig Silverstein  <csilvers@google.com>
14254
14255         * version.cc (version_string): Bump to 1.7
14256
14257 2008-06-18  Craig Silverstein  <csilvers@google.com>
14258
14259         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
14260         constant 0xFFFF to type Valtype.
14261         (Powerpc_relocate_functions::rel16_ha): Likewise.
14262
14263 2008-06-17  Ian Lance Taylor  <iant@google.com>
14264
14265         * output.h (Output_section::Input_section): Initialize p2align_ to
14266         zero for Output_section_data constructors.
14267         (Output_section::Input_section::addralign): If not an input
14268         section, return the alignment of the Output_section_data.
14269         * testsuite/copy_test.cc: New file.
14270         * testsuite/copy_test_1.cc: New file.
14271         * testsuite/copy_test_2.cc: New file.
14272         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
14273         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
14274         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
14275         (copy_test_1_pic.o, copy_test_1.so): New targets.
14276         (copy_test_2_pic.o, copy_test_2.so): New targets.
14277         * testsuite/Makefile.in: Rebuild.
14278
14279         * script-sections.cc (Script_sections::place_orphan): Initialize
14280         local variable exact.
14281
14282 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
14283
14284         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
14285
14286 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
14287             David S. Miller  <davem@davemloft.net>
14288
14289         * powerpc.cc: New file.
14290         * Makefile.am (TARGETSOURCES): Add powerpc.cc
14291         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
14292         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
14293         * Makefile.in: Rebuild.
14294
14295 2008-06-09  Ian Lance Taylor  <iant@google.com>
14296
14297         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
14298         <exception>.
14299         (throwing, orig_terminate): New static variables.
14300         (terminate_handler): New static function.
14301         (t2): Set terminate handler.
14302
14303 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
14304
14305         PR 6584
14306         * binary.cc (Binary_to_elf::sized_convert): Fix .data
14307         alignment.
14308
14309 2008-05-30  Cary Coutant  <ccoutant@google.com>
14310
14311         * archive.cc (Archive::include_all_members) Correct to step
14312         over symbol table and extended name table in thin archives.
14313
14314 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
14315
14316         PR 6407
14317         * target-reloc.h (relocate_for_relocatable): Fix new_offset
14318         calculation.
14319
14320 2008-05-28  Caleb Howe  <cshowe@google.com>
14321
14322         * reduced_debug_output.cc: New file.
14323         * reduced_debug_output.h: New file.
14324         * options.h (class General_options): Add --strip-debug-non-line.
14325         * options.cc (General_options::finalize): Add strip_debug_non_line
14326         to the strip heirarchy.
14327         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
14328         fields.
14329         * layout.cc: Include "reduced_debug_output.h".
14330         (Layout::Layout): Initialize new fields.
14331         (line_only_debug_sections): New static array.
14332         (is_lines_only_debug_sections): New static inline function.
14333         (Layout::include_section): Handle --strip-debug-non-line.
14334         (Layout::make_output_section): If --strip-debug-non-line, build
14335         new output sections for .debug_abbrev and .debug_info.
14336         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
14337         gold.  Warn about possible overflow.
14338         (read_signed_LEB_128): Likewise.
14339         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
14340         (read_signed_LEB_128): Declare.
14341         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
14342         (HFILES): Add reduced_debug_output.h.
14343         * Makefile.in: Rebuild.
14344
14345 2008-05-21  Ian Lance Taylor  <iant@google.com>
14346
14347         * mapfile.cc: New file.
14348         * mapfile.h: New file.
14349         * options.h (class General_options): Add -M/--print-map and -Map.
14350         * options.cc (General_options::finalize): Make -M equivalent to
14351         -Map -.
14352         * main.cc: Include <cstdio> and "mapfile.h".
14353         (main): Open mapfile if requested.
14354         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
14355         constructor.  Change caller.
14356         (queue_initial_tasks): Add mapfile parameter.  Change caller.
14357         (queue_middle_tasks): Likewise.
14358         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
14359         declarations.
14360         * archive.cc: Include "mapfile.h".
14361         (Archive::add_symbols): Add mapfile parameter.  Change all
14362         callers.  Pass mapfile, symbol, and reason to include_member.
14363         (Archive::include_all_members): Add mapfile parameter.  Change all
14364         callers.
14365         (Archive::include_member): Add mapfile, sym, and why parameters.
14366         Change all callers.  Report inclusion to map file.
14367         * archive.h: Include "fileread.h".
14368         (class Archive): Update declarations.
14369         (Archive::file): New const method.
14370         (class Add_archive_symbols): Add mapfile_ field.  Update
14371         constructor.  Change all callers.
14372         * readsyms.h (class Read_symbols): Likewise.
14373         (class Finish_group): Likewise.
14374         (class Read_script): Likewise.
14375         * common.cc: Include "mapfile.h".
14376         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
14377         all callers.
14378         (Symbol_table::do_allocate_commons): Likewise.
14379         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
14380         symbol allocation to mapfile.
14381         * common.h (class Allocate_commons_task): Add mapfile_ field.
14382         Update constructor.  Change all callers.
14383         * symtab.h (class Symbol_table): Update declarations.
14384         * layout.cc: Include "mapfile.h".
14385         (Layout_task_runner::run): Print information to mapfile.
14386         (Layout::create_gold_note): Change Output_data_fixed_space to
14387         Output_data_zero_fill.
14388         (Layout::create_build_id): Likewise.
14389         (Layout::print_to_mapfile): New function.
14390         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
14391         constructor.  Change caller.
14392         (class Layout): Declare print_to_mapfile.
14393         * output.cc (Output_section::Input_section::print_to_mapfile): New
14394         function.
14395         (Output_section::add_input_section): If producing a map, always
14396         add to input_sections_ list.
14397         (Output_section::do_print_to_mapfile): New function.
14398         (Output_segment::print_sections_to_mapfile): New function.
14399         (Output_segment::print_section_list_to_mapfile): New function.
14400         * output.h: Include "mapfile.h".
14401         (Output_data::print_to_mapfile): New function.
14402         (Output_data::do_print_to_mapfile): New virtual function.
14403         (Output_segment_headers::do_print_to_mapfile): New function.
14404         (Output_file_header::do_print_to_mapfile): New function.
14405         (Output_data_const::do_print_to_mapfile): New function.
14406         (class Output_data_const_buffer): Add map_name_ field.  Update
14407         constructor.  Change all callers.  Add do_print_to_mapfile
14408         function.
14409         (class Output_data_fixed_space): Likewise.
14410         (class Output_data_space): Likewise.
14411         (class Output_data_zero_fill): New class.
14412         (Output_data_strtab::do_print_to_mapfile): New function.
14413         (Output_data_reloc_base::do_print_to_mapfile): New function.
14414         (Output_relocatable_relocs::do_print_to_mapfile): New function.
14415         (Output_data_group::do_print_to_mapfile): New function.
14416         (Output_data_got::do_print_to_mapfile): New function.
14417         (Output_data_dynamic::do_print_to_mapfile): New function.
14418         (Output_symtab_xindex::do_print_to_mapfile): New function.
14419         (class Output_section): Declare do_print_to_mapflie.  Declare
14420         print_to_mapfile in Input_section.
14421         (class Output_segment): Declare new functions.
14422         * object.h (Sized_relobj::symbol_count): New function.
14423         * script-sections.cc
14424         (Output_section_element_dot_assignment::set_section_addresses):
14425         Change Output_data_fixed_space to Output_data_zero_fill.
14426         (Output_data_expression::do_print_to_mapfile): New function.
14427         * script.cc (read_input_script): Add mapfile parameter.  Change
14428         all callers.
14429         * script.h (read_input_script): Update declaration.
14430         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
14431         (Eh_frame::do_print_to_mapfile): New function.
14432         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
14433         (Output_merge_string::do_print_to_mapfile): New function.
14434         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
14435         function.
14436         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
14437         function.
14438         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
14439         function.
14440         * Makefile.am (CCFILES): Add mapfile.cc.
14441         (HFILES): Add mapfile.h.
14442         * Makefile.in: Rebuild.
14443
14444 2008-05-19  Ian Lance Taylor  <iant@google.com>
14445
14446         * options.h (class General_options): Add -z relro.
14447         * layout.cc (Layout::Layout): Initialize relro_segment_.
14448         (Layout::add_output_section_data): Return the output section.
14449         (Layout::make_output_section): Rcognize relro sections and mark
14450         them appropriately.
14451         (Layout::attach_allocated_section_to_segment): Put relro sections
14452         in a PT_GNU_RELRO segment.
14453         (Layout::create_initial_dynamic_sections): Mark the .dynamic
14454         section as relro.
14455         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
14456         PT_TLS segments.
14457         (Layout::linkonce_mapping): Map d.rel.ro.local to
14458         .data.rel.ro.local.
14459         (Layout::output_section_name): Us .data.rel.ro.local for any
14460         section which begins with that.
14461         * layout.h (class Layout): Update add_output_section_data
14462         declaration.  Add relro_segment_ field.
14463         * output.cc (Output_section::Output_section): Initialize is_relro_
14464         and is_relro_local_ fields.
14465         (Output_segment::add_output_section): Group relro sections.
14466         (Output_segment::is_first_section_relro): New function.
14467         (Output_segment::maximum_alignment): If there is a relro section,
14468         align the segment to the common page size.
14469         (Output_segment::set_section_addresses): Track whether we are
14470         looking at relro sections.  If the last section is a relro
14471         section, align to the common page size.
14472         (Output_segment::set_section_list_addresses): Add in_relro
14473         parameter.  Change all callers.  Align to the page size when
14474         moving from relro to non-relro section.
14475         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
14476         segment.
14477         * output.h (class Output_section): Add is_relro_ and
14478         is_relro_local_ fields.
14479         (Output_section::is_relro): New function.
14480         (Output_section::set_is_relro): New function.
14481         (Output_section::is_relro_local): New function.
14482         (Output_section::set_is_relro_local): New function.
14483         (class Output_segment): Update declarations.
14484         * i386.cc (Target_i386::got_section): Mark .got section as relro.
14485         * sparc.cc (Target_sparc::got_section): Likewise.
14486         * x86_64.cc (Target_x86_64::got_section): Likewise.
14487         * testsuite/relro_test_main.cc: New file.
14488         * testsuite/relro_test.cc: New file.
14489         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
14490         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
14491         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
14492         (relro_test.so, relro_test_pic.o): New targets.
14493         * testsuite/Makefile.in: Rebuild.
14494
14495 2008-05-16  Ian Lance Taylor  <iant@google.com>
14496
14497         * output.cc (Output_segment::add_output_section): Remove front
14498         parameter.
14499         * output.h (class Output_segment): Remove
14500         add_initial_output_section and overloaded add_output_section.
14501         Update declaration of remaining add_output_section.
14502         * layout.cc (Layout::create_interp): Call add_output_section
14503         rather than add_initial_output_section.
14504         (Layout::finish_dynamic_section): Likewise.
14505
14506         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
14507         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
14508         know the dynamic type.
14509         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
14510         field.  Initialize it in constructor.
14511         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
14512         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
14513         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
14514         reloc.
14515
14516         * output.cc (Output_reloc::get_address): Change return type to
14517         Elf_Addr.
14518         * output.h (class Output_reloc): Update get_address declaration.
14519         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
14520         for section addresses.
14521
14522 2008-05-09  Ian Lance Taylor  <iant@google.com>
14523
14524         PR 6493
14525         * gold.cc (gold_nomem): Use return value of write.
14526
14527 2008-05-08  Ian Lance Taylor  <iant@google.com>
14528
14529         * symtab.c (Symbol::init_base_output_data): Add version
14530         parameter.  Change all callers.
14531         (Symbol::init_base_output_segment): Likewise.
14532         (Symbol::init_base_constant): Likewise.
14533         (Symbol::init_base_undefined): Likewise.
14534         (Sized_symbol::init_output_data): Likewise.
14535         (Sized_symbol::init_output_segment): Likewise.
14536         (Sized_symbol::init_constant): Likewise.
14537         (Sized_symbol::init_undefined): Likewise.
14538         (Symbol_table::do_define_in_output_data): If the new symbol has a
14539         version, mark it as the default.
14540         (Symbol_table::do_define_in_output_segment): Likewise.
14541         (Symbol_table::do_define_as_constant): Likewise.
14542         * symtab.h (class Symbol): Update declarations.
14543         (class Sized_symbol): Likewise.
14544         * resolve.cc (Symbol::override_version): New function.
14545         (Symbol::override_base): Call override_version.
14546         (Symbol::override_base_with_special): Likewise.
14547         * testsuite/ver_script_8.script: New file.
14548         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
14549         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
14550         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
14551         (ver_test_8_1.so, ver_test_8_2.so): New targets.
14552
14553 2008-05-06  Ian Lance Taylor  <iant@google.com>
14554
14555         PR 6049
14556         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
14557         functions.
14558         (class General_options): Remove existing --undefined, and add
14559         --no-undefined instead.  Add new --undefined as synonym for -u.
14560         * archive.cc (Archive::add_symbols): Check whether symbol was
14561         named with -u.
14562         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
14563         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
14564         all uses.  Add IS_UNDEFINED.  Update declarations to split
14565         different versions of init_base.  Declare init_base_undefined.
14566         (Symbol::is_defined): Handle IS_UNDEFINED.
14567         (Symbol::is_undefined): Likewise.
14568         (Symbol::is_weak_undefined): Call is_undefined.
14569         (Symbol::is_absolute): Handle IS_CONSTANT.
14570         (class Sized_symbol): Update declarations to split different
14571         versions of init.  Declare init_undefined.
14572         (class Symbol_table): Declare new functions.
14573         * symtab.cc (Symbol::init_base_object): Rename from init_base.
14574         Change all callers.
14575         (Symbol::init_base_output_data): Likewise.
14576         (Symbol::init_base_output_segment): Likewise.
14577         (Symbol::init_base_constant): Likewise.
14578         (Symbol::init_base_undefined): New function.
14579         (Sized_symbol::init_object): Rename from init.  Change all
14580         callers.
14581         (Sized_symbol::init_output_data): Likewise.
14582         (Sized_symbol::init_output_segment): Likewise.
14583         (Sized_symbol::init_constant): Likewise.
14584         (Sized_symbol::init_undefined): New function.
14585         (Symbol_table::add_undefined_symbols_from_command_line): New
14586         function.
14587         (Symbol_table::do_add_undefined_symbols_from_command_line): New
14588         function.
14589         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
14590         (Symbol::output_section): Likewise.
14591         (Symbol::set_output_section): Likewise.
14592         (Symbol_table::sized_finalize_symbol): Likewise.
14593         (Symbol_table::sized_write_globals): Likewise.
14594         * resolve.cc (Symbol_table::should_override): Likewise.
14595         (Symbol::override_base_with_special): Likewise.
14596
14597         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
14598         symbol, change it to have default visibility.
14599         * testsuite/protected_1.cc: New file.
14600         * testsuite/protected_2.cc: New file.
14601         * testsuite/protected_3.cc: New file.
14602         * testsuite/protected_main_1.cc: New file.
14603         * testsuite/protected_main_2.cc: New file.
14604         * testsuite/protected_main_3.cc: New file.
14605         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
14606         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
14607         (protected_1_LDFLAGS, protected_1_LDADD): Define.
14608         (protected_1.so): New target.
14609         (protected_1_pic.o, protected_2_pic.o): New targets.
14610         (protected_3_pic.o): New target.
14611         (check_PROGRAMS): Add protected_2.
14612         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
14613         (protected_2_LDFLAGS, protected_2_LDADD): Define.
14614         * testsuite/Makefile.in: Rebuild.
14615
14616         * options.h (DEFINE_var): Add set_user_set_##varname__.
14617         (DEFINE_bool_alias): New macro.
14618         (class General_options): Define -Bstatic using DEFINE_bool_alias
14619         rather than DEFINE_special.  Add --undefined as an alias for -z
14620         defs.
14621         * options.cc (General_options::parse_Bstatic): Remove.
14622
14623         * options.h (class General_options): Add --fatal-warnings.
14624         * main.cc (main): Implement --fatal-warnings.
14625         * errors.h (Errors::warning_count): New function.
14626
14627         * options.h (class General_options): Add -Bsymbolic-functions.
14628         * symtab.h (Symbol::is_preemptible): Check for
14629         -Bsymbolic-functions.
14630
14631 2008-05-05  Ian Lance Taylor  <iant@google.com>
14632
14633         * options.h (DEFINE_bool): For DASH_Z, create the negative option
14634         as noVARNAME rather than no-VARNAME.
14635         (class General_options): Add option -z combreloc.
14636         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
14637         get_address.
14638         (Output_reloc::sort_before) [SHT_REL]: New function.
14639         (Output_reloc::sort_before) [SHT_RELA]: New function.
14640         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
14641         Sort_relocs_comparison.
14642         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
14643         parameter.  Change all callers.
14644         (Output_data_reloc::Output_data_reloc) [both versions]: Add
14645         sort_relocs parameter.  Change all callers.
14646         * output.cc (Output_reloc::get_address): New function, broken out
14647         of write_rel.
14648         (Output_reloc::write_rel): Call it.
14649         (Output_reloc::compare): New function.
14650         (Output_data_reloc_base::do_write): Optionally sort relocs.
14651
14652         * configure.ac: If targ_extra_obj is set, link it in.
14653         * configure.tgt: Initialize all variables.
14654         (x86_64*): Set targ_extra_obj and targ_extra_size.
14655         * configure: Rebuild.
14656
14657         * object.cc (Sized_relobj::include_section_group): Adjust section
14658         indexes read from group data.  Build vector to pass to
14659         layout_group.
14660         * layout.cc (Layout::layout_group): Add flags and shndxes
14661         parameters.  Remove contents parameter.  Change caller.  Update
14662         explicit instantiations.
14663         * layout.h (class Layout): Update layout_group declaration.
14664         * output.cc (Output_data_group::Output_data_group): Add flags and
14665         input_shndxes parameters.  Remove contents parameter.  Change
14666         caller.
14667         (Output_data_group::do_write): Change input_sections_ to
14668         input_shndxes_.
14669         * output.h (class Output_data_group): Update constructor
14670         declaration.  Rename input_sections_ to input_shndxes_.
14671         * testsuite/many_sections_test.cc: Add template.
14672
14673 2008-04-30  Cary Coutant  <ccoutant@google.com>
14674
14675         * target-reloc.h (relocate_section): Fix dead-pointer bug.
14676
14677         * layout.cc (Layout::include_section): Refactored check for debug
14678         info section.
14679         (Layout::add_comdat): Add new parameters.  Change type
14680         of signature parameter.  Add object and shndx to signatures table.
14681         (Layout::find_kept_object): New function.
14682         * layout.h: Include <cstring>.
14683         (Layout::is_debug_info_section): New function.
14684         (Layout::add_comdat): Add new parameters.
14685         (Layout::find_kept_object): New function.
14686         (Layout::Kept_section): New struct.
14687         (Layout::Signatures): Change type of map range.
14688         * object.cc (Relobj::output_section_address): New function.
14689         (Sized_relobj::include_section_group): Add new parameters.  Change
14690         calls to Layout::add_comdat.  Change to build table of kept comdat
14691         groups and table mapping discarded sections to kept sections.
14692         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
14693         (Sized_relobj::do_layout): Change calls to include_section_group and
14694         include_linkonce_section.
14695         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
14696         value to zero when section is discarded.
14697         (Sized_relobj::map_to_kept_section): New function.
14698         * object.h (Relobj::output_section_address): New function.
14699         (Relobj::Comdat_group): New type.
14700         (Relobj::find_comdat_group): New function.
14701         (Relobj::Comdat_group_table): New type.
14702         (Relobj::Kept_comdat_section): New type.
14703         (Relobj::Kept_comdat_section_table): New type.
14704         (Relobj::add_comdat_group): New function.
14705         (Relobj::set_kept_comdat_section): New function.
14706         (Relobj::get_kept_comdat_section): New function.
14707         (Relobj::comdat_groups_): New field.
14708         (Relobj::kept_comdat_sections_): New field.
14709         (Symbol_value::input_value): Update comment.
14710         (Sized_relobj::map_to_kept_section) New function.
14711         (Sized_relobj::include_linkonce_section): Add new parameter.
14712         * target-reloc.h (Comdat_behavior): New type.
14713         (get_comdat_behavior): New function.
14714         (relocate_section): Add code to map a discarded section to the
14715         corresponding kept section when applying a relocation.
14716
14717 2008-04-30  Craig Silverstein  <csilvers@google.com>
14718
14719         * dwarf_reader.cc (next_generation_count): New static var.
14720         (Addr2line_cache_entry): New struct.
14721         (addr2line_cache): New static var.
14722         (Dwarf_line_info::one_addr2line): Added caching.
14723         (Dwarf_line_info::clear_addr2line_cache): New function.
14724         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
14725         cache-size parameter.
14726         (Dwarf_line_info::one_addr2line_cache): New function.
14727         * symtab.cc (Symbol_table::detect_odr_violations): Pass
14728         new cache-size argument to one_addr2line(), and clear cache.
14729
14730 2008-04-28  Cary Coutant  <ccoutant@google.com>
14731
14732         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
14733         R_386_PC8 relocations.
14734
14735 2008-04-23  Ian Lance Taylor  <iant@google.com>
14736
14737         * object.cc (Sized_relobj::include_section_group): Check for
14738         invalid section group.
14739
14740         * object.cc (make_elf_object): Correct test for 64-bit ELF file
14741         header size.
14742
14743         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
14744         than read for file header.
14745         * archive.cc (Archive::include_member): Likewise.
14746
14747 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
14748
14749         * aclocal.m4: Regenerate.
14750         * configure: Regenerate.
14751
14752 2008-04-19  Ian Lance Taylor  <iant@google.com>
14753
14754         * version.cc (version_string): Bump to 1.6.
14755
14756         * testsuite/Makefile.am (many_sections_r_test): New target.
14757         (many_sections_r_test_SOURCES): Remove.
14758         (many_sections_r_test_DEPENDENCIES): Remove.
14759         (many_sections_r_test_LDFLAGS): Remove.
14760         (many_sections_r_test_LDADD): Remove.
14761
14762         * object.cc (Sized_relobj::do_add_symbols): Always pass
14763         local_symbol_count_ to add_from_relobj.
14764
14765         * testsuite/Makefile.am (many_sections_check.h): Only check one in
14766         every thousand variables.
14767         * testsuite/Makefile.in: Rebuild.
14768
14769         * object.cc (Xindex::initialize_symtab_xindex): New function.
14770         (Xindex::read_symtab_xindex): New function.
14771         (Xindex::sym_xindex_to_shndx): New function.
14772         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
14773         available.
14774         (Sized_relobj::do_initialize_xindex): New function.
14775         (Sized_relobj::do_read_symbols): Adjust section links.
14776         (Sized_relobj::symbol_section_and_value): Add is_ordinary
14777         parameter.  Change all callers.
14778         (Sized_relobj::include_section_group): Adjust section links and
14779         symbol section indexes.
14780         (Sized_relobj::do_layout): Adjust section links.
14781         (Sized_relobj::do_count_local_symbols): Adjust section links and
14782         symbol section indexes.
14783         (Sized_relobj::do_finalize_local_symbols): Distinguish between
14784         ordinary and special symbols.
14785         (Sized_relobj::write_local_symbols): Add symtab_xindex and
14786         dynsym_xindex parameters.  Change all callers.  Adjust section
14787         links.  Use SHN_XINDEX when needed.
14788         (Sized_relobj::get_symbol_location_info): Adjust section links.
14789         Don't get fooled by special symbols.
14790         * object.h (class Xindex): Define.
14791         (class Object): Add xindex_ parameter.  Declare virtual functoin
14792         do_initialize_xindex.
14793         (Object::adjust_sym_shndx): New function.
14794         (Object::set_xindex): New protected function.
14795         (class Symbol_value): Add is_ordinary_shndx_ field.
14796         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
14797         (Symbol_value::value): Assert ordinary section.
14798         (Symbol_value::initialize_input_to_output_map): Likewise.
14799         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
14800         Change all callers.
14801         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
14802         all callers.
14803         (class Sized_relobj): Update declarations.
14804         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
14805         parameter.  Change all callers.
14806         (Sized_relobj::adjust_shndx): New function.
14807         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
14808         field.
14809         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
14810         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
14811         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
14812         (Sized_dynobj::read_dynsym_section): Adjust section links.
14813         (Sized_dynobj::read_dynamic): Likewise.
14814         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
14815         section links.
14816         (Sized_dynobj::do_initialize_xindex): New function.
14817         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
14818         do_initialize_xindex.
14819         (Sized_dynobj::adjust_shndx): New function.
14820         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
14821         dynsym_xindex_ fields.
14822         (Layout::finalize): Add a call to set_section_indexes before
14823         creating the symtab sections.
14824         (Layout::set_section_indexes): Don't do anything if the section
14825         already has a section index.
14826         (Layout::create_symtab_sections): Add shnum parameter.  Change
14827         caller.  Create .symtab_shndx section if needed.
14828         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
14829         caller.
14830         (Layout::allocated_output_section_count): New function.
14831         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
14832         needed.
14833         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
14834         fields.  Update declarations.
14835         (Layout::symtab_xindex): New function.
14836         (Layout::dynsym_xindex): New function.
14837         (class Write_symbols_task): Add layout_ field.
14838         (Write_symbols_task::Write_symbols_task): Add layout parameter.
14839         Change caller.
14840         * output.cc (Output_section_headers::Output_section_headers): Add
14841         shstrtab_section parameter.  Change all callers.
14842         (Output_section_headers::do_sized_write): Store overflow values
14843         for section count and section string table section index in
14844         section header zero.
14845         (Output_file_header::do_sized_write): Check for overflow of
14846         section count and section string table section index.
14847         (Output_symtab_xindex::do_write): New function.
14848         (Output_symtab_xindex::endian_do_write): New function.
14849         * output.h (class Output_section_headers): Add shstrtab_section_.
14850         Update declarations.
14851         (class Output_symtab_xindex): Define.
14852         (Output_section::has_out_shndx): New function.
14853         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
14854         field.
14855         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
14856         Change all callers.
14857         (Sized_symbol::init): Likewise.
14858         (Symbol::output_section): Check for ordinary symbol.
14859         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
14860         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
14861         callers.
14862         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
14863         Change all callers.  Simplify handling of symbols from sections
14864         not included in the link.
14865         (Symbol_table::add_from_dynobj): Handle ordinary symbol
14866         distinction.
14867         (Weak_alias_sorter::operator()): Assert that symbols are
14868         ordinary.
14869         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
14870         distinction.
14871         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
14872         parameters.  Change all callers.
14873         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
14874         symbol distinction.  Use SHN_XINDEX when needed.
14875         (Symbol_table::write_section_symbol): Add symtab_xindex
14876         parameter.  Change all callers.
14877         (Symbol_table::sized_write_section_symbol): Likewise.  Use
14878         SHN_XINDEX when needed.
14879         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
14880         declarations.
14881         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
14882         (Symbol::is_defined): Check is_ordinary.
14883         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
14884         (Symbol::is_absolute, Symbol::is_common): Likewise.
14885         (class Sized_symbol): Update declarations.
14886         (class Symbol_table): Update declarations.
14887         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
14888         parameters.  Change all callers.
14889         (Sized_symbol::override): Likewise.
14890         (Symbol_table::override): Likewise.
14891         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
14892         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
14893         is_ordinary, and orig_st_shndx parameters.  Change all callers.
14894         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
14895         to be in an ordinary section.
14896         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
14897         object and is_ordinary parameters.  Change all callers.
14898         (Sized_dwarf_line_info::read_relocs): Add object parameter.
14899         Change all callers.  Don't add undefined or non-ordinary symbols
14900         to reloc_map_.
14901         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
14902         Change all callers.
14903         * dwarf_reader.h (class Sized_dwarf_line_info): Update
14904         declarations.
14905         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
14906         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
14907         (Sized_relobj::relocate_sections): Likewise.
14908         * target-reloc.h (scan_relocs): Adjust section symbol index.
14909         (scan_relocatable_relocs): Likewise.
14910         * i386.cc (Scan::local): Check for ordinary symbols.
14911         * sparc.cc (Scan::local): Likewise.
14912         * x86_64.cc (Scan::local): Likewise.
14913         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
14914         to symbol_section_and_value.
14915         * testsuite/many_sections_test.cc: New file.
14916         * testsuite/Makefile.am (BUILT_SOURCES): Define.
14917         (check_PROGRAMS): Add many_sections_test.
14918         (many_sections_test_SOURCES): Define.
14919         (many_sections_test_DEPENDENCIES): Define.
14920         (many_sections_test_LDFLAGS): Define.
14921         (BUILT_SOURCES): Add many_sections_define.h.
14922         (many_sections_define.h): New target.
14923         (BUILT_SOURCES): Add many_sections_check.h.
14924         (many_sections_check.h): New target.
14925         (check_PROGRAMS): Add many_sections_r_test.
14926         (many_sections_r_test_SOURCES): Define.
14927         (many_sections_r_test_DEPENDENCIES): Define.
14928         (many_sections_r_test_LDFLAGS): Define.
14929         (many_sections_r_test_LDADD): Define.
14930         (many_sections_r_test.o): New target.
14931         * testsuite/Makefile.in: Rebuild.
14932
14933 2008-04-17  Cary Coutant  <ccoutant@google.com>
14934
14935         * errors.cc (Errors::info): New function.
14936         (gold_info): New function.
14937         * errors.h (Errors::info): New function.
14938         * gold.h (gold_info): New function.
14939         * object.cc (Input_objects::add_object): Print trace output.
14940         * options.cc (options::parse_set): New function.
14941         (General_options::parse_wrap): Deleted.
14942         (General_options::General_options): Deleted initializer.
14943         * options.h (options::String_set): New typedef.
14944         (options::parse_set): New function.
14945         (DEFINE_set): New macro.
14946         (General_options::wrap): Changed to use DEFINE_set. Changed
14947         callers of any_wrap_symbols and is_wrap_symbol.
14948         (General_options::trace, General_options::trace_symbol):
14949         New options.
14950         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
14951         (General_options::wrap_symbols_): Deleted.
14952         * symtab.cc (Symbol_table::add_from_object): Print trace output.
14953
14954 2008-04-17  David S. Miller  <davem@davemloft.net>
14955
14956         * options.cc (General_options::parse_V): New function.
14957         * options.h: Add entries for -V and -Qy.
14958
14959 2008-04-17  Ian Lance Taylor  <iant@google.com>
14960
14961         * common.cc (Symbol_table::allocate_commons): Remove options
14962         parameter.  Change caller.
14963         (Symbol_table::do_allocate_commons): Remove options parameter.
14964         Change caller.  Just call do_allocate_commons_list twice.
14965         (Symbol_table::do_allocate_commons_list): New function, broken out
14966         of do_allocate_commons.
14967         * common.h (class Allocate_commons_task): Remove options_ field.
14968         Update constructor.
14969         * symtab.cc (Symbol_table::Symbol_table): Initialize
14970         tls_commons_.
14971         (Symbol_table::add_from_object): Put TLS common symbols on
14972         tls_commons_ list.
14973         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
14974         which are IN_OUTPUT_DATA.
14975         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
14976         allocate_commons and do_allocate_commons declarations.  Declare
14977         do_allocate_commons_list.
14978         * gold.cc (queue_middle_tasks): Update creation of
14979         Allocate_commons_task to not pass options.
14980         * testsuite/Makefile.am (INCLUDES): Add -I.. .
14981         (TLS_TEST_C_FLAGS): New variable.
14982         (tls_test_c_pic.o): New target.
14983         (tls_test_shared.so): Link in tls_test_c_pic.o.
14984         (tls_test_c_pic_ie.o): New target.
14985         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
14986         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
14987         (tls_test_c.o): New target.
14988         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
14989         (tls_pic_test_LDADD): Likewise.
14990         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
14991         (tls_shared_gd_to_ie_test_LDADD): Likewise.
14992         (tls_test_c_gnu2.o): New target.
14993         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
14994         tls_test_c_gnu2.o.
14995         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
14996         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
14997         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
14998         * testsuite/tls_test.cc: Include "config.h".
14999         (t_last): Call t11_last.
15000         * testsuite/tls_test.h (t11, t11_last): Declare.
15001         * testsuite/tls_test_c.c: New file.
15002         * testsuite/tls_test_main.cc (thread_routine): Call t11.
15003         * configure.ac: Check for OpenMP support.
15004         * configure, config.in, Makefile.in: Rebuild.
15005         * testsuite/Makefile.in: Rebuild.
15006
15007 2008-04-16  Cary Coutant  <ccoutant@google.com>
15008
15009         * i386.cc (Target_i386::define_tls_base_symbol): New function.
15010         (Target_i386::tls_base_symbol_defined_): New field.
15011         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15012         (Target_i386::Scan::global): Likewise.
15013         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
15014         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
15015         (Target_x86_64::tls_base_symbol_defined_): New field.
15016         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15017         (Target_x86_64::Scan::global): Likewise.
15018
15019 2008-04-16  Cary Coutant  <ccoutant@google.com>
15020
15021         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
15022         (Symbol::needs_plt_entry): Allow weak undefined symbols.
15023         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
15024         building shared libraries.
15025         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
15026         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
15027         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
15028         * testsuite/Makefile.in: Rebuild.
15029         * testsuite/weak_undef.h: New file.
15030         * testsuite/weak_undef_file1.cc: Add extra test cases.
15031         * testsuite/weak_undef_file2.cc: Likewise.
15032         * testsuite/weak_undef_test.cc: Likewise.
15033
15034 2008-04-16  David S. Miller  <davem@davemloft.net>
15035
15036         * sparc.cc (Target_sparc::Scan): Change from struct to class.
15037         Add issued_non_pic_error_ field.  Declare check_non_pic.
15038         (Target_sparc::Scan::check_non_pic): New function.
15039         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
15040         (Target_sparc::Scan::global): Likewise.
15041
15042         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
15043         * configure: Rebuild.
15044
15045         * options.h (DEFINE_enable): New macro.
15046         (new_dtags): New enable option.
15047         (initfirst, interpose, loadfltr, nodefaultlib,
15048         nodelete, nodlopen, nodump): New -z options.
15049         * layout.cc (Layout:finish_dynamic_section): If new
15050         dtags enabled, emit DT_RUNPATH.  Also, emit a
15051         DT_FLAGS_1 containing any specified -z flags.
15052
15053 2008-04-16  Ian Lance Taylor  <iant@google.com>
15054
15055         * copy-relocs.cc: New file.
15056         * copy-relocs.h: New file.
15057         * reloc.cc: Remove Copy_relocs code.
15058         * reloc.h: Likewise.
15059         * reloc-types.h (struct Reloc_types) [both versions]: Add
15060         get_reloc_addend_noerror.
15061         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
15062         variants of add_global which take an addend which must be zero.
15063         * i386.cc: Include "copy-relocs.h".
15064         (class Target_i386): Change type of copy_relocs_ to variable,
15065         update initializer.
15066         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
15067         Change all callers.
15068         (Target_i386::do_finalize_sections): Change handling of
15069         copy_relocs_.
15070         * sparc.cc: Include "copy-relocs.h".
15071         (class Target_sparc): Change type of copy_relocs_ to variable,
15072         update initializer.
15073         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
15074         Change all callers.
15075         (Target_sparc::do_finalize_sections): Change handling of
15076         copy_relocs_.
15077         * x86_64.cc: Include "copy-relocs.h".
15078         (class Target_x86_64): Change type of copy_relocs_ to variable,
15079         update initializer.
15080         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
15081         class.  Change all callers.
15082         (Target_x86_64::do_finalize_sections): Change handling of
15083         copy_relocs_.
15084         * Makefile.am (CCFILES): Add copy-relocs.cc.
15085         (HFILES): Add copy-relocs.h.
15086
15087         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
15088
15089         * testsuite/script_test_4.sh: Permit leading zeroes.
15090
15091 2008-04-15  Ian Lance Taylor  <iant@google.com>
15092
15093         * script-sections.cc (Script_sections::create_segments): Use
15094         header_size_adjustment even when there is enough room for the
15095         headers.
15096         * testsuite/script_test_4.sh: New file.
15097         * testsuite/script_test_4.t: New file.
15098         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
15099         (check_DATA): Add script_test_4.stdout.
15100         (MOSTLYCLEANFILES): Likewise.
15101         (script_test_4): New target.
15102         (script_test_4.stdout): New target.
15103         * testsuite/Makefile.in: Rebuild.
15104
15105         * sparc.cc: Add definitions for Output_data_plt_sparc class
15106         constants.
15107
15108 2008-04-14  David S. Miller  <davem@davemloft.net>
15109
15110         * sparc.cc: New file.
15111         * Makefile.am (TARGETSOURCES): Add sparc.cc
15112         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
15113         * configure.tgt: Document targ_extra_size and
15114         targ_extra_big_endian.  Add entries for sparc-* and
15115         sparc64-*.
15116         * configure.ac: Handle targ_extra_size and
15117         targ_extra_big_endian.
15118         * Makefile.in: Rebuild.
15119         * configure: Likewise.
15120         * po/POTFILES.in: Likewise.
15121         * po/gold.pot: Likewise.
15122
15123 2008-04-14  Ian Lance Taylor  <iant@google.com>
15124
15125         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
15126         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
15127         in the name/type/flags to section mapping.  Don't call
15128         allocate_output_section.
15129         (Layout::choose_output_section): Change parameter from adjust_name
15130         to is_input_section.  Don't permit input sections after sections
15131         are attached to segments.  Don't call allocate_output_section.
15132         (Layout::layout_eh_frame): Call update_flags_for_input_section,
15133         not write_enable_output_section.
15134         (Layout::make_output_section): Don't push to
15135         unattached_section_list_ nor call attach_to_segment.  Call
15136         attach_section_to_segment if sections are attached.
15137         (Layout::attach_sections_to_segments): New function.
15138         (Layout::attach_section_to_segment): New function.
15139         (Layout::attach_allocated_section_to_segment): Rename from
15140         attach_to_segment.  Remove flags parameter.
15141         (Layout::allocate_output_section): Remove function.
15142         (Layout::write_enable_output_section): Remove function.
15143         * layout.h (class Layout): Update for above changes.  Add new
15144         field sections_are_attached_.
15145         * output.h (Output_section::update_flags_for_input_section): New
15146         function.
15147         * output.cc (Output_section::add_input_section): Call
15148         update_flags_for_input_section.
15149         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
15150
15151 2008-04-11  Cary Coutant  <ccoutant@google.com>
15152
15153         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
15154         thought unnecessary.
15155         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
15156
15157 2008-04-11  Ian Lance Taylor  <iant@google.com>
15158
15159         * output.h (class Output_section_data): Remove inline definition
15160         of set_addralign.
15161         * output.cc (Output_section_data::set_addralign): New function.
15162
15163 2008-04-11  Cary Coutant  <ccoutant@google.com>
15164
15165         Add support for TLS descriptors for i386 and x86_64.
15166         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
15167         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
15168         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
15169         GOT_TYPE_TLS_DESC.
15170         (Target_i386::got_mod_index_entry): Remove unnecessary code.
15171         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
15172         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
15173         relocations.
15174         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
15175         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
15176         Fix problem with initial-exec relocations.
15177         (Target_i386::Relocate::relocate_tls): Likewise.
15178         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
15179         relaxation.
15180         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
15181         support for section-plus-offset dynamic table entries.
15182         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
15183         (Output_data_dynamic::Dynamic_entry): Add support for
15184         section-plus-offset dynamic table entries.
15185         (Output_data_dynamic::Classification): Likewise.
15186         (Output_data_dynamic::classification_): Renamed offset_.
15187         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
15188         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
15189         (Target_x86_64::make_plt_section): New function.
15190         (Target_x86_64::reserve_tlsdesc_entries): New function.
15191         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
15192         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
15193         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
15194         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
15195         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
15196         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
15197         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
15198         add extra PLT entry for TLS descriptors.
15199         (Output_data_plt_x86_64::got_): New field.
15200         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
15201         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
15202         fields.
15203         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
15204         descriptors.
15205         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
15206         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
15207         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
15208         R_386_TLS_DESC_CALL relocations.
15209         (Target_x86_64::Scan::global): Likewise.
15210         (Target_x86_64::do_finalize_sections): Add dynamic table entries
15211         for TLS descriptors.
15212         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
15213         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
15214         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
15215         GD-to-IE relaxation.
15216         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
15217         and TLS_DESCRIPTORS.
15218         * Makefile.in: Rebuild.
15219         * configure: Rebuild.
15220         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
15221         (tls_test_shared2.so): New target.
15222         (tls_shared_gd_to_ie_test_SOURCES): New variable.
15223         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
15224         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
15225         (tls_shared_gd_to_ie_test_LDADD): New variable.
15226         (tls_shared_gnu2_gd_to_ie_test): New target.
15227         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
15228         New targets.
15229         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
15230         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
15231         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
15232         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
15233         (tls_shared_gnu2_test): New target.
15234         (tls_test_gnu2_shared.so): New target.
15235         (tls_shared_gnu2_test_SOURCES): New variable.
15236         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
15237         (tls_shared_gnu2_test_LDFLAGS): New variable.
15238         (tls_shared_gnu2_test_LDADD): New variable.
15239         * testsuite/Makefile.in: Rebuild.
15240         * testsuite/Makefile.
15241
15242 2008-04-11  Ian Lance Taylor  <iant@google.com>
15243
15244         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
15245         justsyms.t.
15246         * testsuite/Makefile.in: Rebuild.
15247
15248         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
15249         long.
15250         * testsuite/script_test_2.cc (main): Adjust test.
15251
15252 2008-04-11  David S. Miller  <davem@davemloft.net>
15253             Ian Lance Taylor  <iant@google.com>
15254
15255         * options.h (General_options): Add entries for '-Y' and
15256         '-relax'.
15257         * options.cc (General_options:finalize): If -Y was used, add those
15258         entries to the library path instead of the default "/lib" and
15259         "/usr/lib".
15260
15261 2008-04-11  David S. Miller  <davem@davemloft.net>
15262
15263         * testsuite/justsyms.t: Start at 0x100.
15264         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
15265         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
15266         long.
15267         * testsuite/script_test_2.cc: Adjust string and section length
15268         checks.
15269
15270 2008-04-09  Ian Lance Taylor  <iant@google.com>
15271
15272         PR gold/5996
15273         * script-sections.cc (Sections_element::allocate_to_segment): Add
15274         orphan parameter.
15275         (Output_section_definition::allocate_to_segment): Likewise.
15276         (Orphan_output_section::allocate_to_segment): Likewise.
15277         (Script_sections::attach_sections_using_phdrs_clause): Don't
15278         propagate non-PT_LOAD segments to orphan sections.
15279         * testsuite/Makefile.am (script_test_3.stdout): Generate using
15280         readelf rather than objdump.
15281         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
15282         .interp section and PT_INTERP segment are the same size.
15283         * testsuite/Makefile.in: Rebuild.
15284
15285         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
15286         aliases for symbols defined in the same object.
15287         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
15288         (weak_alias_test_SOURCES): New variable.
15289         (weak_alias_test_DEPENDENCIES): New variable.
15290         (weak_alias_test_LDFLAGS): New variable.
15291         (weak_alias_test_LDADD): New variable.
15292         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
15293         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
15294         (weak_alias_test_3.o): New target.
15295         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
15296         * testsuite/weak_alias_test_main.cc: New file.
15297         * testsuite/weak_alias_test_1.cc: New file.
15298         * testsuite/weak_alias_test_2.cc: New file.
15299         * testsuite/weak_alias_test_3.cc: New file.
15300
15301 2008-04-08  Ian Lance Taylor  <iant@google.com>
15302
15303         * options.h (class General_options): Add --noinhibit-exec option.
15304         * main.cc (main): Check --noinhibit-exec.
15305
15306         * options.h (class General_options): Define --wrap as a special
15307         option.  Add wrap_symbols_ field.
15308         (General_options::any_wrap_symbols): New function.
15309         (General_options::is_wrap_symbol): New function.
15310         * options.cc (General_options::parse_wrap): New function.
15311         (General_options::General_options): Initialize wrap_symbols_.
15312         * symtab.cc (Symbol_table::wrap_symbol): New function.
15313         (Symbol_table::add_from_object): Handle --wrap.
15314         * symtab.h (class Symbol_table): Declare wrap_symbol.
15315         * target.h (Target::wrap_char): New function.
15316         (Target::Target_info): Add wrap_char field.
15317         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
15318         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
15319         * testsuite/testfile.cc (Target_test::test_target_info):
15320         Likewise.
15321
15322         * errors.cc (Errors::undefined_symbol): Mention symbol version if
15323         there is one.
15324
15325         * layout.h (class Layout): Add added_eh_frame_data_ field.
15326         * layout.cc (Layout::Layout): Initialize new field.
15327         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
15328         output section until we find a section we merged successfully.
15329         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
15330         that the size be non-zero.
15331
15332         * merge.cc (Object_merge_map::get_output_offset): Remove inline
15333         qualifier.
15334
15335 2008-04-08  Craig Silverstein  <csilvers@google.com>
15336
15337         * configure.ac: Export new conditional variable HAVE_ZLIB.
15338         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
15339         on HAVE_ZLIB.
15340         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
15341         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15342
15343 2008-04-07  Ian Lance Taylor  <iant@google.com>
15344
15345         * version.cc (version_string): Set to "1.5".
15346
15347         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
15348         Add issued_non_pic_error_ field.  Declare check_non_pic.
15349         (Target_x86_64::Scan::check_non_pic): New function.
15350         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
15351         (Target_x86_64::Scan::global): Likewise.
15352
15353         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
15354         addend parameter.  Change caller.  Handle merge sections.
15355         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
15356         Address to Addend.  Don't add in the result of
15357         local_section_offset, pass down the addend and use the returned
15358         value.
15359         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
15360         Update declarations of local_section_offset and symbol_value.
15361         * testsuite/two_file_test_1.cc (t18): New function.
15362         * testsuite/two_file_test_2.cc (f18): New function.
15363         * testsuite/two_file_test_main.cc (main): Call t18.
15364         * testsuite/two_file_test.h (t18, f18): Declare.
15365
15366         * configure.ac: Don't test for objdump, c++filt, or readelf.
15367         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
15368         conditionals.
15369         (TEST_READELF): New variable.
15370         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
15371         (check_PROGRAMS): Add two_file_strip_test.
15372         (two_file_strip_test): New target.
15373         (check_PROGRAMS): Add two_file_same_shared_strip_test.
15374         (two_file_same_shared_strip_test_SOURCES): New variable.
15375         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
15376         (two_file_same_shared_strip_test_LDFLAGS): New variable.
15377         (two_file_same_shared_strip_test_LDADD): New variable.
15378         (two_file_shared_strip.so): New target.
15379         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
15380         (ver_test_5.syms, ver_test_7.syms): Likewise.
15381         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
15382         (strip_test_3.stdout): Use TEST_OBJDUMP.
15383         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15384
15385 2008-04-04  Cary Coutant  <ccoutant@google.com>
15386
15387         * symtab.h (Symbol::is_weak_undefined): New function.
15388         (Symbol::is_strong_undefined): New function.
15389         (Symbol::is_absolute): New function.
15390         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
15391         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
15392         absolute symbols.
15393         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
15394         (weak_undef_test): New target.
15395         * testsuite/Makefile.in: Rebuild.
15396         * testsuite/weak_undef_file1.cc: New file.
15397         * testsuite/weak_undef_file2.cc: New file.
15398         * testsuite/weak_undef_test.cc: New file.
15399
15400 2008-04-03  Craig Silverstein  <csilvers@google.com>
15401
15402         * compressed_output.h (class Output_compressed_section): Use
15403         unsigned buffer.
15404         * compressed_output.cc (zlib_compress): Use unsigned buffers,
15405         add zlib header.
15406         (zlib_compressed_suffix): Removed.
15407         (Output_compressed_section::set_final_data_size): Use unsigned
15408         buffers.
15409         * testsuite/Makefile.am (flagstest_compress_debug_sections):
15410         Fix linker invocation.
15411         (flagstest_o_specialfile_and_compress_debug_sections):
15412         Likewise.
15413         * testsuite/Makefile.in: Regenerated.
15414
15415 2008-04-02  David S. Miller  <davem@davemloft.net>
15416
15417         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
15418         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
15419
15420 2008-04-02  Craig Silverstein  <csilvers@google.com>
15421
15422         * TODO: New file.
15423
15424 2008-04-02  Ian Lance Taylor  <iant@google.com>
15425
15426         * fileread.cc (File_read::find_view): Add byteshift and vshifted
15427         parameters.  Update for new key type to views_.  Change all
15428         callers.
15429         (File_read::read): Adjust for byteshift in returned view.
15430         (File_read::add_view): New function, broken out of
15431         find_and_make_view.
15432         (File_read::make_view): New function, broken out of
15433         find_and_make_view.
15434         (File_read::find_or_make_view): Add offset and aligned
15435         parameters.  Rewrite accordingly.  Change all callers.
15436         (File_read::get_view): Add offset and aligned parameters.  Adjust
15437         for byteshift in return value.
15438         (File_read::get_lasting_view): Likewise.
15439         * fileread.h (class File_read): Update declarations.
15440         (class File_read::View): Add byteshift_ field.  Add byteshift to
15441         constructor.  Add byteshift method.
15442         * archive.h (Archive::clear_uncached_views): New function.
15443         (Archive::get_view): Add aligned parameter.  Change all callers.
15444         * object.h (Object::get_view): Add aligned parameter.  Change all
15445         callers.
15446         (Object::get_lasting_view): Likewise.
15447
15448         * fileread.cc (File_read::release): Don't call clear_views if
15449         there are multiple objects.
15450         * fileread.h (File_read::clear_uncached_views): New function.
15451         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
15452         on the archive.
15453
15454 2008-03-31  Cary Coutant  <ccoutant@google.com>
15455
15456         Add thin archive support.
15457         * archive.cc (Archive::armagt): New const.
15458         (Archive::setup): Remove task parameter and calls to unlock.
15459         (Archive::unlock_nested_archives): New function.
15460         (Archive::read_header): Add nested_off parameter. Change
15461         all callers.
15462         (Archive::interpret_header): Likewise.
15463         (Archive::include_all_members): Change to handle thin
15464         archives.
15465         (Archive::include_member): Likewise.
15466         * archive.h (Archive::Archive): Add new parameters and
15467         initializers.
15468         (Archive::armagt): New const.
15469         (Archive::setup): Remove task parameter.
15470         (Archive::unlock_nested_archives): New function.
15471         (Archive::read_header): Add nested_off parameter.
15472         (Archive::interpret_header): Likewise.
15473         (Archive::Nested_archive_table): New typedef.
15474         (Archive::is_thin_archive_): New field.
15475         (Archive::nested_archives_): New field.
15476         (Archive::options_): New field.
15477         (Archive::dirpath_): New field.
15478         (Archive::task_): New field.
15479         * readsyms.cc (Read_symbols::do_read_symbols): Add check
15480         for thin archives.  Pass additional parameters to
15481         Archive::Archive.  Unlock the archive file after calling
15482         Archive::setup.
15483
15484 2008-03-29  Ian Lance Taylor  <iant@google.com>
15485
15486         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
15487         version symbol to be local.
15488         * testsuite/ver_test_4.sh: New file.
15489         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
15490         (check_DATA): Add ver_test_4.syms.
15491         (ver_test_4.syms): New target.
15492         * testsuite/Makefile.in: Rebuild.
15493
15494         * output.cc
15495         (Output_section::Input_section_sort_entry::has_priority): New
15496         function.
15497         (Output_section::Input_section_sort_entry::match_file_name): New
15498         function.
15499         (Output_section::Input_section_sort_entry::match_section_name):
15500         Remove.
15501         (Output_section::Input_section_sort_entry::match_section_name_prefix):
15502         Remove.
15503         (Output_section::Input_section_sort_entry::match_section_file):
15504         Remove.
15505         (Output_section::Input_section_sort_compare::operator()): Rewrite
15506         using new Input_section_sort_entry functions.  Sort crtbegin and
15507         crtend first.  Sort sections with no priority before sections with
15508         a priority.
15509         * testsuite/initpri1.c (d3): Check j != 4.
15510         (cd5): New constructor/destructor function.
15511         (main): Check j != 2.
15512
15513         * symtab.cc (Symbol_table::add_from_object): If we don't use the
15514         new symbol when resolving, don't call set_is_default.
15515         * testsuite/ver_test_7.cc: New file.
15516         * testsuite/ver_test_7.sh: New file.
15517         * testsuite/Makefile.am (ver_test_7.so): New target.
15518         (ver_test_7.o): New target.
15519         (check_SCRIPTS): Add ver_test_7.sh.
15520         (check_DATA): Add ver_test_7.syms.
15521         (ver_test_7.syms): New target.
15522
15523 2008-03-28  Ian Lance Taylor  <iant@google.com>
15524
15525         * layout.cc (Layout::layout): If we see an input section with a
15526         name that needs sorting, set the must_sort flag for the output
15527         section.
15528         (Layout::make_output_section): If the name of the output section
15529         indicates that it might require sorting, set the may_sort flag.
15530         * output.h (Output_section::may_sort_attached_input_sections): New
15531         function.
15532         (Output_section::set_may_sort_attached_input_sections): New
15533         function.
15534         (Output_section::must_sort_attached_input_sections): New
15535         function.
15536         (Output_section::set_must_sort_attached_input_sections): New
15537         function.
15538         (class Output_section): Declare Input_section_sort_entry.  Define
15539         Input_section_sort_compare.  Declare
15540         sort_attached_input_sections.  Add new fields:
15541         may_sort_attached_input_sections_,
15542         must_sort_attached_input_sections_,
15543         attached_input_sections_are_sorted_.
15544         * output.cc (Output_section::Output_section): Initialize new
15545         fields.
15546         (Output_section::add_input_section): Add an entry to
15547         input_sections_ if may_sort or must_sort are true.
15548         (Output_section::set_final_data_size): Call
15549         sort_attached_input_sections if necessary.
15550         (Output_section::Input_section_sort_entry): Define new class.
15551         (Output_section::Input_section_sort_compare::operator()): New
15552         function.
15553         (Output_section::sort_attached_input_sections): New function.
15554         * configure.ac: Check whether the compiler supports constructor
15555         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
15556         * testsuite/initpri1.c: New file.
15557         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
15558         CONSTRUCTOR_PRIORITY.
15559         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
15560         (initpri1_LDFLAGS): New variable.
15561         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15562
15563 2008-03-27  Ian Lance Taylor  <iant@google.com>
15564
15565         * common.cc (Sort_commons::operator): Correct sorting algorithm.
15566         * testsuite/common_test_1.c: New file.
15567         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
15568         (common_test_1_SOURCES): New variable.
15569         (common_test_1_DEPENDENCIES): New variable.
15570         (common_test_1_LDFLAGS): New variable.
15571
15572         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
15573         and commons_ correctly when NAME/VERSION does not override
15574         NAME/NULL.
15575         * testsuite/ver_test_6.c: New file.
15576         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
15577         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
15578         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
15579
15580 2008-03-26  Ian Lance Taylor  <iant@google.com>
15581
15582         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
15583         of an undefined symbol from a version script.
15584         * testsuite/Makefile.am (ver_test_5.so): New target.
15585         (ver_test_5.o): New target.
15586         (check_SCRIPTS): Add ver_test_5.sh.
15587         (check_DATA): Add ver_test_5.syms.
15588         (ver_test_5.syms): New target.
15589         * testsuite/ver_test_5.cc: New file.
15590         * testsuite/ver_test_5.script: New file.
15591         * testsuite/ver_test_5.sh: New file.
15592         * Makefile.in, testsuite/Makefile.in: Rebuild.
15593
15594         PR gold/5986
15595         Fix problems building gold with gcc 4.3.0.
15596         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
15597         (gold_error_at_location, gold_warning_at_location): Use it.
15598         * configure.ac: Check whether we can compile and use a template
15599         function with a printf attribute.
15600         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
15601         when jumping over bytes.
15602         * object.cc: Instantiate Object::read_section_data.
15603         * debug.h: Include <cstring>
15604         * dwarf_reader.cc: Include <algorithm>
15605         * main.cc: Include <cstring>.
15606         * options.cc: Include <cstring>.
15607         * output.cc: Include <cstring>.
15608         * script.cc: Include <cstring>.
15609         * script.h: Include <string>.
15610         * symtab.cc: Include <cstring> and <algorithm>.
15611         * target-select.cc: Include <cstring>.
15612         * version.cc: Include <string>.
15613         * testsuite/testmain.cc: Include <cstdlib>.
15614         * configure, config.in: Rebuild.
15615
15616 2008-03-25  Ian Lance Taylor  <iant@google.com>
15617
15618         * options.cc: Include "../bfd/bfdver.h".
15619         (options::help): Print bug reporting address.
15620
15621         * version.cc (print_version): Adjust output for current value of
15622         BFD_VERSION_STRING.
15623
15624         * NEWS: New file.
15625
15626         * options.cc (options::help): Print list of supported targets.
15627         * target-select.h: Include <vector>.
15628         (class Target_selector): Make machine_, size_, and is_big_endian_
15629         fields const.  Add bfd_name_ and instantiated_target_ fields.
15630         (Target_selector::Target_selector): Add bfd_name parameter.
15631         (Target_selector::recognize): Make non-virtual, call
15632         do_recognize.
15633         (Target_selector::recognize_by_name): Make non-virtual, call
15634         do_recognize_by_name.
15635         (Target_selector::supported_names): New function.
15636         (Target_selector::bfd_name): New function.
15637         (Target_selector::do_instantiate_target): New pure virtual
15638         function.
15639         (Target_selector::do_recognize): New virtual function.
15640         (Target_selector::do_recognize_by_name): New virtual function.
15641         (Target_selector::instantiate_target): New private function.
15642         (supported_target_names): Declare.
15643         * target-select.cc (Target_selector::Target_selector): Update for
15644         new parameter and fields.
15645         (select_target_by_name): Check that the name matches before
15646         calling recognize_by_name.
15647         (supported_target_names): New function.
15648         * i386.cc (class Target_selector_i386): Update Target_selector
15649         constructor call.  Remove recognize and recognize_by_name.  Add
15650         do_instantiate_target.
15651         * x86_64.cc (class Target_selector_x86_64): Likewise.
15652         * testsuite/testfile.cc (class Target_selector_test): Update for
15653         changes to Target_selector.
15654
15655         * README: Rewrite, with some notes on unsupported features.
15656
15657 2008-03-24  Cary Coutant  <ccoutant@google.com>
15658
15659         * i386.cc (Target_i386::Got_type): New enum declaration.
15660         (Target_i386::Scan::local): Updated callers of Output_data_got
15661         member functions.
15662         (Target_i386::Scan::global): Likewise.
15663         (Target_i386::Relocate::relocate): Likewise.
15664         (Target_i386::Relocate::relocate_tls): Likewise.
15665         * object.h (Got_offset_list): New class.
15666         (Sized_relobj::local_has_got_offset): Added got_type parameter.
15667         (Sized_relobj::local_got_offset): Likewise.
15668         (Sized_relobj::set_local_got_offset): Likewise.
15669         (Sized_relobj::local_has_tls_got_offset): Removed.
15670         (Sized_relobj::local_tls_got_offset): Removed.
15671         (Sized_relobj::set_local_tls_got_offset): Removed.
15672         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
15673         * output.cc (Output_data_got::add_global): Added got_type parameter.
15674         (Output_data_got::add_global_with_rel): Likewise.
15675         (Output_data_got::add_global_with_rela): Likewise.
15676         (Output_data_got::add_global_pair_with_rel): New function.
15677         (Output_data_got::add_global_pair_with_rela): New function.
15678         (Output_data_got::add_local): Added got_type parameter.
15679         (Output_data_got::add_local_with_rel): Likewise.
15680         (Output_data_got::add_local_with_rela): Likewise.
15681         (Output_data_got::add_local_pair_with_rel): New function.
15682         (Output_data_got::add_local_pair_with_rela): New function.
15683         (Output_data_got::add_global_tls): Removed.
15684         (Output_data_got::add_global_tls_with_rel): Removed.
15685         (Output_data_got::add_global_tls_with_rela): Removed.
15686         (Output_data_got::add_local_tls): Removed.
15687         (Output_data_got::add_local_tls_with_rel): Removed.
15688         (Output_data_got::add_local_tls_with_rela): Removed.
15689         * output.h (Output_data_got::add_global): Added got_type parameter.
15690         (Output_data_got::add_global_with_rel): Likewise.
15691         (Output_data_got::add_global_with_rela): Likewise.
15692         (Output_data_got::add_global_pair_with_rel): New function.
15693         (Output_data_got::add_global_pair_with_rela): New function.
15694         (Output_data_got::add_local): Added got_type parameter.
15695         (Output_data_got::add_local_with_rel): Likewise.
15696         (Output_data_got::add_local_with_rela): Likewise.
15697         (Output_data_got::add_local_pair_with_rel): New function.
15698         (Output_data_got::add_local_pair_with_rela): New function.
15699         (Output_data_got::add_global_tls): Removed.
15700         (Output_data_got::add_global_tls_with_rel): Removed.
15701         (Output_data_got::add_global_tls_with_rela): Removed.
15702         (Output_data_got::add_local_tls): Removed.
15703         (Output_data_got::add_local_tls_with_rel): Removed.
15704         (Output_data_got::add_local_tls_with_rela): Removed.
15705         * resolve.cc (Symbol::override_base_with_special): Removed
15706         reference to has_got_offset_ field.
15707         * symtab.cc (Symbol::init_fields): Replaced initialization
15708         of got_offset_ with got_offsets_.  Removed initialization
15709         of has_got_offset_
15710         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
15711         (Symbol::got_offset): Likewise.
15712         (Symbol::set_got_offset): Likewise.
15713         (Symbol::has_tls_got_offset): Removed.
15714         (Symbol::tls_got_offset): Removed.
15715         (Symbol::set_tls_got_offset): Removed.
15716         (Symbol::got_offset_): Removed.
15717         (Symbol::tls_mod_got_offset_): Removed.
15718         (Symbol::tls_pair_got_offset_): Removed.
15719         (Symbol::got_offsets_): New field.
15720         (Symbol::has_got_offset): Removed.
15721         (Symbol::has_tls_mod_got_offset): Removed.
15722         (Symbol::has_tls_pair_got_offset): Removed.
15723         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
15724         (Target_x86_64::Scan::local): Updated callers of Output_data_got
15725         member functions.
15726         (Target_x86_64::Scan::global): Likewise.
15727         (Target_x86_64::Relocate::relocate): Likewise.
15728         (Target_x86_64::Relocate::relocate_tls): Likewise.
15729
15730 2008-03-25  Ben Elliston  <bje@au.ibm.com>
15731
15732         * yyscript.y: Fix spelling error in comment.
15733
15734 2008-03-24  Ian Lance Taylor  <iant@google.com>
15735
15736         * options.h (class General_options): Define build_id option.
15737         * layout.h (class Layout): Declare write_build_id, create_note,
15738         create_build_id.  Add build_id_note_ member.
15739         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
15740         "libiberty.h", "md5.h", "sha1.h".
15741         (Layout::Layout): Initialize eh_frame_data_,
15742         eh_frame_hdr_section_, and build_id_note_.
15743         (Layout::finalize): Call create_build_id.
15744         (Layout::create_note): New function, broken out of
15745         Layout::create_gold_note.
15746         (Layout::create_gold_note): Call create_note.
15747         (Layout::create_build_id): New function.
15748         (Layout::write_build_id): New function.
15749         (Close_task_runner::run): Call write_build_id.
15750
15751         * x86_64.cc: Correct license to GPLv3.
15752
15753 2008-03-23  Ian Lance Taylor  <iant@google.com>
15754
15755         * options.cc: Include "demangle.h".
15756         (parse_optional_string): New function.
15757         (parse_long_option): Handle takes_optional_argument.
15758         (parse_short_option): Update dash_z initializer.  Handle
15759         takes_optional_argument.
15760         (General_options::General_options): Initialize do_demangle_.
15761         (General_options::finalize): Set do_demangle_.  Handle demangling
15762         style.
15763         * options.h (parse_optional_string): Declare.
15764         (struct One_option): Add optional_arg field.  Update constructor.
15765         Update call constructor calls.  Add takes_optional_argument
15766         function.
15767         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
15768         (DEFINE_optional_string): Define.
15769         (General_options::demangle): Change from DEFINE_bool to
15770         DEFINE_optional_string.
15771         (General_options::no_demangle): New function.
15772         (General_options::do_demangle): New function.
15773         (General_options::set_do_demangle): New function.
15774         (General_options::execstack_status_): Move definition to end of
15775         class definition.
15776         (General_options::static_): Likewise.
15777         (General_options::do_demangle_): New field.
15778         * object.cc (big_endian>::get_symbol_location_info): Call
15779         Options::do_demangle, not Options::demangle.
15780         * symtab.cc (demangle): Likewise.
15781
15782 2008-03-22  Ian Lance Taylor  <iant@google.com>
15783
15784         * gold.h: Include <cstddef> and <sys/types.h>
15785         * options.h: Include <cstring>.
15786
15787 2008-03-21  Ian Lance Taylor  <iant@google.com>
15788
15789         * Added source code to GNU binutils.
15790 \f
15791 Copyright (C) 2008-2014 Free Software Foundation, Inc.
15792
15793 Copying and distribution of this file, with or without modification,
15794 are permitted in any medium without royalty provided the copyright
15795 notice and this notice are preserved.
15796
15797 Local Variables:
15798 mode: change-log
15799 left-margin: 8
15800 fill-column: 74
15801 version-control: never
15802 End: